diff --git a/.env.example b/.env.example deleted file mode 100644 index b42730f6..00000000 --- a/.env.example +++ /dev/null @@ -1,179 +0,0 @@ -APP_ENV=local -APP_DEBUG=true -APP_DEBUG_EMAIL= -APP_KEY=SomeRandomString -APP_URL=http://localhost -APP_SCOPE_BASE_REALM=http://localhost -APP_OAUTH_2_0_CLIENT_ID=clientid -APP_OAUTH_2_0_CLIENT_SECRET=clientsecret -APP_OAUTH_2_0_AUTH_SERVER_BASE_URL=http://localhost - -DB_HOST=localhost -DB_DATABASE=homestead -DB_USERNAME=homestead -DB_PASSWORD=secret - -SS_DB_HOST=localhost -SS_DB_DATABASE=homestead -SS_DB_USERNAME=homestead -SS_DB_PASSWORD=secret - -REDIS_HOST=127.0.0.1 -REDIS_PORT=port -REDIS_DB=0 -REDIS_PASSWORD= - -CACHE_DRIVER=file - -SESSION_DRIVER=redis -SESSION_COOKIE_DOMAIN= -SESSION_COOKIE_SECURE=false - -QUEUE_DRIVER=database -QUEUE_CONN= -QUEUE_DATABASE= - -MAIL_DRIVER=sendgrid -SENDGRID_API_KEY='YOUR_SENDGRID_API_KEY' - -CORS_ALLOWED_HEADERS=origin, content-type, accept, authorization, x-requested-with -CORS_ALLOWED_METHODS=GET, POST, OPTIONS, PUT, DELETE -CORS_USE_PRE_FLIGHT_CACHING=true -CORS_MAX_AGE=3200 -CORS_EXPOSED_HEADERS= - -CURL_TIMEOUT=3600 -CURL_ALLOWS_REDIRECT=false -CURL_VERIFY_SSL_CERT=false - -ASSETS_BASE_URL=http://www.openstack.org -SSL_ENABLED=true -DB_LOG_ENABLED=true -ACCESS_TOKEN_CACHE_LIFETIME=300 -API_RESPONSE_CACHE_LIFETIME=600 - -LOG_EMAIL_TO=smarcet@gmail.com -LOG_EMAIL_FROM=smarcet@gmail.com -LOG_LEVEL=debug - -EVENTBRITE_OAUTH2_PERSONAL_TOKEN= -SS_ENCRYPT_KEY= -SS_ENCRYPT_CYPHER=AES-256-CBC - -GOOGLE_CLIENT_ID="" -GOOGLE_CLIENT_SECRET="" -GOOGLE_SCOPES="" - -SSH_USER= -SSH_PUBLIC_KEY= -SSH_PRIVATE_KEY= -SCP_HOST= -SCP_REMOTE_BASE_PATH=/tmp - -GOOGLE_GEO_CODING_API_KEY= - -# swift configuration -CLOUD_STORAGE_AUTH_URL= -CLOUD_STORAGE_USERNAME= -CLOUD_STORAGE_APIKEY= -CLOUD_STORAGE_PROJECT_NAME= -CLOUD_STORAGE_REGION= -CLOUD_STORAGE_ASSETS_CONTAINER= -CLOUD_STORAGE_IMAGES_CONTAINER= -CLOUD_STORAGE_MEDIA_UPLOADS_CONTAINER= -# enable/disable cal sync background task -ENABLE_CAL_SYNC=true -# enable/disable bookable rooms reservation revocation task -ENABLE_BOOKABLE_ROOMS_RESERVATION_REVOCATION=false - -MAIL_FROM_NAME= -MAIL_FROM_EMAIL= - -#stripe - -STRIPE_BOOKING_PRIVATE_KEY= -STRIPE_BOOKING_ENDPOINT_SECRET= -STRIPE_REGISTRATION_PRIVATE_KEY= -STRIPE_REGISTRATION_ENDPOINT_SECRET= - -#registration -REGISTRATION_SERVICE_OAUTH2_CLIENT_ID= -REGISTRATION_SERVICE_OAUTH2_CLIENT_SECRET= -REGISTRATION_SERVICE_OAUTH2_SCOPES= -REGISTRATION_DASHBOARD_OAUTH2_CLIENT_ID= -REGISTRATION_FROM_EMAIL= -REGISTRATION_DASHBOARD_BASE_URL= -REGISTRATION_DASHBOARD_BACK_URL=%s/a/orders -REGISTRATION_DASHBOARD_INVITATION_FORM_URL=%s/a/invitations/%s -REGISTRATION_DASHBOARD_ATTENDEE_EDIT_FORM_URL=%s/a/guests/%s -REGISTRATION_REMINDER_EMAIL_DAYS_INTERVAL=7 -REGISTRATION_SUPPORT_EMAIL= -#IDP -# CHECK /.well-known/openid-configuration at idp -IDP_BASE_URI= -IDP_AUTHORIZATION_ENDPOINT= -IDP_TOKEN_ENDPOINT= -IDP_INTROSPECTION_ENDPOINT= -IDP_USERINFO_ENDPOINT= - -REGISTRATION_VALIDATE_TICKET_TYPE_REMOVAL=true - -# default stripe config -# if not set at summit level this will be used ( if set by default) -# *_WEBHOOK_SECRET variables should be populated by manually created webhooks at set stripe account -# and should be pointed to $API_BASE_URL/api/public/v1/summits/all/payments/Registration/confirm -# and set to attended following events types -# * payment_intent.payment_failed -# payment_intent.succeeded - -REGISTRATION_DEFAULT_PAYMENT_PROVIDER=Stripe -REGISTRATION_DEFAULT_STRIPE_TEST_MODE= -REGISTRATION_DEFAULT_LIVE_STRIPE_PRIVATE_KEY= -REGISTRATION_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY= -REGISTRATION_DEFAULT_LIVE_WEBHOOK_SECRET= -REGISTRATION_DEFAULT_TEST_STRIPE_PRIVATE_KEY= -REGISTRATION_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY= -REGISTRATION_DEFAULT_TEST_WEBHOOK_SECRET= - -BOOKABLE_ROOMS_DEFAULT_PAYMENT_PROVIDER=Stripe -BOOKABLE_ROOMS_DEFAULT_STRIPE_TEST_MODE= -BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PRIVATE_KEY= -BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY= -BOOKABLE_ROOMS_DEFAULT_LIVE_WEBHOOK_SECRET= -BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PRIVATE_KEY= -BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY= -BOOKABLE_ROOMS_DEFAULT_TEST_WEBHOOK_SECRET= - -MAIL_API_BASE_URL= -MAIL_API_OAUTH2_CLIENT_ID= -MAIL_API_OAUTH2_CLIENT_SECRET= -MAIL_API_OAUTH2_CLIENT_SCOPES= - -CFP_APP_BASE_URL= -CFP_SUPPORT_EMAIL= - -## RABBIT MQ -RABBITMQ_EXCHANGE_NAME=databus-exchange -RABBITMQ_HOST= -RABBITMQ_PORT=5671 -RABBITMQ_VHOST=databus -RABBITMQ_LOGIN=admin -RABBITMQ_PASSWORD=1qaz2wsx -RABBITMQ_QUEUE=default -RABBITMQ_SSL=true -RABBITMQ_SSL_CAFILE=/certs/rabbit/ca-osf.pem -RABBITMQ_SSL_LOCALCERT=/certs/rabbit/client-cert-osf.pem -RABBITMQ_SSL_LOCALKEY=/certs/rabbit/client-key-osf.pem -RABBITMQ_SSL_VERIFY_PEER=false - -DROPBOX_ACCESS_TOKEN= - -MUX_TOKEN_ID= -MUX_TOKEN_SECRET= - -# S3 -AWS_ACCESS_KEY_ID= -AWS_SECRET_ACCESS_KEY= -AWS_DEFAULT_REGION= -AWS_BUCKET= -AWS_ENDPOINT= \ No newline at end of file diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 95883dea..00000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -* text=auto -*.css linguist-vendored -*.less linguist-vendored diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6b3e6e66..00000000 --- a/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -/vendor -/node_modules -composer.phar -.DS_Storeapp/storage -.idea/* -app/config/dev/* -app/config/testing/* -app/config/local/* -app/config/production/* -app/config/staging/* -app/config/packages/greggilbert/recaptcha/dev/* -app/config/packages/greggilbert/recaptcha/local/* -app/config/packages/greggilbert/recaptcha/production/* -app/config/packages/greggilbert/recaptcha/staging/* -/bootstrap/compiled.php -/bootstrap/environment.php -.tox -AUTHORS -ChangeLog -doc/build -*.egg -*.egg-info -.env.testing -.env -storage/* -*.log -routes.txt -/storage/logs/ -/ss.sql -phpunit.xml \ No newline at end of file diff --git a/.gitreview b/.gitreview index 106d6957..eb52e34b 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.opendev.org port=29418 -project=osf/openstackid-resources.git +project=openinfra/openstackid-resources.git diff --git a/Libs/ModelSerializers/AbstractSerializer.php b/Libs/ModelSerializers/AbstractSerializer.php deleted file mode 100644 index 5efc49f9..00000000 --- a/Libs/ModelSerializers/AbstractSerializer.php +++ /dev/null @@ -1,311 +0,0 @@ -object = $object; - $this->resource_server_context = $resource_server_context; - } - - protected static $array_mappings = []; - - protected static $allowed_fields = []; - - protected static $allowed_relations = []; - - /** - * @return array - */ - protected function getAllowedFields() - { - $mappings = []; - $hierarchy = $this->getClassHierarchy(); - - foreach($hierarchy as $class_name){ - if($class_name === 'Libs\ModelSerializers\AbstractSerializer') continue; - $class = new $class_name($this->object, $this->resource_server_context); - $mappings = array_merge($mappings, $class->getSelfAllowedFields()); - } - $mappings = array_merge($mappings, $this->getSelfAllowedFields()); - return $mappings; - } - - private function getSelfAllowedFields(){ - return static::$allowed_fields; - } - - /** - * @return array - */ - protected function getAllowedRelations() - { - $mappings = array(); - $hierarchy = $this->getClassHierarchy(); - - foreach($hierarchy as $class_name){ - if($class_name === 'Libs\ModelSerializers\AbstractSerializer') continue; - $class = new $class_name($this->object, $this->resource_server_context); - $mappings = array_merge($mappings, $class->getSelfAllowedRelations()); - } - $mappings = array_merge($mappings, $this->getSelfAllowedRelations()); - return $mappings; - } - - private function getSelfAllowedRelations(){ - return static::$allowed_relations; - } - - /** - * @return array - */ - private function getAttributeMappings() - { - $mappings = []; - $hierarchy = $this->getClassHierarchy(); - - foreach($hierarchy as $class_name){ - if($class_name === 'Libs\ModelSerializers\AbstractSerializer') continue; - $class = new $class_name($this->object, $this->resource_server_context); - $mappings = array_merge($mappings, $class->getSelfMappings()); - } - $mappings = array_merge($mappings, $this->getSelfMappings()); - return $mappings; - } - - private function getSelfMappings(){ - return static::$array_mappings; - } - - /** - * @return array - */ - private function getClassHierarchy(){ - return array_reverse($this->get_class_lineage($this)); - } - - private function get_class_lineage($object) - { - $class_name = get_class($object); - $parents = array_values(class_parents($class_name)); - return array_merge(array($class_name), $parents); - } - - const BoolType = 'json_boolean'; - const EpochType = 'datetime_epoch'; - const StringType = 'json_string'; - const IntType = 'json_int'; - const FloatType = 'json_float'; - const ObfuscatedEmailType = 'json_obfuscated_email'; - const UrlType = 'json_url'; - const ColorType = 'json_color'; - - const ValidTypes = [ - self::BoolType, - self::EpochType, - self::StringType, - self::IntType, - self::FloatType, - self::ObfuscatedEmailType, - self::UrlType, - self::ColorType, - ]; - - /** - * @param string $field - * @param string $type - * @return string - */ - public static function buildMapping(string $field, string $type):string { - if(!in_array($type, self::ValidTypes)) - throw new \InvalidArgumentException(); - return sprintf("%s:%s", $field, $type); - } - - protected $expand_mappings = []; - - /** - * @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 = []) - { - $values = []; - $method_prefix = ['get', 'is']; - if(!count($fields)) $fields = $this->getAllowedFields(); - $mappings = $this->getAttributeMappings(); - if (count($mappings)) { - $new_values = []; - foreach ($mappings as $attribute => $mapping) { - $mapping = preg_split('/:/', $mapping); - if(count($fields) > 0 && !in_array($mapping[0], $fields)) continue; - $value = null; - $method_found = false; - foreach($method_prefix as $prefix){ - if(method_exists($this->object, $prefix.$attribute)){ - try { - $value = call_user_func([$this->object, $prefix . $attribute]); - $method_found = true; - break; - } - catch (\Exception $ex){ - Log::warning($ex); - $value = null; - } - } - } - - if(!$method_found){ - try { - //try dynamic one - $value = call_user_func([$this->object, 'get'.$attribute ]); - } - catch (\Exception $ex){ - Log::warning($ex); - $value = null; - } - } - - if(count($mapping) > 1) - { - //we have a formatter ... - switch(strtolower($mapping[1])) - { - case 'datetime_epoch': - { - if(!is_null($value)) { - $value = $value->getTimestamp(); - } - } - break; - case 'json_string': - { - $value = JsonUtils::toJsonString($value); - } - break; - case 'json_boolean': - { - $value = JsonUtils::toJsonBoolean($value); - } - break; - case 'json_color': - { - $value = JsonUtils::toJsonColor($value); - } - break; - case 'json_int': - { - $value = JsonUtils::toJsonInt($value); - } - break; - case 'json_float': - { - $value = JsonUtils::toJsonFloat($value); - } - break; - case 'json_obfuscated_email': - { - $value = JsonUtils::toObfuscatedEmail($value); - } - case 'json_url':{ - $value = JsonUtils::encodeUrl($value); - } - break; - } - } - $new_values[$mapping[0]] = $value; - } - $values = $new_values; - } - - // expand logic - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - $relation = trim($relation); - if(isset($this->expand_mappings[$relation])){ - $values = $this->expand_mappings[$relation]->serialize($values, $expand); - } - } - } - - return $values; - } - - /** - * @param string $expand_str - * @param string $prefix - * @return string - */ - public static function filterExpandByPrefix($expand_str, $prefix){ - - $expand_to = explode(',', $expand_str); - $filtered_expand = array_filter($expand_to, function($element) use($prefix){ - return preg_match('/^' . preg_quote($prefix, '/') . '\./', strtolower(trim($element))) > 0; - }); - $res = ''; - foreach($filtered_expand as $filtered_expand_elem){ - if(strlen($res) > 0) $res .= ','; - $res .= str_replace_first($prefix.".","", strtolower(trim($filtered_expand_elem))); - } - return $res; - } - - /** - * @param string $prefix - * @param string $expand - * @return string - */ - protected static function getExpandForPrefix(string $prefix, string $expand):string { - - Log::debug(sprintf("AbstractSerializer::getExpandForPrefix prefix %s expand %s", $prefix, $expand)); - - $prefix_expand = []; - foreach(explode(',', $expand) as $e){ - if(strstr($e, $prefix.".")!==false) - $prefix_expand[] = str_replace($prefix.".","", $e); - } - - return implode(',', $prefix_expand); - } -} \ No newline at end of file diff --git a/Libs/ModelSerializers/IModelSerializer.php b/Libs/ModelSerializers/IModelSerializer.php deleted file mode 100644 index 6954198f..00000000 --- a/Libs/ModelSerializers/IModelSerializer.php +++ /dev/null @@ -1,26 +0,0 @@ -unsetOriginalAttribute($values); - $callback = $this->getRelationFn; - $res = []; - foreach ($callback($this) as $item){ - $res[] = SerializerRegistry::getInstance()->getSerializer($item)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $this->attribute_name)); - } - $values[$this->attribute_name] = $res; - return $values; - } -} \ No newline at end of file diff --git a/Libs/ModelSerializers/One2ManyExpandSerializer.php b/Libs/ModelSerializers/One2ManyExpandSerializer.php deleted file mode 100644 index 6feceffc..00000000 --- a/Libs/ModelSerializers/One2ManyExpandSerializer.php +++ /dev/null @@ -1,78 +0,0 @@ -attribute_name = $attribute_name; - $this->getRelationFn = $getRelationFn; - $this->original_attribute = $original_attribute; - } - - /** - * @param array $values - * @return array - */ - protected function unsetOriginalAttribute(array $values) - { - if (isset($values[$this->original_attribute])) - unset($values[$this->original_attribute]); - return $values; - } - - /** - * @param array $values - * @param string $expand - * @return array - */ - public function serialize(array $values, string $expand): array - { - $values = $this->unsetOriginalAttribute($values); - $callback = $this->getRelationFn; - $values[$this->attribute_name] = SerializerRegistry::getInstance()->getSerializer($callback($this))->serialize(AbstractSerializer::filterExpandByPrefix($expand, $this->attribute_name)); - return $values; - } - -} \ No newline at end of file diff --git a/Libs/OAuth2/BearerAccessTokenAuthorizationHeaderParser.php b/Libs/OAuth2/BearerAccessTokenAuthorizationHeaderParser.php deleted file mode 100644 index f214185b..00000000 --- a/Libs/OAuth2/BearerAccessTokenAuthorizationHeaderParser.php +++ /dev/null @@ -1,77 +0,0 @@ -container = $values; - } - - /** - * arrayaccess methods - * */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) - { - $this->container[] = $value; - } - else - { - $this->container[$offset] = $value; - } - } - - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } - - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } -} \ No newline at end of file diff --git a/Libs/OAuth2/HttpResponse.php b/Libs/OAuth2/HttpResponse.php deleted file mode 100644 index 63feea5f..00000000 --- a/Libs/OAuth2/HttpResponse.php +++ /dev/null @@ -1,52 +0,0 @@ -http_code = $http_code; - $this->content_type = $content_type; - } - - abstract public function getContent(); - - public function getHttpCode() - { - return $this->http_code; - } - - protected function setHttpCode($http_code) - { - $this->http_code = $http_code; - } - - public function getContentType() - { - return $this->content_type; - } - - abstract public function getType(); - - public function addParam($name, $value) - { - $this[$name] = $value; - } -} \ No newline at end of file diff --git a/Libs/OAuth2/InvalidGrantTypeException.php b/Libs/OAuth2/InvalidGrantTypeException.php deleted file mode 100644 index 384f9826..00000000 --- a/Libs/OAuth2/InvalidGrantTypeException.php +++ /dev/null @@ -1,28 +0,0 @@ -container); - return $json_encoded_format; - } - - public function getType() - { - return self::OAuth2DirectResponse; - } -} \ No newline at end of file diff --git a/Libs/OAuth2/OAuth2InvalidIntrospectionResponse.php b/Libs/OAuth2/OAuth2InvalidIntrospectionResponse.php deleted file mode 100644 index db7c8a56..00000000 --- a/Libs/OAuth2/OAuth2InvalidIntrospectionResponse.php +++ /dev/null @@ -1,24 +0,0 @@ - self::OAuth2Protocol_ResponseType_Code, - self::OAuth2Protocol_ResponseType_Token => self::OAuth2Protocol_ResponseType_Token - ); - public static $protocol_definition = array( - self::OAuth2Protocol_ResponseType => self::OAuth2Protocol_ResponseType, - self::OAuth2Protocol_ClientId => self::OAuth2Protocol_ClientId, - self::OAuth2Protocol_RedirectUri => self::OAuth2Protocol_RedirectUri, - self::OAuth2Protocol_Scope => self::OAuth2Protocol_Scope, - self::OAuth2Protocol_State => self::OAuth2Protocol_State - ); - -} \ No newline at end of file diff --git a/Libs/OAuth2/OAuth2ResourceServerException.php b/Libs/OAuth2/OAuth2ResourceServerException.php deleted file mode 100644 index 25f0b168..00000000 --- a/Libs/OAuth2/OAuth2ResourceServerException.php +++ /dev/null @@ -1,58 +0,0 @@ -http_code = $http_code; - $this->error = $error; - $this->error_description = $error_description; - $this->scope = $scope; - $message = "Resource Server Exception : " . sprintf('http code : %s - error : %s - error description: %s', $http_code, $error, $error_description); - parent::__construct($message, 0, null); - } - - public function getError() - { - return $this->error; - } - - public function getErrorDescription() - { - return $this->error_description; - } - - public function getScope() - { - return $this->scope; - } - - public function getHttpCode() - { - return $this->http_code; - } -} \ No newline at end of file diff --git a/Libs/OAuth2/OAuth2Response.php b/Libs/OAuth2/OAuth2Response.php deleted file mode 100644 index 0d5f7eb9..00000000 --- a/Libs/OAuth2/OAuth2Response.php +++ /dev/null @@ -1,18 +0,0 @@ -realm = $realm; - $this->error = $error; - $this->error_description = $error_description; - $this->scope = $scope; - $this->http_error = $http_error; - } - - public function getWWWAuthenticateHeaderValue() - { - $value = sprintf('Bearer realm="%s"', $this->realm); - $value = $value . sprintf(', error="%s"', $this->error); - $value = $value . sprintf(', error_description="%s"', $this->error_description); - if (!is_null($this->scope)) { - $value = $value . sprintf(', scope="%s"', $this->scope); - } - - return $value; - } - - - public function getContent() - { - $content = array( - 'error' => $this->error, - 'error_description' => $this->error_description - ); - if (!is_null($this->scope)) { - $content['scope'] = $this->scope; - } - - return $content; - } - - public function getType() - { - return null; - } -} \ No newline at end of file diff --git a/Libs/Utils/ConfigurationException.php b/Libs/Utils/ConfigurationException.php deleted file mode 100644 index 0eeb00a7..00000000 --- a/Libs/Utils/ConfigurationException.php +++ /dev/null @@ -1,29 +0,0 @@ -app->singleton('registry', function ($app) { - $registry = new IlluminateRegistry($app, $app->make(CustomEntityManagerFactory::class)); - - // Add all managers into the registry - foreach ($app->make('config')->get('doctrine.managers', []) as $manager => $settings) { - $registry->addManager($manager, $settings); - } - - return $registry; - }); - - // Once the registry get's resolved, we will call the resolve callbacks which were waiting for the registry - $this->app->afterResolving('registry', function (ManagerRegistry $registry, Container $container) { - $this->bootExtensionManager(); - - BootChain::boot($registry); - }); - - $this->app->alias('registry', ManagerRegistry::class); - $this->app->alias('registry', IlluminateRegistry::class); - } - -} \ No newline at end of file diff --git a/Libs/Utils/CustomEntityManagerFactory.php b/Libs/Utils/CustomEntityManagerFactory.php deleted file mode 100644 index 9ee31c79..00000000 --- a/Libs/Utils/CustomEntityManagerFactory.php +++ /dev/null @@ -1,88 +0,0 @@ -config->get('doctrine.cache.second_level', []); - - if (!is_array($second_level_cache_config)) return; - if (!isset($second_level_cache_config['enabled'])) return; - if (!$second_level_cache_config['enabled']) return; - - $configuration->setSecondLevelCacheEnabled(true); - - $cacheConfig = $configuration->getSecondLevelCacheConfiguration(); - $regions_config = isset($second_level_cache_config['regions']) ? $second_level_cache_config['regions'] : []; - - if (is_array($regions_config) && count($regions_config) > 0) { - - $regions_configuration = new RegionsConfiguration - ( - isset($second_level_cache_config['region_lifetime']) ? $second_level_cache_config['region_lifetime'] : 3600, - isset($second_level_cache_config['region_lock_lifetime']) ? $second_level_cache_config['region_lock_lifetime'] : 60 - ); - - foreach ($regions_config as $region_name => $region_config) { - if (isset($region_config['lifetime'])) - $regions_configuration->setLifetime($region_name, $region_config['lifetime']); - - if (isset($region_config['lock_lifetime'])) - $regions_configuration->setLockLifetime($region_name, $region_config['lock_lifetime']); - - } - - $cacheConfig->setRegionsConfiguration($regions_configuration); - } - - // Cache logger - if (isset($second_level_cache_config['log_enabled']) && $second_level_cache_config['log_enabled']){ - $logger = new StatisticsCacheLogger(); - $cacheConfig->setCacheLogger($logger); - } - - $factory = new DefaultCacheFactory - ( - $cacheConfig->getRegionsConfiguration(), - $this->cache->driver() - ); - - $file_lock_region_directory = isset($second_level_cache_config['file_lock_region_directory']) ? - $second_level_cache_config['file_lock_region_directory'] : - '/tmp'; - - $factory->setFileLockRegionDirectory($file_lock_region_directory); - - $cacheConfig->setCacheFactory - ( - $factory - ); - - } -} \ No newline at end of file diff --git a/Libs/Utils/DateTimeUtils.php b/Libs/Utils/DateTimeUtils.php deleted file mode 100644 index 5c8c1cb4..00000000 --- a/Libs/Utils/DateTimeUtils.php +++ /dev/null @@ -1,33 +0,0 @@ -set('CSS.AllowedProperties', []); - $purifier = new \HTMLPurifier($config); - foreach($fields as $field){ - if(!isset($data[$field])) continue; - $data[$field] = $purifier->purify($data[$field]); - } - return $data; - } -} \ No newline at end of file diff --git a/Libs/Utils/ICacheService.php b/Libs/Utils/ICacheService.php deleted file mode 100644 index f1674395..00000000 --- a/Libs/Utils/ICacheService.php +++ /dev/null @@ -1,114 +0,0 @@ -format('Y'); - return [new DateTime('1/1/'.$year, $time_zone), new DateTime('1/1/'.($year + 1), $time_zone)]; - } - /** - * @param array $trans - * @param int $former_offset - * @return DateTime - */ - private static function convertStartDateFromUTC2Local(array $trans, $former_offset){ - $dt = new DateTime($trans['time'], new DateTimeZone('UTC')); - $hours = abs($former_offset); - // START TIME IS ON UTC and should be converted to local using former offset - if($former_offset >= 0 ) - $dt->add(new DateInterval("PT{$hours}H")); - else - $dt->sub(new DateInterval("PT{$hours}H")); - return $dt; - } - /** - * @param DateTime $dt - * @return RecurrenceRule - */ - private static function calculateRecurrenceRule(DateTime $dt){ - $r_rule = new RecurrenceRule(); - $r_rule->setFreq(RecurrenceRule::FREQ_YEARLY); - $r_rule->setByMonth(intval($dt->format('m'))); - $r_rule->setByDay - ( - self::translate2ByDay($dt) - ); - return $r_rule; - } - /** - * @param $offset - * @return string - */ - private static function calculateOffsetFrom($offset){ - return sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs($offset), abs(($offset - floor($offset)) * 60)); - } - /** - * @param $offset - * @return string - */ - private static function calculateOffsetTo($offset){ - return sprintf('%s%02d%02d', $offset >= 0 ? '+' : '-', abs($offset), abs(($offset - floor($offset)) * 60)); - } - /** - * @param DateTimeZone $time_zone - * @param string $calendar_prod_id - * @param bool $with_calendar_envelope - * @return Calendar|Timezone - */ - public static function build(DateTimeZone $time_zone, $calendar_prod_id, $with_calendar_envelope = true){ - // get all transitions for one current year and next - list($start_range, $end_range) = self::calculateTimeRangeForTransitions($time_zone); - $transitions = $time_zone->getTransitions($start_range->getTimestamp(), $end_range->getTimestamp()); - $vTimezone = new Timezone($time_zone->getName()); - $former_offset = null; - foreach ($transitions as $i => $trans) { - $current_time_zone_rule = null; - // skip the first entry... - if ($i == 0) { - // ... but remember the offset for the next TZOFFSETFROM value - $former_offset = $trans['offset'] / 3600; - continue; - } - // daylight saving time definition - if ($trans['isdst']) { - $current_time_zone_rule = new TimezoneRule(TimezoneRule::TYPE_DAYLIGHT);; - } - // standard time definition - else { - $current_time_zone_rule = new TimezoneRule(TimezoneRule::TYPE_STANDARD);; - } - if ($current_time_zone_rule) { - $offset = $trans['offset'] / 3600; - $dt = self::convertStartDateFromUTC2Local($trans, $former_offset); - $current_time_zone_rule->setDtStart($dt); - $current_time_zone_rule->setTzOffsetFrom(self::calculateOffsetFrom($former_offset)); - $current_time_zone_rule->setTzOffsetTo(self::calculateOffsetTo($offset)); - // add abbreviated timezone name if available - if (!empty($trans['abbr'])) { - $current_time_zone_rule->setTzName($trans['abbr']); - } - $former_offset = $offset; - $current_time_zone_rule->setRecurrenceRule(self::calculateRecurrenceRule($dt)); - $vTimezone->addComponent($current_time_zone_rule); - } - } - if($with_calendar_envelope) { - $vCalendar = new Calendar(sprintf("'-//%s//EN'", $calendar_prod_id)); - $vCalendar->setTimezone($vTimezone); - return $vCalendar; - }; - return $vTimezone; - } - /** - * The BYDAY rule part specifies a COMMA-separated list of days of - * the week; SU indicates Sunday; MO indicates Monday; TU indicates - * Tuesday; WE indicates Wednesday; TH indicates Thursday; FR - * indicates Friday; and SA indicates Saturday. - * Each BYDAY value can also be preceded by a positive (+n) or - * negative (-n) integer. - * @see https://tools.ietf.org/html/rfc5545#section-3.3.10 (BYDAY) - * @see http://php.net/manual/en/datetime.formats.relative.php - * @param DateTime $dt) - * @return string - */ - private static function translate2ByDay(DateTime $dt){ - $day_name = substr(strtoupper($dt->format('D')), 0,2); - $ordinals = ['first', 'second', 'third', 'fourth', 'last']; - $day_nbr = 0; - $is_last = false; - foreach($ordinals as $idx => $ord){ - $dt_n = self::buildOrdinalDateTime($ord, $dt); - if($dt_n->format('Y-m-d') == $dt->format('Y-m-d')){ - $day_nbr = $idx + 1; - if($ord == 'last'){ - $is_last = true; - $day_nbr = 1; - } - break; - } - } - return sprintf('%s%s%s', $is_last? '-':'', $day_nbr, $day_name); - } - /** - * @param string $ord - * @param DateTime $dt - * @return DateTime - */ - private static function buildOrdinalDateTime($ord, DateTime $dt){ - return new DateTime - ( - date - ("Y-m-d", - strtotime - ( - sprintf - ( - self::GetOrdinalDayQuery, - $ord, - $dt->format('l'), - $dt->format('F'), - $dt->format('Y') - ) - ) - ) - ); - } - const GetOrdinalDayQuery = '%s %s of %s %s'; -} diff --git a/Libs/Utils/IEncryptionService.php b/Libs/Utils/IEncryptionService.php deleted file mode 100644 index c9c61212..00000000 --- a/Libs/Utils/IEncryptionService.php +++ /dev/null @@ -1,21 +0,0 @@ -getTimestamp(); - } -} \ No newline at end of file diff --git a/Libs/Utils/RequestUtils.php b/Libs/Utils/RequestUtils.php deleted file mode 100644 index 247ad43a..00000000 --- a/Libs/Utils/RequestUtils.php +++ /dev/null @@ -1,45 +0,0 @@ -match($request); - if(is_null($route)) return false; - $route_path = $route->uri(); - if (strpos($route_path, '/') != 0) - $route_path = '/' . $route_path; - - return $route_path; - } - catch (\Exception $ex) - { - Log::error($ex); - } - return false; - } - -} \ No newline at end of file diff --git a/app/Console/Commands/AdminActionsCalendarSyncProcessingCommand.php b/app/Console/Commands/AdminActionsCalendarSyncProcessingCommand.php deleted file mode 100644 index 99d49985..00000000 --- a/app/Console/Commands/AdminActionsCalendarSyncProcessingCommand.php +++ /dev/null @@ -1,84 +0,0 @@ -service = $service; - } - - /** - * The console command name. - * - * @var string - */ - protected $name = 'summit:admin-schedule-action-process'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Process Admin External Schedule Sync Actions'; - - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'summit:admin-schedule-action-process {batch_size?}'; - - public function handle() - { - $enabled = boolval(Config::get("cal_sync.enable_cal_sync", true)); - if(!$enabled){ - $this->info("task is not enabled!"); - return false; - } - - $batch_size = $this->argument('batch_size'); - if(empty($batch_size)) - $batch_size = PHP_INT_MAX; - - $start = time(); - - $this->info(sprintf("processing batch size of %s", $batch_size)); - - - $res = $this->service->processActions($batch_size); - - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds - processed entries %s", $delta, $res)); - - } -} \ No newline at end of file diff --git a/app/Console/Commands/ChatTeamMessagesSender.php b/app/Console/Commands/ChatTeamMessagesSender.php deleted file mode 100644 index 94c9c496..00000000 --- a/app/Console/Commands/ChatTeamMessagesSender.php +++ /dev/null @@ -1,70 +0,0 @@ -service = $service; - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - $bach_size = $this->argument('bach_size'); - if(is_null($bach_size)) $bach_size = 100; - $res = $this->service->sendMessages($bach_size); - $this->info(sprintf("total messages sent %s", $res)); - } -} \ No newline at end of file diff --git a/app/Console/Commands/EnableMP4SupportAtMUXCommand.php b/app/Console/Commands/EnableMP4SupportAtMUXCommand.php deleted file mode 100644 index 3bf13b88..00000000 --- a/app/Console/Commands/EnableMP4SupportAtMUXCommand.php +++ /dev/null @@ -1,57 +0,0 @@ -argument('event_id'); - - if(empty($event_id)) - throw new \InvalidArgumentException("event_id is required"); - - $service->enableMP4Support(intval($event_id)); - } -} \ No newline at end of file diff --git a/app/Console/Commands/ExternalScheduleFeedIngestionCommand.php b/app/Console/Commands/ExternalScheduleFeedIngestionCommand.php deleted file mode 100644 index d4f5a886..00000000 --- a/app/Console/Commands/ExternalScheduleFeedIngestionCommand.php +++ /dev/null @@ -1,70 +0,0 @@ -service = $service; - } - - /** - * The console command name. - * - * @var string - */ - protected $name = 'summit:external-schedule-feed-ingestion-process'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Process External Schedule Feed for summits'; - - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'summit:external-schedule-feed-ingestion-process'; - - - public function handle() - { - $this->info("starting summits external ingestion"); - $start = time(); - $this->service->ingestAllSummits(); - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - log::info(sprintf("execution call %s seconds", $delta)); - } -} \ No newline at end of file diff --git a/app/Console/Commands/MemberActionsCalendarSyncProcessingCommand.php b/app/Console/Commands/MemberActionsCalendarSyncProcessingCommand.php deleted file mode 100644 index 2e0fa7ce..00000000 --- a/app/Console/Commands/MemberActionsCalendarSyncProcessingCommand.php +++ /dev/null @@ -1,91 +0,0 @@ -service = $service; - } - - /** - * The console command name. - * - * @var string - */ - protected $name = 'summit:member-schedule-action-process'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Process Member External Schedule Sync Actions'; - - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'summit:member-schedule-action-process {provider} {batch_size?}'; - - public function handle() - { - $enabled = boolval(Config::get("cal_sync.enable_cal_sync", true)); - if(!$enabled){ - $this->info("task is not enabled!"); - return false; - } - - $batch_size = $this->argument('batch_size'); - $provider = $this->argument('provider'); - if(!CalendarSyncInfo::isValidProvider($provider)){ - $this->error("provider param is not valid , valid values are [Google, Outlook, iCloud]"); - log::error("provider param is not valid , valid values are [Google, Outlook, iCloud]"); - return false; - } - if(empty($batch_size)) - $batch_size = 1000; - - $start = time(); - - $this->info(sprintf("processing provider %s - batch size of %s", $provider, $batch_size)); - log::info(sprintf("processing provider %s - batch size of %s", $provider, $batch_size)); - - $res = $this->service->processActions($provider, $batch_size); - - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds - processed entries %s", $delta, $res)); - log::info(sprintf("execution call %s seconds - processed entries %s", $delta, $res)); - } -} \ No newline at end of file diff --git a/app/Console/Commands/PresentationMaterialsCreateMUXAssetsCommand.php b/app/Console/Commands/PresentationMaterialsCreateMUXAssetsCommand.php deleted file mode 100644 index 9be72e71..00000000 --- a/app/Console/Commands/PresentationMaterialsCreateMUXAssetsCommand.php +++ /dev/null @@ -1,72 +0,0 @@ -argument('summit_id'); - - $event_id = $this->argument('event_id'); - - if(empty($summit_id)) - throw new \InvalidArgumentException("summit_id is required"); - - $mountingFolder = $this->argument('mounting_folder'); - if(empty($mountingFolder)) - $mountingFolder = Config::get('mediaupload.mounting_folder'); - - Log::debug(sprintf("starting to process published presentations for summit id %s mountingFolder %s event id %s", $summit_id, $mountingFolder, $event_id)); - $this->info(sprintf("starting to process published presentations for summit id %s mountingFolder %s event id %s", $summit_id, $mountingFolder, $event_id)); - - if(empty($event_id)) { - $service->processPublishedPresentationFor(intval($summit_id), $mountingFolder); - return; - } - - $service->processEvent(intval($event_id), $mountingFolder); - } -} \ No newline at end of file diff --git a/app/Console/Commands/PromoCodesRedeemProcessor.php b/app/Console/Commands/PromoCodesRedeemProcessor.php deleted file mode 100644 index 87bcf955..00000000 --- a/app/Console/Commands/PromoCodesRedeemProcessor.php +++ /dev/null @@ -1,97 +0,0 @@ -repository = $repository; - $this->service = $service; - } - - /** - * The console command name. - * - * @var string - */ - protected $name = 'summit:promo-codes-redeem-processor'; - - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'summit:promo-codes-redeem-processor {summit_id?}'; - - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Redeems promo codes per summit'; - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - $summit_id = $this->argument('summit_id'); - - if(is_null($summit_id))// if we dont provide a summit id, then get current - $summit = $this->repository->getCurrentAndAvailable(); - else - $summit = $this->repository->getById(intval($summit_id)); - $this->info(sprintf("starting to process promo codes for summit id %s", $summit->getIdentifier())); - $has_more_items = false; - $page = 1; - - do{ - $this->info(sprintf("processing page %s for summit id %s", $page, $summit->getIdentifier())); - $has_more_items = $this->service->updateRedeemedPromoCodes($summit, $page); - ++$page; - } while($has_more_items); - - $this->info(sprintf("finished to process promo codes for summit id %s", $summit->getIdentifier())); - } -} \ No newline at end of file diff --git a/app/Console/Commands/RecalculateAttendeesStatusCommand.php b/app/Console/Commands/RecalculateAttendeesStatusCommand.php deleted file mode 100644 index 2ac78cc6..00000000 --- a/app/Console/Commands/RecalculateAttendeesStatusCommand.php +++ /dev/null @@ -1,90 +0,0 @@ -repository = $repository; - $this->service = $service; - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - - try { - - $start = time(); - $summit_id = $this->argument('summit_id'); - if(empty($summit_id)) - throw new \InvalidArgumentException("summit_id is required"); - $this->service->recalculateAttendeeStatus(intval($summit_id)); - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::error($ex); - } - } - -} \ No newline at end of file diff --git a/app/Console/Commands/RegistrationSummitOrderReminderEmailCommand.php b/app/Console/Commands/RegistrationSummitOrderReminderEmailCommand.php deleted file mode 100644 index 08457522..00000000 --- a/app/Console/Commands/RegistrationSummitOrderReminderEmailCommand.php +++ /dev/null @@ -1,84 +0,0 @@ -order_service = $order_service; - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - - try { - $this->info("processing summit orders without action"); - $start = time(); - Log::debug("RegistrationSummitOrderReminderEmailCommand::handle"); - $this->order_service->processAllOrderReminder(); - - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::error($ex); - } - } -} \ No newline at end of file diff --git a/app/Console/Commands/RegistrationSummitOrderRevocationCommand.php b/app/Console/Commands/RegistrationSummitOrderRevocationCommand.php deleted file mode 100644 index 6388fbe1..00000000 --- a/app/Console/Commands/RegistrationSummitOrderRevocationCommand.php +++ /dev/null @@ -1,102 +0,0 @@ -order_service = $order_service; - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - - $enabled = Config::get("registration.enable_orders_reservation_revocation", true); - if (!$enabled) { - $this->info("task is not enabled!"); - return false; - } - - try { - $this->info("processing summit orders reservations"); - $start = time(); - $lifetime = intval(Config::get("registration.reservation_lifetime", 30)); - Log::info(sprintf("RegistrationSummitOrderRevocationCommand: using lifetime of %s ", $lifetime)); - - Log::info("RegistrationSummitOrderRevocationCommand: invoking revokeReservedOrdersOlderThanNMinutes"); - $this->order_service->revokeReservedOrdersOlderThanNMinutes($lifetime); - - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - - $start = time(); - Log::info("RegistrationSummitOrderRevocationCommand: invoking confirmOrdersOlderThanNMinutes"); - $this->order_service->confirmOrdersOlderThanNMinutes($lifetime); - - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - } catch (Exception $ex) { - Log::error($ex); - } - } -} diff --git a/app/Console/Commands/SummitEmailFlowEventSeederCommand.php b/app/Console/Commands/SummitEmailFlowEventSeederCommand.php deleted file mode 100644 index 08c586ea..00000000 --- a/app/Console/Commands/SummitEmailFlowEventSeederCommand.php +++ /dev/null @@ -1,64 +0,0 @@ -info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::error($ex); - } - } - -} \ No newline at end of file diff --git a/app/Console/Commands/SummitEmailFlowTypeSeederCommand.php b/app/Console/Commands/SummitEmailFlowTypeSeederCommand.php deleted file mode 100644 index 9771c50c..00000000 --- a/app/Console/Commands/SummitEmailFlowTypeSeederCommand.php +++ /dev/null @@ -1,65 +0,0 @@ -info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::error($ex); - } - } - -} \ No newline at end of file diff --git a/app/Console/Commands/SummitEventSetAvgRateProcessor.php b/app/Console/Commands/SummitEventSetAvgRateProcessor.php deleted file mode 100644 index f112290e..00000000 --- a/app/Console/Commands/SummitEventSetAvgRateProcessor.php +++ /dev/null @@ -1,83 +0,0 @@ -summit_service = $summit_service; - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - try { - - $this->info("processing SummitEventSetAvgRateProcessor"); - $start = time(); - $this->summit_service->calculateFeedbackAverageForOngoingSummits(); - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::error($ex); - } - } - -} \ No newline at end of file diff --git a/app/Console/Commands/SummitForwardXDays.php b/app/Console/Commands/SummitForwardXDays.php deleted file mode 100644 index 21683852..00000000 --- a/app/Console/Commands/SummitForwardXDays.php +++ /dev/null @@ -1,112 +0,0 @@ -summit_service = $summit_service; - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - try { - $tenant = $this->argument('tenant'); - if(empty($tenant)) - throw new \InvalidArgumentException("tenant is required"); - - $current_tenant = Config::get("app.tenant_name"); - - Log::debug(sprintf("SummitForwardXDays::handle tenant %s current_tenant %s", $tenant, $current_tenant)); - - if($tenant != $current_tenant){ - Log::warning(sprintf("SummitForwardXDays::handle exiting bc tenants are not the same")); - return; - } - - $summit_id = $this->argument('summit_id'); - if(empty($summit_id)) - throw new \InvalidArgumentException("summit_id is required"); - - $days = $this->argument('days'); - if(empty($days)) - throw new \InvalidArgumentException("days is required"); - - $negative = $this->option('negative'); - $check_summit_ends = $this->option('check-ended'); - $this->info("processing SummitForwardXDays"); - $start = time(); - - $days = intval($days); - - $this->summit_service->advanceSummit(intval($summit_id), $days, $negative, $check_summit_ends); - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::warning($ex); - } - } -} \ No newline at end of file diff --git a/app/Console/Commands/SummitJsonGenerator.php b/app/Console/Commands/SummitJsonGenerator.php deleted file mode 100644 index 573447b3..00000000 --- a/app/Console/Commands/SummitJsonGenerator.php +++ /dev/null @@ -1,120 +0,0 @@ -repository = $repository; - $this->service = $service; - $this->cache_service = $cache_service; - } - - /** - * The console command name. - * - * @var string - */ - protected $name = 'summit:json-generator'; - - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'summit:json-generator'; - - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Regenerates All Summits Initial Json'; - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - - $summits = $this->repository->getAvailables(); - - foreach($summits as $summit) { - - $this->info(sprintf("processing summit %s (%s)", $summit->getName(), $summit->getId())); - $start = time(); - $expand = 'schedule'; - - $data = SerializerRegistry::getInstance()->getSerializer($summit)->serialize($expand); - if (is_null($data)) return; - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - $current_time = time(); - $key_current = sprintf('/api/v1/summits/%s.expand=%s', 'current', urlencode($expand)); - $key_id = sprintf('/api/v1/summits/%s.expand=%s', $summit->getIdentifier(), urlencode($expand)); - - $cache_lifetime = intval(Config::get('cache_api_response.get_summit_response_lifetime', 600)); - - if ($summit->isActive()) { - $this->cache_service->setSingleValue($key_current, gzdeflate(json_encode($data), 9), $cache_lifetime); - $this->cache_service->setSingleValue($key_current . ".generated", $current_time, $cache_lifetime); - } - - $this->cache_service->setSingleValue($key_id, gzdeflate(json_encode($data), 9), $cache_lifetime); - $this->cache_service->setSingleValue($key_id . ".generated", $current_time, $cache_lifetime); - - $this->info(sprintf("regenerated cache for summit id %s", $summit->getIdentifier())); - } - } - -} diff --git a/app/Console/Commands/SummitListJsonGenerator.php b/app/Console/Commands/SummitListJsonGenerator.php deleted file mode 100644 index cd249ec2..00000000 --- a/app/Console/Commands/SummitListJsonGenerator.php +++ /dev/null @@ -1,129 +0,0 @@ -repository = $repository; - $this->service = $service; - $this->cache_service = $cache_service; - } - - /** - * The console command name. - * - * @var string - */ - protected $name = 'summit-list:json-generator'; - - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'summit-list:json-generator'; - - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Regenerates Summit List Json'; - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - - try { - - $this->info("processing summits"); - $start = time(); - $summits = $this->repository->getAvailables(); - - $response = new PagingResponse - ( - count($summits), - count($summits), - 1, - 1, - $summits - ); - - $data = $response->toArray(); - $key_id = "/api/v1/summits"; - $key_id_public = "/api/public/v1/summits"; - - $cache_lifetime = intval(Config::get('server.response_cache_lifetime', 300)); - $current_time = time(); - Log::info(sprintf("writing cached response for %s", $key_id)); - $this->info(sprintf("writing cached response for %s", $key_id)); - $this->cache_service->setSingleValue($key_id, gzdeflate(json_encode($data), 9), $cache_lifetime); - $this->cache_service->setSingleValue($key_id.".generated", $current_time, $cache_lifetime); - Log::info(sprintf("writing cached response for %s", $key_id_public)); - $this->info(sprintf("writing cached response for %s", $key_id_public)); - $this->cache_service->setSingleValue($key_id_public, gzdeflate(json_encode($data), 9), $cache_lifetime); - $this->cache_service->setSingleValue($key_id_public.".generated", $current_time, $cache_lifetime); - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::error($ex); - } - } - -} diff --git a/app/Console/Commands/SummitRoomReservationRevocationCommand.php b/app/Console/Commands/SummitRoomReservationRevocationCommand.php deleted file mode 100644 index 505fc6e6..00000000 --- a/app/Console/Commands/SummitRoomReservationRevocationCommand.php +++ /dev/null @@ -1,95 +0,0 @@ -location_service = $location_service; - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - $enabled = Config::get("bookable_rooms.enable_bookable_rooms_reservation_revocation", false); - if(!$enabled){ - $this->info("task is not enabled!"); - return false; - } - - try { - - $this->info("processing summit room reservations"); - $start = time(); - $lifetime = intval(Config::get("bookable_rooms.reservation_lifetime", 30)); - Log::info(sprintf("SummitRoomReservationRevocationCommand: using lifetime of %s ", $lifetime)); - $this->location_service->revokeBookableRoomsReservedOlderThanNMinutes($lifetime); - $end = time(); - $delta = $end - $start; - $this->info(sprintf("execution call %s seconds", $delta)); - } - catch (Exception $ex) { - Log::error($ex); - } - } -} \ No newline at end of file diff --git a/app/Console/Commands/SummitSyncAllPresentationActions.php b/app/Console/Commands/SummitSyncAllPresentationActions.php deleted file mode 100644 index 47b872bc..00000000 --- a/app/Console/Commands/SummitSyncAllPresentationActions.php +++ /dev/null @@ -1,95 +0,0 @@ -repository = $repository; - $this->service = $service; - $this->cache_service = $cache_service; - } - - /** - * The console command name. - * - * @var string - */ - protected $name = 'summit:synch-presentation-actions'; - - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'summit:synch-presentation-actions'; - - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Synch All Summits Presention Actions'; - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - $summits = $this->repository->getCurrentAndFutureSummits(); - foreach($summits as $summit) { - Log::debug(sprintf("SummitSyncAllPresentationActions::handle processing summit %s (%s)", $summit->getName(), $summit->getId())); - $this->info(sprintf("processing summit %s (%s)", $summit->getName(), $summit->getId())); - $summit->synchAllPresentationActions(); - $this->info(sprintf("regenerated presentation actions for summit id %s", $summit->getIdentifier())); - } - } - -} \ No newline at end of file diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php deleted file mode 100644 index b02bc71d..00000000 --- a/app/Console/Kernel.php +++ /dev/null @@ -1,115 +0,0 @@ -command('summit:json-generator')->everyFiveMinutes()->withoutOverlapping()->onOneServer(); - - // synch presentation actions - $schedule->command('summit:synch-presentation-actions')->everyFiveMinutes()->withoutOverlapping()->onOneServer(); - - // list of available summits - $schedule->command('summit-list:json-generator')->everyFiveMinutes()->withoutOverlapping()->onOneServer(); - - // Calendar Sync Jobs - - // Admin Actions - //$schedule->command('summit:admin-schedule-action-process')->withoutOverlapping(); - // Member Actions - // Google Calendar - //$schedule->command('summit:member-schedule-action-process', [CalendarSyncInfo::ProviderGoogle, 1000])->withoutOverlapping(); - // Outlook - //$schedule->command('summit:member-schedule-action-process', [CalendarSyncInfo::ProviderOutlook, 1000])->withoutOverlapping(); - // iCloud - //$schedule->command('summit:member-schedule-action-process', [CalendarSyncInfo::ProvideriCloud, 1000])->withoutOverlapping(); - - // redeem code processor - - //$schedule->command('summit:promo-codes-redeem-processor', [end($summit_ids)])->daily()->withoutOverlapping(); - - // bookable rooms - - $schedule->command('summit:room-reservation-revocation')->everyFiveMinutes()->withoutOverlapping()->onOneServer(); - // external schedule ingestion task - - $schedule->command("summit:external-schedule-feed-ingestion-process")->everyFifteenMinutes()->withoutOverlapping()->onOneServer(); - - // AVG schedule feedback rate - $schedule->command("summit:feedback-avg-rate-processor")->everyFifteenMinutes()->withoutOverlapping()->onOneServer(); - // registration orders - - $schedule->command('summit:order-reservation-revocation')->everyFiveMinutes()->withoutOverlapping()->onOneServer(); - - // reminder emails - - $schedule->command('summit:registration-order-reminder-action-email')->everyThirtyMinutes()->timezone(new \DateTimeZone('UTC'))->withoutOverlapping()->onOneServer(); - - if ($env == 'production') { - // FNTECH production YOCO (13) advance AT 0700 AM ( 12:00 AM PST) - $schedule->command("summit:forward-x-days", ["FNTECH", 13, 2, '--check-ended'])->dailyAt("07:00")->timezone('UTC')->withoutOverlapping()->onOneServer(); - // FNTECH production Hybrid Alive (30) advance AT 0700 AM ( 12:00 AM PST) - $schedule->command("summit:forward-x-days", ["FNTECH", 30, 3, '--check-ended'])->dailyAt("07:00")->timezone('UTC')->withoutOverlapping()->onOneServer(); - } - - } -} diff --git a/app/EntityPersisters/AdminSummitEventActionSyncWorkRequestPersister.php b/app/EntityPersisters/AdminSummitEventActionSyncWorkRequestPersister.php deleted file mode 100644 index 74f7da44..00000000 --- a/app/EntityPersisters/AdminSummitEventActionSyncWorkRequestPersister.php +++ /dev/null @@ -1,58 +0,0 @@ - $request->getType(), - 'CreatedByID' => $request->getCreatedById(), - 'SummitEventID' => $request->getSummitEventId(), - ]; - - $types = [ - 'Type' => 'string', - 'CreatedByID' => 'integer', - 'SummitEventID' => 'integer', - ]; - - self::insert($sql, $bindings, $types); - - $sql = << $request->getType(), - 'CreatedByID' => $request->getCreatedById(), - 'LocationID' => $request->getLocationId(), - ]; - - $types = [ - 'Type' => 'string', - 'CreatedByID' => 'integer', - 'LocationID' => 'integer', - ]; - - self::insert($sql, $bindings, $types); - - $sql = << $assets_sync_request->getFrom(), - 'ToFile' => $assets_sync_request->getTo(), - ]; - - $types = [ - 'FromFile' => 'string', - 'ToFile' => 'string', - - ]; - - self::insert($sql, $bindings, $types); - } -} \ No newline at end of file diff --git a/app/EntityPersisters/BasePersister.php b/app/EntityPersisters/BasePersister.php deleted file mode 100644 index d69fd450..00000000 --- a/app/EntityPersisters/BasePersister.php +++ /dev/null @@ -1,30 +0,0 @@ -getConnection()->executeUpdate($sql, $bindings, $types); - } -} \ No newline at end of file diff --git a/app/EntityPersisters/EntityEventPersister.php b/app/EntityPersisters/EntityEventPersister.php deleted file mode 100644 index d5e24da0..00000000 --- a/app/EntityPersisters/EntityEventPersister.php +++ /dev/null @@ -1,63 +0,0 @@ - $entity_event->getEntityId(), - 'EntityClassName' => $entity_event->getEntityClassName(), - 'Type' => $entity_event->getType(), - 'Metadata' => $entity_event->getRawMetadata(), - 'Created' => $entity_event->getCreated(), - 'LastEdited' => $entity_event->getLastEdited(), - 'OwnerID' => $entity_event->getOwnerId(), - 'SummitID' => $entity_event->getSummitId() - ]; - - $types = [ - 'EntityID' => 'integer', - 'EntityClassName' => 'string', - 'Type' => 'string', - 'Metadata' => 'string', - 'Created' => 'datetime', - 'LastEdited' => 'datetime', - 'OwnerID' => 'integer', - 'SummitID' => 'integer', - ]; - - self::insert($sql, $bindings, $types); - } - - /** - * @param SummitEntityEvent[] $entity_events - */ - public static function persist_list(array $entity_events){ - foreach ($entity_events as $entity_event) - self::persist($entity_event); - } -} \ No newline at end of file diff --git a/app/Events/BookableRooms/BookableRoomReservationAction.php b/app/Events/BookableRooms/BookableRoomReservationAction.php deleted file mode 100644 index 77315089..00000000 --- a/app/Events/BookableRooms/BookableRoomReservationAction.php +++ /dev/null @@ -1,44 +0,0 @@ -reservation_id = $reservation_id; - } - - /** - * @return int - */ - public function getReservationId(): int - { - return $this->reservation_id; - } -} \ No newline at end of file diff --git a/app/Events/BookableRooms/BookableRoomReservationCanceled.php b/app/Events/BookableRooms/BookableRoomReservationCanceled.php deleted file mode 100644 index ee1c9af5..00000000 --- a/app/Events/BookableRooms/BookableRoomReservationCanceled.php +++ /dev/null @@ -1,22 +0,0 @@ -summit_id = $summit_id; - $this->venue_id = $venue_id; - $this->floor_id = $floor_id; - } - - /** - * @return int - */ - public function getFloorId() - { - return $this->floor_id; - } - - /** - * @return int - */ - public function getVenueId() - { - return $this->venue_id; - } - - public function getSummitId(){ - return $this->summit_id; - } - -} \ No newline at end of file diff --git a/app/Events/FloorDeleted.php b/app/Events/FloorDeleted.php deleted file mode 100644 index 9c7e4a72..00000000 --- a/app/Events/FloorDeleted.php +++ /dev/null @@ -1,22 +0,0 @@ -summit_id = $summit_id; - $this->location_id = $location_id; - $this->location_class_name = $location_class_name; - $this->related_event_ids = $related_event_ids; - } - - /** - * @return int - */ - public function getLocationId() - { - return $this->location_id; - } - - /** - * @return int[] - */ - public function getRelatedEventIds() - { - return $this->related_event_ids; - } - - /** - * @return string - */ - public function getLocationClassName() - { - return $this->location_class_name; - } - - /** - * @return int - */ - public function getSummitId() - { - return $this->summit_id; - } -} \ No newline at end of file diff --git a/app/Events/LocationDeleted.php b/app/Events/LocationDeleted.php deleted file mode 100644 index f512720d..00000000 --- a/app/Events/LocationDeleted.php +++ /dev/null @@ -1,22 +0,0 @@ -entity_id = $entity_id; - $this->location_id = $location_id; - $this->summit_id = $summit_id; - $this->image_type = $image_type; - } - - /** - * @return int - */ - public function getLocationId() - { - return $this->location_id; - } - - /** - * @return string - */ - public function getImageType() - { - return $this->image_type; - } - - /** - * @return int - */ - public function getSummitId(){ - return $this->summit_id; - } - - /** - * @return int - */ - public function getEntityId(){ - return $this->entity_id; - } - -} \ No newline at end of file diff --git a/app/Events/LocationImageDeleted.php b/app/Events/LocationImageDeleted.php deleted file mode 100644 index 2deb221a..00000000 --- a/app/Events/LocationImageDeleted.php +++ /dev/null @@ -1,22 +0,0 @@ -member = $member; - $this->summit = $summit; - parent::__construct($event_id); - } - - public function getMember(){ return $this->member; } - - public function getSummit(){ return $this->summit;} -} \ No newline at end of file diff --git a/app/Events/MyFavoritesRemove.php b/app/Events/MyFavoritesRemove.php deleted file mode 100644 index 6475dc7a..00000000 --- a/app/Events/MyFavoritesRemove.php +++ /dev/null @@ -1,22 +0,0 @@ -member = $member; - $this->summit = $summit; - parent::__construct($event_id); - } - - public function getMember(){ return $this->member; } - - public function getSummit(){ return $this->summit;} -} \ No newline at end of file diff --git a/app/Events/MyScheduleRemove.php b/app/Events/MyScheduleRemove.php deleted file mode 100644 index 03b5710b..00000000 --- a/app/Events/MyScheduleRemove.php +++ /dev/null @@ -1,12 +0,0 @@ -member_id = $member_id; - } - - /** - * @return int - */ - public function getMemberId(): int - { - return $this->member_id; - } - -} \ No newline at end of file diff --git a/app/Events/PresentationActionTypeCreated.php b/app/Events/PresentationActionTypeCreated.php deleted file mode 100644 index 00c10fe8..00000000 --- a/app/Events/PresentationActionTypeCreated.php +++ /dev/null @@ -1,41 +0,0 @@ -action_type = $action_type; - } - - public function getActionType():PresentationActionType{ - return $this->action_type; - } -} \ No newline at end of file diff --git a/app/Events/PresentationMaterialCreated.php b/app/Events/PresentationMaterialCreated.php deleted file mode 100644 index dc1788a1..00000000 --- a/app/Events/PresentationMaterialCreated.php +++ /dev/null @@ -1,45 +0,0 @@ -material = $material; - } - - /** - * @return PresentationMaterial - */ - public function getMaterial(){ - return $this->material; - } -} \ No newline at end of file diff --git a/app/Events/PresentationMaterialDeleted.php b/app/Events/PresentationMaterialDeleted.php deleted file mode 100644 index 274c59ee..00000000 --- a/app/Events/PresentationMaterialDeleted.php +++ /dev/null @@ -1,76 +0,0 @@ -presentation = $presentation; - $this->material_id = $material_id; - $this->class_name = $class_name; - } - - /** - * @return Presentation - */ - public function getPresentation(){ - return $this->presentation; - } - - /** - * @return int - */ - public function getMaterialId(){ - return $this->material_id; - } - - /** - * @return string - */ - public function getClassName(){ - return $this->class_name; - } - -} \ No newline at end of file diff --git a/app/Events/PresentationMaterialUpdated.php b/app/Events/PresentationMaterialUpdated.php deleted file mode 100644 index b5b8a0de..00000000 --- a/app/Events/PresentationMaterialUpdated.php +++ /dev/null @@ -1,46 +0,0 @@ -material = $material; - } - - /** - * @return PresentationMaterial - */ - public function getMaterial(){ - return $this->material; - } -} \ No newline at end of file diff --git a/app/Events/PresentationSpeakerCreated.php b/app/Events/PresentationSpeakerCreated.php deleted file mode 100644 index 994d1a33..00000000 --- a/app/Events/PresentationSpeakerCreated.php +++ /dev/null @@ -1,22 +0,0 @@ -speaker = $speaker; - $this->args = $args; - } - - /** - * @return PresentationSpeaker|null - */ - public function getPresentationSpeaker() - { - return $this->speaker; - } - - /** - * @return LifecycleEventArgs - */ - public function getArgs() - { - return $this->args; - } -} \ No newline at end of file diff --git a/app/Events/PresentationSpeakerUpdated.php b/app/Events/PresentationSpeakerUpdated.php deleted file mode 100644 index a0b481a1..00000000 --- a/app/Events/PresentationSpeakerUpdated.php +++ /dev/null @@ -1,21 +0,0 @@ -rsvp_id = $rsvp->getId(); - parent::__construct($rsvp->getEventId()); - } - - /** - * @return int - */ - public function getRsvpId(): int - { - return $this->rsvp_id; - } - -} \ No newline at end of file diff --git a/app/Events/RSVPCreated.php b/app/Events/RSVPCreated.php deleted file mode 100644 index d3e6c0e1..00000000 --- a/app/Events/RSVPCreated.php +++ /dev/null @@ -1,22 +0,0 @@ -summit_id = $summit_id; - $this->tickets_to_return = $tickets_to_return; - $this->promo_codes_to_return = $promo_codes_to_return; - } - - /** - * @return array - */ - public function getTicketsToReturn(): array - { - return $this->tickets_to_return; - } - - /** - * @return array - */ - public function getPromoCodesToReturn(): array - { - return $this->promo_codes_to_return; - } - - /** - * @return int - */ - public function getSummitId(): int - { - return $this->summit_id; - } - - -} \ No newline at end of file diff --git a/app/Events/Registration/PaymentSummitRegistrationOrderConfirmed.php b/app/Events/Registration/PaymentSummitRegistrationOrderConfirmed.php deleted file mode 100644 index 6b0f7236..00000000 --- a/app/Events/Registration/PaymentSummitRegistrationOrderConfirmed.php +++ /dev/null @@ -1,22 +0,0 @@ -days_before_event_starts = $days_before_event_starts; - } - - /** - * @return int - */ - public function getDaysBeforeEventStarts(): int - { - return $this->days_before_event_starts; - } - -} \ No newline at end of file diff --git a/app/Events/Registration/RequestedSummitOrderRefund.php b/app/Events/Registration/RequestedSummitOrderRefund.php deleted file mode 100644 index 2006d26b..00000000 --- a/app/Events/Registration/RequestedSummitOrderRefund.php +++ /dev/null @@ -1,45 +0,0 @@ -days_before_event_starts = $days_before_event_starts; - } - - /** - * @return int - */ - public function getDaysBeforeEventStarts(): int - { - return $this->days_before_event_starts; - } - -} \ No newline at end of file diff --git a/app/Events/Registration/SummitAttendeeTicketAction.php b/app/Events/Registration/SummitAttendeeTicketAction.php deleted file mode 100644 index 03b828d6..00000000 --- a/app/Events/Registration/SummitAttendeeTicketAction.php +++ /dev/null @@ -1,44 +0,0 @@ -ticket_id = $ticket_id; - } - - /** - * @return int - */ - public function getTicketId(): int - { - return $this->ticket_id; - } -} \ No newline at end of file diff --git a/app/Events/Registration/SummitAttendeeTicketRefundAccepted.php b/app/Events/Registration/SummitAttendeeTicketRefundAccepted.php deleted file mode 100644 index c69852af..00000000 --- a/app/Events/Registration/SummitAttendeeTicketRefundAccepted.php +++ /dev/null @@ -1,59 +0,0 @@ -tickets_to_return = $tickets_to_return; - $this->promo_codes_to_return = $promo_codes_to_return; - } - - /** - * @return array - */ - public function getTicketsToReturn(): array - { - return $this->tickets_to_return; - } - - /** - * @return array - */ - public function getPromoCodesToReturn(): array - { - return $this->promo_codes_to_return; - } - -} \ No newline at end of file diff --git a/app/Events/Registration/SummitOrderCanceled.php b/app/Events/Registration/SummitOrderCanceled.php deleted file mode 100644 index b705ffea..00000000 --- a/app/Events/Registration/SummitOrderCanceled.php +++ /dev/null @@ -1,79 +0,0 @@ -send_email = $send_email; - $this->tickets_to_return = $tickets_to_return; - $this->promo_codes_to_return = $promo_codes_to_return; - } - - /** - * @return bool - */ - public function shouldSendEmail(): bool - { - return $this->send_email; - } - - /** - * @return array - */ - public function getTicketsToReturn(): array - { - return $this->tickets_to_return; - } - - /** - * @return array - */ - public function getPromoCodesToReturn(): array - { - return $this->promo_codes_to_return; - } - - - -} \ No newline at end of file diff --git a/app/Events/Registration/SummitOrderRefundAccepted.php b/app/Events/Registration/SummitOrderRefundAccepted.php deleted file mode 100644 index 4f63b5c0..00000000 --- a/app/Events/Registration/SummitOrderRefundAccepted.php +++ /dev/null @@ -1,59 +0,0 @@ -promo_codes_to_return = $promo_codes_to_return; - $this->tickets_to_return = $tickets_to_return; - } - - /** - * @return array - */ - public function getTicketsToReturn(): array - { - return $this->tickets_to_return; - } - - /** - * @return array - */ - public function getPromoCodesToReturn(): array - { - return $this->promo_codes_to_return; - } - -} \ No newline at end of file diff --git a/app/Events/Registration/SummitRegistrationOrderAction.php b/app/Events/Registration/SummitRegistrationOrderAction.php deleted file mode 100644 index af7c4a76..00000000 --- a/app/Events/Registration/SummitRegistrationOrderAction.php +++ /dev/null @@ -1,44 +0,0 @@ -order_id = $order_id; - } - - /** - * @return int - */ - public function getOrderId(): int - { - return $this->order_id; - } -} \ No newline at end of file diff --git a/app/Events/SummitAction.php b/app/Events/SummitAction.php deleted file mode 100644 index 87c41606..00000000 --- a/app/Events/SummitAction.php +++ /dev/null @@ -1,45 +0,0 @@ -summit_id = $summit_id; - } - - /** - * @return int - */ - public function getSummitId() - { - return $this->summit_id; - } -} \ No newline at end of file diff --git a/app/Events/SummitDeleted.php b/app/Events/SummitDeleted.php deleted file mode 100644 index 0485e56a..00000000 --- a/app/Events/SummitDeleted.php +++ /dev/null @@ -1,22 +0,0 @@ -event_id = $event_id; - } - - /** - * @return int - */ - public function getEventId(){ return $this->event_id;} -} \ No newline at end of file diff --git a/app/Events/SummitEventCreated.php b/app/Events/SummitEventCreated.php deleted file mode 100644 index 0149d474..00000000 --- a/app/Events/SummitEventCreated.php +++ /dev/null @@ -1,22 +0,0 @@ -summit_event = $summit_event; - $this->args = $args; - } - - /** - * @return SummitEvent|null - */ - public function getSummitEvent() - { - return $this->summit_event; - } - - /** - * @return LifecycleEventArgs - */ - public function getArgs() - { - return $this->args; - } - -} \ No newline at end of file diff --git a/app/Events/SummitEventTypeAction.php b/app/Events/SummitEventTypeAction.php deleted file mode 100644 index a9a1d244..00000000 --- a/app/Events/SummitEventTypeAction.php +++ /dev/null @@ -1,75 +0,0 @@ -event_type_id = $event_type_id; - $this->class_name = $class_name; - $this->summit_id = $summit_id; - } - - /** - * @return int - */ - public function getEventTypeId() - { - return $this->event_type_id; - } - - /** - * @return string - */ - public function getClassName() - { - return $this->class_name; - } - - /** - * @return int - */ - public function getSummitId() - { - return $this->summit_id; - } - -} \ No newline at end of file diff --git a/app/Events/SummitEventTypeDeleted.php b/app/Events/SummitEventTypeDeleted.php deleted file mode 100644 index 29b06ea3..00000000 --- a/app/Events/SummitEventTypeDeleted.php +++ /dev/null @@ -1,18 +0,0 @@ -ticket_type_id = $ticket_type_id; - $this->summit_id = $summit_id; - } - - /** - * @return int - */ - public function getTicketTypeId() - { - return $this->ticket_type_id; - } - - /** - * @return int - */ - public function getSummitId() - { - return $this->summit_id; - } - -} \ No newline at end of file diff --git a/app/Events/SummitTicketTypeDeleted.php b/app/Events/SummitTicketTypeDeleted.php deleted file mode 100644 index e300ce9b..00000000 --- a/app/Events/SummitTicketTypeDeleted.php +++ /dev/null @@ -1,21 +0,0 @@ -old_floor_id = $old_floor_id; - $this->new_floor_id = $new_floor_id; - } - - /** - * @return int - */ - public function getOldFloorId() - { - return $this->old_floor_id; - } - - /** - * @return int - */ - public function getNewFloorId() - { - return $this->new_floor_id; - } - -} \ No newline at end of file diff --git a/app/Events/TrackAction.php b/app/Events/TrackAction.php deleted file mode 100644 index 1708edbc..00000000 --- a/app/Events/TrackAction.php +++ /dev/null @@ -1,59 +0,0 @@ -summit_id = $summit_id; - $this->track_id = $track_id; - } - - /** - * @return int - */ - public function getTrackId() - { - return $this->track_id; - } - - /** - * @return int - */ - public function getSummitId() - { - return $this->summit_id; - } -} \ No newline at end of file diff --git a/app/Events/TrackDeleted.php b/app/Events/TrackDeleted.php deleted file mode 100644 index 8c94d935..00000000 --- a/app/Events/TrackDeleted.php +++ /dev/null @@ -1,22 +0,0 @@ -track_group_id = $track_group_id; - $this->summit_id = $summit_id; - $this->class_name = $class_name; - } - - /** - * @return string - */ - public function getClassName() - { - return $this->class_name; - } - - /** - * @return int - */ - public function getTrackGroupId() - { - return $this->track_group_id; - } - - /** - * @return int - */ - public function getSummitId() - { - return $this->summit_id; - } -} \ No newline at end of file diff --git a/app/Events/TrackGroupDeleted.php b/app/Events/TrackGroupDeleted.php deleted file mode 100644 index 7add88db..00000000 --- a/app/Events/TrackGroupDeleted.php +++ /dev/null @@ -1,22 +0,0 @@ -view('errors.404', [], 200); - } -} diff --git a/app/Facades/ResourceServerContext.php b/app/Facades/ResourceServerContext.php deleted file mode 100644 index 4d7ab271..00000000 --- a/app/Facades/ResourceServerContext.php +++ /dev/null @@ -1,24 +0,0 @@ -getCurrentUser(false); - $request = new AdminSummitLocationActionSyncWorkRequest; - - $request->setLocationId($event->getLocationId()); - - $request->setType($type); - - if(!is_null($current_member)){ - $request->setCreatedBy($current_member); - } - - return $request; - } -} \ No newline at end of file diff --git a/app/Factories/CalendarAdminActionSyncWorkRequest/SummitEventDeletedCalendarSyncWorkRequestFactory.php b/app/Factories/CalendarAdminActionSyncWorkRequest/SummitEventDeletedCalendarSyncWorkRequestFactory.php deleted file mode 100644 index c5e88331..00000000 --- a/app/Factories/CalendarAdminActionSyncWorkRequest/SummitEventDeletedCalendarSyncWorkRequestFactory.php +++ /dev/null @@ -1,49 +0,0 @@ -getArgs(); - $params = $args->getParams(); - $resource_server_context = App::make(IResourceServerContext::class); - $current_member = $resource_server_context->getCurrentUser(false); - $request = null; - if(isset($params['published']) && $params['published']){ - // just record the published state at the moment of the update - $request = new AdminSummitEventActionSyncWorkRequest(); - $request->setSummitEventId ($params['id']); - $request->setType(AbstractCalendarSyncWorkRequest::TypeRemove); - if(!is_null($current_member)){ - $request->setCreatedBy($current_member); - } - } - return $request; - } -} \ No newline at end of file diff --git a/app/Factories/CalendarAdminActionSyncWorkRequest/SummitEventUpdatedCalendarSyncWorkRequestFactory.php b/app/Factories/CalendarAdminActionSyncWorkRequest/SummitEventUpdatedCalendarSyncWorkRequestFactory.php deleted file mode 100644 index daf3e937..00000000 --- a/app/Factories/CalendarAdminActionSyncWorkRequest/SummitEventUpdatedCalendarSyncWorkRequestFactory.php +++ /dev/null @@ -1,49 +0,0 @@ -getArgs(); - $current_member = $resource_server_context->getCurrentUser(false); - // sync request from admin - $request = new AdminSummitEventActionSyncWorkRequest(); - $request->setSummitEvent($event->getSummitEvent()) ; - $request->setType(AbstractCalendarSyncWorkRequest::TypeUpdate); - if(!is_null($current_member)){ - $request->setCreatedBy($current_member); - } - - if($args->hasChangedField('published')){ - $pub_old = intval($args->getOldValue('published')); - $pub_new = intval($args->getNewValue('published')); - if($pub_old == 1 && $pub_new == 0) - $request->setType(AbstractCalendarSyncWorkRequest::TypeRemove); - } - - return $request; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/FloorActionEntityEventFactory.php b/app/Factories/EntityEvents/FloorActionEntityEventFactory.php deleted file mode 100644 index 2f37925b..00000000 --- a/app/Factories/EntityEvents/FloorActionEntityEventFactory.php +++ /dev/null @@ -1,55 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName('SummitVenueFloor'); - $entity_event->setEntityId($event->getFloorId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata(json_encode([ - 'venue_id' => $event->getVenueId() - ])); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/LocationActionEntityEventFactory.php b/app/Factories/EntityEvents/LocationActionEntityEventFactory.php deleted file mode 100644 index 62a130e7..00000000 --- a/app/Factories/EntityEvents/LocationActionEntityEventFactory.php +++ /dev/null @@ -1,64 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName($event->getLocationClassName()); - $entity_event->setEntityId($event->getLocationId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $metadata = ''; - - if($event instanceof SummitVenueRoomUpdated){ - $old_floor_id = $event->getOldFloorId(); - $new_floor_id = $event->getNewFloorId(); - - if($old_floor_id != $new_floor_id){ - $metadata = json_encode( ['floor_old' => $old_floor_id, 'floor_new' => $new_floor_id]); - } - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata($metadata); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/LocationImageActionEntityEventFactory.php b/app/Factories/EntityEvents/LocationImageActionEntityEventFactory.php deleted file mode 100644 index bf97eeb9..00000000 --- a/app/Factories/EntityEvents/LocationImageActionEntityEventFactory.php +++ /dev/null @@ -1,51 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName($event->getImageType()); - $entity_event->setEntityId($event->getEntityId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $metadata = json_encode( ['location_id' => $event->getLocationId()]); - - $entity_event->setSummit($summit); - $entity_event->setMetadata($metadata); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/MyFavoritesAddEntityEventFactory.php b/app/Factories/EntityEvents/MyFavoritesAddEntityEventFactory.php deleted file mode 100644 index bfdb2798..00000000 --- a/app/Factories/EntityEvents/MyFavoritesAddEntityEventFactory.php +++ /dev/null @@ -1,36 +0,0 @@ -setEntityClassName('MyFavorite'); - $entity_event->setEntityId($event->getEventId()); - $entity_event->setType('INSERT'); - $entity_event->setOwner($event->getMember()); - $entity_event->setSummit($event->getSummit()); - $entity_event->setMetadata(''); - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/MyFavoritesRemoveEntityEventFactory.php b/app/Factories/EntityEvents/MyFavoritesRemoveEntityEventFactory.php deleted file mode 100644 index 1d56ebba..00000000 --- a/app/Factories/EntityEvents/MyFavoritesRemoveEntityEventFactory.php +++ /dev/null @@ -1,38 +0,0 @@ -setEntityClassName('MyFavorite'); - $entity_event->setEntityId($event->getEventId()); - $entity_event->setType('DELETE'); - $entity_event->setOwner($event->getMember()); - $entity_event->setSummit($event->getSummit()); - $entity_event->setMetadata(''); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/MyScheduleAddEntityEventFactory.php b/app/Factories/EntityEvents/MyScheduleAddEntityEventFactory.php deleted file mode 100644 index c9a72703..00000000 --- a/app/Factories/EntityEvents/MyScheduleAddEntityEventFactory.php +++ /dev/null @@ -1,36 +0,0 @@ -setEntityClassName('MySchedule'); - $entity_event->setEntityId($event->getEventId()); - $entity_event->setType('INSERT'); - $entity_event->setOwner($event->getMember()); - $entity_event->setSummit($event->getSummit()); - $entity_event->setMetadata(''); - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/MyScheduleRemoveEntityEventFactory.php b/app/Factories/EntityEvents/MyScheduleRemoveEntityEventFactory.php deleted file mode 100644 index ef2ea4c8..00000000 --- a/app/Factories/EntityEvents/MyScheduleRemoveEntityEventFactory.php +++ /dev/null @@ -1,36 +0,0 @@ -setEntityClassName('MySchedule'); - $entity_event->setEntityId($event->getEventId()); - $entity_event->setType('DELETE'); - $entity_event->setOwner($event->getMember()); - $entity_event->setSummit($event->getSummit()); - $entity_event->setMetadata(''); - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/PresentationMaterialCreatedEntityEventFactory.php b/app/Factories/EntityEvents/PresentationMaterialCreatedEntityEventFactory.php deleted file mode 100644 index b4dffbb5..00000000 --- a/app/Factories/EntityEvents/PresentationMaterialCreatedEntityEventFactory.php +++ /dev/null @@ -1,45 +0,0 @@ -getCurrentUser(false); - - $entity_event = new SummitEntityEvent(); - $entity_event->setEntityClassName($event->getMaterial()->getClassName()); - $entity_event->setEntityId($event->getMaterial()->getId()); - $entity_event->setType('INSERT'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($event->getMaterial()->getPresentation()->getSummit()); - $entity_event->setMetadata(json_encode([ 'presentation_id' => intval($event->getMaterial()->getPresentation()->getId())])); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/PresentationMaterialDeletedEntityEventFactory.php b/app/Factories/EntityEvents/PresentationMaterialDeletedEntityEventFactory.php deleted file mode 100644 index f472cbe1..00000000 --- a/app/Factories/EntityEvents/PresentationMaterialDeletedEntityEventFactory.php +++ /dev/null @@ -1,45 +0,0 @@ -getCurrentUser(false); - - $entity_event = new SummitEntityEvent(); - $entity_event->setEntityClassName($event->getClassName()); - $entity_event->setEntityId($event->getMaterialId()); - $entity_event->setType('DELETE'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($event->getPresentation()->getSummit()); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/PresentationMaterialUpdatedEntityEventFactory.php b/app/Factories/EntityEvents/PresentationMaterialUpdatedEntityEventFactory.php deleted file mode 100644 index e7b73574..00000000 --- a/app/Factories/EntityEvents/PresentationMaterialUpdatedEntityEventFactory.php +++ /dev/null @@ -1,45 +0,0 @@ -getCurrentUser(false); - $entity_event = new SummitEntityEvent(); - - $entity_event->setEntityClassName($event->getMaterial()->getClassName()); - $entity_event->setEntityId($event->getMaterial()->getId()); - $entity_event->setType('UPDATE'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($event->getMaterial()->getPresentation()->getSummit()); - $entity_event->setMetadata(json_encode([ 'presentation_id' => intval($event->getMaterial()->getPresentation()->getId())])); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/PresentationSpeakerCreatedEntityEventFactory.php b/app/Factories/EntityEvents/PresentationSpeakerCreatedEntityEventFactory.php deleted file mode 100644 index ee12729b..00000000 --- a/app/Factories/EntityEvents/PresentationSpeakerCreatedEntityEventFactory.php +++ /dev/null @@ -1,50 +0,0 @@ -getCurrentUser(false); - - foreach($event->getPresentationSpeaker()->getRelatedSummits() as $summit) { - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName("PresentationSpeaker"); - $entity_event->setEntityId($event->getPresentationSpeaker()->getId()); - $entity_event->setType('INSERT'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata(''); - $list[] = $entity_event; - - } - return $list; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/PresentationSpeakerDeletedEntityEventFactory.php b/app/Factories/EntityEvents/PresentationSpeakerDeletedEntityEventFactory.php deleted file mode 100644 index 5242fd0a..00000000 --- a/app/Factories/EntityEvents/PresentationSpeakerDeletedEntityEventFactory.php +++ /dev/null @@ -1,46 +0,0 @@ -getArgs(); - $params = $args->getParams(); - - foreach($params['summits'] as $summit) { - - $entity_event = new SummitEntityEvent(); - $entity_event->setEntityClassName($params['class_name']); - $entity_event->setEntityId($params['id']); - $entity_event->setType('DELETE'); - $entity_event->setSummit($summit); - $entity_event->setMetadata(''); - $list[] = $entity_event; - } - - return $list; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/PresentationSpeakerUpdatedEntityEventFactory.php b/app/Factories/EntityEvents/PresentationSpeakerUpdatedEntityEventFactory.php deleted file mode 100644 index a98b72eb..00000000 --- a/app/Factories/EntityEvents/PresentationSpeakerUpdatedEntityEventFactory.php +++ /dev/null @@ -1,51 +0,0 @@ -getCurrentUser(false); - - foreach($event->getPresentationSpeaker()->getRelatedSummits() as $summit) { - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName("PresentationSpeaker"); - $entity_event->setEntityId($event->getPresentationSpeaker()->getId()); - $entity_event->setType('UPDATE'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata(''); - - $list[] =$entity_event; - } - - return $list; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/SummitActionEntityEventFactory.php b/app/Factories/EntityEvents/SummitActionEntityEventFactory.php deleted file mode 100644 index 107df579..00000000 --- a/app/Factories/EntityEvents/SummitActionEntityEventFactory.php +++ /dev/null @@ -1,54 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName('Summit'); - $entity_event->setEntityId($event->getSummitId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - if(!is_null($summit)) - $entity_event->setSummit($summit); - - $entity_event->setMetadata(''); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/SummitEventCreatedEntityEventFactory.php b/app/Factories/EntityEvents/SummitEventCreatedEntityEventFactory.php deleted file mode 100644 index d29f8e30..00000000 --- a/app/Factories/EntityEvents/SummitEventCreatedEntityEventFactory.php +++ /dev/null @@ -1,45 +0,0 @@ -getCurrentUser(false); - $entity_event = new SummitEntityEvent(); - - $entity_event->setEntityClassName($event->getSummitEvent()->getClassName()); - $entity_event->setEntityId($event->getSummitEvent()->getId()); - $entity_event->setType('INSERT'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($event->getSummitEvent()->getSummit()); - $entity_event->setMetadata( json_encode([ 'pub_new' => intval($event->getSummitEvent()->isPublished())])); - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/SummitEventDeletedEntityEventFactory.php b/app/Factories/EntityEvents/SummitEventDeletedEntityEventFactory.php deleted file mode 100644 index bf82303a..00000000 --- a/app/Factories/EntityEvents/SummitEventDeletedEntityEventFactory.php +++ /dev/null @@ -1,57 +0,0 @@ -getArgs(); - - $resource_server_context = App::make(\models\oauth2\IResourceServerContext::class); - $owner = $resource_server_context->getCurrentUser(false); - $params = $args->getParams(); - - $entity_event = new SummitEntityEvent(); - $entity_event->setEntityClassName($params['class_name']); - $entity_event->setEntityId($params['id']); - $entity_event->setType('DELETE'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($params['summit']); - $entity_event->setMetadata(''); - - if(isset($params['published']) && $params['published']){ - // just record the published state at the moment of the update - - $entity_event->setMetadata( json_encode([ - 'pub_old' => intval($params['published']), - 'pub_new' => intval($params['published']) - ])); - } - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/SummitEventTypeActionEntityEventFactory.php b/app/Factories/EntityEvents/SummitEventTypeActionEntityEventFactory.php deleted file mode 100644 index 6895dc8f..00000000 --- a/app/Factories/EntityEvents/SummitEventTypeActionEntityEventFactory.php +++ /dev/null @@ -1,54 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName($event->getClassName()); - $entity_event->setEntityId($event->getEventTypeId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata(''); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/SummitEventUpdatedEntityEventFactory.php b/app/Factories/EntityEvents/SummitEventUpdatedEntityEventFactory.php deleted file mode 100644 index 8cdcaa16..00000000 --- a/app/Factories/EntityEvents/SummitEventUpdatedEntityEventFactory.php +++ /dev/null @@ -1,57 +0,0 @@ -getArgs(); - if(!$args instanceof PreUpdateEventArgs) return; - - $resource_server_context = App::make(\models\oauth2\IResourceServerContext::class); - $owner = $resource_server_context->getCurrentUser(false); - $entity_event = new SummitEntityEvent(); - $entity_event->setEntityClassName($event->getSummitEvent()->getClassName()); - $entity_event->setEntityId($event->getSummitEvent()->getId()); - $entity_event->setType('UPDATE'); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($event->getSummitEvent()->getSummit()); - - // check if there was a change on publishing state - if($args->hasChangedField('published')){ - $pub_old = intval($args->getOldValue('published')); - $pub_new = intval($args->getNewValue('published')); - $metadata = json_encode([ 'pub_old'=> $pub_old, 'pub_new' => $pub_new]); - } - else - $metadata = json_encode([ 'pub_new' => intval($event->getSummitEvent()->getPublished())]); - - $entity_event->setMetadata($metadata); - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/SummitTicketTypeActionEntityEventFactory.php b/app/Factories/EntityEvents/SummitTicketTypeActionEntityEventFactory.php deleted file mode 100644 index b3b5dea0..00000000 --- a/app/Factories/EntityEvents/SummitTicketTypeActionEntityEventFactory.php +++ /dev/null @@ -1,52 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName('SummitTicketType'); - $entity_event->setEntityId($event->getTicketTypeId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata(''); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/TrackActionEntityEventFactory.php b/app/Factories/EntityEvents/TrackActionEntityEventFactory.php deleted file mode 100644 index 90a34c3b..00000000 --- a/app/Factories/EntityEvents/TrackActionEntityEventFactory.php +++ /dev/null @@ -1,54 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName('PresentationCategory'); - $entity_event->setEntityId($event->getTrackId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata(''); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/EntityEvents/TrackGroupActionActionEntityEventFactory.php b/app/Factories/EntityEvents/TrackGroupActionActionEntityEventFactory.php deleted file mode 100644 index ce262fbe..00000000 --- a/app/Factories/EntityEvents/TrackGroupActionActionEntityEventFactory.php +++ /dev/null @@ -1,52 +0,0 @@ -getById($event->getSummitId()); - $owner = $resource_server_context->getCurrentUser(false); - - $entity_event = new SummitEntityEvent; - $entity_event->setEntityClassName($event->getClassName()); - $entity_event->setEntityId($event->getTrackGroupId()); - $entity_event->setType($type); - - if (!is_null($owner)) { - $entity_event->setOwner($owner); - } - - $entity_event->setSummit($summit); - $entity_event->setMetadata(''); - - return $entity_event; - } -} \ No newline at end of file diff --git a/app/Factories/FactoriesProvider.php b/app/Factories/FactoriesProvider.php deleted file mode 100644 index b95108ce..00000000 --- a/app/Factories/FactoriesProvider.php +++ /dev/null @@ -1,32 +0,0 @@ - $name){ - $countries[] = [ - 'iso_code' => $iso_code, - 'name' => $name, - ]; - } - - $response = new PagingResponse - ( - count($countries), - count($countries), - 1, - 1, - $countries - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/LanguagesApiController.php b/app/Http/Controllers/Apis/LanguagesApiController.php deleted file mode 100644 index b63b7801..00000000 --- a/app/Http/Controllers/Apis/LanguagesApiController.php +++ /dev/null @@ -1,71 +0,0 @@ -language_repository = $language_repository; - } - - /** - * @return mixed - */ - public function getAll(){ - try { - $languages = $this->language_repository->getAll(); - $response = new PagingResponse - ( - count($languages), - count($languages), - 1, - 1, - $languages - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Marketplace/AbstractCompanyServiceApiController.php b/app/Http/Controllers/Apis/Marketplace/AbstractCompanyServiceApiController.php deleted file mode 100644 index ac686985..00000000 --- a/app/Http/Controllers/Apis/Marketplace/AbstractCompanyServiceApiController.php +++ /dev/null @@ -1,127 +0,0 @@ -repository = $repository; - } - - /** - * @return mixed - */ - public function getAll(){ - $values = Input::all(); - - $rules = array - ( - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ); - - try { - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = 5; - - 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'), array - ( - 'name' => ['=@', '=='], - 'company' => ['=@', '=='], - )); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), array - ( - 'name', - 'company', - 'id', - )); - } - - if(is_null($filter)) $filter = new Filter(); - - $data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations - ) - ); - } - 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); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Marketplace/AppliancesApiController.php b/app/Http/Controllers/Apis/Marketplace/AppliancesApiController.php deleted file mode 100644 index 54397a79..00000000 --- a/app/Http/Controllers/Apis/Marketplace/AppliancesApiController.php +++ /dev/null @@ -1,45 +0,0 @@ - 'sometimes|string', - 'url' => 'nullable|url', - 'display_on_site' => 'nullable|boolean', - 'featured' => 'nullable|boolean', - 'city' => 'nullable|string', - 'state' => 'nullable|string', - 'country' => 'nullable|string', - 'description' => 'nullable|string', - 'industry' => 'nullable|string', - 'products' => 'nullable|string', - 'contributions' => 'nullable|string', - 'contact_email' => 'nullable|email', - 'member_level' => 'nullable|string', - 'admin_email' => 'nullable|email', - 'color' => 'nullable|hex_color', - 'overview' => 'nullable|string', - 'commitment' => 'nullable|string', - 'commitment_author' => 'nullable|string', - ]; - } - - return [ - 'name' => 'required|string', - 'url' => 'nullable|url', - 'display_on_site' => 'nullable|boolean', - 'featured' => 'nullable|boolean', - 'city' => 'nullable|string', - 'state' => 'nullable|string', - 'country' => 'nullable|string', - 'description' => 'nullable|string', - 'industry' => 'nullable|string', - 'products' => 'nullable|string', - 'contributions' => 'nullable|string', - 'contact_email' => 'nullable|email', - 'member_level' => 'nullable|string', - 'admin_email' => 'nullable|email', - 'color' => 'nullable|hex_color', - 'overview' => 'nullable|string', - 'commitment' => 'nullable|string', - 'commitment_author' => 'nullable|string', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/Factories/ProjectSponsorshipTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Main/Factories/ProjectSponsorshipTypeValidationRulesFactory.php deleted file mode 100644 index ca6546cd..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/Factories/ProjectSponsorshipTypeValidationRulesFactory.php +++ /dev/null @@ -1,44 +0,0 @@ - 'sometimes|string', - 'description' => 'sometimes|string', - 'is_active' => 'sometimes|boolean', - 'order' => 'sometimes|integer|min:1', - ]; - } - return [ - 'name' => 'required|string', - 'description' => 'sometimes|string', - 'is_active' => 'sometimes|boolean', - 'order' => 'sometimes|integer|min:1', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/Factories/SponsoredProjectValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Main/Factories/SponsoredProjectValidationRulesFactory.php deleted file mode 100644 index 8e28b4b6..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/Factories/SponsoredProjectValidationRulesFactory.php +++ /dev/null @@ -1,41 +0,0 @@ - 'sometimes|string', - 'description' => 'sometimes|string', - 'is_active' => 'sometimes|boolean', - ]; - } - return [ - 'name' => 'required|string', - 'description' => 'sometimes|string', - 'is_active' => 'sometimes|boolean', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2ChunkedFilesApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2ChunkedFilesApiController.php deleted file mode 100644 index 2bb2772c..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2ChunkedFilesApiController.php +++ /dev/null @@ -1,57 +0,0 @@ -isUploaded() === false) { - throw new UploadMissingFileException(); - } - // receive the file - $save = $receiver->receive(); - - // check if the upload has finished (in chunk mode it will send smaller files) - if ($save->isFinished()) { - // save the file and return any response you need - return $this->saveFile($save->getFile()); - } - - // we are in chunk mode, lets send the current progress - /** @var AbstractHandler $handler */ - $handler = $save->handler(); - $done = $handler->getPercentageDone(); - return response()->json([ - "done" => $done - ]); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2CompaniesApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2CompaniesApiController.php deleted file mode 100644 index 3f6f5144..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2CompaniesApiController.php +++ /dev/null @@ -1,266 +0,0 @@ -repository = $company_repository; - $this->service = $service; - } - - /** - * @return mixed - */ - public function getAllCompanies(){ - - return $this->_getAll( - function(){ - return [ - 'name' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'name' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'name', - 'id', - ]; - }, - function($filter){ - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - } - ); - } - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return CompanyValidationRulesFactory::build($payload); - } - - /** - * @param array $payload - * @return IEntity - * @throws ValidationException - */ - protected function addEntity(array $payload): IEntity - { - return $this->service->addCompany($payload); - } - - /** - * @inheritDoc - */ - protected function deleteEntity(int $id): void - { - $this->service->deleteCompany($id); - } - - /** - * @inheritDoc - */ - protected function getEntity(int $id): IEntity - { - return $this->repository->getById($id); - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return CompanyValidationRulesFactory::build($payload, true); - } - - /** - * @inheritDoc - */ - protected function updateEntity($id, array $payload): IEntity - { - return $this->service->updateCompany($id, $payload); - } - - // Logos - - /** - * @param LaravelRequest $request - * @param $speaker_id - * @return mixed - */ - public function addCompanyLogo(LaravelRequest $request, $company_id) - { - try { - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $logo = $this->service->addCompanyLogo($company_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($logo)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $company_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteCompanyLogo($company_id){ - try { - - $this->service->deleteCompanyLogo($company_id); - - return $this->deleted(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $speaker_id - * @return mixed - */ - public function addCompanyBigLogo(LaravelRequest $request, $company_id) - { - try { - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $logo = $this->service->addCompanyBigLogo($company_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($logo)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $company_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteCompanyBigLogo($company_id){ - try { - - $this->service->deleteCompanyBigLogo($company_id); - - return $this->deleted(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2GroupsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2GroupsApiController.php deleted file mode 100644 index 859c6c67..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2GroupsApiController.php +++ /dev/null @@ -1,134 +0,0 @@ -repository = $group_repository; - } - - public function getAll(){ - - $values = Input::all(); - - $rules = array - ( - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ); - - try { - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = 5; - - 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'), array - ( - 'code' => ['=@', '=='], - 'title' => ['=@', '=='], - )); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), array - ( - 'code', - 'title', - 'id', - )); - } - - if(is_null($filter)) $filter = new Filter(); - - $data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations - ) - ); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2LegalDocumentsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2LegalDocumentsApiController.php deleted file mode 100644 index 40eaa150..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2LegalDocumentsApiController.php +++ /dev/null @@ -1,74 +0,0 @@ -repository = $repository; - } - - /** - * @param $id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getById($id){ - try{ - - $document = $this->repository->getBySlug(trim($id)); - if(is_null($document)) - $document = $this->repository->getById(intval($id)); - - if(is_null($document)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer - ( - $document - )->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2MembersApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2MembersApiController.php deleted file mode 100644 index a4bc4862..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2MembersApiController.php +++ /dev/null @@ -1,556 +0,0 @@ -repository = $member_repository; - $this->member_service = $member_service; - } - - /** - * @return mixed - */ - public function getAll(){ - - $values = Input::all(); - - $rules = [ - 'page' => 'integer|min:1', - 'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::MinPageSize, PagingConstants::MaxPageSize), - ]; - - try { - - $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'), [ - - 'irc' => ['=@', '=='], - 'twitter' => ['=@', '=='], - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'group_slug' => ['=@', '=='], - 'group_id' => ['=='], - 'email_verified' => ['=='], - 'active' => ['=='], - 'github_user' => ['=@', '=='], - 'full_name' => ['=@', '=='], - 'created' => ['>', '<', '<=', '>=', '=='], - 'last_edited' => ['>', '<', '<=', '>=', '=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'irc' => 'sometimes|required|string', - 'twitter' => 'sometimes|required|string', - 'first_name' => 'sometimes|required|string', - 'last_name' => 'sometimes|required|string', - 'email' => 'sometimes|required|string', - 'group_slug' => 'sometimes|required|string', - 'group_id' => 'sometimes|required|integer', - 'email_verified' => 'sometimes|required|boolean', - 'active' => 'sometimes|required|boolean', - 'github_user' => 'sometimes|required|string', - 'full_name' => 'sometimes|required|string', - 'created' => 'sometimes|required|date_format:U', - 'last_edited' => 'sometimes|required|date_format:U', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'first_name', - 'last_name', - 'id', - 'created', - 'last_edited', - ]); - } - - $data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - $current_member = $this->resource_server_context->getCurrentUser(); - $serializer_type = SerializerRegistry::SerializerType_Public; - if(!is_null($current_member) && $current_member->isAdmin()){ - $serializer_type = SerializerRegistry::SerializerType_Admin; - } - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations, - [], - $serializer_type - ) - ); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function getMyMember(){ - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error404(); - - $fields = Request::input('fields', null); - $relations = Request::input('relations', null); - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($current_member, SerializerRegistry::SerializerType_Private) - ->serialize - ( - Request::input('expand', ''), - is_null($fields) ? [] : explode(',', $fields), - is_null($relations) ? [] : explode(',', $relations) - ) - ); - } - - - /** - * @return mixed - */ - public function getMyMemberAffiliations(){ - return $this->getMemberAffiliations('me'); - } - - /** - * @param $member_id - * @return mixed - */ - public function getMemberAffiliations($member_id){ - try { - - $member = (strtolower($member_id) == 'me') ? - $this->resource_server_context->getCurrentUser() : - $this->repository->getById($member_id); - - if(is_null($member)) return $this->error404(); - $affiliations = $member->getAffiliations()->toArray(); - - $response = new PagingResponse - ( - count($affiliations), - count($affiliations), - 1, - 1, - $affiliations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function addMyAffiliation(){ - return $this->addAffiliation('me'); - } - - /** - * @param $member_id - * @return mixed - */ - public function addAffiliation($member_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $member = (strtolower($member_id) == 'me') ? - $this->resource_server_context->getCurrentUser() : - $this->repository->getById($member_id); - - if(is_null($member)) return $this->error404(); - - $rules = [ - 'is_current' => 'required|boolean', - 'start_date' => 'required|date_format:U|valid_epoch', - 'end_date' => 'sometimes|after_or_null_epoch:start_date', - 'organization_id' => 'sometimes|integer|required_without:organization_name', - 'organization_name' => 'sometimes|string|max:255|required_without:organization_id', - 'job_title' => 'sometimes|string|max:255' - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $affiliation = $this->member_service->addAffiliation($member, $data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($affiliation)->serialize - ( - Input::get('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 (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $affiliation_id - * @return mixed - */ - public function updateMyAffiliation($affiliation_id){ - return $this->updateAffiliation('me', $affiliation_id); - } - - /** - * @param int $member_id - * @param int $affiliation_id - * @return mixed - */ - public function updateAffiliation($member_id, $affiliation_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $member = (strtolower($member_id) == 'me') ? - $this->resource_server_context->getCurrentUser() : - $this->repository->getById($member_id); - - if(is_null($member)) return $this->error404(); - - $rules = [ - 'is_current' => 'sometimes|boolean', - 'start_date' => 'sometimes|date_format:U|valid_epoch', - 'end_date' => 'sometimes|after_or_null_epoch:start_date', - 'organization_id' => 'sometimes|integer', - 'organization_name' => 'sometimes|string|max:255', - 'job_title' => 'sometimes|string|max:255' - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $affiliation = $this->member_service->updateAffiliation($member, $affiliation_id, $data->all()); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($affiliation)->serialize( - Input::get('expand','') - )); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - public function deleteMyAffiliation($affiliation_id){ - return $this->deleteAffiliation('me', $affiliation_id); - } - - /** - * @param $member_id - * @param $affiliation_id - * @return mixed - */ - public function deleteAffiliation($member_id, $affiliation_id){ - try{ - - $member = (strtolower($member_id) == 'me') ? - $this->resource_server_context->getCurrentUser() : - $this->repository->getById($member_id); - - if(is_null($member)) return $this->error404(); - - $this->member_service->deleteAffiliation($member, $affiliation_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $member_id - * @param $rsvp_id - * @return mixed - */ - public function deleteRSVP($member_id, $rsvp_id){ - try{ - - $member = $this->repository->getById($member_id); - if(is_null($member)) return $this->error404(); - - $this->member_service->deleteRSVP($member, $rsvp_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $member_id - * @return mixed - */ - public function signFoundationMembership(){ - try{ - - $member = $this->resource_server_context->getCurrentUser(); - - if(is_null($member)) return $this->error404(); - - $member = $this->member_service->signFoundationMembership($member); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer - ( - $member, - SerializerRegistry::SerializerType_Private - )->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $member_id - * @return mixed - */ - public function signCommunityMembership(){ - try{ - - $member = $this->resource_server_context->getCurrentUser(); - - if(is_null($member)) return $this->error404(); - - $member = $this->member_service->signCommunityMembership($member); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer - ( - $member, - SerializerRegistry::SerializerType_Private - )->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $member_id - * @return mixed - */ - public function resignMembership(){ - try{ - - $member = $this->resource_server_context->getCurrentUser(); - - if(is_null($member)) return $this->error404(); - - $this->member_service->resignMembership($member); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php deleted file mode 100644 index 1fbffcd0..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2OrganizationsApiController.php +++ /dev/null @@ -1,184 +0,0 @@ -repository = $company_repository; - $this->service = $service; - } - - public function getAll(){ - - $values = Input::all(); - - $rules = [ - - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ]; - - try { - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = 5; - - 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'), [ - - 'name' => ['=@', '=='], - ]); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'name', - 'id', - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations - ) - ); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - public function addOrganization(){ - try { - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = [ - 'name' => 'required|string|max:255', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $organization = $this->service->addOrganization($data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($organization)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2SponsoredProjectApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2SponsoredProjectApiController.php deleted file mode 100644 index 53573080..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2SponsoredProjectApiController.php +++ /dev/null @@ -1,426 +0,0 @@ -repository = $company_repository; - $this->project_sponsorship_type_repository = $project_sponsorship_type_repository; - $this->supporting_company_repository = $supporting_company_repository; - $this->service = $service; - } - - /** - * @inheritDoc - */ - function getAddValidationRules(array $payload): array - { - return SponsoredProjectValidationRulesFactory::build($payload); - } - - /** - * @inheritDoc - */ - protected function addEntity(array $payload): IEntity - { - return $this->service->add(HTMLCleaner::cleanData($payload, ['description'])); - } - - /** - * @inheritDoc - */ - protected function deleteEntity(int $id): void - { - $this->service->delete($id); - } - - /** - * @inheritDoc - */ - protected function getEntity(int $id): IEntity - { - return $this->repository->getById($id); - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return SponsoredProjectValidationRulesFactory::build($payload, true); - } - - /** - * @inheritDoc - */ - protected function updateEntity($id, array $payload): IEntity - { - return $this->service->update($id, HTMLCleaner::cleanData($payload, ['description'])); - } - - /** - * @return mixed - */ - public function getAll() - { - return $this->_getAll( - function () { - return [ - 'name' => ['=@', '=='], - 'slug' => ['=@', '=='], - 'is_active' => ['=='] - ]; - }, - function () { - return [ - 'is_active' => 'sometimes|boolean', - 'name' => 'sometimes|string', - 'slug' => 'sometimes|string', - ]; - }, - function () { - return [ - 'name', - 'id', - ]; - }, - function ($filter) { - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - } - ); - } - - // sponsorship types - - /** - * @param $id string|int - */ - public function getAllSponsorshipTypes($id) - { - return $this->_getAll( - function () { - return [ - 'name' => ['=@', '=='], - 'slug' => ['=@', '=='], - 'is_active' => ['=='] - ]; - }, - function () { - return [ - 'is_active' => 'sometimes|boolean', - 'name' => 'sometimes|string', - 'slug' => 'sometimes|string', - ]; - }, - function () { - return [ - 'name', - 'id', - 'order' - ]; - }, - function ($filter) use($id) { - if($filter instanceof Filter){ - if(is_numeric($id)) - $filter->addFilterCondition(FilterElement::makeEqual('sponsored_project_id', intval($id))); - else - $filter->addFilterCondition(FilterElement::makeEqual('sponsored_project_slug', $id)); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) { - return $this->project_sponsorship_type_repository->getAllByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } - - /** - * @param $id - * @param $sponsorship_type_id - */ - public function getSponsorshipType($id, $sponsorship_type_id){ - Log::debug(sprintf("OAuth2SponsoredProjectApiController::getSponsorshipType id %s sponsorship_type_id %s", $id, $sponsorship_type_id)); - return $this->_get($sponsorship_type_id, function($id){ - return $this->project_sponsorship_type_repository->getById(intval($id)); - }); - } - - /** - * @param $id - * @return mixed - */ - public function addSponsorshipType($id) - { - $args = [intval($id)]; - return $this->_add( - function ($payload) { - return ProjectSponsorshipTypeValidationRulesFactory::build($payload); - }, - function ($payload, $id){ - return $this->service->addProjectSponsorshipType($id, HTMLCleaner::cleanData($payload, ['description'])); - }, - ...$args - ); - } - - /** - * @param $id - * @param $sponsorship_type_id - * @return mixed - */ - public function updateSponsorshipType($id, $sponsorship_type_id){ - $args = [ intval($id) ]; - return $this->_update( - $sponsorship_type_id, - function($payload){ - return ProjectSponsorshipTypeValidationRulesFactory::build($payload, true); - }, - function($sponsorship_type_id, $payload, $project_id){ - return $this->service->updateProjectSponsorshipType($project_id, $sponsorship_type_id, HTMLCleaner::cleanData($payload, ['description'])); - }, - ...$args - ); - } - - /** - * @param $id - * @param $sponsorship_type_id - * @return mixed - */ - public function deleteSponsorshipType($id, $sponsorship_type_id){ - $args = [ intval($id) ]; - - return $this->_delete( - $sponsorship_type_id, - function ($sponsorship_type_id, $project_id){ - $this->service->deleteProjectSponsorshipType($project_id, $sponsorship_type_id); - }, - ...$args - ); - } - - // supporting companies - - public function getSupportingCompanies($id, $sponsorship_type_id){ - return $this->_getAll( - function () { - return [ - 'name' => ['=@', '=='], - ]; - }, - function () { - return [ - 'name' => 'sometimes|string', - ]; - }, - function () { - return [ - 'name', - 'order', - ]; - }, - function ($filter) use($id, $sponsorship_type_id) { - if($filter instanceof Filter){ - if(is_numeric($id)) - $filter->addFilterCondition(FilterElement::makeEqual('sponsored_project_id', intval($id))); - else - $filter->addFilterCondition(FilterElement::makeEqual('sponsored_project_slug', $id)); - - if(is_numeric($sponsorship_type_id)) - $filter->addFilterCondition(FilterElement::makeEqual('sponsorship_type_id', intval($sponsorship_type_id))); - else - $filter->addFilterCondition(FilterElement::makeEqual('sponsorship_type_slug', $sponsorship_type_id)); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) { - return $this->supporting_company_repository->getAllByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } - - - /** - * @param $id - * @param $sponsorship_type_id - * @return mixed - */ - public function addSupportingCompanies($id, $sponsorship_type_id){ - return $this->_add( - function($payload){ - return [ - 'company_id' => 'required|integer', - 'order' => 'sometimes|integer|min:1', - ]; - }, - function($payload, $project_id, $sponsorship_type_id){ - return $this->service->addCompanyToProjectSponsorshipType - ( - $project_id, - $sponsorship_type_id, - $payload - ); - }, - $id, - $sponsorship_type_id - ); - } - - /** - * @param $id - * @param $sponsorship_type_id - * @param $company_id - * @return mixed - */ - public function updateSupportingCompanies($id, $sponsorship_type_id, $company_id){ - return $this->_update($company_id, - function($payload){ - return [ - 'order' => 'sometimes|integer|min:1', - ]; - }, - function($id, $payload, $project_id, $sponsorship_type_id){ - return $this->service->updateCompanyToProjectSponsorshipType - ( - $project_id, - $sponsorship_type_id, - $id, - $payload - ); - }, - $id, - $sponsorship_type_id - ); - } - - /** - * @param $id - * @param $sponsorship_type_id - * @param $company_id - * @return mixed - */ - public function deleteSupportingCompanies($id, $sponsorship_type_id, $company_id){ - return $this->_delete($company_id, function($id, $project_id, $sponsorship_type_id){ - $this->service->removeCompanyToProjectSponsorshipType($project_id, $sponsorship_type_id, $id); - }, $id, $sponsorship_type_id); - } - - /** - * @param $id - * @param $sponsorship_type_id - * @param $company_id - * @return mixed - */ - public function getSupportingCompany($id, $sponsorship_type_id, $company_id){ - return $this->_get($sponsorship_type_id, function($id, $company_id){ - $sponsorship_type = $this->project_sponsorship_type_repository->getById(intval($id)); - if(is_null($sponsorship_type)) - throw new EntityNotFoundException(); - return $sponsorship_type->getSupportingCompanyById(intval($company_id)); - }, $company_id); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2SponsoredProjectsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2SponsoredProjectsApiController.php deleted file mode 100644 index 5f9414dd..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2SponsoredProjectsApiController.php +++ /dev/null @@ -1,23 +0,0 @@ -service = $service; - $this->repository = $repository; - } - - use ParametrizedGetAll; - - use AddEntity; - - use DeleteEntity; - - use UpdateEntity; - - use GetEntity; - - function getAll() - { - return $this->_getAll( - function () { - return [ - 'title' => ['=@', '=='], - 'member_first_name' => ['=@', '=='], - 'member_last_name' => ['=@', '=='], - 'member_full_name' => ['=@', '=='], - 'member_email' => ['=@', '=='], - 'summit_id' => ['=='], - 'member_id' => ['=='], - ]; - }, - function () { - return [ - 'title' => 'sometimes|string', - 'member_first_name' => 'sometimes|string', - 'member_last_name' => 'sometimes|string', - 'member_full_name' => 'sometimes|string', - 'member_email' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'member_id' => 'sometimes|integer', - ]; - }, - function () { - return [ - 'id', - 'title', - ]; - }, - function ($filter) { - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - } - ); - } - - /** - * @inheritDoc - */ - function getAddValidationRules(array $payload): array - { - return [ - 'title' => 'required|string', - 'summits' => 'required|int_array', - 'members' => 'required|int_array', - ]; - } - - /** - * @inheritDoc - */ - protected function addEntity(array $payload): IEntity - { - return $this->service->create($payload); - } - - /** - * @inheritDoc - */ - protected function deleteEntity(int $id): void - { - $this->service->delete($id); - } - - /** - * @inheritDoc - */ - protected function getEntity(int $id): IEntity - { - return $this->repository->getById($id); - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return [ - 'title' => 'sometimes|string', - 'summits' => 'sometimes|int_array', - 'members' => 'sometimes|int_array', - ]; - } - - /** - * @inheritDoc - */ - protected function updateEntity($id, array $payload): IEntity - { - return $this->service->update($id, $payload); - } - - public function addMember($id, $member_id) - { - try { - $group = $this->repository->getById($id); - if (is_null($group)) - throw new EntityNotFoundException(); - $group = $this->service->addMemberTo($group, $member_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($group)->serialize()); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function removeMember($id, $member_id) - { - try { - $group = $this->repository->getById($id); - if (is_null($group)) - throw new EntityNotFoundException(); - $group = $this->service->removeMemberFrom($group, $member_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($group)->serialize()); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function addSummit($id, $summit_id) - { - try { - $group = $this->repository->getById($id); - if (is_null($group)) - throw new EntityNotFoundException(); - $group = $this->service->addSummitTo($group, $summit_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($group)->serialize()); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function removeSummit($id, $summit_id) - { - try { - $group = $this->repository->getById($id); - if (is_null($group)) - throw new EntityNotFoundException(); - $group = $this->service->removeSummitFrom($group, $summit_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($group)->serialize()); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2TagsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2TagsApiController.php deleted file mode 100644 index 9d51553c..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2TagsApiController.php +++ /dev/null @@ -1,184 +0,0 @@ -repository = $tag_repository; - $this->tag_service = $tag_service; - } - - public function getAll(){ - - $values = Input::all(); - - $rules = [ - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ]; - - try { - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = 5; - - 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'), [ - - 'tag' => ['=@', '=='], - ]); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'tag', - 'id', - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations - ) - ); - } - - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function addTag(){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $rules = [ - 'tag' => 'required|string', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $tag = $this->tag_service->addTag($data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($tag)->serialize - ( - Input::get('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 (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2TeamInvitationsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2TeamInvitationsApiController.php deleted file mode 100644 index 348daff8..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2TeamInvitationsApiController.php +++ /dev/null @@ -1,215 +0,0 @@ -repository = $repository; - $this->service = $service; - } - - /** - * @return mixed - */ - public function getMyInvitations(){ - - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $invitations = $this->repository->getInvitationsByInvitee($current_member->getId()); - - $response = new PagingResponse - ( - count($invitations), - count($invitations), - 1, - 1, - $invitations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function getMyPendingInvitations(){ - - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $invitations = $this->repository->getPendingInvitationsByInvitee($current_member->getId()); - - $response = new PagingResponse - ( - count($invitations), - count($invitations), - 1, - 1, - $invitations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function getMyAcceptedInvitations(){ - - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $invitations = $this->repository->getAcceptedInvitationsByInvitee($current_member->getId()); - - $response = new PagingResponse - ( - count($invitations), - count($invitations), - 1, - 1, - $invitations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $invitation_id - * @return mixed - */ - public function acceptInvitation($invitation_id){ - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $team_member = $this->service->acceptInvitation($invitation_id, $current_member->getId()); - return $this->created(SerializerRegistry::getInstance()->getSerializer($team_member)->serialize($expand = '')); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $invitation_id - * @return mixed - */ - public function declineInvitation($invitation_id){ - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $this->service->declineInvitation($invitation_id, $current_member->getId()); - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/OAuth2TeamsApiController.php b/app/Http/Controllers/Apis/Protected/Main/OAuth2TeamsApiController.php deleted file mode 100644 index a612e283..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/OAuth2TeamsApiController.php +++ /dev/null @@ -1,548 +0,0 @@ -service = $service; - $this->repository = $repository; - $this->message_repository = $message_repository; - $this->member_repository = $member_repository; - } - - /** - * @return mixed - */ - public function getMyTeams(){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $teams = $this->repository->getTeamsByMember($current_member); - - $response = new PagingResponse - ( - count($teams), - count($teams), - 1, - 1, - $teams - ); - - return $this->ok - ( - $response->toArray - ( - $expand = Input::get('expand',''), - $fields = [], - $relations = [], - $params = [ - 'current_member' => $current_member - ] - ) - ); - - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $team_id - * @return mixed - */ - public function getMyTeam($team_id){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $team = $this->repository->getById($team_id); - - if(is_null($team)) throw new EntityNotFoundException(); - - if(!$team->isMember($current_member)) - throw new EntityNotFoundException(); - - return $this->ok - ( - SerializerRegistry::getInstance() - ->getSerializer($team) - ->serialize - ( - $expand = Input::get('expand',''), - $fields = [], - $relations = [], - $params = [ - 'current_member' => $current_member - ] - ) - ); - - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function addTeam(){ - try { - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = array - ( - 'name' => 'required|string|max:255', - 'description' => 'required|sometimes|string|max:512', - ); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = array - ( - 'name', - 'description', - ); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $team = $this->service->addTeam(HTMLCleaner::cleanData($data->all(), $fields), $current_member); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($team)->serialize($expand = 'owner,members,member')); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $team_id - * @return mixed - */ - public function deleteTeam($team_id){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->service->deleteTeam($team_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $team_id - * @return mixed - */ - public function updateTeam($team_id){ - try { - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = array - ( - 'name' => 'required|string|max:255', - 'description' => 'string|max:512', - ); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = array - ( - 'name', - 'description', - ); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $team = $this->service->updateTeam(HTMLCleaner::cleanData($data->all(), $fields), $team_id); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($team)->serialize($expand = 'owner,members,member')); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - - } - - /** - * @param $team_id - * @return mixed - */ - public function getMyTeamMessages($team_id){ - - $values = Input::all(); - - $rules = array - ( - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ); - - try { - - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = 5; - - 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'), array - ( - 'owner_id' => ['=='], - 'sent_date' => ['>', '<', '<=', '>=', '=='], - )); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), array - ( - 'sent_date', - 'id', - )); - } - - if(is_null($filter)) $filter = new Filter(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $team = $this->repository->getById($team_id); - - if(is_null($team)) throw new EntityNotFoundException(); - - if(!$team->isMember($current_member)) - throw new EntityNotFoundException(); - - $data = $this->message_repository->getAllSentByTeamPaginated - ( - $team_id, - new PagingInfo($page, $per_page), - $filter, - $order - ); - - return $this->ok($data->toArray(Request::input('expand', ''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $team_id - * @return mixed - */ - public function postTeamMessage($team_id){ - try { - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = array - ( - 'body' => 'required|string', - 'priority' => 'required|sometimes|string|chat_message_priority', - ); - - $values = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - if(!isset($values['priority'])) - $values['priority'] = PushNotificationMessagePriority::Normal; - - $message = $this->service->postMessage($team_id, $values); - return $this->created(SerializerRegistry::getInstance()->getSerializer($message)->serialize($expand = 'team,owner')); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $team_id - * @param $member_id - * @return mixed - */ - public function addMember2MyTeam($team_id, $member_id){ - try { - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = array - ( - 'permission' => 'required|string|team_permission', - ); - - $values = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $invitation = $this->service->addMember2Team($team_id, $member_id, $values['permission']); - return $this->created(SerializerRegistry::getInstance()->getSerializer($invitation)->serialize($expand = 'team,inviter,invitee')); - - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $team_id - * @param $member_id - * @return mixed - */ - public function removedMemberFromMyTeam($team_id, $member_id){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->service->removeMemberFromTeam($team_id, $member_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Main/UploadController.php b/app/Http/Controllers/Apis/Protected/Main/UploadController.php deleted file mode 100644 index aa512952..00000000 --- a/app/Http/Controllers/Apis/Protected/Main/UploadController.php +++ /dev/null @@ -1,115 +0,0 @@ -isUploaded() === false) { - throw new UploadMissingFileException(); - } - - // receive the file - $save = $receiver->receive(); - - // check if the upload has finished (in chunk mode it will send smaller files) - if ($save->isFinished()) { - // save the file and return any response you need, current example uses `move` function. If you are - // not using move, you need to manually delete the file by unlink($save->getFile()->getPathname()) - return $this->saveFile($save->getFile()); - } - - // we are in chunk mode, lets send the current progress - /** @var AbstractHandler $handler */ - $handler = $save->handler(); - - return response()->json([ - "done" => $handler->getPercentageDone(), - 'status' => true - ]); - } - - /** - * Saves the file - * - * @param UploadedFile $file - * - * @return JsonResponse - */ - protected function saveFile(UploadedFile $file) - { - $fileName = $this->createFilename($file); - // Group files by mime type - $mime = str_replace('/', '-', $file->getMimeType()); - // Group files by the date (week - $dateFolder = date("Y-m-W"); - - // Build the file path - $filePath = "upload/{$mime}/{$dateFolder}/"; - - $disk = Storage::disk('local'); - - $disk->putFileAs($filePath, $file, $fileName); - - unlink($file->getPathname()); - - return response()->json([ - 'path' => $filePath, - 'name' => $fileName, - 'mime_type' => $mime - ]); - } - - /** - * Create unique filename for uploaded file - * @param UploadedFile $file - * @return string - */ - protected function createFilename(UploadedFile $file) - { - $extension = $file->getClientOriginalExtension(); - $filename = str_replace(".".$extension, "", $file->getClientOriginalName()); // Filename without extension - - // Add timestamp hash to name of the file - $filename .= "_" . md5(time()) . "." . $extension; - - return $filename; - } -} diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/CheckAttendeeStrategyFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/CheckAttendeeStrategyFactory.php deleted file mode 100644 index 2b33c540..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/CheckAttendeeStrategyFactory.php +++ /dev/null @@ -1,49 +0,0 @@ - $name_rule, - 'color' => 'sometimes|hex_color', - 'black_out_times' => 'sometimes|boolean', - 'use_sponsors' => 'sometimes|boolean', - 'are_sponsors_mandatory' => 'sometimes|boolean|required_with:use_sponsors', - 'allows_attachment' => 'sometimes|boolean', - 'allows_level' => 'sometimes|boolean', - 'is_private' => 'sometimes|boolean', - 'is_default' => 'sometimes|boolean', - ]; - - $specific_rules = []; - - switch ($class_name){ - case PresentationType::ClassName: - { - $specific_rules = [ - 'use_speakers' => 'sometimes|boolean', - 'are_speakers_mandatory' => 'sometimes|boolean|required_with:use_speakers', - 'min_speakers' => 'sometimes|integer|required_with:use_speakers', - 'max_speakers' => 'sometimes|integer|required_with:use_speakers|greater_than_field:min_speakers', - 'use_moderator' => 'sometimes|boolean', - 'is_moderator_mandatory' => 'sometimes|boolean|required_with:use_moderator', - 'min_moderators' => 'sometimes|integer|required_with:use_moderator', - 'max_moderators' => 'sometimes|integer|required_with:use_moderator|greater_than_field:min_moderators', - 'should_be_available_on_cfp' => 'sometimes|boolean', - 'moderator_label' => 'sometimes|string' - ]; - } - break; - - } - return array_merge($base_rules, $specific_rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/ExtraQuestionTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/ExtraQuestionTypeValidationRulesFactory.php deleted file mode 100644 index 12435f15..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/ExtraQuestionTypeValidationRulesFactory.php +++ /dev/null @@ -1,49 +0,0 @@ - 'sometimes|string', - 'type' => 'sometimes|string|in:'.implode(",", ExtraQuestionTypeConstants::ValidQuestionTypes), - 'label' => 'sometimes|string', - 'mandatory' => 'sometimes|boolean', - 'placeholder' => 'sometimes|nullable|string', - 'order' => 'sometimes|integer|min:1', - ]; - } - - return [ - 'name' => 'required|string', - 'type' => 'required|string|in:'.implode(",", ExtraQuestionTypeConstants::ValidQuestionTypes), - 'label' => 'required|string', - 'mandatory' => 'required|boolean', - 'placeholder' => 'sometimes|nullable|string', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/ExtraQuestionTypeValueValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/ExtraQuestionTypeValueValidationRulesFactory.php deleted file mode 100644 index 8153b039..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/ExtraQuestionTypeValueValidationRulesFactory.php +++ /dev/null @@ -1,42 +0,0 @@ - 'sometimes|string', - 'value' => 'sometimes|string|max:255', - 'order' => 'sometimes|integer|min:1' - ]; - } - - return [ - 'label' => 'sometimes|string', - 'value' => 'required|string|max:255', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/PaymentGatewayProfileValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/PaymentGatewayProfileValidationRulesFactory.php deleted file mode 100644 index bc114cd4..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/PaymentGatewayProfileValidationRulesFactory.php +++ /dev/null @@ -1,69 +0,0 @@ - 'sometimes|boolean', - 'application_type' => 'sometimes|string|in:'.implode(',',IPaymentConstants::ValidApplicationTypes), - 'provider' => 'required|string|in:'.implode(',',IPaymentConstants::ValidProviderTypes), - ]; - if(isset($data['provider']) && $data['provider'] == IPaymentConstants::ProviderStripe){ - $rules = array_merge($rules, [ - 'test_mode_enabled' => 'required|boolean', - 'live_secret_key' => 'sometimes|string', - 'live_publishable_key' => 'required_with:live_secret_key|string', - 'test_secret_key' => 'required_with:test_mode_enabled|string', - 'test_publishable_key' => 'required_with:test_secret_key|string', - 'send_email_receipt' => 'sometimes|boolean', - ]); - } - return $rules; - } - - $rules = [ - 'active' => 'required|boolean', - 'application_type' => 'required|string|in:'.implode(',',IPaymentConstants::ValidApplicationTypes), - 'provider' => 'required|string|in:'.implode(',',IPaymentConstants::ValidProviderTypes), - ]; - - if(isset($data['provider']) && $data['provider'] == IPaymentConstants::ProviderStripe){ - $rules = array_merge($rules, [ - 'test_mode_enabled' => 'required|boolean', - 'live_secret_key' => 'sometimes|string', - 'live_publishable_key' => 'required_with:live_secret_key|string', - 'test_secret_key' => 'required_with:test_mode_enabled|string', - 'test_publishable_key' => 'required_with:test_secret_key|string', - 'send_email_receipt' => 'sometimes|boolean', - ]); - } - return $rules; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationCategoryGroupValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationCategoryGroupValidationRulesFactory.php deleted file mode 100644 index 792af56b..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationCategoryGroupValidationRulesFactory.php +++ /dev/null @@ -1,76 +0,0 @@ - 'required|string', - 'description' => 'sometimes|string', - 'color' => 'sometimes|hex_color', - ]; - - if($update){ - $base_rules = [ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'color' => 'sometimes|hex_color', - ]; - } - - $specific_rules = []; - - switch ($class_name){ - case PrivatePresentationCategoryGroup::ClassName: - { - $specific_rules = [ - 'submission_begin_date' => 'sometimes|date_format:U', - 'submission_end_date' => 'sometimes|date_format:U|required_with:submission_begin_date|after:submission_begin_date', - 'max_submission_allowed_per_user' => 'sometimes|integer|min:1', - ]; - } - break; - } - - return array_merge($base_rules, $specific_rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationLinkValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationLinkValidationRulesFactory.php deleted file mode 100644 index 20c39e35..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationLinkValidationRulesFactory.php +++ /dev/null @@ -1,35 +0,0 @@ - 'sometimes|required|url', - ]); - } - - return array_merge($former_rules, [ - 'link' => 'required|url', - ]); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationMaterialValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationMaterialValidationRulesFactory.php deleted file mode 100644 index 11c0069a..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationMaterialValidationRulesFactory.php +++ /dev/null @@ -1,41 +0,0 @@ - 'sometimes|required|string:512', - 'description' => 'sometimes|required|string', - 'display_on_site' => 'sometimes|required|boolean', - 'featured' => 'sometimes|required|boolean', - 'order' => 'sometimes|integer|min:1', - ]; - } - - return [ - 'name' => 'sometimes|required|string:512', - 'description' => 'sometimes|required|string', - 'display_on_site' => 'sometimes|required|boolean', - 'featured' => 'sometimes|required|boolean', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationSlideValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationSlideValidationRulesFactory.php deleted file mode 100644 index 3dffec41..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationSlideValidationRulesFactory.php +++ /dev/null @@ -1,37 +0,0 @@ - 'nullable|url', - ]); - } - - return array_merge($former_rules, [ - 'file' => 'required_without_all:link,filepath', - 'link' => 'required_without_all:file,filepath|url', - 'filepath' => 'required_without_all:link,file', - ]); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationVideoValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationVideoValidationRulesFactory.php deleted file mode 100644 index 937aad04..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/PresentationVideoValidationRulesFactory.php +++ /dev/null @@ -1,37 +0,0 @@ - 'required_without:external_url|alpha_dash', - 'external_url' => 'required_without:youtube_id|string:512|url', - ]); - } - - return array_merge($former_rules, [ - 'youtube_id' => 'required_without:external_url|alpha_dash', - 'external_url' => 'required_without:youtube_id|string:512|url', - ]); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/AccessLevelTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/AccessLevelTypeValidationRulesFactory.php deleted file mode 100644 index 1da084af..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/AccessLevelTypeValidationRulesFactory.php +++ /dev/null @@ -1,43 +0,0 @@ - 'sometimes|string', - 'description' => 'sometimes|string', - 'template_content' => 'sometimes|string', - 'is_default' => 'sometimes|boolean', - ]; - } - return [ - 'name' => 'required|string', - 'description' => 'sometimes|string', - 'template_content' => 'nullable|string', - 'is_default' => 'required|boolean', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/PromoCodesValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/PromoCodesValidationRulesFactory.php deleted file mode 100644 index a77721b4..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/PromoCodesValidationRulesFactory.php +++ /dev/null @@ -1,124 +0,0 @@ - $update ? 'sometimes|string|max:255' : 'required|string|max:255', - 'quantity_available' => 'sometimes|integer|min:0', - 'valid_since_date' => 'nullable|date_format:U', - 'valid_until_date' => 'nullable|required_with:valid_since_date|date_format:U|after:valid_since_date', - 'allowed_ticket_types' => 'sometimes|int_array', - 'badge_features' => 'sometimes|int_array', - ]; - - $specific_rules = []; - $discount_code_rules = [ - 'amount' => 'sometimes|numeric|min:0', - 'rate' => 'sometimes|numeric|min:0', - ]; - - switch ($class_name){ - case MemberSummitRegistrationPromoCode::ClassName:{ - $specific_rules = [ - 'first_name' => 'required_without:owner_id|string', - 'last_name' => 'required_without:owner_id|string', - 'email' => 'required_without:owner_id|email|max:254', - 'type' => 'required|string|in:'.join(",", PromoCodesConstants::MemberSummitRegistrationPromoCodeTypes), - 'owner_id' => 'required_without:first_name,last_name,email|integer' - ]; - } - break; - case SpeakerSummitRegistrationPromoCode::ClassName: - { - $specific_rules = [ - 'type' => 'required|string|in:'.join(",", PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypes), - 'speaker_id' => 'required|integer' - ]; - } - break; - case SponsorSummitRegistrationPromoCode::ClassName: - { - $specific_rules = [ - 'sponsor_id' => 'required|integer' - ]; - } - break; - case MemberSummitRegistrationDiscountCode::ClassName: - { - $specific_rules = array_merge([ - 'first_name' => 'required_without:owner_id|string', - 'last_name' => 'required_without:owner_id|string', - 'email' => 'required_without:owner_id|email|max:254', - 'type' => 'required|string|in:'.join(",", PromoCodesConstants::MemberSummitRegistrationPromoCodeTypes), - 'owner_id' => 'required_without:first_name,last_name,email|integer', - ], $discount_code_rules); - } - break; - case SpeakerSummitRegistrationDiscountCode::ClassName: - { - $specific_rules = array_merge([ - 'type' => 'required|string|in:'.join(",", PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypes), - 'speaker_id' => 'required|integer', - 'amount' => 'sometimes|required_without:rate', - 'rate' => 'sometimes|required_without:amount', - ], $discount_code_rules); - } - break; - case SponsorSummitRegistrationDiscountCode::ClassName: - { - $specific_rules = array_merge([ - 'sponsor_id' => 'required|integer' - ],$discount_code_rules); - - } - break; - } - - return array_merge($base_rules, $specific_rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitBadgeFeatureTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitBadgeFeatureTypeValidationRulesFactory.php deleted file mode 100644 index fc20c706..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitBadgeFeatureTypeValidationRulesFactory.php +++ /dev/null @@ -1,41 +0,0 @@ - 'sometimes|string', - 'description' => 'sometimes|string', - 'template_content' => 'nullable|string', - ]; - } - return [ - 'name' => 'required|string', - 'description' => 'sometimes|string', - 'template_content' => 'nullable|string', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitBadgeTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitBadgeTypeValidationRulesFactory.php deleted file mode 100644 index adb243ae..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitBadgeTypeValidationRulesFactory.php +++ /dev/null @@ -1,43 +0,0 @@ - 'sometimes|string', - 'description' => 'sometimes|string', - 'template_content' => 'nullable|string', - 'is_default' => 'sometimes|boolean', - ]; - } - return [ - 'name' => 'required|string', - 'description' => 'required|string', - 'template_content' => 'nullable|string', - 'is_default' => 'required|boolean', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitOrderExtraQuestionTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitOrderExtraQuestionTypeValidationRulesFactory.php deleted file mode 100644 index dbdb71d2..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitOrderExtraQuestionTypeValidationRulesFactory.php +++ /dev/null @@ -1,44 +0,0 @@ - 'sometimes|string|in:'.implode(",", SummitOrderExtraQuestionTypeConstants::ValidQuestionUsages), - 'printable' => 'sometimes|boolean', - ], $rules); - } - - return array_merge([ - 'usage' => 'required|string|in:'.implode(",", SummitOrderExtraQuestionTypeConstants::ValidQuestionUsages), - 'printable' => 'sometimes|boolean', - - ], $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitRefundPolicyTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitRefundPolicyTypeValidationRulesFactory.php deleted file mode 100644 index 66bb6bfe..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitRefundPolicyTypeValidationRulesFactory.php +++ /dev/null @@ -1,41 +0,0 @@ - 'sometimes|string', - 'refund_rate' => 'sometimes|numeric|min:0|max:100', - 'until_x_days_before_event_starts' => 'sometimes|integer|min:1', - ]; - } - return [ - 'name' => 'required|string', - 'refund_rate' => 'required|numeric|min:0|max:100', - 'until_x_days_before_event_starts' => 'required|integer|min:1', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitTicketTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitTicketTypeValidationRulesFactory.php deleted file mode 100644 index abfd614a..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/SummitTicketTypeValidationRulesFactory.php +++ /dev/null @@ -1,55 +0,0 @@ - 'sometimes|string', - 'description' => 'sometimes|string', - 'badge_type_id' => 'sometimes|integer', - 'external_id' => 'sometimes|string|max:255', - 'currency' => 'sometimes|string|currency_iso', - 'quantity_2_sell' => 'sometimes|integer|greater_than:0', - 'max_quantity_per_order' => 'sometimes|integer', - 'sales_start_date' => 'nullable|date_format:U', - 'sales_end_date' => 'nullable:sales_start_date|date_format:U|after:sales_start_date', - 'cost' => 'sometimes|numeric|greater_than_or_equal:0', - ]; - } - - return [ - 'name' => 'required|string', - 'cost' => 'sometimes|numeric|greater_than_or_equal:0', - 'currency' => 'required_with:cost|string|currency_iso', - 'quantity_2_sell' => 'sometimes|integer|greater_than:0', - 'max_quantity_per_order' => 'sometimes|integer', - 'sales_start_date' => 'nullable|date_format:U', - 'sales_end_date' => 'nullable:sales_start_date|date_format:U|after:sales_start_date', - 'description' => 'sometimes|string', - 'external_id' => 'sometimes|string|max:255', - 'badge_type_id' => 'sometimes|integer', - ]; - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/TaxTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/TaxTypeValidationRulesFactory.php deleted file mode 100644 index 198b6eb3..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/Registration/TaxTypeValidationRulesFactory.php +++ /dev/null @@ -1,41 +0,0 @@ - 'sometimes|string', - 'tax_id' => 'sometimes|string', - 'rate' => 'sometimes|numeric|greater_than:0' - ]; - } - return [ - 'name' => 'required|string', - 'tax_id' => 'sometimes|string', - 'rate' => 'required|numeric|greater_than:0' - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SelectionPlanExtraQuestionValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SelectionPlanExtraQuestionValidationRulesFactory.php deleted file mode 100644 index 68462fe0..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SelectionPlanExtraQuestionValidationRulesFactory.php +++ /dev/null @@ -1,22 +0,0 @@ - 'sometimes|integer', - 'sponsorship_id' => 'sometimes|integer', - 'order' => 'sometimes|integer|min:1', - ]; - } - return [ - 'company_id' => 'required|integer', - 'sponsorship_id' => 'required|integer', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SponsorshipTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SponsorshipTypeValidationRulesFactory.php deleted file mode 100644 index f6ea6478..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SponsorshipTypeValidationRulesFactory.php +++ /dev/null @@ -1,45 +0,0 @@ - 'sometimes|string', - 'label' => 'sometimes|string', - 'size' => 'sometimes|string|in:'.implode(",", ISponsorshipTypeConstants::AllowedSizes), - 'order' => 'sometimes|integer|min:1', - ]; - } - return [ - 'name' => 'required|string', - 'label' => 'required|string', - 'size' => 'required|string|in:'.implode(",", ISponsorshipTypeConstants::AllowedSizes), - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitAbstractLocationValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitAbstractLocationValidationRulesFactory.php deleted file mode 100644 index db672acc..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitAbstractLocationValidationRulesFactory.php +++ /dev/null @@ -1,43 +0,0 @@ - 'sometimes|string|max:255', - 'short_name' => 'sometimes|string|max:255', - 'description' => 'sometimes|string', - 'order' => 'sometimes|integer|min:1' - ]; - } - - return [ - 'name' => 'required|string|max:255', - 'short_name' => 'sometimes|string|max:255', - 'description' => 'sometimes|string', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitAirportValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitAirportValidationRulesFactory.php deleted file mode 100644 index 2529d40a..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitAirportValidationRulesFactory.php +++ /dev/null @@ -1,36 +0,0 @@ - sprintf('sometimes|in:%s,%s',SummitAirport::AirportTypeInternational, SummitAirport::AirportTypeDomestic), - ], $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitEventValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitEventValidationRulesFactory.php deleted file mode 100644 index cf53d920..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitEventValidationRulesFactory.php +++ /dev/null @@ -1,143 +0,0 @@ - 'sometimes|string|max:255', - 'description' => 'sometimes|string|max:1100', - 'rsvp_link' => 'nullable|sometimes|url', - 'streaming_url' => 'nullable|sometimes|url', - 'etherpad_link' => 'nullable|sometimes|url', - 'meeting_url' => 'nullable|sometimes|url', - 'rsvp_template_id' => 'sometimes|integer', - 'rsvp_max_user_number' => 'required_with:rsvp_template_id|integer|min:0', - 'rsvp_max_user_wait_list_number' => 'required_with:rsvp_template_id|integer|min:0', - 'head_count' => 'sometimes|integer', - 'social_description' => 'sometimes|string|max:110', - 'location_id' => 'sometimes|integer', - 'start_date' => 'sometimes|date_format:U', - 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date', - 'allow_feedback' => 'sometimes|boolean', - 'type_id' => 'sometimes|required|integer', - 'track_id' => 'sometimes|required|integer', - 'tags' => 'sometimes|string_array', - 'sponsors' => 'sometimes|int_array', - 'level' => 'sometimes|string', - // presentation rules - 'attendees_expected_learnt' => 'sometimes|string|max:1100', - 'attending_media' => 'sometimes|boolean', - 'to_record' => 'sometimes|boolean', - 'speakers' => 'sometimes|int_array', - 'moderator_speaker_id' => 'sometimes|integer', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'links' => 'sometimes|url_array', - // group event - 'groups' => 'sometimes|int_array', - 'occupancy' => 'sometimes|in:EMPTY,25%,50%,75%,FULL', - 'selection_plan_id' => 'sometimes|integer', - 'disclaimer_accepted' => 'sometimes|boolean', - ]; - } - - return [ - 'title' => 'required|string|max:255', - 'description' => 'required|string|max:1100', - 'type_id' => 'required|integer', - 'location_id' => 'sometimes|integer', - 'start_date' => 'sometimes|required|date_format:U', - 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date', - 'track_id' => 'required|integer', - 'rsvp_link' => 'nullable|sometimes|url', - 'streaming_url' => 'nullable|sometimes|url', - 'etherpad_link' => 'nullable|sometimes|url', - 'meeting_url' => 'nullable|sometimes|url', - 'rsvp_template_id' => 'sometimes|integer', - 'rsvp_max_user_number' => 'required_with:rsvp_template_id|integer|min:0', - 'rsvp_max_user_wait_list_number' => 'required_with:rsvp_template_id|integer|min:0', - 'head_count' => 'sometimes|integer', - 'social_description' => 'sometimes|string|max:110', - 'allow_feedback' => 'sometimes|boolean', - 'tags' => 'sometimes|string_array', - 'sponsors' => 'sometimes|int_array', - 'level' => 'sometimes|string', - // presentation rules - 'attendees_expected_learnt' => 'sometimes|string|max:1100', - 'attending_media' => 'sometimes|boolean', - 'to_record' => 'sometimes|boolean', - 'speakers' => 'sometimes|int_array', - 'moderator_speaker_id' => 'sometimes|integer', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'links' => 'sometimes|url_array', - // group event - 'groups' => 'sometimes|int_array', - 'selection_plan_id' => 'sometimes|integer', - 'disclaimer_accepted' => 'sometimes|boolean', - ]; - } - - /** - * @param array $data - * @param bool $update - * @return string[] - */ - public static function buildForSubmission(array $data, bool $update = false){ - - if($update){ - return [ - 'title' => 'required|string|max:255', - 'description' => 'required|string|max:1100', - 'social_description' => 'sometimes|string|max:110', - 'attendees_expected_learnt' => 'required|string|max:1100', - 'will_all_speakers_attend' => 'sometimes|boolean', - 'type_id' => 'required|integer', - 'track_id' => 'required|integer', - 'attending_media' => 'required|boolean', - 'links' => 'sometimes|url_array', - 'tags' => 'sometimes|string_array', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'disclaimer_accepted' => 'sometimes|boolean', - ]; - } - - return [ - 'title' => 'required|string|max:255', - 'description' => 'required|string|max:1100', - 'social_description' => 'sometimes|string|max:110', - 'attendees_expected_learnt' => 'required|string|max:1100', - 'type_id' => 'required|integer', - 'track_id' => 'required|integer', - 'attending_media' => 'required|boolean', - 'will_all_speakers_attend' => 'sometimes|boolean', - 'links' => 'sometimes|url_array', - 'tags' => 'sometimes|string_array', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'disclaimer_accepted' => 'sometimes|boolean', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitExternalLocationValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitExternalLocationValidationRulesFactory.php deleted file mode 100644 index b004d977..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitExternalLocationValidationRulesFactory.php +++ /dev/null @@ -1,35 +0,0 @@ - 'sometimes|integer|min:0' - ], $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitFinderStrategyFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitFinderStrategyFactory.php deleted file mode 100644 index 9cd1eb1d..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitFinderStrategyFactory.php +++ /dev/null @@ -1,39 +0,0 @@ - 'sometimes|string', - 'address_2' => 'sometimes|string', - 'zip_code' => 'sometimes|string', - 'city' => 'string|required_with:address_1', - 'state' => 'string|required_with:address_1', - 'country' => 'country_iso_alpha2_code|required_with:address_1', - 'website_url' => 'sometimes|url', - 'lng' => 'sometimes|geo_longitude|required_with:lat', - 'lat' => 'sometimes|geo_latitude|required_with:lng', - 'display_on_site' => 'sometimes|boolean', - 'details_page' => 'sometimes|boolean', - 'location_message' => 'sometimes|string', - ], $rules); - } - - return array_merge([ - 'address_1' => 'string|required_without:lng,lat', - 'address_2' => 'sometimes|string', - 'zip_code' => 'sometimes|string', - 'city' => 'string|required_without:lng,lat', - 'state' => 'string|required_without:lng,lat', - 'country' => 'country_iso_alpha2_code|required_without:lng,lat', - 'lng' => 'geo_longitude|required_with:lat|required_without:address_1,city,state,country', - 'lat' => 'geo_latitude|required_with:lng|required_without:address_1,city,state,country', - 'website_url' => 'sometimes|url', - 'display_on_site' => 'sometimes|boolean', - 'details_page' => 'sometimes|boolean', - 'location_message' => 'sometimes|string', - ], $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitHotelValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitHotelValidationRulesFactory.php deleted file mode 100644 index 4d7ed097..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitHotelValidationRulesFactory.php +++ /dev/null @@ -1,36 +0,0 @@ - sprintf('sometimes|in:%s,%s',SummitHotel::HotelTypePrimary, SummitHotel::HotelTypeAlternate), - 'sold_out' => 'sometimes|boolean', - 'booking_link' => 'sometimes|url' - ], $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationBannerValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationBannerValidationRulesFactory.php deleted file mode 100644 index 4dc9dc64..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationBannerValidationRulesFactory.php +++ /dev/null @@ -1,79 +0,0 @@ - sprintf('required|in:%s', implode(",", SummitLocationBannerConstants::$valid_class_names)), - 'title' => 'required|string', - 'content' => 'required|string', - 'type' => sprintf('required|in:%s', implode(",", SummitLocationBannerConstants::$valid_types)), - 'enabled' => 'required|boolean' - ]; - - if($update){ - $base_rules = [ - 'class_name' => sprintf('required|in:%s', implode(",", SummitLocationBannerConstants::$valid_class_names)), - 'title' => 'sometimes|string', - 'content' => 'sometimes|string', - 'type' => sprintf('sometimes|in:%s', implode(",", SummitLocationBannerConstants::$valid_types)), - 'enabled' => 'sometimes|boolean' - ]; - } - - switch($data['class_name']){ - case SummitLocationBanner::ClassName: { - return $base_rules; - } - break; - case ScheduledSummitLocationBanner::ClassName: { - $extended_rules = [ - 'start_date' => 'required|date_format:U', - 'end_date' => 'required_with:start_date|date_format:U|after:start_date', - ]; - - if($update){ - $extended_rules = [ - 'start_date' => 'sometimes|date_format:U', - 'end_date' => 'required_with:start_date|date_format:U|after:start_date', - ]; - } - - return array_merge($base_rules, $extended_rules); - } - default: - throw new ValidationException("invalid class_name"); - break; - } - return []; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationImageValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationImageValidationRulesFactory.php deleted file mode 100644 index 816936c9..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationImageValidationRulesFactory.php +++ /dev/null @@ -1,38 +0,0 @@ - 'sometimes|string|max:255', - 'description' => 'sometimes|string', - 'order' => 'sometimes|integer|min:1', - ]; - } - return [ - 'name' => 'required|string|max:255', - 'description' => 'sometimes|string', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationValidationRulesFactory.php deleted file mode 100644 index 6bfc8b9d..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitLocationValidationRulesFactory.php +++ /dev/null @@ -1,75 +0,0 @@ - sprintf('required|in:%s', implode(",", SummitLocationConstants::$valid_class_names)) - ]; - - switch($data['class_name']){ - case SummitVenue::ClassName: { - return array_merge($base_rules, SummitVenueValidationRulesFactory::build($data, $update)); - } - break; - case SummitAirport::ClassName: { - return array_merge($base_rules, SummitAirportValidationRulesFactory::build($data, $update)); - } - break; - case SummitHotel::ClassName: { - return array_merge($base_rules, SummitHotelValidationRulesFactory::build($data, $update)); - } - break; - case SummitExternalLocation::ClassName: { - return array_merge($base_rules, SummitExternalLocationValidationRulesFactory::build($data, $update)); - } - case SummitVenueRoom::ClassName: { - return array_merge($base_rules, SummitVenueRoomValidationRulesFactory::build($data, $update)); - } - break; - case SummitBookableVenueRoom::ClassName: { - return array_merge($base_rules, SummitVenueBookableRoomValidationRulesFactory::build($data, $update)); - } - break; - default:{ - throw new ValidationException('invalid class_name param'); - } - break; - } - - return []; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitPresentationActionTypeValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitPresentationActionTypeValidationRulesFactory.php deleted file mode 100644 index 3a2e4e46..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitPresentationActionTypeValidationRulesFactory.php +++ /dev/null @@ -1,40 +0,0 @@ - 'sometimes|string|max:255', - 'order' => 'sometimes|integer|min:1', - ]; - } - - return [ - 'label' => 'required|string|max:255', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitPushNotificationValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitPushNotificationValidationRulesFactory.php deleted file mode 100644 index b573097b..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitPushNotificationValidationRulesFactory.php +++ /dev/null @@ -1,31 +0,0 @@ - 'required|string', - 'platform' => 'required|in:MOBILE,WEB', - 'channel' => 'required_if:platform,MOBILE|in:EVERYONE,SPEAKERS,ATTENDEES,MEMBERS,SUMMIT,EVENT,GROUP', - 'event_id' => 'required_if:channel,EVENT|integer', - 'group_id' => 'required_if:channel,GROUP|integer', - 'recipient_ids' => 'required_if:channel,MEMBERS|int_array', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPLiteralContentQuestionTemplateValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPLiteralContentQuestionTemplateValidationRulesFactory.php deleted file mode 100644 index a8768a33..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPLiteralContentQuestionTemplateValidationRulesFactory.php +++ /dev/null @@ -1,32 +0,0 @@ - 'sometimes|string']; - } - return ['content' => 'required|string']; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPMultiValueQuestionTemplateValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPMultiValueQuestionTemplateValidationRulesFactory.php deleted file mode 100644 index 5a91f386..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPMultiValueQuestionTemplateValidationRulesFactory.php +++ /dev/null @@ -1,32 +0,0 @@ - 'sometimes|string']; - } - return ['empty_string' => 'required|string']; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateQuestionValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateQuestionValidationRulesFactory.php deleted file mode 100644 index 69921dff..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateQuestionValidationRulesFactory.php +++ /dev/null @@ -1,119 +0,0 @@ - sprintf('required|in:%s', implode(",", SummitRSVPTemplateQuestionConstants::$valid_class_names)) - ]; - - if($update){ - $base_rules = array_merge($base_rules, [ - 'name' => 'sometimes|alpha_dash|max:255', - 'label' => 'sometimes|string', - 'is_mandatory' => 'sometimes|boolean', - 'order' => 'sometimes|integer|min:1', - 'is_read_only;' => 'sometimes|boolean', - ]); - } - else - { - $base_rules = array_merge($base_rules, [ - 'name' => 'required|alpha_dash|max:255', - 'label' => 'required|string', - 'is_mandatory' => 'sometimes|boolean', - 'is_read_only;' => 'sometimes|boolean', - ]); - } - - switch($data['class_name']){ - case RSVPMemberEmailQuestionTemplate::ClassName: { - return $base_rules; - } - break; - case RSVPMemberFirstNameQuestionTemplate::ClassName: { - return $base_rules; - } - break; - case RSVPMemberLastNameQuestionTemplate::ClassName: { - return $base_rules; - } - break; - case RSVPTextBoxQuestionTemplate::ClassName: { - return array_merge($base_rules, ['initial_value' => 'string|sometimes']); - } - break; - case RSVPTextAreaQuestionTemplate::ClassName: { - return array_merge($base_rules, ['initial_value' => 'string|sometimes']); - } - break; - case RSVPCheckBoxListQuestionTemplate::ClassName: { - return array_merge($base_rules, SummitRSVPMultiValueQuestionTemplateValidationRulesFactory::build($data, $update)); - } - break; - case RSVPRadioButtonListQuestionTemplate::ClassName: { - return array_merge($base_rules, SummitRSVPMultiValueQuestionTemplateValidationRulesFactory::build($data, $update)); - } - break; - case RSVPDropDownQuestionTemplate::ClassName: { - return array_merge - ( - $base_rules, - SummitRSVPMultiValueQuestionTemplateValidationRulesFactory::build($data, $update), - [ - 'is_multiselect' => 'sometimes|boolean', - 'is_country_selector' => 'sometimes|boolean', - 'use_chosen_plugin' => 'sometimes|boolean', - ] - ); - } - break; - case RSVPLiteralContentQuestionTemplate::ClassName: { - return array_merge($base_rules, SummitRSVPLiteralContentQuestionTemplateValidationRulesFactory::build($data, $update)); - } - break; - default:{ - throw new ValidationException(sprintf('invalid class_name param (%s)', implode(",", SummitRSVPTemplateQuestionConstants::$valid_class_names))); - } - break; - } - - return []; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateQuestionValueValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateQuestionValueValidationRulesFactory.php deleted file mode 100644 index 6caa2fca..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateQuestionValueValidationRulesFactory.php +++ /dev/null @@ -1,34 +0,0 @@ - 'sometimes|string|max:255', - 'label' => 'sometimes|string', - 'order' => 'sometimes|integer|min:1', - ]; - } - return [ - 'value' => 'required|string|max:255', - 'label' => 'required|string', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateValidationRulesFactory.php deleted file mode 100644 index 3b16e9c9..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRSVPTemplateValidationRulesFactory.php +++ /dev/null @@ -1,33 +0,0 @@ - 'sometimes|string|max:255', - 'is_enabled' => 'sometimes|boolean', - ]; - } - return [ - 'title' => 'required|string|max:255', - 'is_enabled' => 'required|boolean', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRoomReservationValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRoomReservationValidationRulesFactory.php deleted file mode 100644 index 6d4af1c6..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitRoomReservationValidationRulesFactory.php +++ /dev/null @@ -1,36 +0,0 @@ - 'required|string|currency_iso', - 'amount' => 'required|integer|greater_than:0', - 'start_datetime' => 'required|date_format:U', - 'end_datetime' => 'required|date_format:U|after:start_datetime', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitSelectionPlanValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitSelectionPlanValidationRulesFactory.php deleted file mode 100644 index d739273a..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitSelectionPlanValidationRulesFactory.php +++ /dev/null @@ -1,53 +0,0 @@ - 'sometimes|string|max:255', - 'is_enabled' => 'sometimes|boolean', - 'allow_new_presentations' => 'sometimes|boolean', - 'max_submission_allowed_per_user' => 'sometimes|integer|min:1', - 'submission_begin_date' => 'nullable|date_format:U', - 'submission_end_date' => 'nullable|required_with:submission_begin_date|date_format:U|after_or_equal:submission_begin_date', - 'voting_begin_date' => 'nullable|date_format:U', - 'voting_end_date' => 'nullable|required_with:voting_begin_date|date_format:U|after_or_equal:voting_begin_date', - 'selection_begin_date' => 'nullable|date_format:U', - 'selection_end_date' => 'nullable|required_with:selection_begin_date|date_format:U|after_or_equal:selection_begin_date', - ]; - } - return [ - 'name' => 'required|string|max:255', - 'is_enabled' => 'required|boolean', - 'allow_new_presentations' => 'required|boolean', - 'max_submission_allowed_per_user' => 'sometimes|integer|min:1', - 'submission_begin_date' => 'nullable|date_format:U', - 'submission_end_date' => 'nullable|required_with:submission_begin_date|date_format:U|after_or_equal:submission_begin_date', - 'voting_begin_date' => 'nullable|date_format:U', - 'voting_end_date' => 'nullable|required_with:voting_begin_date|date_format:U|after_or_equal:voting_begin_date', - 'selection_begin_date' => 'nullable|date_format:U', - 'selection_end_date' => 'nullable|required_with:selection_begin_date|date_format:U|after_or_equal:selection_begin_date', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitValidationRulesFactory.php deleted file mode 100644 index b12d943b..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitValidationRulesFactory.php +++ /dev/null @@ -1,151 +0,0 @@ - 'sometimes|string|max:50', - 'start_date' => 'sometimes|date_format:U', - 'end_date' => 'required_with:start_date|date_format:U|after_or_equal:start_date', - 'registration_begin_date' => 'nullable|date_format:U', - 'registration_end_date' => 'nullable|required_with:registration_begin_date|date_format:U|after_or_equal:registration_begin_date', - 'start_showing_venues_date' => 'nullable|date_format:U|before_or_equal:start_date', - 'schedule_start_date' => 'nullable|date_format:U|after_or_equal:start_date|before_or_equal:end_date', - 'active' => 'sometimes|boolean', - 'dates_label' => 'nullable|sometimes|string', - 'time_zone_id' => 'sometimes|timezone', - 'available_on_api' => 'sometimes|boolean', - 'calendar_sync_name' => 'nullable|sometimes|string|max:255', - 'calendar_sync_desc' => 'nullable|sometimes|string', - 'link' => 'nullable|sometimes|url', - 'registration_link' => 'nullable|sometimes|url', - 'max_submission_allowed_per_user' => 'sometimes|integer|min:1', - 'secondary_registration_link' => 'nullable|sometimes|url', - 'secondary_registration_label' => 'nullable|sometimes|string', - 'slug' => 'required|string', - 'meeting_room_booking_start_time' => 'nullable|date_format:U', - 'meeting_room_booking_end_time' => 'nullable|required_with:meeting_room_booking_start_time|date_format:U|after_or_equal:meeting_room_booking_start_time', - 'meeting_room_booking_slot_length' => 'nullable|integer', - 'meeting_room_booking_max_allowed' => 'nullable|integer|min:1', - 'api_feed_type' => sprintf('nullable|in:%s', implode(',', ISummitExternalScheduleFeedType::ValidFeedTypes)), - 'api_feed_url' => 'nullable|string|url|required_with:api_feed_type', - 'api_feed_key' => 'nullable|string|required_with:api_feed_type', - 'begin_allow_booking_date' => 'nullable|date_format:U', - 'end_allow_booking_date' => 'nullable|required_with:begin_allow_booking_date|date_format:U|after_or_equal:begin_allow_booking_date', - 'reassign_ticket_till_date' => 'nullable|date_format:U', - 'registration_disclaimer_content' => 'nullable|string', - 'registration_disclaimer_mandatory' => 'nullable|boolean', - 'registration_reminder_email_days_interval' => 'nullable|integer|min:1', - 'external_summit_id' => 'nullable|string', - 'external_registration_feed_type' => sprintf('nullable|in:%s', implode(',', ISummitExternalRegistrationFeedType::ValidFeedTypes)), - 'external_registration_feed_api_key' => 'nullable|string|required_with:external_registration_feed_type', - // schedule - 'schedule_default_page_url' => 'nullable|url', - 'schedule_default_event_detail_url' => 'nullable|url', - 'schedule_og_site_name' => 'nullable|string', - 'schedule_og_image_url' => 'nullable|url', - 'schedule_og_image_secure_url' => 'nullable|url', - 'schedule_og_image_width' => 'nullable|integer', - 'schedule_og_image_height' => 'nullable|integer', - 'schedule_facebook_app_id' => 'nullable|string', - 'schedule_ios_app_name' => 'nullable|string', - 'schedule_ios_app_store_id' => 'nullable|string', - 'schedule_ios_app_custom_schema' => 'nullable|string', - 'schedule_android_app_name' => 'nullable|string', - 'schedule_android_app_package' => 'nullable|string', - 'schedule_android_custom_schema' => 'nullable|string', - 'schedule_twitter_app_name' => 'nullable|string', - 'schedule_twitter_text' => 'nullable|string', - 'default_page_url' => 'nullable|url', - 'speaker_confirmation_default_page_url' => 'nullable|url', - 'virtual_site_url' => 'nullable|url', - 'marketing_site_url' => 'nullable|url', - 'virtual_site_oauth2_client_id' => 'nullable|string', - 'marketing_site_oauth2_client_id' => 'nullable|string', - 'support_email' => 'nullable|email', - ]; - } - - return [ - 'name' => 'required|string|max:50', - 'start_date' => 'required|date_format:U', - 'end_date' => 'required_with:start_date|date_format:U|after_or_equal:start_date', - 'registration_begin_date' => 'nullable|date_format:U', - 'registration_end_date' => 'nullable|required_with:registration_begin_date|date_format:U|after_or_equal:registration_begin_date', - 'start_showing_venues_date' => 'nullable|date_format:U|before_or_equal:start_date', - 'schedule_start_date' => 'nullable|date_format:U|after_or_equal:start_date|before_or_equal:end_date', - 'active' => 'sometimes|boolean', - 'dates_label' => 'nullable|sometimes|string', - 'time_zone_id' => 'required|timezone', - 'available_on_api' => 'sometimes|boolean', - 'calendar_sync_name' => 'nullable|sometimes|string|max:255', - 'calendar_sync_desc' => 'nullable|sometimes|string', - 'link' => 'nullable|sometimes|url', - 'registration_link' => 'nullable|sometimes|url', - 'max_submission_allowed_per_user' => 'nullable|sometimes|integer|min:1', - 'secondary_registration_link' => 'nullable|sometimes|url', - 'secondary_registration_label' => 'nullable|sometimes|string', - 'slug' => 'required|string', - 'meeting_room_booking_start_time' => 'nullable|date_format:U', - 'meeting_room_booking_end_time' => 'nullable|required_with:meeting_room_booking_start_time|date_format:U|after_or_equal:meeting_room_booking_start_time', - 'meeting_room_booking_slot_length' => 'nullable|integer', - 'meeting_room_booking_max_allowed' => 'nullable|integer|min:1', - 'api_feed_type' => sprintf('nullable|in:%s', implode(',', ISummitExternalScheduleFeedType::ValidFeedTypes)), - 'api_feed_url' => 'nullable|string|url|required_with:api_feed_type', - 'api_feed_key' => 'nullable|string|required_with:api_feed_type', - 'begin_allow_booking_date' => 'nullable|date_format:U', - 'end_allow_booking_date' => 'nullable|required_with:begin_allow_booking_date|date_format:U|after_or_equal:begin_allow_booking_date', - 'reassign_ticket_till_date' => 'nullable|date_format:U', - 'registration_disclaimer_content' => 'nullable|string', - 'registration_disclaimer_mandatory' => 'nullable|boolean', - 'registration_reminder_email_days_interval' => 'nullable|integer|min:1', - 'external_summit_id' => 'nullable|string', - 'external_registration_feed_type' => sprintf('nullable|in:%s', implode(',', ISummitExternalRegistrationFeedType::ValidFeedTypes)), - 'external_registration_feed_api_key' => 'nullable|string|required_with:external_registration_feed_type', - // schedule - 'schedule_default_page_url' => 'nullable|url', - 'schedule_default_event_detail_url' => 'nullable|url', - 'schedule_og_site_name' => 'nullable|string', - 'schedule_og_image_url' => 'nullable|url', - 'schedule_og_image_secure_url' => 'nullable|url', - 'schedule_og_image_width' => 'nullable|integer', - 'schedule_og_image_height' => 'nullable|integer', - 'schedule_facebook_app_id' => 'nullable|string', - 'schedule_ios_app_name' => 'nullable|string', - 'schedule_ios_app_store_id' => 'nullable|string', - 'schedule_ios_app_custom_schema' => 'nullable|string', - 'schedule_android_app_name' => 'nullable|string', - 'schedule_android_app_package' => 'nullable|string', - 'schedule_android_custom_schema' => 'nullable|string', - 'schedule_twitter_app_name' => 'nullable|string', - 'schedule_twitter_text' => 'nullable|string', - 'default_page_url' => 'nullable|url', - 'speaker_confirmation_default_page_url' => 'nullable|url', - 'virtual_site_url' => 'nullable|url', - 'marketing_site_url' => 'nullable|url', - 'virtual_site_oauth2_client_id' => 'nullable|string', - 'marketing_site_oauth2_client_id' => 'nullable|string', - 'support_email' => 'nullable|email', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueBookableRoomValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueBookableRoomValidationRulesFactory.php deleted file mode 100644 index 3fdb14e5..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueBookableRoomValidationRulesFactory.php +++ /dev/null @@ -1,36 +0,0 @@ - 'required|integer:min:0', - 'time_slot_cost' => 'required|integer|greater_than:0', - 'currency' => 'required|string|currency_iso', - ], $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueRoomValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueRoomValidationRulesFactory.php deleted file mode 100644 index 82f2a933..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueRoomValidationRulesFactory.php +++ /dev/null @@ -1,36 +0,0 @@ - 'sometimes|integer:min:0', - 'override_blackouts' => 'sometimes|boolean', - 'floor_id' => 'sometimes|integer', - ], $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueValidationRulesFactory.php deleted file mode 100644 index 22bc98ba..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/SummitVenueValidationRulesFactory.php +++ /dev/null @@ -1,31 +0,0 @@ - 'sometimes|boolean']; - return array_merge($venues_rules, $rules); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackLiteralContentQuestionTemplateValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackLiteralContentQuestionTemplateValidationRulesFactory.php deleted file mode 100644 index eabc7282..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackLiteralContentQuestionTemplateValidationRulesFactory.php +++ /dev/null @@ -1,33 +0,0 @@ - 'sometimes|string']; - } - return ['content' => 'required|string']; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackMultiValueQuestionTemplateValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackMultiValueQuestionTemplateValidationRulesFactory.php deleted file mode 100644 index 6a281521..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackMultiValueQuestionTemplateValidationRulesFactory.php +++ /dev/null @@ -1,37 +0,0 @@ - 'sometimes|string', - 'default_value_id' => 'sometimes|integer', - ]; - } - return [ - 'empty_string' => 'required|string' - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackQuestionTemplateValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackQuestionTemplateValidationRulesFactory.php deleted file mode 100644 index 1f50852e..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackQuestionTemplateValidationRulesFactory.php +++ /dev/null @@ -1,122 +0,0 @@ - sprintf('required|in:%s', implode(",", TrackQuestionTemplateConstants::$valid_class_names)) - ]; - - if ($update) { - $base_rules = array_merge($base_rules, [ - 'name' => 'sometimes|alpha_dash|max:255', - 'label' => 'sometimes|string', - 'is_mandatory' => 'sometimes|boolean', - 'is_read_only' => 'sometimes|boolean', - 'tracks' => 'sometimes|int_array', - ]); - } else { - $base_rules = array_merge($base_rules, [ - 'name' => 'required|alpha_dash|max:255', - 'label' => 'required|string', - 'is_mandatory' => 'sometimes|boolean', - 'is_read_only' => 'sometimes|boolean', - 'tracks' => 'sometimes|int_array', - ]); - } - - switch ($data['class_name']) { - case TrackTextBoxQuestionTemplate::ClassName: - { - return array_merge($base_rules, ['initial_value' => 'string|sometimes']); - } - break; - case TrackCheckBoxQuestionTemplate::ClassName: - { - return array_merge($base_rules, ['initial_value' => 'string|sometimes']); - } - break; - case TrackCheckBoxListQuestionTemplate::ClassName: - { - return array_merge - ( - $base_rules, - TrackMultiValueQuestionTemplateValidationRulesFactory::build($data, $update) - ); - } - break; - case TrackRadioButtonListQuestionTemplate::ClassName: - { - return array_merge - ( - $base_rules, - TrackMultiValueQuestionTemplateValidationRulesFactory::build($data, $update) - ); - } - break; - case TrackDropDownQuestionTemplate::ClassName: - { - return array_merge - ( - $base_rules, - TrackMultiValueQuestionTemplateValidationRulesFactory::build($data, $update), - [ - 'is_multiselect' => 'sometimes|boolean', - 'is_country_selector' => 'sometimes|boolean', - ] - ); - } - break; - case TrackLiteralContentQuestionTemplate::ClassName: - { - return array_merge( - $base_rules, - TrackLiteralContentQuestionTemplateValidationRulesFactory::build($data, $update) - ); - } - break; - default: - { - throw new ValidationException(sprintf('invalid class_name param (%s)', implode(",", TrackQuestionTemplateConstants::$valid_class_names))); - } - break; - } - - return []; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackQuestionValueTemplateValidationRulesFactory.php b/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackQuestionValueTemplateValidationRulesFactory.php deleted file mode 100644 index 141bcdaf..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Factories/TrackQuestionValueTemplateValidationRulesFactory.php +++ /dev/null @@ -1,34 +0,0 @@ - 'sometimes|string|max:255', - 'label' => 'sometimes|string', - 'order' => 'sometimes|integer|min:1', - ]; - } - return [ - 'value' => 'required|string|max:255', - 'label' => 'required|string', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2PaymentGatewayProfileApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2PaymentGatewayProfileApiController.php deleted file mode 100644 index 22056d93..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2PaymentGatewayProfileApiController.php +++ /dev/null @@ -1,171 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - use GetAllBySummit; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @inheritDoc - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addPaymentProfile($summit, $payload); - } - - /** - * @inheritDoc - */ - function getAddValidationRules(array $payload): array - { - return PaymentGatewayProfileValidationRulesFactory::build($payload, false); - } - - /** - * @inheritDoc - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deletePaymentProfile($summit, $child_id); - } - - /** - * @inheritDoc - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getPaymentProfileById($child_id); - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return PaymentGatewayProfileValidationRulesFactory::build($payload, true); - } - - /** - * @inheritDoc - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updatePaymentProfile($summit, $child_id, $payload); - } - - /** - * @return array - */ - protected function getFilterRules():array - { - return [ - 'application_type' => ['=@', '=='], - 'active' => ['=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'application_type' => 'sometimes|required|string', - 'active' => 'sometimes|required|boolean', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'application_type', - ]; - } - - protected function serializerType():string{ - return SerializerRegistry::SerializerType_Private; - } - - protected function addSerializerType():string{ - return SerializerRegistry::SerializerType_Private; - } - - protected function updateSerializerType():string{ - return SerializerRegistry::SerializerType_Private; - } - - public function getChildSerializer(){ - return SerializerRegistry::SerializerType_Private; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2PresentationApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2PresentationApiController.php deleted file mode 100644 index 3c4696d8..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2PresentationApiController.php +++ /dev/null @@ -1,1234 +0,0 @@ -presentation_repository = $presentation_repository; - $this->presentation_service = $presentation_service; - $this->member_repository = $member_repository; - $this->summit_repository = $summit_repository; - } - - //presentations - - //videos - - public function getPresentationVideos($summit_id, $presentation_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) return $this->error404(); - - $videos = $presentation->getVideos(); - - $items = []; - foreach ($videos as $i) { - if ($i instanceof IEntity) { - $i = SerializerRegistry::getInstance()->getSerializer($i)->serialize(); - } - $items[] = $i; - } - - return $this->ok($items); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $video_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getPresentationVideo($summit_id, $presentation_id, $video_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) return $this->error404(); - - $video = $presentation->getVideoBy($video_id); - - if (is_null($video)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($video)->serialize()); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addVideo(LaravelRequest $request, $summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if (!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $data = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, PresentationVideoValidationRulesFactory::build($data)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - ]; - - $video = $this->presentation_service->addVideoTo($presentation_id, HTMLCleaner::cleanData($data, $fields)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($video)->serialize()); - } 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); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @param $video_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateVideo(LaravelRequest $request, $summit_id, $presentation_id, $video_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if (!Request::isJson()) return $this->error400(); - - $data = Input::json(); - $data = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, PresentationVideoValidationRulesFactory::build($data, true)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - ]; - - $video = $this->presentation_service->updateVideo($presentation_id, $video_id, HTMLCleaner::cleanData($data, $fields)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($video)->serialize()); - } 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); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $video_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteVideo($summit_id, $presentation_id, $video_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->presentation_service->deleteVideo($presentation_id, $video_id); - - return $this->deleted(); - } 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); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function submitPresentation($summit_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if (!Request::isJson()) return $this->error400(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $data = Input::json(); - $data = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, SummitEventValidationRulesFactory::buildForSubmission($data)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'title', - 'description', - 'social_summary', - 'attendees_expected_learnt', - ]; - - $presentation = $this->presentation_service->submitPresentation($summit, HTMLCleaner::cleanData($data, $fields)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($presentation)->serialize(Request::input('expand', ''))); - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(['message' => $ex1->getMessage()]); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @return mixed - */ - public function updatePresentationSubmission($summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if (!Request::isJson()) return $this->error400(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $data = Input::json(); - - $data = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, SummitEventValidationRulesFactory::buildForSubmission($data . true)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'title', - 'description', - 'social_summary', - 'attendees_expected_learnt', - ]; - - $presentation = $this->presentation_service->updatePresentationSubmission - ( - $summit, - $presentation_id, - HTMLCleaner::cleanData($data, $fields) - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($presentation)->serialize(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); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @return mixed - */ - public function completePresentationSubmission($summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $presentation = $this->presentation_service->completePresentationSubmission - ( - $summit, - $presentation_id - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($presentation)->serialize(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); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @return mixed - */ - public function deletePresentation($summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->presentation_service->deletePresentation($summit, $presentation_id); - - return $this->deleted(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - // Slides - - /** - * @param $summit_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getPresentationSlides($summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) return $this->error404(); - - $slides = $presentation->getSlides(); - - $items = []; - foreach ($slides as $i) { - if ($i instanceof IEntity) { - $i = SerializerRegistry::getInstance()->getSerializer($i)->serialize(); - } - $items[] = $i; - } - - return $this->ok($items); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $slide_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getPresentationSlide($summit_id, $presentation_id, $slide_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) return $this->error404(); - - $slide = $presentation->getSlideBy($slide_id); - - if (is_null($slide)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($slide)->serialize()); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addPresentationSlide(LaravelRequest $request, $summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $data = $request->all(); - $data = MultipartFormDataCleaner::cleanBool('display_on_site', $data); - $data = MultipartFormDataCleaner::cleanBool('featured', $data); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, PresentationSlideValidationRulesFactory::build($data)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - ]; - - $slide = $this->presentation_service->addSlideTo - ( - $request, - $presentation_id, - HTMLCleaner::cleanData($data, $fields), - array_merge(FileTypes::ImagesExntesions, FileTypes::SlidesExtensions), - intval(Config::get("mediaupload.slides_max_file_size")) - ); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($slide)->serialize()); - } 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); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @param $slide_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updatePresentationSlide(LaravelRequest $request, $summit_id, $presentation_id, $slide_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $data = $request->all(); - $data = MultipartFormDataCleaner::cleanBool('display_on_site', $data); - $data = MultipartFormDataCleaner::cleanBool('featured', $data); - $data = MultipartFormDataCleaner::cleanInt('order', $data); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, PresentationSlideValidationRulesFactory::build($data, true)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - ]; - - $slide = $this->presentation_service->updateSlide - ( - $request, - $presentation_id, - $slide_id, - HTMLCleaner::cleanData($data, $fields), - array_merge(FileTypes::ImagesExntesions, FileTypes::SlidesExtensions), - intval(Config::get("mediaupload.slides_max_file_size")) - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($slide)->serialize()); - } 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); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $slide_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deletePresentationSlide($summit_id, $presentation_id, $slide_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $this->presentation_service->deleteSlide($presentation_id, $slide_id); - - return $this->deleted(); - } 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); - } - } - - // Links - - /** - * @param $summit_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getPresentationLinks($summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) return $this->error404(); - - $links = $presentation->getLinks(); - - $items = []; - foreach ($links as $i) { - if ($i instanceof IEntity) { - $i = SerializerRegistry::getInstance()->getSerializer($i)->serialize(); - } - $items[] = $i; - } - - return $this->ok($items); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $link_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getPresentationLink($summit_id, $presentation_id, $link_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) return $this->error404(); - - $link = $presentation->getLinkBy($link_id); - - if (is_null($link)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($link)->serialize()); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addPresentationLink(LaravelRequest $request, $summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $data = $request->all(); - $data = MultipartFormDataCleaner::cleanBool('display_on_site', $data); - $data = MultipartFormDataCleaner::cleanBool('featured', $data); - - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, PresentationLinkValidationRulesFactory::build($data)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - ]; - - $link = $this->presentation_service->addLinkTo($presentation_id, HTMLCleaner::cleanData($data, $fields)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($link)->serialize()); - } 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); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @param $link_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updatePresentationLink(LaravelRequest $request, $summit_id, $presentation_id, $link_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $data = $request->all(); - $data = MultipartFormDataCleaner::cleanBool('display_on_site', $data); - $data = MultipartFormDataCleaner::cleanBool('featured', $data); - $data = MultipartFormDataCleaner::cleanInt('order', $data); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, PresentationLinkValidationRulesFactory::build($data, true)); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - ]; - - $link = $this->presentation_service->updateLink($presentation_id, $link_id, HTMLCleaner::cleanData($data, $fields)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($link)->serialize()); - } 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); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $link_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deletePresentationLink($summit_id, $presentation_id, $link_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $this->presentation_service->deleteLink($presentation_id, $link_id); - - return $this->deleted(); - } 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); - } - } - - // MediaUploads - - /** - * @param $summit_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getPresentationMediaUploads($summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation) || !$presentation instanceof Presentation) return $this->error404(); - - $mediaUploads = $presentation->getMediaUploads(); - - $items = []; - foreach ($mediaUploads as $i) { - if ($i instanceof IEntity) { - $i = SerializerRegistry::getInstance()->getSerializer($i)->serialize(); - } - $items[] = $i; - } - - return $this->ok($items); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $media_upload_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getPresentationMediaUpload($summit_id, $presentation_id, $media_upload_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation) || !$presentation instanceof Presentation) return $this->error404(); - - $mediaUpload = $presentation->getMediaUploadBy($media_upload_id); - - if (is_null($mediaUpload)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($mediaUpload)->serialize()); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addPresentationMediaUpload(LaravelRequest $request, $summit_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $serializeType = SerializerRegistry::SerializerType_Private; - - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - $serializeType = SerializerRegistry::SerializerType_Public; - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $data = $request->all(); - - $rules = [ - 'media_upload_type_id' => 'required|integer', - 'display_on_site' => 'sometimes|boolean', - ]; - $data = MultipartFormDataCleaner::cleanBool('display_on_site', $data); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, $rules); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $mediaUpload = $this->presentation_service->addMediaUploadTo - ( - $request, - $summit, - intval($presentation_id), - $data - ); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->created(SerializerRegistry::getInstance()->getSerializer - ( - $mediaUpload, $serializeType) - ->serialize - ( - Request::input('expand', ''), - $fields, - $relations - ) - ); - } 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); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $presentation_id - * @param $media_upload_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updatePresentationMediaUpload(LaravelRequest $request, $summit_id, $presentation_id, $media_upload_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $serializeType = SerializerRegistry::SerializerType_Private; - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - $serializeType = SerializerRegistry::SerializerType_Public; - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $data = $request->all(); - - $rules = [ - 'display_on_site' => 'sometimes|boolean', - ]; - - $data = MultipartFormDataCleaner::cleanBool('display_on_site', $data); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, $rules); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $mediaUpload = $this->presentation_service->updateMediaUploadFrom - ( - $request, - $summit, - intval($presentation_id), - intval($media_upload_id), - $data - ); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->updated(SerializerRegistry::getInstance()->getSerializer - ( - $mediaUpload, $serializeType) - ->serialize - ( - Request::input('expand', ''), - $fields, - $relations - ) - ); - } 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); - } - } - - /** - * @param $summit_id - * @param $presentation_id - * @param $media_upload_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deletePresentationMediaUpload($summit_id, $presentation_id, $media_upload_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $isAdmin = $current_member->isAdmin() || $current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators); - if (!$isAdmin) { - // check if we could edit presentation - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation) || !$presentation instanceof Presentation) - return $this->error404(); - if (!$current_member->hasSpeaker() || !$presentation->canEdit($current_member->getSpeaker())) - return $this->error403(); - } - - $this->presentation_service->deleteMediaUpload($summit, intval($presentation_id), intval($media_upload_id)); - - return $this->deleted(); - } 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); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function importAssetsFromMUX($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if (!Request::isJson()) return $this->error400(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $data = Input::json(); - $data = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data,[ - 'mux_token_id' => 'required|string', - 'mux_token_secret' => 'required|string', - 'email_to' => 'sometimes|email', - ]); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - VideoStreamUrlMUXProcessingForSummitJob::dispatch( - $summit_id, - $data['mux_token_id'], - $data['mux_token_secret'], - $data['email_to'] ?? null - )->delay(now()->addMinutes(1)); - - return $this->ok(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(['message' => $ex1->getMessage()]); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2PresentationCategoryGroupController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2PresentationCategoryGroupController.php deleted file mode 100644 index 057dc736..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2PresentationCategoryGroupController.php +++ /dev/null @@ -1,580 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->presentation_category_group_service = $presentation_category_group_service; - } - /** - * @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::DefaultPageSize, 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'), [ - 'name' => ['=@', '=='], - 'description' => ['=@', '=='], - 'slug' => ['=@', '=='], - 'track_title' => ['=@', '=='], - 'track_code' => ['=@', '=='], - 'group_title' => ['=@', '=='], - 'group_code' => ['=@', '=='], - 'voting_visible' => ['=='], - 'chair_visible' => ['=='], - 'class_name' => ['=='] - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'slug' => 'sometimes|string', - 'track_title' => 'sometimes|string', - 'track_code' => 'sometimes|string', - 'group_title' => 'sometimes|string', - 'group_code' => 'sometimes|string', - 'voting_visible' => 'sometimes|boolean', - 'chair_visible' => 'sometimes|boolean', - 'class_name' => sprintf('sometimes|in:%s', implode(',',PresentationCategoryGroupConstants::$valid_class_names)), - ], - [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", PresentationCategoryGroupConstants::$valid_class_names) - ), - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'name', - 'slug' - ]); - } - - $data = $this->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); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - // default values - $page = 1; - $per_page = PHP_INT_MAX; - - 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'), [ - 'name' => ['=@', '=='], - 'description' => ['=@', '=='], - 'slug' => ['=@', '=='], - 'track_title' => ['=@', '=='], - 'track_code' => ['=@', '=='], - 'group_title' => ['=@', '=='], - 'group_code' => ['=@', '=='], - 'voting_visible' => ['=='], - 'chair_visible' => ['=='], - 'class_name' => ['=='] - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'slug' => 'sometimes|string', - 'track_title' => 'sometimes|string', - 'track_code' => 'sometimes|string', - 'group_title' => 'sometimes|string', - 'group_code' => 'sometimes|string', - 'voting_visible' => 'sometimes|boolean', - 'chair_visible' => 'sometimes|boolean', - 'class_name' => sprintf('sometimes|in:%s', implode(',',PresentationCategoryGroupConstants::$valid_class_names)), - ], - [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", PresentationCategoryGroupConstants::$valid_class_names) - ), - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'name', - 'slug' - ]); - } - - $data = $this->repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - - $filename = "presentation-category-groups-" . date('Ymd'); - $list = $data->toArray(); - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - ] - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_group_id - * @return mixed - */ - public function getTrackGroupBySummit($summit_id, $track_group_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - - if (is_null($summit)) return $this->error404(); - $track_group = $summit->getCategoryGroupById($track_group_id); - - if(is_null($track_group)) - return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($track_group)->serialize( 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 (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_group_id - * @return mixed - */ - public function updateTrackGroupBySummit($summit_id, $track_group_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = PresentationCategoryGroupValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $track_group = $this->presentation_category_group_service->updateTrackGroup($summit, $track_group_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($track_group)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_group_id - * @return mixed - */ - public function deleteTrackGroupBySummit($summit_id, $track_group_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->presentation_category_group_service->deleteTrackGroup($summit, $track_group_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addTrackGroupBySummit($summit_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = PresentationCategoryGroupValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $track_group = $this->presentation_category_group_service->addTrackGroup($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($track_group)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_group_id - * @param $track_id - * @return mixed - */ - public function associateTrack2TrackGroup($summit_id, $track_group_id, $track_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->presentation_category_group_service->associateTrack2TrackGroup($summit, $track_group_id, $track_id); - - return $this->updated(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_group_id - * @param $track_id - * @return mixed - */ - public function disassociateTrack2TrackGroup($summit_id, $track_group_id, $track_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->presentation_category_group_service->disassociateTrack2TrackGroup($summit, $track_group_id, $track_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_group_id - * @param $group_id - * @return mixed - */ - public function associateAllowedGroup2TrackGroup($summit_id, $track_group_id, $group_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->presentation_category_group_service->associateAllowedGroup2TrackGroup($summit, $track_group_id, $group_id); - - return $this->updated(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_group_id - * @param $group_id - * @return mixed - */ - public function disassociateAllowedGroup2TrackGroup($summit_id, $track_group_id, $group_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->presentation_category_group_service->disassociateAllowedGroup2TrackGroup($summit, $track_group_id, $group_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getMetadata($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->ok - ( - $this->repository->getMetadata($summit) - ); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php deleted file mode 100644 index 70ad0e67..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerActiveInvolvementApiController.php +++ /dev/null @@ -1,74 +0,0 @@ -repository = $repository; - } - - /** - * @return mixed - */ - public function getAll(){ - try { - $involvements = $this->repository->getDefaultOnes(); - $response = new PagingResponse - ( - count($involvements), - count($involvements), - 1, - 1, - $involvements - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php deleted file mode 100644 index faad2e87..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ /dev/null @@ -1,71 +0,0 @@ -repository = $repository; - } - - /** - * @return mixed - */ - public function getAll() - { - try { - $roles = $this->repository->getDefaultOnes(); - $response = new PagingResponse - ( - count($roles), - count($roles), - 1, - 1, - $roles - ); - - return $this->ok($response->toArray($expand = Input::get('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SponsorshipTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SponsorshipTypeApiController.php deleted file mode 100644 index 3ccb4303..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SponsorshipTypeApiController.php +++ /dev/null @@ -1,225 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - use GetAll; - - /** - * @return array - */ - protected function getFilterRules(): array - { - return [ - 'name' => ['==', '=@'], - 'label' => ['==', '=@'], - 'size' => ['==', '=@'], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules(): array - { - return [ - 'name' => 'sometimes|required|string', - 'label' => 'sometimes|required|string', - 'size' => 'sometimes|required|string', - ]; - } - - /** - * @return array - */ - protected function getOrderRules(): array - { - return [ - 'id', - 'name', - 'order', - 'label', - 'size', - ]; - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function add() - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, SponsorshipTypeValidationRulesFactory::build($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $sponsorship_type = $this->service->addSponsorShipType($payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($sponsorship_type)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function get($id) - { - try { - $sponsorship_type = $this->repository->getById($id); - if(is_null($sponsorship_type)) - return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($sponsorship_type)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function update($id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, SponsorshipTypeValidationRulesFactory::build($payload, true)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $sponsorship_type = $this->service->updateSponsorShipType($id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($sponsorship_type)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function delete($id) - { - try { - $this->service->deleteSponsorShipType($id); - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAccessLevelTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAccessLevelTypeApiController.php deleted file mode 100644 index 30188607..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAccessLevelTypeApiController.php +++ /dev/null @@ -1,181 +0,0 @@ - ['=@', '=='], - 'is_default' => [ '=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - 'is_default' => 'sometimes|required|boolean', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - ]; - } - - public function __construct - ( - ISummitAccessLevelTypeRepository $repository, - ISummitRepository $summit_repository, - ISummitAccessLevelTypeService $service, - IResourceServerContext $resource_server_context - ) - { - parent::__construct($resource_server_context); - $this->repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @return IResourceServerContext - */ - protected function getResourceServerContext(): IResourceServerContext - { - return $this->resource_server_context; - } - - /** - * @return IBaseRepository - */ - protected function getRepository(): IBaseRepository - { - return $this->repository; - } - - /** - * @param array $payload - * @return array - */ - protected function getAddValidationRules(array $payload): array - { - return AccessLevelTypeValidationRulesFactory::build($payload); - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - * @throws EntityNotFoundException - * @throws ValidationException - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addAccessLevelType($summit, $payload); - } - - /** - * @param Summit $summit - * @param $child_id - * @return IEntity|null - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getBadgeAccessLevelTypeById($child_id); - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return AccessLevelTypeValidationRulesFactory::build($payload, true); - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - * @throws EntityNotFoundException - * @throws ValidationException - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateAccessLevelType($summit, $child_id, $payload); - } - - /** - * @param Summit $summit - * @param $child_id - * @throws EntityNotFoundException - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteAccessLevelType($summit, $child_id); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitApiController.php deleted file mode 100644 index 26d94186..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitApiController.php +++ /dev/null @@ -1,863 +0,0 @@ -repository = $summit_repository; - $this->speaker_repository = $speaker_repository; - $this->event_repository = $event_repository; - $this->event_feedback_repository = $event_feedback_repository; - $this->serializer_type_selector = $serializer_type_selector; - $this->build_default_payment_gateway_profile_strategy = $build_default_payment_gateway_profile_strategy; - $this->summit_service = $summit_service; - } - - use ParametrizedGetAll; - - - /** - * @return mixed - */ - public function getSummits() - { - $current_member = $this->resource_server_context->getCurrentUser(); - - if (!is_null($current_member) && !$current_member->isAdmin() && $current_member->isSummitAdmin() && !$current_member->isSummitAdmin()) { - return $this->error403(['message' => sprintf("Member %s has not permission for any Summit", $current_member->getId())]); - } - - return $this->_getAll( - function () { - return [ - 'name' => ['=@', '=='], - 'start_date' => ['==', '<', '>', '<=', '>='], - 'end_date' => ['==', '<', '>', '<=', '>='], - 'registration_begin_date' => ['==', '<', '>', '<=', '>='], - 'registration_end_date' => ['==', '<', '>', '<=', '>='], - 'ticket_types_count' => ['==', '<', '>', '<=', '>=', '<>'], - ]; - }, - function () { - return [ - 'name' => 'sometimes|required|string', - 'start_date' => 'sometimes|required|date_format:U', - 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date', - 'registration_begin_date' => 'sometimes|required|date_format:U', - 'registration_end_date' => 'sometimes|required_with:start_date|date_format:U|after:registration_begin_date', - 'ticket_types_count' => 'sometimes|required|integer' - ]; - }, - function () { - return [ - 'id', - 'name', - 'start_date', - 'registration_begin_date' - ]; - }, - function ($filter) use ($current_member) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('available_on_api', '1')); - if (!is_null($current_member) && !$current_member->isAdmin() && $current_member->isSummitAdmin()) { - // filter only the ones that we are allowed to see - $filter->addFilterCondition - ( - FilterElement::makeEqual - ( - 'summit_id', - $current_member->getAllAllowedSummitsIds(), - "OR" - - ) - ); - - } - } - return $filter; - }, - function () { - return $this->serializer_type_selector->getSerializerType(); - }, - function () { - return new Order([ - OrderElement::buildAscFor("start_date"), - ]); - }, - function () { - return PHP_INT_MAX; - }, - null, - [ - 'build_default_payment_gateway_profile_strategy' => $this->build_default_payment_gateway_profile_strategy - ] - ); - } - - /** - * @return mixed - */ - public function getAllSummits() - { - - $current_member = $this->resource_server_context->getCurrentUser(); - - if (!is_null($current_member) && - !$current_member->isAdmin() && - !$current_member->hasAllowedSummits()) { - return $this->error403(['message' => sprintf("Member %s has not permission for any Summit", $current_member->getId())]); - } - - return $this->_getAll( - function () { - return [ - 'name' => ['=@', '=='], - 'start_date' => ['==', '<', '>', '<=', '>='], - 'end_date' => ['==', '<', '>', '<=', '>='], - 'registration_begin_date' => ['==', '<', '>', '<=', '>='], - 'registration_end_date' => ['==', '<', '>', '<=', '>='], - 'ticket_types_count' => ['==', '<', '>', '<=', '>=', '<>'], - 'submission_begin_date' => ['==', '<', '>', '<=', '>='], - 'submission_end_date' => ['==', '<', '>', '<=', '>='], - 'voting_begin_date' => ['==', '<', '>', '<=', '>='], - 'voting_end_date' => ['==', '<', '>', '<=', '>='], - 'selection_begin_date' => ['==', '<', '>', '<=', '>='], - 'selection_end_date' => ['==', '<', '>', '<=', '>='], - 'selection_plan_enabled' => ['=='], - ]; - }, - function () { - return [ - 'name' => 'sometimes|required|string', - 'start_date' => 'sometimes|required|date_format:U', - 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date', - 'registration_begin_date' => 'sometimes|required|date_format:U', - 'registration_end_date' => 'sometimes|required_with:start_date|date_format:U|after:registration_begin_date', - 'ticket_types_count' => 'sometimes|required|integer', - 'submission_begin_date' => 'sometimes|required|date_format:U', - 'submission_end_date' => 'sometimes|required_with:submission_begin_date|date_format:U', - 'voting_begin_date' => 'sometimes|required|date_format:U', - 'voting_end_date' => 'sometimes|required_with:voting_begin_date|date_format:U', - 'selection_begin_date' =>'sometimes|required|date_format:U', - 'selection_end_date' => 'sometimes|required_with:selection_begin_date|date_format:U', - 'selection_plan_enabled' => 'sometimes|required|boolean', - ]; - }, - function () { - return [ - 'id', - 'name', - 'start_date', - 'registration_begin_date' - ]; - }, - function ($filter) use ($current_member) { - if ($filter instanceof Filter) { - if (!is_null($current_member) && !$current_member->isAdmin() && $current_member->hasAllowedSummits()) { - // filter only the ones that we are allowed to see - $filter->addFilterCondition - ( - FilterElement::makeEqual - ( - 'summit_id', - $current_member->getAllAllowedSummitsIds(), - "OR" - - ) - ); - - } - } - return $filter; - }, - function () { - return $this->serializer_type_selector->getSerializerType(); - } - , - function () { - return new Order([ - OrderElement::buildAscFor("start_date"), - ]); - }, - function () { - return PHP_INT_MAX; - }, - null, - [ - 'build_default_payment_gateway_profile_strategy' => $this->build_default_payment_gateway_profile_strategy - ] - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getSummit($summit_id) - { - $expand = Request::input('expand', ''); - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $current_member = $this->resource_server_context->getCurrentUser(); - - if - ( - !is_null($current_member) && - !$current_member->isAdmin() && - !$current_member->hasPermissionFor($summit) - ) - return $this->error403(['message' => sprintf("Member %s has not permission for this Summit", $current_member->getId())]); - - $serializer_type = $this->serializer_type_selector->getSerializerType(); - return $this->ok - ( - SerializerRegistry::getInstance() - ->getSerializer($summit, $serializer_type) - ->serialize($expand, [], [], [ - 'build_default_payment_gateway_profile_strategy' => $this->build_default_payment_gateway_profile_strategy - ]) - ); - } catch (HTTP403ForbiddenException $ex1) { - Log::warning($ex1); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllCurrentSummit() - { - $expand = Request::input('expand', ''); - - try { - $summit = $this->repository->getCurrent(); - if (is_null($summit)) return $this->error404(); - $current_member = $this->resource_server_context->getCurrentUser(); - if (!is_null($current_member) && !$current_member->isAdmin() && !$current_member->hasPermissionFor($summit)) - return $this->error403(['message' => sprintf("Member %s has not permission for this Summit", $current_member->getId())]); - $serializer_type = $this->serializer_type_selector->getSerializerType(); - return $this->ok - ( - SerializerRegistry::getInstance() - ->getSerializer($summit, $serializer_type) - ->serialize($expand, [], [], [ - 'build_default_payment_gateway_profile_strategy' => $this->build_default_payment_gateway_profile_strategy - ]) - ); - } catch (HTTP403ForbiddenException $ex1) { - Log::warning($ex1); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllSummitByIdOrSlug($id) - { - - $expand = Request::input('expand', ''); - - try { - $summit = $this->repository->getById(intval($id)); - if (is_null($summit)) - $summit = $this->repository->getBySlug(trim($id)); - - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (!is_null($current_member) && !$current_member->isAdmin() && !$current_member->hasPermissionFor($summit)) - return $this->error403(['message' => sprintf("Member %s has not permission for this Summit", $current_member->getId())]); - - $serializer_type = $this->serializer_type_selector->getSerializerType(); - - return $this->ok - ( - SerializerRegistry::getInstance() - ->getSerializer($summit, $serializer_type) - ->serialize($expand, [], [], - [ - 'build_default_payment_gateway_profile_strategy' => $this->build_default_payment_gateway_profile_strategy - ]) - ); - } catch (HTTP403ForbiddenException $ex1) { - Log::warning($ex1); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function addSummit() - { - try { - - if (!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $rules = SummitValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules, $messages = [ - 'slug.required' => 'A Slug is required.', - 'schedule_start_date.before_or_equal' => 'Show on schedule page needs to be after the start of the Show And Before of the Show End.', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $summit = $this->summit_service->addSummit($payload); - $serializer_type = $this->serializer_type_selector->getSerializerType(); - return $this->created(SerializerRegistry::getInstance()->getSerializer($summit, $serializer_type)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(['message' => $ex2->getMessage()]); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function updateSummit($summit_id) - { - try { - - if (!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $rules = SummitValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (!is_null($current_member) && !$current_member->isAdmin() && !$current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators)) - return $this->error403(['message' => sprintf("Member %s has not permission for this Summit", $current_member->getId())]); - - $summit = $this->summit_service->updateSummit($summit_id, $payload); - $serializer_type = $this->serializer_type_selector->getSerializerType(); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($summit, $serializer_type)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(['message' => $ex2->getMessage()]); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function deleteSummit($summit_id) - { - try { - - $this->summit_service->deleteSummit($summit_id); - - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(['message' => $ex2->getMessage()]); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getSummitEntityEvents($summit_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - $current_member_id = is_null($current_member) ? null : $current_member->getId(); - - $last_event_id = Request::input('last_event_id', null); - $from_date = Request::input('from_date', null); - $limit = Request::input('limit', 25); - - $rules = [ - 'last_event_id' => 'sometimes|required|integer', - 'from_date' => 'sometimes|required|integer', - 'limit' => 'sometimes|required|integer', - ]; - - $data = []; - - if (!is_null($last_event_id)) { - $data['last_event_id'] = $last_event_id; - } - - if (!is_null($from_date)) { - $data['from_date'] = $from_date; - } - - if (!is_null($limit)) { - $data['limit'] = $limit; - } - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - if (!is_null($from_date)) { - $from_date = new \DateTime("@$from_date", new \DateTimeZone("UTC")); - } - - list($last_event_id, $last_event_date, $list) = $this->summit_service->getSummitEntityEvents - ( - $summit, - $current_member_id, - $from_date, - intval($last_event_id), - intval($limit) - ); - - return $this->ok - ( - //todo: send this new response once that testing is done! - /*array - ( - 'events' => $list, - 'last_event_id' => $last_event_id, - 'last_event_date' => $last_event_date->getTimestamp() - )*/ - $list - ); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $external_order_id - * @return mixed - */ - public function getExternalOrder($summit_id, $external_order_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $order = $this->summit_service->getExternalOrder($summit, $external_order_id); - return $this->ok($order); - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(array('message' => $ex1->getMessage())); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $external_order_id - * @param $external_attendee_id - * @return mixed - */ - public function confirmExternalOrderAttendee($summit_id, $external_order_id, $external_attendee_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new \HTTP401UnauthorizedException; - - $attendee = $this->summit_service->confirmExternalOrderAttendee - ( - new ConfirmationExternalOrderRequest - ( - $summit, - $current_member->getId(), - trim($external_order_id), - trim($external_attendee_id) - ) - ); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($attendee)->serialize()); - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(array('message' => $ex1->getMessage())); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->repository; - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addSummitLogo(LaravelRequest $request, $summit_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $current_member = $this->resource_server_context->getCurrentUser(); - if (!is_null($current_member) && !$current_member->isAdmin() && !$current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators)) - return $this->error403(['message' => sprintf("Member %s has not permission for this Summit", $current_member->getId())]); - - $photo = $this->summit_service->addSummitLogo($summit_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($photo)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteSummitLogo($summit_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (!is_null($current_member) && !$current_member->isAdmin() && !$current_member->hasPermissionForOnGroup($summit, IGroup::SummitAdministrators)) - return $this->error403(['message' => sprintf("Member %s has not permission for this Summit", $current_member->getId())]); - - $this->summit_service->deleteSummitLogo($summit_id); - - return $this->deleted(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $speaker_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addFeatureSpeaker($summit_id, $speaker_id){ - try { - - $this->summit_service->addFeaturedSpeaker(intval($summit_id), intval($speaker_id)); - - return $this->updated(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $speaker_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeFeatureSpeaker($summit_id, $speaker_id){ - try { - - $this->summit_service->removeFeaturedSpeaker(intval($summit_id), intval($speaker_id)); - - return $this->deleted(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllFeatureSpeaker($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function(){ - return [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'id' => ['=='], - 'full_name' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'first_name' => 'sometimes|string', - 'last_name' => 'sometimes|string', - 'email' => 'sometimes|string', - 'id' => 'sometimes|integer', - 'full_name' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'first_name', - 'last_name', - 'id', - 'email', - ]; - }, - function($filter) use($summit){ - return $filter; - }, - function(){ - return $this->serializer_type_selector->getSerializerType(); - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) use($summit) { - return $this->speaker_repository->getFeaturedSpeakers - ( - $summit, - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - }, - [ - 'summit_id' => $summit_id, - 'published' => true, - 'summit' => $summit - ] - ); - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeesApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeesApiController.php deleted file mode 100644 index f8a082bd..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeesApiController.php +++ /dev/null @@ -1,922 +0,0 @@ -summit_repository = $summit_repository; - $this->repository = $attendee_repository; - $this->speaker_repository = $speaker_repository; - $this->event_repository = $event_repository; - $this->event_feedback_repository = $event_feedback_repository; - $this->member_repository = $member_repository; - $this->summit_service = $summit_service; - $this->attendee_service = $attendee_service; - $this->summit_order_service = $summit_order_service; - } - - /** - * Attendees endpoints - */ - - /** - * @param $summit_id - * @return mixed - */ - public function getOwnAttendee($summit_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $type = CheckAttendeeStrategyFactory::Me; - $attendee = CheckAttendeeStrategyFactory::build($type, $this->resource_server_context)->check('me', $summit); - if (is_null($attendee)) return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($attendee)->serialize( - SerializerUtils::getExpand(), - SerializerUtils::getFields(), - SerializerUtils::getRelations() - )); - } catch (\HTTP401UnauthorizedException $ex1) { - Log::warning($ex1); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @return mixed - */ - public function getAttendee($summit_id, $attendee_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = $this->repository->getById($attendee_id); - if (is_null($attendee)) return $this->error404(); - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer - ( - $attendee, - SerializerRegistry::SerializerType_Private - )->serialize - ( - SerializerUtils::getExpand(), - SerializerUtils::getFields(), - SerializerUtils::getRelations(), - ['serializer_type' => SerializerRegistry::SerializerType_Private] - )); - } catch (\HTTP401UnauthorizedException $ex1) { - Log::warning($ex1); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @return mixed - */ - public function getAttendeeSchedule($summit_id, $attendee_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit); - if (is_null($attendee)) return $this->error404(); - - $schedule = []; - foreach ($attendee->getSchedule() as $attendee_schedule) { - if (!$summit->isEventOnSchedule($attendee_schedule->getEvent()->getId())) continue; - $schedule[] = SerializerRegistry::getInstance()->getSerializer($attendee_schedule)->serialize(); - } - - return $this->ok($schedule); - } catch (\HTTP401UnauthorizedException $ex1) { - Log::warning($ex1); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @param $event_id - * @return mixed - */ - public function addEventToAttendeeSchedule($summit_id, $attendee_id, $event_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit); - if (is_null($attendee)) return $this->error404(); - - $this->summit_service->addEventToMemberSchedule($summit, $attendee->getMember(), intval($event_id)); - - return $this->created(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @param $event_id - * @return mixed - */ - public function removeEventFromAttendeeSchedule($summit_id, $attendee_id, $event_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit); - if (is_null($attendee)) return $this->error404(); - - $this->summit_service->removeEventFromMemberSchedule($summit, $attendee->getMember(), intval($event_id)); - - return $this->deleted(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @param $event_id - * @return mixed - */ - public function deleteEventRSVP($summit_id, $attendee_id, $event_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $event = $summit->getScheduleEvent(intval($event_id)); - - if (is_null($event)) { - return $this->error404(); - } - - $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit); - if (is_null($attendee)) return $this->error404(); - - $this->summit_service->unRSVPEvent($summit, $attendee->getMember(), $event_id); - - return $this->deleted(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAttendeesBySummit($summit_id) - { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - SynchAllAttendeesStatus::dispatch($summit->getId()); - - return $this->_getAll( - function () { - return [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'full_name' => ['=@', '=='], - 'company' => ['=@', '=='], - 'email' => ['=@', '=='], - 'external_order_id' => ['=@', '=='], - 'external_attendee_id' => ['=@', '=='], - 'member_id' => ['==', '>'], - 'ticket_type' => ['=@', '=='], - 'badge_type' => ['=@', '=='], - 'status' => ['=@', '=='], - 'has_member' => ['=='], - 'has_tickets' => ['=='], - 'tickets_count' => ['==', '>=', '<=', '>', '<'], - ]; - }, - function () { - return [ - 'first_name' => 'sometimes|string', - 'last_name' => 'sometimes|string', - 'full_name' => 'sometimes|string', - 'company' => 'sometimes|string', - 'email' => 'sometimes|string', - 'external_order_id' => 'sometimes|string', - 'external_attendee_id' => 'sometimes|string', - 'member_id' => 'sometimes|integer', - 'ticket_type' => 'sometimes|string', - 'badge_type' => 'sometimes|string', - 'status' => 'sometimes|string', - 'has_member' => 'sometimes|required|string|in:true,false', - 'has_tickets'=> 'sometimes|required|string|in:true,false', - 'tickets_count' => 'sometimes|integer', - ]; - }, - function () { - return [ - 'first_name', - 'last_name', - 'email', - 'full_name', - 'company', - 'id', - 'external_order_id', - 'member_id', - 'status', - 'full_name', - ]; - }, - function ($filter) use ($summit) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Private; - } - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAttendeesBySummitCSV($summit_id) - { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAllCSV( - function () { - return [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'full_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'external_order_id' => ['=@', '=='], - 'company' => ['=@', '=='], - 'external_attendee_id' => ['=@', '=='], - 'member_id' => ['==', '<=', '>='], - 'ticket_type' => ['=@', '=='], - 'badge_type' => ['=@', '=='], - 'status' => ['=@', '=='], - 'has_member' => ['=='], - 'has_tickets' => ['=='], - 'tickets_count' => ['==', '>=', '<=', '>', '<'], - ]; - }, - function () { - return [ - 'first_name' => 'sometimes|string', - 'last_name' => 'sometimes|string', - 'full_name' => 'sometimes|string', - 'email' => 'sometimes|string', - 'external_order_id' => 'sometimes|string', - 'external_attendee_id' => 'sometimes|string', - 'company' => 'sometimes|string', - 'member_id' => 'sometimes|integer', - 'ticket_type' => 'sometimes|string', - 'badge_type' => 'sometimes|string', - 'status' => 'sometimes|string', - 'has_member' => 'sometimes|required|string|in:true,false', - 'has_tickets'=> 'sometimes|required|string|in:true,false', - 'tickets_count' => 'sometimes|integer', - ]; - }, - function () { - return [ - 'first_name', - 'last_name', - 'id', - 'external_order_id', - 'company', - 'member_id', - 'status', - 'email', - 'full_name', - ]; - }, - function ($filter) use ($summit) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_CSV; - }, - function () { - return [ - 'created' => new EpochCellFormatter(), - 'last_edited' => new EpochCellFormatter(), - 'disclaimer_accepted_date' => new EpochCellFormatter(), - ]; - }, - function () { - return []; - }, - 'attendees-' - ); - } - - /** - * @param int $summit_id - * @return mixed - */ - public function addAttendee($summit_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'shared_contact_info' => 'sometimes|boolean', - 'summit_hall_checked_in' => 'sometimes|boolean', - 'disclaimer_accepted' => 'sometimes|boolean', - 'first_name' => 'required_without:member_id|string|max:255', - 'surname' => 'required_without:member_id|string|max:255', - 'admin_notes' => 'nullable|sometimes|string|max:1024', - 'company' => 'nullable|sometimes|string|max:255', - 'email' => 'required_without:member_id|string|max:255|email', - 'member_id' => 'required_without:email|integer', - 'extra_questions' => 'sometimes|extra_question_dto_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $attendee = $this->attendee_service->addAttendee($summit, $data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($attendee)->serialize( - SerializerUtils::getExpand(), - SerializerUtils::getFields(), - SerializerUtils::getRelations() - )); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @return mixed - */ - public function deleteAttendee($summit_id, $attendee_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = $this->repository->getById($attendee_id); - if (is_null($attendee)) return $this->error404(); - - $this->attendee_service->deleteAttendee($summit, $attendee->getIdentifier()); - - return $this->deleted(); - - } catch (\HTTP401UnauthorizedException $ex1) { - Log::warning($ex1); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param int $summit_id - * @param int $attendee_id - * @return mixed - */ - public function updateAttendee($summit_id, $attendee_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = $this->repository->getById($attendee_id); - if (is_null($attendee)) return $this->error404(); - - $rules = [ - 'shared_contact_info' => 'sometimes|boolean', - 'summit_hall_checked_in' => 'sometimes|boolean', - 'disclaimer_accepted' => 'sometimes|boolean', - 'first_name' => 'required_without:member_id|string|max:255', - 'surname' => 'required_without:member_id|string|max:255', - 'company' => 'nullable|sometimes|string|max:255', - 'email' => 'required_without:member_id|string|max:255|email', - 'member_id' => 'required_without:email|integer', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'admin_notes' => 'nullable|sometimes|string|max:1024', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $attendee = $this->attendee_service->updateAttendee($summit, $attendee_id, $data->all()); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($attendee)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @return mixed - */ - public function addAttendeeTicket($summit_id, $attendee_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = $this->repository->getById($attendee_id); - if (is_null($attendee) || !$attendee instanceof SummitAttendee) return $this->error404(); - - $rules = [ - 'ticket_type_id' => 'required|integer', - 'promo_code' => 'nullable|string', - 'external_order_id' => 'nullable|string', - 'external_attendee_id' => 'nullable|string', - ]; - - $payload = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $payload['owner_email'] = $attendee->getEmail(); - $payload['owner_first_name'] = $attendee->getFirstName(); - $payload['owner_last_name'] = $attendee->getSurname(); - $payload['owner_company'] = $attendee->getCompanyName(); - - if ($attendee->hasMember()) - $payload['owner_id'] = $attendee->getMemberId(); - - $ticket = $this->summit_order_service->createOrderSingleTicket($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize - ( - SerializerUtils::getExpand(), - SerializerUtils::getFields(), - SerializerUtils::getRelations() - )); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @param $ticket_id - * @return mixed - */ - public function deleteAttendeeTicket($summit_id, $attendee_id, $ticket_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = $this->repository->getById($attendee_id); - if (is_null($attendee)) return $this->error404(); - - $ticket = $this->attendee_service->deleteAttendeeTicket($attendee, $ticket_id); - - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @param $ticket_id - * @param $other_member_id - * @return mixed - */ - public function reassignAttendeeTicketByMember($summit_id, $attendee_id, $ticket_id, $other_member_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = $this->repository->getById($attendee_id); - if (is_null($attendee) || !$attendee instanceof SummitAttendee) return $this->error404(); - - $other_member = $this->member_repository->getById($other_member_id); - if (is_null($other_member) || !$other_member instanceof Member) return $this->error404(); - - $ticket = $this->attendee_service->reassignAttendeeTicketByMember($summit, $attendee, $other_member, intval($ticket_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( - SerializerUtils::getExpand(), - SerializerUtils::getFields(), - SerializerUtils::getRelations() - )); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $attendee_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function reassignAttendeeTicket($summit_id, $attendee_id, $ticket_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attendee = $this->repository->getById($attendee_id); - if (is_null($attendee) || !$attendee instanceof SummitAttendee) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'attendee_first_name' => 'nullable|string|max:255', - 'attendee_last_name' => 'nullable|string|max:255', - 'attendee_email' => 'required|string|max:255|email', - 'attendee_company' => 'nullable|string|max:255', - 'extra_questions' => 'sometimes|extra_question_dto_array' - ]); - - $ticket = $this->attendee_service->reassignAttendeeTicket($summit, $attendee, intval($ticket_id), $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( - SerializerUtils::getExpand(), - SerializerUtils::getFields(), - SerializerUtils::getRelations() - )); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function send($summit_id) - { - try { - - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, [ - 'email_flow_event' => 'required|string|in:' . join(',', [ - SummitAttendeeTicketRegenerateHashEmail::EVENT_SLUG, - InviteAttendeeTicketEditionMail::EVENT_SLUG - ]), - 'attendees_ids' => 'sometimes|int_array', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $filter = null; - - if (Input::has('filter')) { - $filter = FilterParser::parse(Input::get('filter'), [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'full_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'external_order_id' => ['=@', '=='], - 'company' => ['=@', '=='], - 'external_attendee_id' => ['=@', '=='], - 'member_id' => ['==', '<=', '>='], - 'ticket_type' => ['=@', '=='], - 'badge_type' => ['=@', '=='], - 'status' => ['=@', '=='], - 'has_member' => ['=='], - 'tickets_count' => ['==', '>=', '<=', '>', '<'], - 'has_tickets' => ['=='], - ]); - } - - if (is_null($filter)) - $filter = new Filter(); - - $filter->validate([ - 'first_name' => 'sometimes|string', - 'last_name' => 'sometimes|string', - 'full_name' => 'sometimes|string', - 'company' => 'sometimes|string', - 'email' => 'sometimes|string', - 'external_order_id' => 'sometimes|string', - 'external_attendee_id' => 'sometimes|string', - 'member_id' => 'sometimes|integer', - 'ticket_type' => 'sometimes|string', - 'badge_type' => 'sometimes|string', - 'status' => 'sometimes|string', - 'has_member' => 'sometimes|required|string|in:true,false', - 'tickets_count' => 'sometimes|integer', - 'has_tickets'=> 'sometimes|required|string|in:true,false', - ]); - - $this->attendee_service->triggerSend($summit, $payload, Input::get('filter')); - - return $this->ok(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php deleted file mode 100644 index e2bfadae..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeFeatureTypeApiController.php +++ /dev/null @@ -1,252 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - - /** - * @return array - */ - protected function getFilterRules():array - { - return [ - 'name' => ['=@', '=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - ]; - } - - use GetAllBySummit; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return SummitBadgeFeatureTypeValidationRulesFactory::build($payload); - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addBadgeFeatureType($summit, $payload); - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @return IResourceServerContext - */ - protected function getResourceServerContext(): IResourceServerContext - { - return $this->resource_server_context; - } - - /** - * @return IBaseRepository - */ - protected function getRepository(): IBaseRepository - { - return $this->repository; - } - - /** - * @param Summit $summit - * @param $child_id - * @return void - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteBadgeFeatureType($summit, $child_id); - } - - /** - * @param Summit $summit - * @param $child_id - * @return IEntity|null - */ - protected function getChildFromSummit(Summit $summit,$child_id): ?IEntity - { - return $summit->getFeatureTypeById($child_id); - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return SummitBadgeFeatureTypeValidationRulesFactory::build($payload, true); - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateBadgeFeatureType($summit, $child_id, $payload); - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addFeatureImage(LaravelRequest $request, $summit_id, $feature_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $image = $this->service->addFeatureImage($summit, $feature_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($image)->serialize()); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteFeatureImage($summit_id, $feature_id) { - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->service->removeFeatureImage($summit, $feature_id); - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeScanApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeScanApiController.php deleted file mode 100644 index 4d82f1c0..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeScanApiController.php +++ /dev/null @@ -1,376 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - use AddSummitChildElement; - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return [ - 'qr_code' => 'required|string', - 'scan_date' => 'required|date_format:U', - ]; - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new HTTP403ForbiddenException(); - - return $this->service->addBadgeScan($summit, $current_member, $payload); - } - - /** - * @param $summit_id - * @param $sponsor_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addGrant($summit_id, $sponsor_id){ - try{ - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new HTTP403ForbiddenException(); - - $grant = $this->service->addGrant($summit, intval($sponsor_id), $current_member); - return $this->created(SerializerRegistry::getInstance()->getSerializer - ( - $grant, - $this->addSerializerType() - )->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - // traits - use ParametrizedGetAll; - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllMyBadgeScans($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - return $this->_getAll( - function(){ - return [ - 'attendee_first_name' => ['=@', '=='], - 'attendee_last_name' => ['=@', '=='], - 'attendee_full_name' => ['=@', '=='], - 'attendee_email' => ['=@', '=='], - 'ticket_number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'attendee_first_name' => 'sometimes|string', - 'attendee_last_name' => 'sometimes|string', - 'attendee_full_name' => 'sometimes|string', - 'attendee_email' => 'sometimes|string', - 'ticket_number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'id', - 'scan_date' - ]; - }, - function($filter) use($summit, $current_member){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - $filter->addFilterCondition(FilterElement::makeEqual('user_id', $current_member->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - } - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummit($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $sponsor = null; - if(!$current_member->isAdmin()){ - $sponsor = $current_member->getSponsorBySummit($summit); - if(is_null($sponsor)){ - return $this->error403(); - } - } - - return $this->_getAll( - function(){ - return [ - 'attendee_first_name' => ['=@', '=='], - 'attendee_last_name' => ['=@', '=='], - 'attendee_full_name' => ['=@', '=='], - 'attendee_email' => ['=@', '=='], - 'ticket_number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - 'sponsor_id' => ['=='], - 'attendee_company' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'attendee_first_name' => 'sometimes|string', - 'attendee_last_name' => 'sometimes|string', - 'attendee_full_name' => 'sometimes|string', - 'attendee_email' => 'sometimes|string', - 'ticket_number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - 'sponsor_id' => 'sometimes|integer', - 'attendee_company' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'id', - 'attendee_full_name', - 'attendee_email', - 'attendee_first_name', - 'attendee_last_name', - 'attendee_company', - 'scan_date' - ]; - }, - function($filter) use($summit, $sponsor){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - if(!is_null($sponsor)){ - $filter->addFilterCondition(FilterElement::makeEqual('sponsor_id', $sponsor->getId())); - } - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - } - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $sponsor = null; - if(!$current_member->isAdmin()){ - $sponsor = $current_member->getSponsorBySummit($summit); - if(is_null($sponsor)){ - return $this->error403(); - } - } - - return $this->_getAllCSV( - function(){ - return [ - 'attendee_first_name' => ['=@', '=='], - 'attendee_last_name' => ['=@', '=='], - 'attendee_full_name' => ['=@', '=='], - 'attendee_email' => ['=@', '=='], - 'ticket_number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - 'sponsor_id' => ['=='], - 'attendee_company' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'attendee_first_name' => 'sometimes|string', - 'attendee_last_name' => 'sometimes|string', - 'attendee_full_name' => 'sometimes|string', - 'attendee_email' => 'sometimes|string', - 'ticket_number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - 'sponsor_id' => 'sometimes|integer', - 'attendee_company' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'id', - 'attendee_full_name', - 'attendee_email', - 'attendee_first_name', - 'attendee_last_name', - 'attendee_company', - 'scan_date' - ]; - }, - function($filter) use($summit, $sponsor){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - if(!is_null($sponsor)){ - $filter->addFilterCondition(FilterElement::makeEqual('sponsor_id', $sponsor->getId())); - } - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_CSV; - }, - function(){ - return [ - 'scan_date' => new EpochCellFormatter(), - ]; - }, - function(){ - - $allowed_columns = [ - 'scan_date', - 'qr_code', - 'sponsor_id', - 'user_id', - 'badge_id', - 'attendee_first_name', - 'attendee_last_name', - 'attendee_email', - 'attendee_company' - ]; - - $columns_param = Input::get("columns", ""); - $columns = []; - if(!empty($columns_param)) - $columns = explode(',', $columns_param); - $diff = array_diff($columns, $allowed_columns); - if(count($diff) > 0){ - throw new ValidationException(sprintf("columns %s are not allowed!", implode(",", $diff))); - } - if(empty($columns)) - $columns = $allowed_columns; - return $columns; - }, - 'attendees-badge-scans-' - ); - } -} diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeTypeApiController.php deleted file mode 100644 index 08a336a7..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgeTypeApiController.php +++ /dev/null @@ -1,301 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - /** - * @return array - */ - protected function getFilterRules():array - { - return [ - 'name' => ['=@', '=='], - 'is_default' => [ '=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - 'is_default' => 'sometimes|required|boolean', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - ]; - } - - use GetAllBySummit; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return SummitBadgeTypeValidationRulesFactory::build($payload); - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addBadgeType($summit, $payload); - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @return IResourceServerContext - */ - protected function getResourceServerContext(): IResourceServerContext - { - return $this->resource_server_context; - } - - /** - * @return IBaseRepository - */ - protected function getRepository(): IBaseRepository - { - return $this->repository; - } - - /** - * @param Summit $summit - * @param $child_id - * @return void - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteBadgeType($summit, $child_id); - } - - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getBadgeTypeById($child_id); - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return SummitBadgeTypeValidationRulesFactory::build($payload, true); - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateBadgeType($summit, $child_id, $payload); - } - - /** - * @param $summit_id - * @param $badge_type_id - * @param $access_level_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addAccessLevelToBadgeType($summit_id, $badge_type_id, $access_level_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $child = $this->service->addAccessLevelToBadgeType($summit, $badge_type_id, $access_level_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($child)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $badge_type_id - * @param $access_level_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeAccessLevelFromBadgeType($summit_id, $badge_type_id, $access_level_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $child = $this->service->removeAccessLevelFromBadgeType($summit, $badge_type_id, $access_level_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($child)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $badge_type_id - * @param $feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addFeatureToBadgeType($summit_id, $badge_type_id, $feature_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $child = $this->service->addFeatureToBadgeType($summit, $badge_type_id, $feature_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($child)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $badge_type_id - * @param $feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeFeatureFromBadgeType($summit_id, $badge_type_id, $feature_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $child = $this->service->removeFeatureFromBadgeType($summit, $badge_type_id, $feature_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($child)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgesApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgesApiController.php deleted file mode 100644 index 55cac8eb..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgesApiController.php +++ /dev/null @@ -1,166 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummit($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function(){ - return [ - 'owner_first_name' => ['=@', '=='], - 'owner_last_name' => ['=@', '=='], - 'owner_full_name' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'ticket_number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'owner_first_name' => 'sometimes|string', - 'owner_last_name' => 'sometimes|string', - 'owner_full_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'ticket_number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'id', - 'ticket_number', - 'order_number', - 'created' - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Private; - } - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAllCSV( - function(){ - return [ - 'owner_first_name' => ['=@', '=='], - 'owner_last_name' => ['=@', '=='], - 'owner_full_name' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'ticket_number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'owner_first_name' => 'sometimes|string', - 'owner_last_name' => 'sometimes|string', - 'owner_full_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'ticket_number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'id', - 'ticket_number', - 'order_number', - 'created' - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Private; - }, - function(){ - return []; - }, - function(){ - return []; - }, - 'attendees-badges-' - ); - } - - - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBookableRoomsAttributeTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBookableRoomsAttributeTypeApiController.php deleted file mode 100644 index 577ccabf..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBookableRoomsAttributeTypeApiController.php +++ /dev/null @@ -1,592 +0,0 @@ -attribute_type_repository = $attribute_type_repository; - $this->attribute_value_repository = $attribute_value_repository; - $this->summit_repository = $summit_repository; - $this->summit_service = $summit_service; - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBookableRoomAttributeTypes($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'), [ - 'type' => ['==', '=@'], - 'summit_id' => ['=='], - ]); - } - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'type' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'type', - ]); - } - - $filter->addFilterCondition(FilterElement::makeEqual("summit_id", $summit->getId())); - - $data = $this->attribute_type_repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - [], - [], - [] - ) - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addBookableRoomAttributeType($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'type' => 'required|string', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $attr = $this->summit_service->addBookableRoomAttribute($summit, $payload); - return $this->created(SerializerRegistry::getInstance()->getSerializer($attr)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getBookableRoomAttributeType($summit_id, $type_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attr = $summit->getBookableAttributeTypeById($type_id); - if (is_null($attr)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($attr)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - /** - * @param $summit_id - * @param $type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateBookableRoomAttributeType($summit_id, $type_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'type' => 'required|string', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $attr = $this->summit_service->updateBookableRoomAttribute($summit, $type_id, $payload); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($attr)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteBookableRoomAttributeType($summit_id, $type_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->summit_service->deleteBookableRoomAttribute($summit, $type_id); - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - // values - - /** - * @param $summit_id - * @param $type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBookableRoomAttributeValues($summit_id, $type_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(); - - $attr = $summit->getBookableAttributeTypeById($type_id); - if (is_null($attr)) 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'), [ - 'value' => ['==', '=@'], - 'summit_id' => ['=='], - 'type_id' => ['=='], - ]); - } - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'value' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'type_id' => 'sometimes|integer', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'value', - ]); - } - - $filter->addFilterCondition(FilterElement::makeEqual("summit_id", $summit->getId())); - $filter->addFilterCondition(FilterElement::makeEqual("type_id", $attr->getId())); - - $data = $this->attribute_value_repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - [], - [], - [] - ) - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $type_id - * @param $value_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getBookableRoomAttributeValue($summit_id, $type_id, $value_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $attr = $summit->getBookableAttributeTypeById($type_id); - if (is_null($attr)) return $this->error404(); - - $value = $attr->getValueById($value_id); - if (is_null($value)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addBookableRoomAttributeValue($summit_id, $type_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'value' => 'required|string', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->summit_service->addBookableRoomAttributeValue($summit, $type_id, $payload); - return $this->created(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $type_id - * @param $value_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateBookableRoomAttributeValue($summit_id, $type_id, $value_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'value' => 'required|string', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->summit_service->updateBookableRoomAttributeValue($summit, $type_id, $value_id, $payload); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $type_id - * @param $value_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteBookableRoomAttributeValue($summit_id, $type_id, $value_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->summit_service->deleteBookableRoomAttributeValue($summit, $type_id, $value_id); - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitDocumentsApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitDocumentsApiController.php deleted file mode 100644 index e03c3246..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitDocumentsApiController.php +++ /dev/null @@ -1,339 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function add(LaravelRequest $request, $summit_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $request->all(); - - $rules = [ - 'file' => 'required', - 'name' => 'required|string:512', - 'label' => 'required|string:512', - 'description' => 'nullable|string', - 'event_types' => 'sometimes|int_array', - 'show_always' => 'sometimes|boolean', - ]; - - $payload = MultipartFormDataCleaner::cleanBool('show_always', $payload); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - 'label', - ]; - - $document = $this->service->addSummitDocument - ( - $summit, - HTMLCleaner::cleanData($payload, $fields) - - ); - return $this->created(SerializerRegistry::getInstance()->getSerializer($document)->serialize()); - } - 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); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $document_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function update(LaravelRequest $request, $summit_id, $document_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $request->all(); - - $rules = [ - 'file' => 'sometimes', - 'name' => 'nullable|string:512', - 'label' => 'nullable|string:512', - 'description' => 'nullable|string', - 'event_types' => 'sometimes|int_array', - 'show_always' => 'sometimes|boolean', - ]; - - $payload = MultipartFormDataCleaner::cleanBool('show_always', $payload); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $fields = [ - 'name', - 'description', - 'label', - ]; - - $document = $this->service->updateSummitDocument - ( - $summit, - $document_id, - HTMLCleaner::cleanData($payload, $fields) - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($document)->serialize()); - } - 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); - } - } - - /** - * @inheritDoc - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @inheritDoc - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteSummitDocument($summit, $child_id); - } - - /** - * @inheritDoc - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getSummitDocumentById($child_id); - } - - /** - * @return array - */ - protected function getFilterRules():array - { - return [ - 'name' => ['=@', '=='], - 'description' => ['=@', '=='], - 'label' => ['=@', '=='], - 'event_type' => ['=@', '=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - 'description' => 'sometimes|required|string', - 'label' => 'sometimes|required|string', - 'event_type' => 'sometimes|required|string', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - 'label', - ]; - } - - /** - * @param $summit_id - * @param $document_id - * @param $event_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addEventType($summit_id, $document_id, $event_type_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - - $document = $this->service->addEventTypeToSummitDocument - ( - $summit, - $document_id, - $event_type_id - ); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($document)->serialize()); - } - 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); - } - } - - /** - * @param $summit_id - * @param $document_id - * @param $event_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeEventType($summit_id, $document_id, $event_type_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - - $document = $this->service->removeEventTypeFromSummitDocument - ( - $summit, - $document_id, - $event_type_id - ); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($document)->serialize()); - } - 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); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitEmailEventFlowApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitEmailEventFlowApiController.php deleted file mode 100644 index b064f589..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitEmailEventFlowApiController.php +++ /dev/null @@ -1,143 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - /** - * @inheritDoc - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return [ - 'email_template_identifier' => 'sometimes|required|string', - ]; - } - - /** - * @inheritDoc - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateEmailEventFlow($summit, $child_id, $payload); - } - - /** - * @inheritDoc - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getEmailEventById($child_id); - } - - /** - * @return array - */ - protected function getFilterRules():array - { - return [ - 'email_template_identifier' => ['=@', '=='], - 'event_type_name' => ['=@', '=='], - 'flow_name' => ['=@', '=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'email_template_identifier' => 'sometimes|required|string', - 'event_type_name' => 'sometimes|required|string', - 'flow_name' => 'sometimes|required|string', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'email_template_identifier', - ]; - } - - /** - * @param Summit $summit - * @param $child_id - * @throws \models\exceptions\EntityNotFoundException - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteEmailEventFlow($summit, $child_id); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitEventsApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitEventsApiController.php deleted file mode 100644 index 8eb2df64..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitEventsApiController.php +++ /dev/null @@ -1,1373 +0,0 @@ -repository = $summit_repository; - $this->speaker_repository = $speaker_repository; - $this->event_repository = $event_repository; - $this->event_feedback_repository = $event_feedback_repository; - $this->member_repository = $member_repository; - $this->service = $service; - } - - /** - * Events endpoints - */ - - /** - * @param $summit_id - * @return mixed - */ - public function getEvents($summit_id) - { - try - { - $strategy = new RetrieveAllSummitEventsBySummitStrategy($this->repository, $this->event_repository, $this->resource_server_context); - $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); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getEventsCSV($summit_id) - { - try - { - $strategy = new RetrieveAllSummitEventsBySummitCSVStrategy - ( - $this->repository, - $this->event_repository, - $this->resource_server_context - ); - $response = $strategy->getEvents(['summit_id' => $summit_id]); - - $filename = "activities-" . date('Ymd'); - $list = $response->toArray( - null, - [], - ['none'], - [ - 'current_user' => $this->resource_server_context->getCurrentUser(true) - ], - SerializerRegistry::SerializerType_CSV - ); - - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter(), - 'last_edited' => new EpochCellFormatter(), - 'start_date' => new EpochCellFormatter(), - 'end_date' => new EpochCellFormatter(), - 'allow_feedback' => new BooleanCellFormatter(), - 'is_published' => new BooleanCellFormatter(), - 'rsvp_external' => new BooleanCellFormatter(), - ] - ); - } - 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); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getScheduledEvents($summit_id) - { - try - { - $expand = Request::input('expand', ''); - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) :[]; - $fields = !empty($fields) ? explode(',', $fields) :[]; - $params = ['summit_id' => $summit_id]; - $strategy = new RetrievePublishedSummitEventsBySummitStrategy($this->repository, $this->event_repository, $this->resource_server_context); - $response = $strategy->getEvents($params); - return $this->ok($response->toArray($expand, $fields, $relations, $params)); - } - 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); - } - } - - use ParametrizedGetAll; - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getScheduledEventsTags($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->getRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function(){ - return [ - 'tag' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'tag' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'tag' - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters){ - return $this->event_repository->getAllPublishedTagsByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } - - /** - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllEvents() - { - try - { - $strategy = new RetrieveAllSummitEventsStrategy($this->event_repository); - $response = $strategy->getEvents(); - 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); - } - } - - /** - * @return mixed - */ - public function getAllScheduledEvents() - { - try - { - $strategy = new RetrieveAllPublishedSummitEventsStrategy($this->event_repository); - $response = $strategy->getEvents(); - 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); - } - } - - /** - * @param $summit_id - * @param $event_id - * @param string $expand - * @param string $fields - * @param string $relations - * @param bool $published - * @return array - * @throws EntityNotFoundException - */ - private function _getSummitEvent($summit_id, $event_id, $expand = '', $fields = '', $relations = '', $published = true) - { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) throw new EntityNotFoundException; - - $event = $published ? $summit->getScheduleEvent(intval($event_id)) : $summit->getEvent(intval($event_id)); - - if (is_null($event)) throw new EntityNotFoundException; - $relations = !empty($relations) ? explode(',', $relations) : array(); - $fields = !empty($fields) ? explode(',', $fields) : array(); - - return SerializerRegistry::getInstance()->getSerializer($event)->serialize($expand, $fields, $relations); - } - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function getEvent($summit_id, $event_id) - { - try { - - $expand = Request::input('expand', ''); - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - return $this->ok($this->_getSummitEvent($summit_id, $event_id, $expand, $fields, $relations, false)); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function getScheduledEvent($summit_id, $event_id) - { - try { - - $expand = Request::input('expand', ''); - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - return $this->ok($this->_getSummitEvent($summit_id, $event_id, $expand, $fields, $relations, true)); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - use ValidateEventUri; - - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function shareScheduledEventByEmail($summit_id, $event_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload( [ - 'from' => 'required|email', - 'to' => 'required|email', - 'event_uri' => 'sometimes|url', - ]); - - $this->service->shareEventByEmail($summit, $event_id, $this->validateEventUri($payload)); - - return $this->ok(); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addEvent($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $current_member = $this->resource_server_context->getCurrentUser(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, SummitEventValidationRulesFactory::build($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = [ - 'title', - 'description', - 'social_summary', - ]; - - $event = $this->service->addEvent($summit, HTMLCleaner::cleanData($payload, $fields)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($event)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function updateEvent($summit_id, $event_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $payload = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, SummitEventValidationRulesFactory::build($payload, true)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = [ - 'title', - 'description', - 'social_summary', - ]; - - $event = $this->service->updateEvent($summit, $event_id, HTMLCleaner::cleanData($payload, $fields)); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($event)->serialize()); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function publishEvent($summit_id, $event_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $rules = array - ( - 'location_id' => 'sometimes|required|integer', - 'start_date' => 'sometimes|required|date_format:U', - 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date', - ); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $this->service->publishEvent($summit, $event_id, $data->all()); - - return $this->updated(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function unPublishEvent($summit_id, $event_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if(!Request::isJson()) return $this->error400(); - - - $this->service->unPublishEvent($summit, $event_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function deleteEvent($summit_id, $event_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->service->deleteEvent($summit, $event_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** Feedback endpoints */ - - /** - * @param $summit_id - * @param $event_id - * @return mixed - */ - public function getEventFeedback($summit_id, $event_id) - { - - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $values = Input::all(); - - $rules = array - ( - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ); - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412($messages); - } - - $event = $summit->getScheduleEvent(intval($event_id)); - - if (is_null($event)) { - return $this->error404(); - } - - $filter = null; - // default values - $page = 1; - $per_page = 5; - - if (Input::has('page')) - { - $page = intval(Input::get('page')); - $per_page = intval(Input::get('per_page')); - } - - $order = null; - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), array - ( - 'created_date', - 'owner_id', - 'rate', - 'id', - )); - } - - $response = $this->event_feedback_repository->getByEvent($event, new PagingInfo($page, $per_page), $filter, $order); - - return $this->ok($response->toArray(Request::input('expand', ''))); - - } - catch(FilterParserException $ex1){ - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addMyEventFeedbackReturnId($summit_id, $event_id){ - return $this->_addMyEventFeedback($summit_id, $event_id, true); - } - - /** - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addMyEventFeedback($summit_id, $event_id){ - return $this->_addMyEventFeedback($summit_id, $event_id, false); - } - /** - * @param $summit_id - * @param $event_id - * @param bool $returnId - * @return \Illuminate\Http\JsonResponse|mixed - */ - private function _addMyEventFeedback($summit_id, $event_id, $returnId = false){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $payload = $this->getJsonPayload([ - 'rate' => 'required|integer|digits_between:0,5', - 'note' => 'max:500', - ]); - - $feedback = $this->service->addMyEventFeedback - ( - $current_member, - $summit, - $event_id, - $payload - ); - - if($returnId){ - return $this->updated($feedback->getId()); - } - - return $this->created(SerializerRegistry::getInstance()->getSerializer($feedback)->serialize - ( - Request::input('expand', '') - )); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateMyEventFeedbackReturnId($summit_id, $event_id){ - return $this->_updateMyEventFeedback($summit_id, $event_id, true); - } - - /** - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateMyEventFeedback($summit_id, $event_id){ - return $this->_updateMyEventFeedback($summit_id, $event_id, false); - } - - /** - * @param $summit_id - * @param $event_id - * @param bool $returnId - * @return \Illuminate\Http\JsonResponse|mixed - */ - private function _updateMyEventFeedback($summit_id, $event_id, $returnId = false) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $payload = $this->getJsonPayload([ - 'rate' => 'required|integer|digits_between:0,5', - 'note' => 'max:500', - ]); - - $feedback = $this->service->updateMyEventFeedback - ( - $current_member, - $summit, - $event_id, - $payload - ); - - if($returnId){ - return $this->updated($feedback->getId()); - } - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($feedback)->serialize - ( - Request::input('expand', '') - )); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getMyEventFeedback($summit_id, $event_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $feedback = $this->service->getMyEventFeedback - ( - $current_member, - $summit, - $event_id - ); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($feedback)->serialize - ( - Request::input('expand', '') - )); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteMyEventFeedback($summit_id, $event_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->service->deleteMyEventFeedback - ( - $current_member, - $summit, - $event_id - ); - - return $this->deleted(); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addEventAttachment(LaravelRequest $request, $summit_id, $event_id){ - - try { - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $res = $this->service->addEventAttachment($summit, $event_id, $file); - - return !is_null($res) ? $this->created($res->getId()) : $this->error400(); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch(ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getUnpublishedEvents($summit_id){ - - try - { - $strategy = new RetrieveAllUnPublishedSummitEventsStrategy($this->repository, $this->event_repository, $this->resource_server_context); - - $serializer_type = SerializerRegistry::SerializerType_Public; - $current_member = $this->resource_server_context->getCurrentUser(); - if(!is_null($current_member) && $current_member->isAdmin()){ - $serializer_type = SerializerRegistry::SerializerType_Private; - } - - $response = $strategy->getEvents(['summit_id' => $summit_id]); - return $this->ok($response->toArray(Request::input('expand', ''),[],[],[], $serializer_type)); - } - 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); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getScheduleEmptySpots($summit_id){ - try - { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $filter = null; - if (Input::has('filter')) { - $filter = FilterParser::parse(Input::get('filter'), [ - 'location_id' => ['=='], - 'start_date' => ['>='], - 'end_date' => ['<='], - 'gap' => ['>', '<', '<=', '>=', '=='], - ]); - } - - if(empty($filter)) - throw new ValidationException("filter param is mandatory!"); - - $gaps = []; - foreach ($this->service->getSummitScheduleEmptySpots($summit, $filter) as $gap) - { - $gaps[] = SerializerRegistry::getInstance()->getSerializer($gap)->serialize(); - } - - $response = new PagingResponse - ( - count($gaps), - count($gaps), - 1, - 1, - $gaps - ); - - return $this->ok($response->toArray()); - } - catch (EntityNotFoundException $ex1) - { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (Exception $ex) - { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function unPublishEvents($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = [ - 'events' => 'required|int_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $this->service->unPublishEvents($summit, $data->all()); - - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateAndPublishEvents($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = [ - 'events' => 'required|event_dto_publish_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $this->service->updateAndPublishEvents($summit, $data->all()); - - return $this->updated(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateEvents($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - if(!Request::isJson()) return $this->error400(); - - $data = Input::json(); - - $rules = [ - 'events' => 'required|event_dto_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $this->service->updateEvents($summit, $data->all()); - - return $this->updated(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function cloneEvent($summit_id, $event_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $event = $this->service->cloneEvent($summit, $event_id); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($event)->serialize()); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function addEventImage(LaravelRequest $request, $summit_id, $event_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $image = $this->service->addEventImage($summit, $event_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($image)->serialize()); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deleteEventImage($summit_id, $event_id) { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->service->removeEventImage($summit, $event_id); - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - */ - public function importEventData(LaravelRequest $request, $summit_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $payload = $request->all(); - - $rules = [ - 'file' => 'required', - 'send_speaker_email' => 'required|boolean', - ]; - - $payload = MultipartFormDataCleaner::cleanBool('send_speaker_email', $payload); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $ex = new ValidationException; - $ex->setMessages($validation->messages()->toArray()); - throw $ex; - } - - $file = $request->file('file'); - - $this->service->importEventData($summit, $file, $payload); - - return $this->ok(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitLocationsApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitLocationsApiController.php deleted file mode 100644 index c0a7d61a..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitLocationsApiController.php +++ /dev/null @@ -1,2442 +0,0 @@ -repository = $summit_repository; - $this->speaker_repository = $speaker_repository; - $this->event_repository = $event_repository; - $this->member_repository = $member_repository; - $this->event_feedback_repository = $event_feedback_repository; - $this->location_repository = $location_repository; - $this->location_banners_repository = $location_banners_repository; - $this->location_service = $location_service; - $this->summit_service = $summit_service; - $this->reservation_repository = $reservation_repository; - } - - /** - * @param $summit_id - * @return mixed - */ - public function getLocations($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->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'), [ - 'class_name' => ['=='], - 'name' => ['==', '=@'], - 'description' => ['=@'], - 'address_1' => ['=@'], - 'address_2' => ['=@'], - 'zip_code' => ['==','=@'], - 'city' => ['==','=@'], - 'state' => ['==','=@'], - 'country' => ['==','=@'], - 'sold_out' => ['=='], - 'is_main' => ['=='], - ]); - } - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'class_name' => sprintf('sometimes|in:%s',implode(',', SummitLocationConstants::$valid_first_level_class_names)), - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'address_1' => 'sometimes|string', - 'address_2' => 'sometimes|string', - 'zip_code' => 'sometimes|string', - 'city' => 'sometimes|string', - 'state' => 'sometimes|string', - 'country' => 'sometimes|string', - 'sold_out' => 'sometimes|boolean', - 'is_main' => 'sometimes|boolean', - ], [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitLocationConstants::$valid_first_level_class_names) - ) - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'name', - 'order' - ]); - } - - $data = $this->location_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(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getVenues($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - //locations - $locations = array(); - - foreach ($summit->getVenues() as $location) - { - $locations[] = SerializerRegistry::getInstance()->getSerializer($location)->serialize(); - } - - $response = new PagingResponse - ( - count($locations), - count($locations), - 1, - 1, - $locations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getExternalLocations($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - //locations - $locations = array(); - foreach ($summit->getExternalLocations() as $location) - { - $locations[] = SerializerRegistry::getInstance()->getSerializer($location)->serialize(); - } - - $response = new PagingResponse - ( - count($locations), - count($locations), - 1, - 1, - $locations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getHotels($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - //locations - $locations = array(); - foreach ($summit->getHotels() as $location) - { - $locations[] = SerializerRegistry::getInstance()->getSerializer($location)->serialize(); - } - - $response = new PagingResponse - ( - count($locations), - count($locations), - 1, - 1, - $locations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAirports($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - //locations - $locations = array(); - foreach ($summit->getAirports() as $location) - { - $locations[] = SerializerRegistry::getInstance()->getSerializer($location)->serialize(); - } - - $response = new PagingResponse - ( - count($locations), - count($locations), - 1, - 1, - $locations - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - /** - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function getLocation($summit_id, $location_id) - { - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $location = $summit->getLocation($location_id); - if (is_null($location)) { - return $this->error404(); - } - - if (!Summit::isPrimaryLocation($location)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($location)->serialize($expand,[], $relations)); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param string $summit_id - * @param string $location_id - * @param bool $published - * @return PagingResponse - * @throws EntityNotFoundException - * @throws ValidationException - */ - private function _getLocationEvents($summit_id, $location_id, $published = true) - { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) - throw new EntityNotFoundException; - - if(strtolower($location_id) !== "tbd") { - $location = $summit->getLocation(intval($location_id)); - if (is_null($location)) - throw new EntityNotFoundException; - } - - $values = Input::all(); - - $rules = - [ - 'page' => 'integer|min:1', - 'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::MinPageSize, PagingConstants::MaxPageSize), - ]; - - $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' => ['=@', '=='], - 'start_date' => ['>', '<', '<=', '>=', '=='], - 'end_date' => ['>', '<', '<=', '>=', '=='], - 'speaker' => ['=@', '=='], - 'tags' => ['=@', '=='], - 'event_type_id' => ['=='], - 'track_id' => ['=='] - ]); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), - [ - 'title', - 'start_date', - 'end_date', - 'id', - 'created', - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->addFilterCondition(FilterParser::buildFilter('summit_id','==', $summit_id)); - - if(intval($location_id) > 0) - $filter->addFilterCondition(FilterParser::buildFilter('location_id','==', $location_id)); - - if($published) - { - $filter->addFilterCondition(FilterParser::buildFilter('published','==', 1)); - } - - return strtolower($location_id) === "tbd" ? - $this->event_repository->getAllByPageLocationTBD(new PagingInfo($page, $per_page), $filter, $order): - $this->event_repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - } - - /** - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function getLocationEvents($summit_id, $location_id) - { - try { - return $this->ok($this->_getLocationEvents($summit_id, $location_id, false)->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(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function getLocationPublishedEvents($summit_id, $location_id) - { - try { - return $this->ok($this->_getLocationEvents($summit_id, $location_id, true)->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); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getMetadata($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->ok - ( - $this->location_repository->getMetadata($summit) - ); - } - - /** - * @param $summit_id - * @param $venue_id - * @param $floor_id - * @return mixed - */ - public function getVenueFloor($summit_id, $venue_id, $floor_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($floor)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @return mixed - */ - public function getVenueRoom($summit_id, $venue_id, $room_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $room = $venue->getRoom($room_id); - - if (is_null($room)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $floor_id - * @param $room_id - * @return mixed - */ - public function getVenueFloorRoom($summit_id, $venue_id, $floor_id, $room_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - return $this->error404(); - } - - $room = $floor->getRoom($room_id); - - if (is_null($room)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /*** - * Add Locations Endpoints - */ - - /** - * @param $summit_id - * @return mixed - */ - public function addLocation($summit_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->addLocation($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addVenue($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitVenue::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->addLocation($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addExternalLocation($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitExternalLocation::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->addLocation($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addHotel($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitHotel::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->addLocation($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addAirport($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitAirport::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->addLocation($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $venue_id - * @return mixed - */ - public function addVenueFloor($summit_id, $venue_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $rules = [ - 'name' => 'required|string|max:50', - 'number' => 'required|integer', - 'description' => 'sometimes|string', - ]; - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $floor = $this->location_service->addVenueFloor($summit, $venue_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($floor)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @return mixed - */ - public function addVenueRoom($summit_id, $venue_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $room = $this->location_service->addVenueRoom($summit, $venue_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @return mixed - */ - public function addVenueFloorRoom($summit_id, $venue_id, $floor_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $payload['floor_id'] = intval($floor_id); - - $room = $this->location_service->addVenueRoom($summit, $venue_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * Update Location Endpoints - */ - - /** - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function updateLocation($summit_id, $location_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->updateLocation($summit, $location_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @return mixed - */ - public function updateVenue($summit_id, $venue_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitVenue::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->updateLocation($summit, $venue_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $floor_id - * @return mixed - */ - public function updateVenueFloor($summit_id, $venue_id, $floor_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $rules = [ - 'name' => 'sometimes|string|max:50', - 'number' => 'sometimes|integer', - 'description' => 'sometimes|string', - ]; - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $floor = $this->location_service->updateVenueFloor($summit, $venue_id, $floor_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($floor)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @return mixed - */ - public function updateVenueRoom($summit_id, $venue_id, $room_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $room = $this->location_service->updateVenueRoom($summit, $venue_id, $room_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $floor_id - * @param $room_id - * @return mixed - */ - public function updateVenueFloorRoom($summit_id, $venue_id, $floor_id, $room_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - if(!isset($payload['floor_id'])) - $payload['floor_id'] = intval($floor_id); - - $room = $this->location_service->updateVenueRoom($summit, $venue_id, $room_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $hotel_id - * @return mixed - */ - public function updateHotel($summit_id, $hotel_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitHotel::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->updateLocation($summit, $hotel_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $airport_id - * @return mixed - */ - public function updateAirport($summit_id, $airport_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitAirport::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->updateLocation($summit, $airport_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $external_location_id - * @return mixed - */ - public function updateExternalLocation($summit_id, $external_location_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitExternalLocation::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $location = $this->location_service->updateLocation($summit, $external_location_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($location)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * Delete Location Endpoints - */ - - /** - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function deleteLocation($summit_id, $location_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->location_service->deleteLocation($summit, $location_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deleteVenueFloor($summit_id, $venue_id, $floor_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->location_service->deleteVenueFloor($summit, $venue_id, $floor_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deleteVenueRoom($summit_id, $venue_id, $room_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->location_service->deleteVenueRoom($summit, $venue_id, $room_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * Location Banners Endpoints - */ - - /** - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function getLocationBanners($summit_id, $location_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->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $location = $summit->getLocation($location_id); - if (is_null($location)) 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'), [ - 'class_name' => ['=='], - 'title' => ['==', '=@'], - 'content' => ['=@'], - 'type' => ['=='], - 'enabled' => ['=='], - 'start_date' => ['>', '<', '<=', '>=', '=='], - 'end_date' => ['>', '<', '<=', '>=', '=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'class_name' => sprintf('sometimes|in:%s',implode(',', SummitLocationBannerConstants::$valid_class_names)), - 'title' => 'sometimes|string', - 'content' => 'sometimes|string', - 'type' => sprintf('sometimes|in:%s',implode(',', SummitLocationBannerConstants::$valid_types)), - 'enabled' => 'sometimes|boolean', - 'start_date' => 'sometimes|date_format:U', - 'end_date' => 'sometimes|date_format:U', - ], [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitLocationBannerConstants::$valid_class_names) - ) - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'title', - 'start_date', - 'end_date' - ]); - } - - $data = $this->location_banners_repository->getBySummitLocation($location, new PagingInfo($page, $per_page), $filter, $order); - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - [], - [], - [] - ) - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function addLocationBanner($summit_id, $location_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitLocationBannerValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $messages = [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitLocationBannerConstants::$valid_class_names) - ) - ]; - $validation = Validator::make($payload, $rules, $messages); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $banner = $this->location_service->addLocationBanner - ( - $summit, - $location_id, - HTMLCleaner::cleanData - ( - $payload, ['title', 'content'] - ) - ); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($banner)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $location_id - * @param $banner_id - * @return mixed - */ - public function deleteLocationBanner($summit_id, $location_id, $banner_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->location_service->deleteLocationBanner($summit, $location_id, $banner_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $location_id - * @param $banner_id - * @return mixed - */ - public function updateLocationBanner($summit_id, $location_id, $banner_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitLocationBannerValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $messages = [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitLocationBannerConstants::$valid_class_names) - ) - ]; - $validation = Validator::make($payload, $rules, $messages); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $banner = $this->location_service->updateLocationBanner - ( - $summit, - $location_id, - $banner_id, - HTMLCleaner::cleanData - ( - $payload, ['title', 'content'] - ) - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($banner)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * Location Maps endpoints - */ - - - /** - * @param $summit_id - * @param $location_id - * @param $map_id - * @return mixed - */ - public function getLocationMap($summit_id, $location_id, $map_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $location = $summit->getLocation($location_id); - if (is_null($location)) { - return $this->error404(); - } - - if (!Summit::isPrimaryLocation($location)) { - return $this->error404(); - } - - $map = $location->getMap($map_id); - if (is_null($map)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($map)->serialize($expand,[], $relations)); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function addLocationMap(LaravelRequest $request, $summit_id, $location_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $file = $request->file('file'); - - if(is_null($file)) - throw new ValidationException('file is required.'); - - $metadata = $request->all(); - - $rules = SummitLocationImageValidationRulesFactory::build(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($metadata, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $map = $this->location_service->addLocationMap - ( - $summit, - $location_id, - HTMLCleaner::cleanData - ( - $metadata, ['description'] - ), - $file - ); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($map)->serialize()); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch(ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $location_id - * @param $map_id - * @return mixed - */ - public function updateLocationMap(LaravelRequest $request, $summit_id, $location_id, $map_id){ - - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $data = $request->all(); - $rules = SummitLocationImageValidationRulesFactory::build(true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $map = $this->location_service->updateLocationMap - ( - $summit, - $location_id, - $map_id, - HTMLCleaner::cleanData - ( - $data, ['description'] - ), - $request->hasFile('file') ? $request->file('file'):null - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($map)->serialize()); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch(ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $location_id - * @param $map_id - * @return mixed - */ - public function deleteLocationMap($summit_id, $location_id, $map_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->location_service->deleteLocationMap($summit, $location_id, $map_id); - return $this->deleted(); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch(ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * Location Images endpoints - */ - - /** - * @param $summit_id - * @param $location_id - * @param $image_id - * @return mixed - */ - public function getLocationImage($summit_id, $location_id, $image_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $location = $summit->getLocation($location_id); - if (is_null($location)) { - return $this->error404(); - } - - if(!$location instanceof SummitGeoLocatedLocation){ - return $this->error404(); - } - - $image = $location->getImage($image_id); - if (is_null($image)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($image)->serialize($expand,[], $relations)); - - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $location_id - * @return mixed - */ - public function addLocationImage(LaravelRequest $request, $summit_id, $location_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $file = $request->file('file'); - if(is_null($file)) - throw new ValidationException('file is required.'); - - $metadata = $request->all(); - - $rules = SummitLocationImageValidationRulesFactory::build(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($metadata, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $image = $this->location_service->addLocationImage - ( - $summit, - $location_id, - HTMLCleaner::cleanData - ( - $metadata, ['description'] - ), - $file - ); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($image)->serialize()); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch(ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $location_id - * @param $image_id - * @return mixed - */ - public function updateLocationImage(LaravelRequest $request, $summit_id, $location_id, $image_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $data = $request->all(); - $rules = SummitLocationImageValidationRulesFactory::build(true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $image = $this->location_service->updateLocationImage - ( - $summit, - $location_id, - $image_id, - HTMLCleaner::cleanData - ( - $data, ['description'] - ), - $request->hasFile('file') ? $request->file('file'):null - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($image)->serialize()); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch(ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $location_id - * @param $image_id - * @return mixed - */ - public function deleteLocationImage($summit_id, $location_id, $image_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->location_service->deleteLocationImage($summit, $location_id, $image_id); - return $this->deleted(); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch(ValidationException $ex2) - { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $venue_id - * @param $room_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addVenueRoomImage(LaravelRequest $request, $summit_id, $venue_id, $room_id){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $room = $venue->getRoom($room_id); - - if (is_null($room)) { - return $this->error404(); - } - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $photo = $this->location_service->addRoomImage($summit, intval($venue_id), intval($room_id), $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($photo)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeVenueRoomImage($summit_id, $venue_id, $room_id){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $room = $venue->getRoom($room_id); - - if (is_null($room)) { - return $this->error404(); - } - - $room = $this->location_service->removeRoomImage($summit, intval($venue_id), intval($room_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @param $venue_id - * @param $floor_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addVenueFloorImage(LaravelRequest $request, $summit_id, $venue_id, $floor_id){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - return $this->error404(); - } - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $photo = $this->location_service->addFloorImage($summit, intval($venue_id), intval($floor_id), $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($photo)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $floor_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeVenueFloorImage($summit_id, $venue_id, $floor_id){ - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - return $this->error404(); - } - - $floor = $this->location_service->removeFloorImage($summit, intval($venue_id), intval($floor_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($floor)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - // bookable rooms - - use SummitBookableVenueRoomApi; - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php deleted file mode 100644 index 4fe2a710..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaFileTypeApiController.php +++ /dev/null @@ -1,142 +0,0 @@ -service = $service; - $this->repository = $repository; - } - - - /** - * @inheritDoc - */ - function getAddValidationRules(array $payload): array - { - return [ - 'name' => 'required|string|max:255', - 'description' => 'sometimes|string|max:255', - 'allowed_extensions'=> 'required|string_array', - ]; - } - - /** - * @inheritDoc - */ - protected function addEntity(array $payload): IEntity - { - return $this->service->add($payload); - } - - /** - * @inheritDoc - */ - protected function deleteEntity(int $id): void - { - $this->service->delete($id); - } - - /** - * @inheritDoc - */ - protected function getEntity(int $id): IEntity - { - return $this->repository->getById($id); - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return [ - 'name' => 'sometimes|string|max:255', - 'description' => 'sometimes|string|max:255', - 'allowed_extensions'=> 'required|string_array', - ]; - } - - /** - * @inheritDoc - */ - protected function updateEntity($id, array $payload): IEntity - { - return $this->service->update($id, $payload); - } - - public function getAll(){ - return $this->_getAll( - function(){ - return [ - 'name' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'name' => 'sometimes|string', - ]; - }, - function() - { - return [ - 'name', - 'id', - ]; - }, - function($filter){ - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - } - ); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php deleted file mode 100644 index 41b203a3..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMediaUploadTypeApiController.php +++ /dev/null @@ -1,298 +0,0 @@ -service = $service; - $this->summit_repository = $summit_repository; - $this->repository = $repository; - } - - /** - * @return array - */ - protected function getFilterRules():array - { - return [ - 'name' => ['=@', '=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - ]; - } - - /** - * @inheritDoc - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->add($summit, $payload); - } - - /** - * @inheritDoc - */ - function getAddValidationRules(array $payload): array - { - return [ - 'name' => 'required|string|max:255', - 'description' => 'sometimes|string|max:255', - 'is_mandatory' => 'required|boolean', - // in KB - 'max_size' => 'required|int|megabyte_aligned', - 'private_storage_type' => 'required|string|in:'.implode(",", IStorageTypesConstants::ValidPrivateTypes), - 'public_storage_type' => 'required|string|in:'.implode(",", IStorageTypesConstants::ValidPublicTypes), - 'type_id' => 'required|int', - 'presentation_types' => 'sometimes|int_array', - ]; - } - - /** - * @inheritDoc - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @inheritDoc - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->delete($summit, $child_id); - } - - /** - * @inheritDoc - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getMediaUploadTypeById($child_id); - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return [ - 'name' => 'sometimes|string|max:255', - 'description' => 'sometimes|string|max:255', - 'is_mandatory' => 'sometimes|boolean', - // KB - 'max_size' => 'sometimes|int|megabyte_aligned', - 'private_storage_type' => 'sometimes|string|in:'.implode(",", IStorageTypesConstants::ValidPrivateTypes), - 'public_storage_type' => 'sometimes|string|in:'.implode(",", IStorageTypesConstants::ValidPublicTypes), - 'type_id' => 'sometimes|int', - 'presentation_types' => 'sometimes|int_array', - ]; - } - - /** - * @inheritDoc - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->update($summit, $child_id, $payload); - } - - /** - * @param $summit_id - * @param $media_upload_type_id - * @param $presentation_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addToPresentationType($summit_id, $media_upload_type_id, $presentation_type_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation_type = $this->service->addToPresentationType($summit, intval($media_upload_type_id), intval($presentation_type_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer - ( - $presentation_type - )->serialize()); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $media_upload_type_id - * @param $presentation_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteFromPresentationType($summit_id, $media_upload_type_id, $presentation_type_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation_type = $this->service->deleteFromPresentationType($summit, intval($media_upload_type_id), intval($presentation_type_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer - ( - $presentation_type - )->serialize()); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $to_summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function cloneMediaUploadTypes($summit_id, $to_summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $to_summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($to_summit_id); - if (is_null($to_summit)) return $this->error404(); - - $to_summit = $this->service->cloneMediaUploadTypes($summit, $to_summit); - - return $this->created( - SerializerRegistry::getInstance()->getSerializer - ( - $to_summit - )->serialize() - ); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMembersApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMembersApiController.php deleted file mode 100644 index 7fa8a198..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMembersApiController.php +++ /dev/null @@ -1,950 +0,0 @@ -summit_repository = $summit_repository; - $this->repository = $member_repository; - $this->summit_service = $summit_service; - } - - /** - * @param $summit_id - * @param $member_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getMyMember($summit_id, $member_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $fields = Request::input('fields', null); - $relations = Request::input('relations', null); - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($current_member, SerializerRegistry::SerializerType_Private) - ->serialize - ( - Request::input('expand', ''), - is_null($fields) ? [] : explode(',', $fields), - is_null($relations) ? [] : explode(',', $relations), - ['summit' => $summit] - ) - ); - } - - /** - * @param $summit_id - * @param $member_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getMemberFavoritesSummitEvents($summit_id, $member_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $favorites = array(); - foreach ($current_member->getFavoritesSummitEventsBySummit($summit) as $favorite_event) - { - if(!$summit->isEventOnSchedule($favorite_event->getEvent()->getId())) continue; - $favorites[] = SerializerRegistry::getInstance()->getSerializer($favorite_event)->serialize(Request::input('expand', '')); - } - - $response = new PagingResponse - ( - count($favorites), - count($favorites), - 1, - 1, - $favorites - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (\Exception $ex) - { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function addEventToMemberFavorites($summit_id, $member_id, $event_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->addEventToMemberFavorites($summit, $current_member, intval($event_id)); - - return $this->created(); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (\Exception $ex) - { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function removeEventFromMemberFavorites($summit_id, $member_id, $event_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->removeEventFromMemberFavorites($summit, $current_member, intval($event_id)); - - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (\Exception $ex) - { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @return mixed - */ - public function getMemberScheduleSummitEvents($summit_id, $member_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $schedule = []; - foreach ($current_member->getScheduleBySummit($summit) as $schedule_event) - { - if(!$summit->isEventOnSchedule($schedule_event->getEvent()->getId())) continue; - $schedule[] = SerializerRegistry::getInstance()->getSerializer($schedule_event)->serialize(Request::input('expand', '')); - } - - $response = new PagingResponse - ( - count($schedule), - count($schedule), - 1, - 1, - $schedule - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (\Exception $ex) - { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function addEventToMemberSchedule($summit_id, $member_id, $event_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->addEventToMemberSchedule($summit, $current_member, intval($event_id)); - - return $this->created(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (\Exception $ex) - { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function removeEventFromMemberSchedule($summit_id, $member_id, $event_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->removeEventFromMemberSchedule($summit, $current_member, intval($event_id)); - - return $this->deleted(); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (\Exception $ex) - { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|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'), [ - 'irc' => ['=@', '=='], - 'twitter' => ['=@', '=='], - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'group_slug' => ['=@', '=='], - 'group_id' => ['=='], - 'schedule_event_id' => ['=='], - 'email_verified' => ['=='], - 'active' => ['=='], - 'github_user' => ['=@', '=='], - 'full_name' => ['=@', '=='], - 'created' => ['>', '<', '<=', '>=', '=='], - 'last_edited' => ['>', '<', '<=', '>=', '=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'irc' => 'sometimes|required|string', - 'twitter' => 'sometimes|required|string', - 'first_name' => 'sometimes|required|string', - 'last_name' => 'sometimes|required|string', - 'email' => 'sometimes|required|string', - 'group_slug' => 'sometimes|required|string', - 'group_id' => 'sometimes|required|integer', - 'schedule_event_id' => 'sometimes|required|integer', - 'email_verified' => 'sometimes|required|boolean', - 'active' => 'sometimes|required|boolean', - 'github_user' => 'sometimes|required|string', - 'full_name' => 'sometimes|required|string', - 'created' => 'sometimes|required|date_format:U', - 'last_edited' => 'sometimes|required|date_format:U', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'first_name', - 'last_name', - 'id', - 'created', - 'last_edited', - ]); - } - - $filter->addFilterCondition(FilterElement::makeEqual("summit_id", $summit_id)); - $data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations, - [], - SerializerRegistry::SerializerType_Private - ) - ); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummitCSV($summit_id){ - $values = Input::all(); - - $allowed_columns = [ - "id", - "created", - "last_edited", - "first_name", - "last_name", - "email", - "country", - "gender", - "github_user", - "bio", - "linked_in", - "irc", - "twitter", - "state", - "country", - "active", - "email_verified", - "pic", - "affiliations", - "groups" - ]; - - $rules = [ - ]; - - 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 = PHP_INT_MAX; - - 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'), [ - 'irc' => ['=@', '=='], - 'twitter' => ['=@', '=='], - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'group_slug' => ['=@', '=='], - 'group_id' => ['=='], - 'email_verified' => ['=='], - 'active' => ['=='], - 'github_user' => ['=@', '=='], - 'full_name' => ['=@', '=='], - 'created' => ['>', '<', '<=', '>=', '=='], - 'last_edited' => ['>', '<', '<=', '>=', '=='], - 'schedule_event_id' => ['=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'irc' => 'sometimes|required|string', - 'twitter' => 'sometimes|required|string', - 'first_name' => 'sometimes|required|string', - 'last_name' => 'sometimes|required|string', - 'email' => 'sometimes|required|string', - 'group_slug' => 'sometimes|required|string', - 'group_id' => 'sometimes|required|integer', - 'email_verified' => 'sometimes|required|boolean', - 'active' => 'sometimes|required|boolean', - 'github_user' => 'sometimes|required|string', - 'full_name' => 'sometimes|required|string', - 'created' => 'sometimes|required|date_format:U', - 'last_edited' => 'sometimes|required|date_format:U', - 'schedule_event_id' => 'sometimes|required|integer', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'first_name', - 'last_name', - 'id', - 'created', - 'last_edited', - ]); - } - - $filter->addFilterCondition(FilterElement::makeEqual("summit_id", $summit_id)); - $data = $this->repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - - $filename = "members-" . date('Ymd'); - - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $columns_param = Input::get("columns", ""); - $columns = []; - if(!empty($columns_param)) - $columns = explode(',', $columns_param); - $diff = array_diff($columns, $allowed_columns); - if(count($diff) > 0){ - throw new ValidationException(sprintf("columns %s are not allowed!", implode(",", $diff))); - } - if(empty($columns)) - $columns = $allowed_columns; - - $list = $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations, - [], - SerializerRegistry::SerializerType_Private - ); - - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter(), - 'last_edited' => new EpochCellFormatter(), - 'affiliations' => new CurrentAffiliationsCellFormatter(), - ], - $columns - ); - } - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - use ValidateEventUri; - - use GetAndValidateJsonPayload; - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addEventRSVP($summit_id, $member_id, $event_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'answers' => 'sometimes|rsvp_answer_dto_array', - 'event_uri' => 'sometimes|url', - ]); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $event = $summit->getScheduleEvent(intval($event_id)); - - if (is_null($event)) { - return $this->error404(); - } - - $rsvp = $this->summit_service->addRSVP($summit, $current_member, $event_id, $this->validateEventUri($payload)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($rsvp)->serialize - ( - Request::input('expand', '') - )); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateEventRSVP($summit_id, $member_id, $event_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'answers' => 'sometimes|rsvp_answer_dto_array', - 'event_uri' => 'sometimes|url', - ]); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $event = $summit->getScheduleEvent(intval($event_id)); - - if (is_null($event)) { - return $this->error404(); - } - - $rsvp = $this->summit_service->updateRSVP($summit, $current_member, $event_id, $this->validateEventUri($payload)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($rsvp)->serialize - ( - Request::input('expand', '') - )); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteEventRSVP($summit_id, $member_id, $event_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $event = $summit->getScheduleEvent(intval($event_id)); - - if (is_null($event)) { - return $this->error404(); - } - - $this->summit_service->unRSVPEvent($summit, $current_member, $event_id); - - return $this->deleted(); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - - } - - /** - * @param $summit_id - * @param $member_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function createScheduleShareableLink($summit_id, $member_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $link = $this->summit_service->createScheduleShareableLink($summit, $current_member); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($link)->serialize - ( - Request::input('expand', '') - )); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - - } - - /** - * @param $summit_id - * @param $member_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function revokeScheduleShareableLink($summit_id, $member_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $link = $this->summit_service->revokeScheduleShareableLink($summit, $current_member); - - return $this->deleted(); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - - } - - /** - * @param $summit_id - * @param $cid - * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|mixed - */ - public function getCalendarFeedICS($summit_id, $cid){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $feedBody = $this->summit_service->buildICSFeed($summit, $cid); - - return $this->rawContent($feedBody, [ - 'Content-type' => 'text/calendar', - ]); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMetricsApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMetricsApiController.php deleted file mode 100644 index 64bcc8af..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitMetricsApiController.php +++ /dev/null @@ -1,264 +0,0 @@ -summit_repository = $summit_repository; - $this->repository = $member_repository; - $this->service = $service; - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function enter($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $payload = Input::all(); - if(Request::isJson()){ - $payload = Input::json()->all(); - } - - $validation = Validator::make($payload, - [ - 'type' => 'required|string|in:'.implode(",", ISummitMetricType::ValidTypes), - 'source_id' => 'sometimes|integer', - 'location' => 'sometimes|string', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - $ex = new ValidationException(); - $ex->setMessages($messages); - throw $ex; - } - - $metric = $this->service->enter($summit, $current_member, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($metric)->serialize()); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function leave($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $payload = Input::all(); - if(Request::isJson()){ - $payload = Input::json()->all(); - } - - $validation = Validator::make($payload, - [ - 'type' => 'required|string|in:'.implode(",", ISummitMetricType::ValidTypes), - 'source_id' => 'sometimes|integer', - 'location' => 'sometimes|string', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - $ex = new ValidationException(); - $ex->setMessages($messages); - throw $ex; - } - - $metric = $this->service->leave($summit, $current_member, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($metric)->serialize()); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function enterToEvent($summit_id, $member_id, $event_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $metric = $this->service->enter($summit, $current_member, [ - 'type' => ISummitMetricType::Event, - 'source_id' => intval($event_id) - ]); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($metric)->serialize()); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $member_id - * @param $event_id - * @return mixed - */ - public function leaveFromEvent($summit_id, $member_id, $event_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $metric = $this->service->leave($summit, $current_member, [ - 'type' => ISummitMetricType::Event, - 'source_id' => intval($event_id) - ]); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($metric)->serialize()); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitNotificationsApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitNotificationsApiController.php deleted file mode 100644 index f0ae3da9..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitNotificationsApiController.php +++ /dev/null @@ -1,419 +0,0 @@ -repository = $notification_repository; - $this->push_notification_service = $push_notification_service; - $this->member_repository = $member_repository; - $this->summit_repository = $summit_repository; - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAll($summit_id) - { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function(){ - return [ - 'message' => ['=@', '=='], - 'channel' => ['=='], - 'sent_date' => ['>', '<', '<=', '>=', '=='], - 'created' => ['>', '<', '<=', '>=', '=='], - 'is_sent' => ['=='], - 'approved' => ['=='], - 'event_id' => ['=='], - ]; - }, - function(){ - return [ - 'message' => 'sometimes|string', - 'channel' => 'sometimes|in:EVERYONE,SPEAKERS,ATTENDEES,MEMBERS,SUMMIT,EVENT,GROUP', - 'sent_date' => 'sometimes|date_format:U', - 'created' => 'sometimes|date_format:U', - 'is_sent' => 'sometimes|boolean', - 'approved' => 'sometimes|boolean', - 'event_id' => 'sometimes|integer', - ]; - }, - function() - { - return [ - - 'sent_date', - 'created', - 'id', - ]; - }, - function($filter) use($summit){ - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit){ - return $this->repository->getAllByPageBySummit - ( - $summit, - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - }, - ['summit_id' => $summit_id] - ); - } - - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllApprovedByUser($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - - - return $this->_getAll( - function(){ - return [ - 'message' => ['=@', '=='], - 'sent_date' => ['>', '<', '<=', '>=', '=='], - 'created' => ['>', '<', '<=', '>=', '=='], - ]; - }, - function(){ - return [ - 'message' => 'sometimes|string', - 'sent_date' => 'sometimes|date_format:U', - 'created' => 'sometimes|date_format:U', - ]; - }, - function() - { - return [ - 'sent_date', - 'created', - 'id', - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual("is_sent", true)); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($current_member, $summit){ - return $this->repository->getAllByPageByUserBySummit - ( - $current_member, - $summit, - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - }, - ['summit_id' => $summit_id] - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllCSV($summit_id) - { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAllCSV( - function(){ - return [ - 'message' => ['=@', '=='], - 'channel' => ['=='], - 'sent_date' => ['>', '<', '<=', '>=', '=='], - 'created' => ['>', '<', '<=', '>=', '=='], - 'is_sent' => ['=='], - 'approved' => ['=='], - 'event_id' => ['=='], - ]; - }, - function(){ - return [ - 'message' => 'sometimes|string', - 'channel' => 'sometimes|in:EVERYONE,SPEAKERS,ATTENDEES,MEMBERS,SUMMIT,EVENT,GROUP', - 'sent_date' => 'sometimes|date_format:U', - 'created' => 'sometimes|date_format:U', - 'is_sent' => 'sometimes|boolean', - 'approved' => 'sometimes|boolean', - 'event_id' => 'sometimes|integer', - ]; - }, - function() - { - return [ - - 'sent_date', - 'created', - 'id', - ]; - }, - function($filter) use($summit){ - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - }, - function(){ - return [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - 'sent_date' => new EpochCellFormatter, - 'is_sent' => new BooleanCellFormatter, - 'approved' => new BooleanCellFormatter, - ]; - }, - function(){ - return []; - }, - "push-notification-" . date('Ymd'), - ['summit_id' => $summit_id], - function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit){ - return $this->repository->getAllByPageBySummit - ( - $summit, - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } - - /** - * @param $summit_id - * @param $notification_id - * @return mixed - */ - public function getById($summit_id, $notification_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $notification = $summit->getNotificationById($notification_id); - if(is_null($notification)) - return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($notification)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $notification_id - * @return mixed - */ - public function deleteNotification($summit_id, $notification_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->push_notification_service->deleteNotification($summit, $notification_id); - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $notification_id - * @return mixed - */ - public function approveNotification($summit_id, $notification_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $notification = $this->push_notification_service->approveNotification($summit, $this->resource_server_context->getCurrentUser(), $notification_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($notification)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $notification_id - * @return mixed - */ - public function unApproveNotification($summit_id, $notification_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $notification = $this->push_notification_service->unApproveNotification($summit, $this->resource_server_context->getCurrentUser(), $notification_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($notification)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addPushNotification($summit_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitPushNotificationValidationRulesFactory::build($data->all()); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $notification = $this->push_notification_service->addPushNotification($summit, $this->resource_server_context->getCurrentUser(), $data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($notification)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php deleted file mode 100644 index 73f26892..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrderExtraQuestionTypeApiController.php +++ /dev/null @@ -1,318 +0,0 @@ -summit_repository = $summit_repository; - $this->service = $service; - $this->repository = $repository; - } - - use GetAllBySummit; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - /** - * @param $summit_id - * @return mixed - */ - public function getMetadata($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->ok - ( - $this->repository->getQuestionsMetadata($summit) - ); - } - - /** - * @return array - */ - protected function getFilterRules():array{ - return [ - 'name' => ['==', '=@'], - 'type' => ['==', '=@'], - 'usage' => ['==', '=@'], - 'label' => ['==', '=@'], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - 'type' => 'sometimes|required|string', - 'usage' => 'sometimes|required|string', - 'label' => 'sometimes|required|string', - ]; - } - - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - 'label', - 'order', - ]; - } - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return SummitOrderExtraQuestionTypeValidationRulesFactory::build($payload); - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - * @throws EntityNotFoundException - * @throws ValidationException - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addOrderExtraQuestion($summit, HTMLCleaner::cleanData($payload, ['label'])); - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param Summit $summit - * @param $child_id - * @throws EntityNotFoundException - * @throws ValidationException - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteOrderExtraQuestion($summit, $child_id); - } - - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getOrderExtraQuestionById($child_id); - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return SummitOrderExtraQuestionTypeValidationRulesFactory::build($payload, true); - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - * @throws \models\exceptions\EntityNotFoundException - * @throws \models\exceptions\ValidationException - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateOrderExtraQuestion - ( - $summit, $child_id, - HTMLCleaner::cleanData($payload, ['label']) - ); - } - - /** - * @param $summit_id - * @param $question_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addQuestionValue($summit_id, $question_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, ExtraQuestionTypeValueValidationRulesFactory::build($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->service->addOrderExtraQuestionValue($summit, $question_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $question_id - * @param $value_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateQuestionValue($summit_id, $question_id, $value_id){ - - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, ExtraQuestionTypeValueValidationRulesFactory::build($payload, true)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->service->updateOrderExtraQuestionValue($summit, $question_id, $value_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $question_id - * @param $value_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteQuestionValue($summit_id, $question_id, $value_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->service->deleteOrderExtraQuestionValue($summit, $question_id, $value_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrdersApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrdersApiController.php deleted file mode 100644 index 1f4abff6..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrdersApiController.php +++ /dev/null @@ -1,1285 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - $this->ticket_repository = $ticket_repository; - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function reserve($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $owner = $this->getResourceServerContext()->getCurrentUser(); - - $validation_rules = [ - 'tickets' => 'required|ticket_dto_array', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'owner_company' => 'nullable|string|max:255', - ]; - - if(is_null($owner)){ - $validation_rules = array_merge([ - 'owner_first_name' => 'required|string|max:255', - 'owner_last_name' => 'required|string|max:255', - 'owner_email' => 'required|string|max:255|email', - ], $validation_rules); - } - else{ - if(empty($owner->getFirstName())){ - $validation_rules = array_merge([ - 'owner_first_name' => 'required|string|max:255', - ], $validation_rules); - } - if(empty($owner->getLastName())){ - $validation_rules = array_merge([ - 'owner_last_name' => 'required|string|max:255', - ], $validation_rules); - } - } - - $payload = $this->getJsonPayload($validation_rules); - if(!is_null($owner)){ - $payload_ex = [ - 'owner_first_name' => !empty($owner->getFirstName()) ? $owner->getFirstName() : $payload['owner_first_name'], - 'owner_last_name' => !empty($owner->getLastName()) ? $owner->getLastName() : $payload['owner_last_name'], - 'owner_email' => $owner->getEmail(), - ]; - $payload = array_merge($payload, $payload_ex); - } - - $order = $this->service->reserve($owner, $summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($order, ISummitOrderSerializerTypes::ReservationType)->serialize(Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function checkout($summit_id, $hash){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'billing_address_1' => 'nullable|sometimes|string|max:255', - 'billing_address_2' => 'nullable|sometimes|string|max:255', - 'billing_address_zip_code' => 'nullable|sometimes|string|max:255', - 'billing_address_city' => 'nullable|sometimes|string|max:255', - 'billing_address_state' => 'nullable|sometimes|string|max:255', - 'billing_address_country' => 'nullable|sometimes|string|country_iso_alpha2_code', - ]); - - $order = $this->service->checkout($summit, $hash, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($order, ISummitOrderSerializerTypes::CheckOutType)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getMyTicketByOrderHash($summit_id, $hash){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $ticket = $this->service->getMyTicketByOrderHash($summit, $hash); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($ticket, ISummitAttendeeTicketSerializerTypes::GuestEdition)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function cancel($summit_id, $hash){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->service->cancel($summit, $hash); - return $this->deleted(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummit($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function(){ - return [ - 'number' => ['=@', '=='], - 'owner_name' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'owner_company' => ['=@', '=='], - 'ticket_owner_name' => ['=@', '=='], - 'ticket_owner_email' => ['=@', '=='], - 'ticket_number' => ['=@', '=='], - 'summit_id' => ['=='], - 'owner_id' => ['=='], - 'status' => ['==','<>'], - ]; - }, - function(){ - return [ - 'status' => sprintf('sometimes|in:%s',implode(',', IOrderConstants::ValidStatus)), - 'number' => 'sometimes|string', - 'owner_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'owner_company' => 'sometimes|string', - 'ticket_owner_name' => 'sometimes|string', - 'ticket_owner_email' => 'sometimes|string', - 'ticket_number' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'owner_id' => 'sometimes|integer', - - ]; - }, - function() - { - return [ - 'id', - 'number', - 'status', - 'owner_name' - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return ISummitOrderSerializerTypes::AdminType; - } - ); - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummitCSV($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAllCSV( - function(){ - return [ - 'number' => ['=@', '=='], - 'owner_name' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'owner_company' => ['=@', '=='], - 'summit_id' => ['=='], - 'owner_id' => ['=='], - 'status' => ['=='], - 'ticket_owner_name' => ['=@', '=='], - 'ticket_owner_email' => ['=@', '=='], - 'ticket_number' => ['=@', '=='], - ]; - }, - function(){ - return [ - 'status' => sprintf('sometimes|in:%s',implode(',', IOrderConstants::ValidStatus)), - 'number' => 'sometimes|string', - 'owner_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'owner_company' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'owner_id' => 'sometimes|integer', - 'ticket_owner_name' => 'sometimes|string', - 'ticket_owner_email' => 'sometimes|string', - 'ticket_number' => 'sometimes|string', - - ]; - }, - function() - { - return [ - 'id', - 'number', - 'status', - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return ISummitOrderSerializerTypes::AdminType; - }, - function (){ - return []; - }, - function(){ - return []; - }, - 'orders-' - ); - } - - /** - * @return mixed - */ - public function getAllMyOrders(){ - $owner = $this->getResourceServerContext()->getCurrentUser(); - return $this->_getAll( - function(){ - return [ - 'number' => ['=@', '=='], - 'summit_id' => ['=='], - 'status' => ['==','<>'], - ]; - }, - function(){ - return [ - 'status' => sprintf('sometimes|in:%s',implode(',', IOrderConstants::ValidStatus)), - 'number' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - ]; - }, - function() - { - return [ - 'id', - 'number', - 'status', - ]; - }, - function($filter) use($owner){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('owner_id', $owner->getId())); - } - return $filter; - }, - function(){ - return ISummitOrderSerializerTypes::AdminType; - } - ); - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param $order_id - */ - public function updateMyOrder($order_id){ - try { - $current_user = $this->getResourceServerContext()->getCurrentUser(); - $payload = $this->getJsonPayload([ - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'owner_company' => 'sometimes|string|max:255', - 'billing_address_1' => 'sometimes|string|max:255', - 'billing_address_2' => 'sometimes|string|max:255', - 'billing_address_zip_code' => 'sometimes|string|max:255', - 'billing_address_city' => 'sometimes|string|max:255', - 'billing_address_state' => 'sometimes|string|max:255', - 'billing_address_country' => 'sometimes|string|country_iso_alpha2_code', - ]); - - $order = $this->service->updateMyOrder($current_user, intval($order_id), $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($order, ISummitOrderSerializerTypes::CheckOutType)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $order_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function requestRefundMyOrder($order_id){ - try { - $current_user = $this->getResourceServerContext()->getCurrentUser(); - - $order = $this->service->requestRefundOrder($current_user, intval($order_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($order)->serialize( Request::input('expand', ''))); - - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $order_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function cancelRefundRequestOrder($order_id){ - try { - - $order = $this->service->cancelRequestRefundOrder(intval($order_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($order)->serialize( Request::input('expand', ''))); - - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $order_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function cancelRefundRequestTicket($order_id , $ticket_id){ - try { - - $ticket = $this->service->cancelRequestRefundTicket(intval($order_id), intval($ticket_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( Request::input('expand', ''))); - - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function requestRefundMyTicket($order_id, $ticket_id){ - try { - $current_user = $this->getResourceServerContext()->getCurrentUser(); - - $ticket = $this->service->requestRefundTicket($current_user, intval($order_id), intval($ticket_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( Request::input('expand', ''))); - - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function assignAttendee($order_id, $ticket_id){ - try { - $current_user = $this->getResourceServerContext()->getCurrentUser(); - - $payload = $this->getJsonPayload([ - 'attendee_first_name' => 'nullable|string|max:255', - 'attendee_last_name' => 'nullable|string|max:255', - 'attendee_email' => 'required|string|max:255|email', - 'attendee_company' => 'nullable|string|max:255', - 'extra_questions' => 'sometimes|extra_question_dto_array' - ]); - - $ticket = $this->service->ownerAssignTicket($current_user, intval($order_id), intval($ticket_id), $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $order_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function reSendOrderEmail($order_id){ - try { - - $order = $this->service->reSendOrderEmail(intval($order_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($order)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function reInviteAttendee($order_id, $ticket_id){ - try { - $current_user = $this->resource_server_context->getCurrentUser(); - if(is_null($current_user)) - return $this->error403(); - $ticket = $this->ticket_repository->getById(intval($ticket_id)); - - if(is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - if(!$ticket->canEditTicket($current_user)){ - return $this->error403(); - } - - $ticket = $this->service->reInviteAttendee(intval($order_id), intval($ticket_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( Request::input('expand', ''))); - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateTicket($summit_id, $order_id, $ticket_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'ticket_type_id' => 'nullable|integer', - 'badge_type_id' => 'nullable|integer', - 'attendee_first_name' => 'nullable|string|max:255', - 'attendee_last_name' => 'nullable|string|max:255', - 'attendee_email' => 'required|string|max:255|email', - 'attendee_company' => 'nullable|string|max:255', - 'extra_questions' => 'sometimes|extra_question_dto_array' - ]); - - $ticket = $this->service->updateTicket($summit, intval($order_id), intval($ticket_id), $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket, ISummitAttendeeTicketSerializerTypes::AdminType)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addTicket($summit_id, $order_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'ticket_type_id' => 'required|integer', - 'badge_type_id' => 'nullable|integer', - 'attendee_first_name' => 'nullable|string|max:255', - 'attendee_last_name' => 'nullable|string|max:255', - 'attendee_email' => 'required|string|max:255|email', - 'attendee_company' => 'nullable|string|max:255', - 'extra_questions' => 'sometimes|extra_question_dto_array' - ]); - - $ticket = $this->service->addTicket($summit, intval($order_id), $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeAttendee($order_id, $ticket_id){ - try { - $current_user = $this->getResourceServerContext()->getCurrentUser(); - $ticket = $this->service->revokeTicket($current_user, intval($order_id), intval($ticket_id)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( Request::input('expand', ''))); - - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|mixed - */ - public function getTicketPDFBySummit($summit_id, $order_id, $ticket_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $content = $this->service->renderTicketByFormat(intval($ticket_id), IRenderersFormats::PDFFormat,null, intval($order_id), $summit); - return $this->pdf('ticket_'.$ticket_id.'.pdf', $content); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|mixed - */ - public function getTicketPDFByOrderId($order_id, $ticket_id){ - try { - $current_user = $this->getResourceServerContext()->getCurrentUser(); - $content = $this->service->renderTicketByFormat(intval($ticket_id),IRenderersFormats::PDFFormat, $current_user, intval($order_id)); - return $this->pdf('ticket_'.$ticket_id.'.pdf', $content); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|mixed - */ - public function getTicketPDFById($ticket_id){ - try { - $current_user = $this->getResourceServerContext()->getCurrentUser(); - $content = $this->service->renderTicketByFormat(intval($ticket_id),IRenderersFormats::PDFFormat, $current_user); - return $this->pdf('ticket_'.$ticket_id.'.pdf', $content); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /// public endpoints - - /** - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getTicketByHash($hash){ - try { - $ticket = $this->service->getTicketByHash($hash); - if(is_null($ticket) || !$ticket->isActive()) - throw new EntityNotFoundException(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($ticket, ISummitAttendeeTicketSerializerTypes::PublicEdition)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateTicketByHash($hash){ - try { - - $payload = $this->getJsonPayload([ - 'attendee_first_name' => 'nullable|string|max:255', - 'attendee_last_name' => 'nullable|string|max:255', - 'attendee_company' => 'nullable|string|max:255', - 'disclaimer_accepted' => 'nullable|boolean', - 'share_contact_info' => 'nullable|boolean', - 'extra_questions' => 'sometimes|extra_question_dto_array' - ]); - - $ticket = $this->service->updateTicketByHash($hash, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket, ISummitAttendeeTicketSerializerTypes::PublicEdition)->serialize( Request::input('expand', ''))); - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $order_hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateTicketsByOrderHash($order_hash) - { - try { - - $payload = $this->getJsonPayload([ - 'tickets' => 'required|ticket_dto_array', - ]); - - $order = $this->service->updateTicketsByOrderHash($order_hash, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($order, ISummitOrderSerializerTypes::CheckOutType)->serialize(Request::input('expand', ''))); - - } catch (\InvalidArgumentException $ex) { - Log::warning($ex); - return $this->error400(); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - /** - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateTicketById($ticket_id){ - try { - - $current_user = $this->getResourceServerContext()->getCurrentUser(); - if(is_null($current_user)) - return $this->error403(); - - $payload = $this->getJsonPayload([ - 'attendee_first_name' => 'nullable|string|max:255', - 'attendee_last_name' => 'nullable|string|max:255', - 'attendee_company' => 'nullable|string|max:255', - 'disclaimer_accepted' => 'nullable|boolean', - 'share_contact_info' => 'nullable|boolean', - 'extra_questions' => 'sometimes|extra_question_dto_array' - ]); - - $ticket = $this->service->updateTicketById($current_user, $ticket_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket, ISummitAttendeeTicketSerializerTypes::PublicEdition)->serialize( Request::input('expand', ''))); - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function regenerateTicketHash($hash){ - try { - - $this->service->regenerateTicketHash($hash); - - return $this->ok(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $hash - * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response|mixed - */ - public function getTicketPDFByHash($hash){ - try { - $content = $this->service->renderTicketByFormat($hash, IRenderersFormats::PDFFormat); - return $this->pdf('ticket_'.$hash.'.pdf', $content); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return [ - 'owner_first_name' => 'required_without:owner_id|string|max:255', - 'owner_last_name' => 'required_without:owner_id|string|max:255', - 'owner_email' => 'required_without:owner_id|string|max:255|email', - 'owner_id' => 'required_without:owner_first_name,owner_last_name,owner_email|int', - 'ticket_type_id' => 'required|int', - 'promo_code' => 'sometimes|string', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'owner_company' => 'required|string|max:255', - 'billing_address_1' => 'sometimes|string|max:255', - 'billing_address_2' => 'sometimes|string|max:255', - 'billing_address_zip_code' => 'sometimes|string|max:255', - 'billing_address_city' => 'sometimes|string|max:255', - 'billing_address_state' => 'sometimes|string|max:255', - 'billing_address_country' => 'sometimes|string|country_iso_alpha2_code', - ]; - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->createOrderSingleTicket($summit, $payload); - } - - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getOrderById($child_id); - } - - /** - * @return string - */ - public function getChildSerializer(){ - return ISummitOrderSerializerTypes::AdminType; - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return [ - 'owner_first_name' => 'required_without:owner_id|string|max:255', - 'owner_last_name' => 'required_without:owner_id|string|max:255', - 'owner_email' => 'required_without:owner_id|string|max:255|email', - 'owner_id' => 'required_without:owner_first_name,owner_last_name,owner_email|int', - 'extra_questions' => 'sometimes|extra_question_dto_array', - 'owner_company' => 'required|string|max:255', - 'billing_address_1' => 'sometimes|string|max:255', - 'billing_address_2' => 'sometimes|string|max:255', - 'billing_address_zip_code' => 'sometimes|string|max:255', - 'billing_address_city' => 'sometimes|string|max:255', - 'billing_address_state' => 'sometimes|string|max:255', - 'billing_address_country' => 'sometimes|string|country_iso_alpha2_code', - ]; - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateOrder($summit, $child_id, $payload); - } - - /** - * @param Summit $summit - * @param $child_id - * @return void - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteOrder($summit, intval($child_id)); - } - - /** - * @param $summit_id - * @param $order_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function refundOrder($summit_id, $order_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'amount' => 'required|numeric|greater_than:0', - ]); - - $order = $this->service->refundOrder($summit, intval($order_id), floatval($payload['amount'])); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($order)->serialize( Request::input('expand', ''))); - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $order_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function activateTicket($summit_id, $order_id, $ticket_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $ticket = $this->service->activateTicket($summit, intval($order_id), intval($ticket_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket, ISummitAttendeeTicketSerializerTypes::AdminType)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deActivateTicket($summit_id, $order_id, $ticket_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $ticket = $this->service->deActivateTicket($summit, intval($order_id), intval($ticket_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket, ISummitAttendeeTicketSerializerTypes::AdminType)->serialize( Request::input('expand', ''))); - - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionApiController.php deleted file mode 100644 index 0af37f56..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionApiController.php +++ /dev/null @@ -1,133 +0,0 @@ -summit_repository = $summit_repository; - $this->service = $service; - parent::__construct($resource_server_context); - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $presentation_id - * @param $action_id - */ - public function complete($summit_id, $selection_plan_id, $presentation_id, $action_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $member = $this->resource_server_context->getCurrentUser(); - - if (is_null($member)) - return $this->error403(); - - $authz = $summit->isTrackChair($member) || $summit->isTrackChairAdmin($member); - - if (!$authz) - return $this->error403(); - - $action = $this->service->updateAction($summit, intval($selection_plan_id), intval($presentation_id), intval($action_id), true ); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($action)->serialize(Input::get('expand', ''))); - - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $presentation_id - * @param $action_id - */ - public function uncomplete($summit_id, $selection_plan_id, $presentation_id, $action_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $member = $this->resource_server_context->getCurrentUser(); - - if (is_null($member)) - return $this->error403(); - - $authz = $summit->isTrackChair($member) || $summit->isTrackChairAdmin($member); - - if (!$authz) - return $this->error403(); - - $action = $this->service->updateAction($summit, intval($selection_plan_id), intval($presentation_id), intval($action_id), false ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($action)->serialize(Input::get('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php deleted file mode 100644 index 9daabb3e..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPresentationActionTypeApiController.php +++ /dev/null @@ -1,251 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - use ParametrizedGetAll; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - /** - * @inheritDoc - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->add($summit, $payload); - } - - /** - * @inheritDoc - */ - function getAddValidationRules(array $payload): array - { - return SummitPresentationActionTypeValidationRulesFactory::build($payload, false); - } - - /** - * @inheritDoc - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @inheritDoc - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->delete($summit, $child_id); - } - - /** - * @inheritDoc - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getPresentationActionTypeById($child_id); - } - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return SummitPresentationActionTypeValidationRulesFactory::build($payload, true); - } - - /** - * @inheritDoc - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->update($summit, $child_id, $payload); - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummit($summit_id) - { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function () { - return [ - 'name' => ['=@', '=='], - 'label' => ['=@', '=='], - 'is_enabled' => ['=='], - ]; - }, - function () { - return [ - 'name' => 'sometimes|string', - 'label' => 'sometimes|string', - 'is_enabled' => 'sometimes|boolean', - ]; - }, - function () { - return [ - 'id', - 'name', - 'order', - 'label', - 'is_enabled' - ]; - }, - function ($filter) use ($summit) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - } - ); - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummitCSV($summit_id) - { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAllCSV( - function () { - return [ - 'name' => ['=@', '=='], - 'label' => ['=@', '=='], - 'is_enabled' => ['=='], - ]; - }, - function () { - return [ - 'name' => 'sometimes|string', - 'label' => 'sometimes|string', - 'is_enabled' => 'sometimes|boolean', - ]; - }, - function () { - return [ - 'id', - 'name', - 'order', - 'label', - 'is_enabled' - ]; - }, - function ($filter) use ($summit) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - }, - function () { - return [ - 'created' => new EpochCellFormatter(), - 'last_edited' => new EpochCellFormatter(), - ]; - }, - function () use ($summit) { - $allowed_columns = [ - 'id', - 'created', - 'last_edited', - 'name', - 'label', - 'is_enabled', - 'order', - ]; - - $columns_param = Input::get("columns", ""); - $columns = []; - if (!empty($columns_param)) - $columns = explode(',', $columns_param); - $diff = array_diff($columns, $allowed_columns); - if (count($diff) > 0) { - throw new ValidationException(sprintf("columns %s are not allowed!", implode(",", $diff))); - } - if (empty($columns)) - $columns = $allowed_columns; - return $columns; - }, - sprintf('summit_presentation_action_types-%s', $summit_id) - ); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPromoCodesApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPromoCodesApiController.php deleted file mode 100644 index cb05ba3b..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitPromoCodesApiController.php +++ /dev/null @@ -1,647 +0,0 @@ -promo_code_service = $promo_code_service; - $this->promo_code_repository = $promo_code_repository; - $this->summit_repository = $summit_repository; - $this->member_repository = $member_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'), [ - - 'code' => ['=@', '=='], - 'creator' => ['=@', '=='], - 'creator_email' => ['=@', '=='], - 'owner' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'speaker' => ['=@', '=='], - 'speaker_email' => ['=@', '=='], - 'sponsor' => ['=@', '=='], - 'class_name' => ['=='], - 'type' => ['=='], - ]); - } - - 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')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'id', - 'code', - ]); - } - - $data = $this->promo_code_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - [], - [], - [ 'serializer_type' => SerializerRegistry::SerializerType_Private ] - ) - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\Response|mixed - */ - public function getAllBySummitCSV($summit_id){ - $values = Input::all(); - $rules = []; - $allowed_columns = [ - "id", - "created", - "last_edited", - "code", - "redeemed", - "email_sent", - "source", - "summit_id", - "creator_id", - "class_name", - "type", - "speaker_id", - "owner_name", - "owner_email", - "sponsor_name" - ]; - - 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 = PHP_INT_MAX; - $filter = null; - - if (Input::has('filter')) { - $filter = FilterParser::parse(Input::get('filter'), [ - 'code' => ['=@', '=='], - 'creator' => ['=@', '=='], - 'creator_email' => ['=@', '=='], - 'owner' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'speaker' => ['=@', '=='], - 'speaker_email' => ['=@', '=='], - 'sponsor' => ['=@', '=='], - 'class_name' => ['=='], - 'type' => ['=='], - ]); - } - - 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')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'id', - 'code', - ]); - } - $columns_param = Input::get("columns", ""); - $columns = []; - if(!empty($columns_param)) - $columns = explode(',', $columns_param); - $diff = array_diff($columns, $allowed_columns); - if(count($diff) > 0){ - throw new ValidationException(sprintf("columns %s are not allowed!", implode(",", $diff))); - } - - $data = $this->promo_code_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - $filename = "promocodes-" . date('Ymd'); - $list = $data->toArray(Input::get("expand", "")); - - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - 'redeemed' => new BooleanCellFormatter, - 'email_sent' => new BooleanCellFormatter, - ], - $columns - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getMetadata($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->ok - ( - $this->promo_code_repository->getMetadata($summit) - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function addPromoCodeBySummit($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = PromoCodesValidationRulesFactory::build($data->all()); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $promo_code = $this->promo_code_service->addPromoCode($summit, $data->all(), $this->resource_server_context->getCurrentUser()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $promo_code_id - * @return mixed - */ - public function updatePromoCodeBySummit($summit_id, $promo_code_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = PromoCodesValidationRulesFactory::build($data->all(), true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $promo_code = $this->promo_code_service->updatePromoCode($summit, intval($promo_code_id), $data->all(), $this->resource_server_context->getCurrentUser()); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize()); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $promo_code_id - * @return mixed - */ - public function deletePromoCodeBySummit($summit_id, $promo_code_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->promo_code_service->deletePromoCode($summit, intval($promo_code_id)); - - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $promo_code_id - * @return mixed - */ - public function sendPromoCodeMail($summit_id, $promo_code_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->promo_code_service->sendPromoCodeMail($summit, intval($promo_code_id)); - return $this->ok(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $promo_code_id - * @return mixed - */ - public function getPromoCodeBySummit($summit_id, $promo_code_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $promo_code = $summit->getPromoCodeById(intval($promo_code_id)); - if(is_null($promo_code)) - return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $promo_code_id - * @param $badge_feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addBadgeFeatureToPromoCode($summit_id, $promo_code_id, $badge_feature_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $promo_code = $this->promo_code_service->addPromoCodeBadgeFeature($summit, intval($promo_code_id), intval($badge_feature_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $promo_code_id - * @param $badge_feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeBadgeFeatureFromPromoCode($summit_id, $promo_code_id, $badge_feature_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $promo_code = $this->promo_code_service->removePromoCodeBadgeFeature($summit, intval($promo_code_id), intval($badge_feature_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $promo_code_id - * @param $ticket_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addTicketTypeToPromoCode($summit_id, $promo_code_id, $ticket_type_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload = []; - if (Request::isJson()) { - $data = Input::json(); - $payload = $data->all(); - $discount_code_rules = [ - 'amount' => 'sometimes|required_without:rate|numeric|min:0', - 'rate' => 'sometimes|required_without:amount|numeric|min:0', - ]; - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $discount_code_rules); - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - return $this->error412 - ( - $messages - ); - } - } - - $promo_code = $this->promo_code_service->addPromoCodeTicketTypeRule($summit, intval($promo_code_id), intval($ticket_type_id), $payload); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $promo_code_id - * @param $ticket_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeTicketTypeFromPromoCode($summit_id, $promo_code_id, $ticket_type_id){ - - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $promo_code = $this->promo_code_service->removePromoCodeTicketTypeRule($summit, intval($promo_code_id), intval($ticket_type_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRSVPTemplatesApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRSVPTemplatesApiController.php deleted file mode 100644 index e31e8a2c..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRSVPTemplatesApiController.php +++ /dev/null @@ -1,689 +0,0 @@ -summit_repository = $summit_repository; - $this->member_repository = $member_repository; - $this->rsvp_template_service = $rsvp_template_service; - $this->rsvp_template_repository = $rsvp_template_repository; - } - - /** - * Template endpoints - */ - - /** - * @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); - } - } - - /** - * @param $summit_id - * @param $template_id - * @return mixed - */ - public function getRSVPTemplate($summit_id, $template_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $template = $summit->getRSVPTemplateById($template_id); - - if (is_null($template)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($template)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @return mixed - */ - public function getRSVPTemplateQuestionsMetadata($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->ok - ( - $this->rsvp_template_repository->getQuestionsMetadata($summit) - ); - } - - /** - * @param $summit_id - * @param $template_id - * @return mixed - */ - public function deleteRSVPTemplate($summit_id, $template_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->rsvp_template_service->deleteTemplate($summit, $template_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addRSVPTemplate($summit_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitRSVPTemplateValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $template = $this->rsvp_template_service->addTemplate($summit, $this->resource_server_context->getCurrentUser(), $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($template)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $template_id - * @return mixed - */ - public function updateRSVPTemplate($summit_id, $template_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitRSVPTemplateValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $template = $this->rsvp_template_service->updateTemplate($summit, $template_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($template)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * Questions endpoints - */ - - /** - * @param $summit_id - * @param $template_id - * @param $question_id - * @return mixed - */ - public function getRSVPTemplateQuestion($summit_id, $template_id, $question_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $template = $summit->getRSVPTemplateById($template_id); - if (is_null($template)) return $this->error404(); - - $question = $template->getQuestionById($question_id); - if (is_null($question)) return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($question)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $template_id - * @return mixed - */ - public function addRSVPTemplateQuestion($summit_id, $template_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitRSVPTemplateQuestionValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $question = $this->rsvp_template_service->addQuestion($summit, $template_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($question)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $template_id - * @param $question_id - * @return mixed - */ - public function updateRSVPTemplateQuestion($summit_id, $template_id, $question_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitRSVPTemplateQuestionValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $question = $this->rsvp_template_service->updateQuestion($summit, $template_id, $question_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($question)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $template_id - * @param $question_id - * @return mixed - */ - public function deleteRSVPTemplateQuestion($summit_id, $template_id, $question_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->rsvp_template_service->deleteQuestion($summit, $template_id, $question_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * values endpoints - */ - - /** - * @param $summit_id - * @param $template_id - * @param $question_id - * @param $value_id - * @return mixed - */ - public function getRSVPTemplateQuestionValue($summit_id, $template_id, $question_id, $value_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $template = $summit->getRSVPTemplateById($template_id); - if (is_null($template)) return $this->error404(); - - $question = $template->getQuestionById($question_id); - if (is_null($question)) return $this->error404(); - - if (!$question instanceof RSVPMultiValueQuestionTemplate) return $this->error404(); - - $value = $question->getValueById($value_id); - if (is_null($value)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $template_id - * @param $question_id - * @return mixed - */ - public function addRSVPTemplateQuestionValue($summit_id, $template_id, $question_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitRSVPTemplateQuestionValueValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->rsvp_template_service->addQuestionValue($summit, $template_id, $question_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $template_id - * @param $question_id - * @param $value_id - * @return mixed - */ - public function updateRSVPTemplateQuestionValue($summit_id, $template_id, $question_id, $value_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitRSVPTemplateQuestionValueValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->rsvp_template_service->updateQuestionValue($summit, $template_id, $question_id, $value_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $template_id - * @param $question_id - * @param $value_id - * @return mixed - */ - public function deleteRSVPTemplateQuestionValue($summit_id, $template_id, $question_id, $value_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->rsvp_template_service->deleteQuestionValue($summit, $template_id, $question_id, $value_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRefundPolicyTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRefundPolicyTypeApiController.php deleted file mode 100644 index 06ee8693..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRefundPolicyTypeApiController.php +++ /dev/null @@ -1,161 +0,0 @@ -summit_repository = $summit_repository; - $this->service = $service; - $this->repository = $repository; - } - - use GetAllBySummit; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return SummitRefundPolicyTypeValidationRulesFactory::build($payload); - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return SummitRefundPolicyTypeValidationRulesFactory::build($payload, true); - } - - /** - * @return array - */ - protected function getFilterRules():array - { - return [ - 'name' => ['=@', '=='], - 'until_x_days_before_event_starts' => ['>=', '==', '>', '>=', '<', '<='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - ]; - } - - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - 'until_x_days_before_event_starts', - ]; - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - * @throws \models\exceptions\EntityNotFoundException - * @throws \models\exceptions\ValidationException - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addPolicy($summit, $payload); - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param Summit $summit - * @param $child_id - * @return void - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deletePolicy($summit, $child_id); - } - - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getRefundPolicyById($child_id); - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updatePolicy($summit, $child_id, $payload); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRegistrationInvitationApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRegistrationInvitationApiController.php deleted file mode 100644 index 67e20f8d..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitRegistrationInvitationApiController.php +++ /dev/null @@ -1,474 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function ingestInvitations(LaravelRequest $request, $summit_id){ - - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $this->service->importInvitationData($summit, $file); - return $this->ok(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $token - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getInvitationByToken($token){ - - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $invitation = $this->service->getInvitationByToken($current_member, $token); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($invitation)->serialize(Request::input('expand', ''))); - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $email - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getByEmail($summit_id, $email){ - - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $invitation = $this->service->getInvitationByEmail($summit,$email); - if(is_null($invitation)) - throw new EntityNotFoundException(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($invitation)->serialize(Request::input('expand', ''))); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - // traits - use ParametrizedGetAll; - - use GetSummitChildElementById; - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @inheritDoc - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getSummitRegistrationInvitationById($child_id); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummit($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function(){ - return [ - 'email' => ['=@', '=='], - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'is_accepted' => ['=='], - 'is_sent' => ['=='], - ]; - }, - function(){ - return [ - 'email' => 'sometimes|required|string', - 'first_name' => 'sometimes|required|string', - 'last_name' => 'sometimes|required|string', - 'is_accepted' => 'sometimes|required|string|in:true,false', - 'is_sent' => 'sometimes|required|string|in:true,false', - ]; - }, - function() - { - return [ - 'id', - 'email', - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_Public; - } - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAllCSV( - function(){ - return [ - 'email' => ['=@', '=='], - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'is_accepted' => ['=='], - 'is_sent' => ['=='], - ]; - }, - function(){ - return [ - 'email' => 'sometimes|required|string', - 'first_name' => 'sometimes|required|string', - 'last_name' => 'sometimes|required|string', - 'is_accepted' => 'sometimes|required|string|in:true,false', - 'is_sent' => 'sometimes|required|string|in:true,false', - ]; - }, - function() - { - return [ - 'id', - 'email', - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_CSV; - }, - function(){ - return [ - 'accepted_date' => new EpochCellFormatter(), - 'is_accepted' => new BooleanCellFormatter(), - 'is_sent' => new BooleanCellFormatter(), - ]; - }, - function(){ - - $allowed_columns = [ - 'id', - 'email', - 'first_name', - 'last_name', - 'member_id', - 'order_id', - 'summit_id', - 'accepted_date', - 'is_accepted', - 'is_sent', - ]; - - $columns_param = Input::get("columns", ""); - $columns = []; - if(!empty($columns_param)) - $columns = explode(',', $columns_param); - $diff = array_diff($columns, $allowed_columns); - if(count($diff) > 0){ - throw new ValidationException(sprintf("columns %s are not allowed!", implode(",", $diff))); - } - if(empty($columns)) - $columns = $allowed_columns; - return $columns; - }, - 'summit-registration-invitations-' - ); - } - - - use DeleteSummitChildElement; - - /** - * @inheritDoc - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->delete($summit, $child_id); - } - - use AddSummitChildElement; - - /** - * @inheritDoc - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->add($summit, $payload); - } - - /** - * @inheritDoc - */ - function getAddValidationRules(array $payload): array - { - return [ - 'email' => 'required|email|max:255', - 'first_name' => 'required|string|max:255', - 'last_name' => 'required|string|max:255', - ]; - } - - use UpdateSummitChildElement; - - /** - * @inheritDoc - */ - function getUpdateValidationRules(array $payload): array - { - return [ - 'email' => 'sometimes|email|max:255', - 'first_name' => 'sometimes|string|max:255', - 'last_name' => 'sometimes|string|max:255', - ]; - } - - /** - * @inheritDoc - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->update($summit, $child_id, $payload); - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteAll($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->service->deleteAll($summit); - return $this->deleted(); - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function send($summit_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, [ - 'email_flow_event' => 'required|string|in:'.join(',', [ - InviteSummitRegistrationEmail::EVENT_SLUG, - ReInviteSummitRegistrationEmail::EVENT_SLUG, - ]), - 'invitations_ids' => 'sometimes|int_array', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $filter = null; - - if (Input::has('filter')) { - $filter = FilterParser::parse(Input::get('filter'), [ - 'is_accepted' => ['=='], - 'is_sent' => ['=='], - ]); - } - - if (is_null($filter)) - $filter = new Filter(); - - $filter->validate([ - 'is_accepted' => 'sometimes|required|string|in:true,false', - 'is_sent' => 'sometimes|required|string|in:true,false', - ]); - - $this->service->triggerSend($summit, $payload, Input::get('filter')); - - return $this->ok(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectedPresentationListApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectedPresentationListApiController.php deleted file mode 100644 index 23b403e3..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectedPresentationListApiController.php +++ /dev/null @@ -1,326 +0,0 @@ -summit_repository = $summit_repository; - $this->member_repository = $member_repository; - $this->service = $service; - } - - /** - * @param $summit_id - * @param $track_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getTeamSelectionList($summit_id, $track_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_list = $this->service->getTeamSelectionList($summit, intval($track_id)); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($selection_list)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function createTeamSelectionList($summit_id, $track_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_list = $this->service->createTeamSelectionList($summit, intval($track_id)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($selection_list)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @param $owner_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getIndividualSelectionList($summit_id, $track_id, $owner_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_list = $this->service->getIndividualSelectionList($summit, intval($track_id), intval($owner_id)); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($selection_list)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @param $owner_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function createIndividualSelectionList($summit_id, $track_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_list = $this->service->createIndividualSelectionList($summit, intval($track_id)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($selection_list)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch(AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function reorderSelectionList($summit_id, $track_id, $list_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $data = Request::json(); - $payload = $data->all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload,[ - 'hash' => 'sometimes|nullable|string', - 'collection' => sprintf('required|string|in:%s,%s', SummitSelectedPresentation::CollectionMaybe, SummitSelectedPresentation::CollectionSelected), - 'presentations' => 'nullable|sometimes|int_array', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - return $this->error412 - ( - $messages - ); - } - - $selection_list = $this->service->reorderList($summit, intval($track_id), intval($list_id), $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($selection_list)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @param $collection - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function assignPresentationToMyIndividualList($summit_id, $track_id, $collection, $presentation_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_list = $this->service->assignPresentationToMyIndividualList($summit, intval($track_id), trim($collection), intval($presentation_id)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($selection_list)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch(AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @param $collection - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removePresentationFromMyIndividualList($summit_id, $track_id, $collection, $presentation_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_list = $this->service->removePresentationFromMyIndividualList($summit, intval($track_id), intval($presentation_id)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($selection_list)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectionPlansApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectionPlansApiController.php deleted file mode 100644 index 8c9d95d3..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSelectionPlansApiController.php +++ /dev/null @@ -1,1199 +0,0 @@ -summit_repository = $summit_repository; - $this->summit_event_repository = $summit_event_repository; - $this->category_change_request_repository = $category_change_request_repository; - $this->selection_plan_service = $selection_plan_service; - $this->selection_plan_extra_questions_service = $selection_plan_extra_questions_service; - $this->selection_plan_extra_questions_repository = $selection_plan_extra_questions_repository; - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @return mixed - */ - public function getSelectionPlan($summit_id, $selection_plan_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($selection_plan)->serialize(Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @return mixed - */ - public function updateSelectionPlan($summit_id, $selection_plan_id) - { - try { - - if (!Request::isJson()) return $this->error400(); - $payload = Request::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitSelectionPlanValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $selection_plan = $this->selection_plan_service->updateSelectionPlan($summit, $selection_plan_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($selection_plan)->serialize()); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addSelectionPlan($summit_id) - { - try { - - if (!Request::isJson()) return $this->error400(); - $payload = Request::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitSelectionPlanValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $selection_plan = $this->selection_plan_service->addSelectionPlan($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($selection_plan)->serialize()); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @return mixed - */ - public function deleteSelectionPlan($summit_id, $selection_plan_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->selection_plan_service->deleteSelectionPlan($summit, $selection_plan_id); - - return $this->deleted(); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $track_group_id - * @return mixed - */ - public function addTrackGroupToSelectionPlan($summit_id, $selection_plan_id, $track_group_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->selection_plan_service->addTrackGroupToSelectionPlan($summit, $selection_plan_id, $track_group_id); - - return $this->deleted(); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $track_group_id - * @return mixed - */ - public function deleteTrackGroupToSelectionPlan($summit_id, $selection_plan_id, $track_group_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->selection_plan_service->deleteTrackGroupToSelectionPlan($summit, $selection_plan_id, $track_group_id); - - return $this->deleted(); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $status - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getCurrentSelectionPlanByStatus($summit_id, $status) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $this->selection_plan_service->getCurrentSelectionPlanByStatus($summit, $status); - - if (is_null($selection_plan)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($selection_plan)->serialize(Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - use ParametrizedGetAll; - - /** - * @param $summit_id - * @param $selection_plan_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getSelectionPlanPresentations($summit_id, $selection_plan_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $member = $this->resource_server_context->getCurrentUser(); - - if (is_null($member)) - return $this->error403(); - - $authz = $summit->isTrackChair($member) || $summit->isTrackChairAdmin($member); - - if (!$authz) - return $this->error403(); - - return $this->_getAll( - function () { - return [ - 'title' => ['=@', '=='], - 'abstract' => ['=@', '=='], - 'social_summary' => ['=@', '=='], - 'tags' => ['=@', '=='], - 'level' => ['=@', '=='], - 'summit_type_id' => ['=='], - 'event_type_id' => ['=='], - 'track_id' => ['=='], - 'speaker_id' => ['=='], - 'speaker' => ['=@', '=='], - 'speaker_email' => ['=@', '=='], - 'selection_status' => ['=='], - 'id' => ['=='], - 'selection_plan_id' => ['=='], - 'status' => ['=='], - 'is_chair_visible' => ['=='], - 'is_voting_visible' => ['=='], - 'track_chairs_status' => ['=='], - 'viewed_status' => ['=='], - 'actions' => ['=='], - ]; - }, - function () { - return [ - 'title' => 'sometimes|string', - 'abstract' => 'sometimes|string', - 'social_summary' => 'sometimes|string', - 'tags' => 'sometimes|string', - 'level' => 'sometimes|string', - 'summit_type_id' => 'sometimes|integer', - 'event_type_id' => 'sometimes|integer', - 'track_id' => 'sometimes|integer', - 'speaker_id' => 'sometimes|integer', - 'speaker' => 'sometimes|string', - 'speaker_email' => 'sometimes|string', - 'selection_status' => 'sometimes|string', - 'id' => 'sometimes|integer', - 'selection_plan_id' => 'sometimes|integer', - 'status' => 'sometimes|string', - 'is_chair_visible' => 'sometimes|boolean', - 'is_voting_visible' => 'sometimes|boolean', - 'track_chairs_status' => 'sometimes|string|in:voted,untouched,team_selected,selected,maybe,pass', - 'viewed_status' => 'sometimes|string|in:seen,unseen,moved', - 'actions' => 'sometimes|string', - ]; - }, - function () { - return [ - 'id', - 'title', - 'start_date', - 'end_date', - 'created', - 'track', - 'location', - 'trackchairsel', - 'last_edited', - ]; - }, - function ($filter) use ($summit, $selection_plan_id) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - $filter->addFilterCondition(FilterElement::makeEqual('selection_plan_id', $selection_plan_id)); - $current_member = $this->resource_server_context->getCurrentUser(false); - if(!is_null($current_member)) { - $filter->addFilterCondition(FilterElement::makeEqual('current_member_id', $current_member->getId())); - } - } - return $filter; - }, - function () { - return IPresentationSerializerTypes::TrackChairs; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) { - return $this->summit_event_repository->getAllByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getSelectionPlanPresentationsCSV($summit_id, $selection_plan_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $member = $this->resource_server_context->getCurrentUser(); - - if (is_null($member)) - return $this->error403(); - - $authz = $summit->isTrackChair($member) || $summit->isTrackChairAdmin($member); - - if (!$authz) - return $this->error403(); - - return $this->_getAllCSV( - function () { - return [ - 'title' => ['=@', '=='], - 'abstract' => ['=@', '=='], - 'social_summary' => ['=@', '=='], - 'tags' => ['=@', '=='], - 'level' => ['=@', '=='], - 'summit_type_id' => ['=='], - 'event_type_id' => ['=='], - 'track_id' => ['=='], - 'speaker_id' => ['=='], - 'speaker' => ['=@', '=='], - 'speaker_email' => ['=@', '=='], - 'selection_status' => ['=='], - 'id' => ['=='], - 'selection_plan_id' => ['=='], - 'status' => ['=='], - 'is_chair_visible' => ['=='], - 'is_voting_visible' => ['=='], - 'track_chairs_status' => ['=='], - 'viewed_status' => ['=='], - 'actions' => ['=='], - ]; - }, - function () { - return [ - 'title' => 'sometimes|string', - 'abstract' => 'sometimes|string', - 'social_summary' => 'sometimes|string', - 'tags' => 'sometimes|string', - 'level' => 'sometimes|string', - 'summit_type_id' => 'sometimes|integer', - 'event_type_id' => 'sometimes|integer', - 'track_id' => 'sometimes|integer', - 'speaker_id' => 'sometimes|integer', - 'speaker' => 'sometimes|string', - 'speaker_email' => 'sometimes|string', - 'selection_status' => 'sometimes|string', - 'id' => 'sometimes|integer', - 'selection_plan_id' => 'sometimes|integer', - 'status' => 'sometimes|string', - 'is_chair_visible' => 'sometimes|boolean', - 'is_voting_visible' => 'sometimes|boolean', - 'track_chairs_status' => 'sometimes|string|in:voted,untouched,team_selected,selected,maybe,pass', - 'viewed_status' => 'sometimes|string|in:seen,unseen,moved', - 'actions' => 'sometimes|string', - ]; - }, - function () { - return [ - 'id', - 'title', - 'start_date', - 'end_date', - 'created', - 'track', - 'location', - 'trackchairsel', - 'last_edited', - ]; - }, - function ($filter) use ($summit, $selection_plan_id) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - $filter->addFilterCondition(FilterElement::makeEqual('selection_plan_id', $selection_plan_id)); - $current_member = $this->resource_server_context->getCurrentUser(false); - if(!is_null($current_member)) { - $filter->addFilterCondition(FilterElement::makeEqual('current_member_id', $current_member->getId())); - } - } - return $filter; - }, - function () { - return IPresentationSerializerTypes::TrackChairs_CSV; - }, - function () { - return [ - 'created' => new EpochCellFormatter(), - 'last_edited' => new EpochCellFormatter(), - ]; - }, - function () { - return []; - }, - 'presentations-', - [], - function ($page, $per_page, $filter, $order, $applyExtraFilters) { - return $this->summit_event_repository->getAllByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getSelectionPlanPresentation($summit_id, $selection_plan_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById(intval($selection_plan_id)); - if (is_null($selection_plan)) return $this->error404(); - - $presentation = $selection_plan->getPresentation(intval($presentation_id)); - if(is_null($presentation)) throw new EntityNotFoundException(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer - ( - $presentation - )->serialize(Request::input('expand', ''))); - - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function markPresentationAsViewed($summit_id, $selection_plan_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $presentation = $this->selection_plan_service->markPresentationAsViewed($summit, $selection_plan_id, $presentation_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer - ( - $presentation, - IPresentationSerializerTypes::TrackChairs - )->serialize(Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addCommentToPresentation($summit_id, $selection_plan_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $data = Request::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, [ - 'body' => 'required|string', - 'is_public' => 'required|boolean', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - return $this->error412 - ( - $messages - ); - } - - $comment = $this->selection_plan_service->addPresentationComment($summit, $selection_plan_id, $presentation_id, HTMLCleaner::cleanData($payload, ['body'])); - return $this->created(SerializerRegistry::getInstance()->getSerializer($comment)->serialize(Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $selection_plan_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllPresentationCategoryChangeRequest($summit_id, $selection_plan_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $member = $this->resource_server_context->getCurrentUser(); - - if (is_null($member)) - return $this->error403(); - - $authz = $summit->isTrackChair($member) || $summit->isTrackChairAdmin($member); - - if (!$authz) - return $this->error403(); - - return $this->_getAll( - function () { - return [ - 'selection_plan_id' => ['=='], - 'summit_id' => ['=='], - 'new_category_id' => ['=='], - 'old_category_id' => ['=='], - 'new_category_title' => ['=@', '=='], - 'old_category_title' => ['=@', '=='], - 'requester_fullname' => ['=@', '=='], - 'requester_email' => ['=@', '=='], - 'aprover_fullname' => ['=@', '=='], - 'aprover_email' => ['=@', '=='], - 'presentation_title' => ['=@', '=='], - ]; - }, - function () { - return [ - 'selection_plan_id' => 'sometimes|integer', - 'summit_id' => 'sometimes|integer', - 'new_category_id' => 'sometimes|integer', - 'old_category_id' => 'sometimes|integer', - 'new_category_name' => 'sometimes|string', - 'old_category_name' => 'sometimes|string', - 'requester_fullname' => 'sometimes|string', - 'aprover_fullname' => 'sometimes|string', - 'aprover_email' => 'sometimes|string', - 'presentation_title' => 'sometimes|string', - ]; - }, - function () { - return [ - 'id', - 'approval_date', - 'status', - 'presentation_title', - 'new_category_name', - 'old_category_name', - 'requester_fullname', - ]; - }, - function ($filter) use ($summit, $selection_plan_id) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - $filter->addFilterCondition(FilterElement::makeEqual('selection_plan_id', $selection_plan_id)); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) { - return $this->category_change_request_repository->getAllByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $presentation_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function createPresentationCategoryChangeRequest($summit_id, $selection_plan_id, $presentation_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $data = Request::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, [ - 'new_category_id' => 'required|integer', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - return $this->error412 - ( - $messages - ); - } - - $change_request = $this->selection_plan_service->createPresentationCategoryChangeRequest - ( - $summit, - intval($selection_plan_id), - intval($presentation_id), - intval($payload['new_category_id']) - ); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($change_request)->serialize(Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $presentation_id - * @param $category_change_request_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function resolvePresentationCategoryChangeRequest($summit_id, $selection_plan_id, $presentation_id, $category_change_request_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $data = Request::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, [ - 'approved' => 'required|bool', - 'reason' => 'sometimes|string', - ]); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - return $this->error412 - ( - $messages - ); - } - - $change_request = $this->selection_plan_service->resolvePresentationCategoryChangeRequest - ( - $summit, - intval($selection_plan_id), - intval($presentation_id), - intval($category_change_request_id), - $payload - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($change_request)->serialize(Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * Extra questions - */ - - /** - * @param $summit_id - * @param $selection_plan_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getExtraQuestions($summit_id, $selection_plan_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function () { - return [ - 'name' => ['=@', '=='], - 'type' => ['=@', '=='], - 'label' => ['=@', '=='], - ]; - }, - function () { - return [ - 'name' => 'sometimes|string', - 'type' => 'sometimes|string', - 'label' => 'sometimes|string', - ]; - }, - function () { - return [ - 'id', - 'name', - 'label', - 'order', - ]; - }, - function ($filter) use ($summit, $selection_plan_id) { - if ($filter instanceof Filter) { - $filter->addFilterCondition - ( - FilterElement::makeEqual('selection_plan_id', intval($selection_plan_id)) - ); - } - return $filter; - }, - function () { - return SerializerRegistry::SerializerType_Public; - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) { - return $this->selection_plan_extra_questions_repository->getAllByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404($ex->getMessage()); - } - catch (AuthzException $ex) { - Log::warning($ex); - return $this->error403($ex); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getExtraQuestionsMetadata($summit_id, $selection_plan_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->ok - ( - $this->selection_plan_extra_questions_repository->getQuestionsMetadata() - ); - } - - use ParametrizedAddEntity; - - /** - * @param $summit_id - * @param $selection_plan_id - * @return \Illuminate\Http\JsonResponse - */ - public function addExtraQuestion($summit_id, $selection_plan_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - $args = [$selection_plan]; - - return $this->_add( - function ($payload) { - return SelectionPlanExtraQuestionValidationRulesFactory::build($payload); - }, - function ($payload, $selection_plan){ - return $this->selection_plan_extra_questions_service->addExtraQuestion($selection_plan, HTMLCleaner::cleanData($payload, ['label'])); - }, - ...$args - ); - } - - use ParametrizedGetEntity; - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $question_id - * @return \Illuminate\Http\JsonResponse - */ - public function getExtraQuestion($summit_id, $selection_plan_id, $question_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - return $this->_get($question_id, function($id) use($selection_plan){ - return $selection_plan->getExtraQuestionById(intval($id)); - }); - } - - use ParametrizedUpdateEntity; - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $question_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateExtraQuestion($summit_id, $selection_plan_id, $question_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - $args = [$selection_plan]; - - return $this->_update($question_id, function($payload){ - return SelectionPlanExtraQuestionValidationRulesFactory::build($payload, true); - }, - function ($question_id, $payload, $selection_plan){ - return $this->selection_plan_extra_questions_service->updateExtraQuestion($selection_plan, $question_id, HTMLCleaner::cleanData($payload, ['label'])); - }, ...$args); - } - - use ParametrizedDeleteEntity; - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $question_id - * @return \Illuminate\Http\JsonResponse - */ - public function deleteExtraQuestion($summit_id, $selection_plan_id, $question_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - $args = [$selection_plan]; - - return $this->_delete(intval($question_id) , function($question_id, $selection_plan){ - $this->selection_plan_extra_questions_service->deleteExtraQuestion($selection_plan, $question_id); - }, ...$args); - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $question_id - * @return \Illuminate\Http\JsonResponse - */ - public function addExtraQuestionValue($summit_id, $selection_plan_id, $question_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - $args = [$selection_plan, intval($question_id)]; - - return $this->_add( - function($payload){ - return ExtraQuestionTypeValueValidationRulesFactory::build($payload); - }, - function($payload, $selection_plan, $question_id){ - return $this->selection_plan_extra_questions_service-> - addExtraQuestionValue($selection_plan, $question_id, $payload); - }, - ...$args); - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $question_id - * @param $value_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateExtraQuestionValue($summit_id, $selection_plan_id, $question_id, $value_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - $args = [$selection_plan, intval($question_id)]; - - return $this->_update($value_id, function($payload){ - return ExtraQuestionTypeValueValidationRulesFactory::build($payload, false); - }, - function($value_id, $payload, $selection_plan, $question_id){ - return $this->selection_plan_extra_questions_service->updateExtraQuestionValue - ( - $selection_plan, - $question_id, - $value_id, - $payload - ); - }, ...$args); - } - - /** - * @param $summit_id - * @param $selection_plan_id - * @param $question_id - * @param $value_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteExtraQuestionValue($summit_id, $selection_plan_id, $question_id, $value_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) return $this->error404(); - - $args = [$selection_plan, intval($question_id)]; - - return $this->_delete($value_id, function($value_id, $selection_plan, $question_id){ - $this->selection_plan_extra_questions_service->deleteExtraQuestionValue($selection_plan, $question_id, $value_id); - } - , ...$args); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersApiController.php deleted file mode 100644 index ef2baaef..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersApiController.php +++ /dev/null @@ -1,1398 +0,0 @@ -repository = $summit_repository; - $this->speaker_repository = $speaker_repository; - $this->event_repository = $event_repository; - $this->member_repository = $member_repository; - $this->event_feedback_repository = $event_feedback_repository; - $this->selection_plan_repository = $selection_plan_repository; - $this->service = $service; - $this->summit_service = $summit_service; - $this->serializer_type_selector = $serializer_type_selector; - } - - /** - * Speakers endpoints - */ - - use ParametrizedGetAll; - - /** - * @param $summit_id - * @return mixed - */ - public function getSpeakers($summit_id) - { - $summit = SummitFinderStrategyFactory::build($this->getRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function () { - return [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'id' => ['=='], - 'full_name' => ['=@', '=='], - ]; - }, - function () { - return [ - 'first_name' => 'sometimes|string', - 'last_name' => 'sometimes|string', - 'email' => 'sometimes|string', - 'id' => 'sometimes|integer', - 'full_name' => 'sometimes|string', - ]; - }, - function () { - return [ - 'first_name', - 'last_name', - 'id', - 'email', - ]; - }, - function ($filter) use ($summit) { - return $filter; - }, - function () { - return $this->serializer_type_selector->getSerializerType(); - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit) { - return $this->speaker_repository->getSpeakersBySummit - ( - $summit, - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - }, - [ - 'summit_id' => $summit_id, - 'published' => true, - 'summit' => $summit - ] - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getSpeakersOnSchedule($summit_id) - { - $summit = SummitFinderStrategyFactory::build($this->getRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function () { - return [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'id' => ['=='], - 'full_name' => ['=@', '=='], - 'event_start_date' => ['>', '<', '<=', '>=', '=='], - 'event_end_date' => ['>', '<', '<=', '>=', '=='], - 'featured' => ['=='], - ]; - }, - function () { - return [ - 'first_name' => 'sometimes|string', - 'last_name' => 'sometimes|string', - 'email' => 'sometimes|string', - 'id' => 'sometimes|integer', - 'full_name' => 'sometimes|string', - 'event_start_date' => 'sometimes|date_format:U', - 'event_end_date' => 'sometimes|date_format:U', - 'featured' => 'sometimes|required|string|in:true,false', - ]; - }, - function () { - return [ - 'first_name', - 'last_name', - 'id', - 'email', - ]; - }, - function ($filter) use ($summit) { - return $filter; - }, - function () { - return $this->serializer_type_selector->getSerializerType(); - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) use ($summit) { - return $this->speaker_repository->getSpeakersBySummitAndOnSchedule - ( - $summit, - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - }, - [ - 'summit_id' => $summit_id, - 'published' => true, - 'summit' => $summit - ] - ); - } - - /** - * get all speakers without summit - * @return mixed - */ - public function getAll() - { - return $this->_getAll( - function () { - return [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'email' => ['=@', '=='], - 'id' => ['=='], - 'full_name' => ['=@', '=='], - ]; - }, - function () { - return [ - 'first_name' => 'sometimes|string', - 'last_name' => 'sometimes|string', - 'email' => 'sometimes|string', - 'id' => 'sometimes|integer', - 'full_name' => 'sometimes|string', - ]; - }, - function () { - return [ - 'first_name', - 'last_name', - 'id', - 'email', - ]; - }, - function ($filter) { - return $filter; - }, - function () { - return $this->serializer_type_selector->getSerializerType(); - }, - null, - null, - function ($page, $per_page, $filter, $order, $applyExtraFilters) { - return $this->speaker_repository->getAllByPage - ( - new PagingInfo($page, $per_page), - call_user_func($applyExtraFilters, $filter), - $order - ); - } - ); - } - - /** - * @param $summit_id - * @param $speaker_id - * @return mixed - */ - public function getSummitSpeaker($summit_id, $speaker_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check($speaker_id, $summit); - if (is_null($speaker)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - $serializer_type = SerializerRegistry::SerializerType_Public; - // if speaker profile belongs to current member - if (!is_null($current_member)) { - if ($speaker->getMemberId() == $current_member->getId()) - $serializer_type = SerializerRegistry::SerializerType_Private; - } - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize - ( - Request::input('expand', ''), - [], - [], - ['summit_id' => $summit_id, 'published' => true, 'summit' => $summit] - ) - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getMySummitSpeaker($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check('me', $summit); - if (is_null($speaker)) return $this->error404(); - - $serializer_type = SerializerRegistry::SerializerType_Private; - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize - ( - Request::input('expand', ''), - [], - [], - [ - 'summit_id' => $summit_id, - 'published' => Request::input('published', false), - 'summit' => $summit - ] - ) - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function getMySpeaker() - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($speaker)) return $this->error404(); - - $serializer_type = SerializerRegistry::SerializerType_Private; - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize - ( - Request::input('expand', ''), - [], - [], - [] - ) - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function createMySpeaker() - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - // set data from current member ... - $speaker = $this->service->addSpeaker([ - 'member_id' => $current_member->getId(), - 'first_name' => $current_member->getFirstName(), - 'last_name' => $current_member->getLastName(), - 'bio' => $current_member->getBio(), - 'twitter' => $current_member->getTwitterHandle(), - 'irc' => $current_member->getIrcHandle(), - ]); - - $serializer_type = SerializerRegistry::SerializerType_Private; - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize - ( - Request::input('expand', ''), - [], - [], - [] - ) - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function updateMySpeaker() - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($speaker)) return $this->error404(); - - return $this->updateSpeaker($speaker->getId()); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $speaker_id - * @return mixed - */ - public function getSpeaker($speaker_id) - { - try { - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker) || !$speaker instanceof PresentationSpeaker) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - $serializer_type = SerializerRegistry::SerializerType_Public; - // if speaker profile belongs to current member - if (!is_null($current_member)) { - if ($speaker->getMemberId() == $current_member->getId() || $speaker->canBeEditedBy($current_member)) - $serializer_type = SerializerRegistry::SerializerType_Private; - } - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($speaker, $serializer_type)->serialize - ( - Request::input('expand', ''), - [], - [], - [] - ) - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addSpeakerBySummit($summit_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'title' => 'required|string|max:100', - 'first_name' => 'required|string|max:100', - 'last_name' => 'required|string|max:100', - 'bio' => 'sometimes|string', - 'irc' => 'sometimes|string|max:50', - 'twitter' => 'sometimes|string|max:50', - 'member_id' => 'sometimes|integer', - 'email' => 'sometimes|email:rfc|max:50', - 'on_site_phone' => 'sometimes|string|max:50', - 'registered' => 'sometimes|boolean', - 'is_confirmed' => 'sometimes|boolean', - 'checked_in' => 'sometimes|boolean', - 'registration_code' => 'sometimes|string', - 'available_for_bureau' => 'sometimes|boolean', - 'funded_travel' => 'sometimes|boolean', - 'willing_to_travel' => 'sometimes|boolean', - 'willing_to_present_video' => 'sometimes|boolean', - 'org_has_cloud' => 'sometimes|boolean', - 'country' => 'sometimes|string|country_iso_alpha2_code', - // collections - 'languages' => 'sometimes|int_array', - 'areas_of_expertise' => 'sometimes|string_array', - 'other_presentation_links' => 'sometimes|link_array', - 'travel_preferences' => 'sometimes|string_array', - 'organizational_roles' => 'sometimes|int_array', - 'other_organizational_rol' => 'sometimes|string|max:255', - 'active_involvements' => 'sometimes|int_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = [ - 'title', - 'bio', - ]; - - $speaker = $this->service->addSpeakerBySummit($summit, HTMLCleaner::cleanData($data->all(), $fields)); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($speaker)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $speaker_id - * @return mixed - */ - public function updateSpeakerBySummit($summit_id, $speaker_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) return $this->error404(); - - $rules = [ - 'title' => 'sometimes|string|max:100', - 'first_name' => 'sometimes|string|max:100', - 'last_name' => 'sometimes|string|max:100', - 'bio' => 'sometimes|string', - 'irc' => 'sometimes|string|max:50', - 'twitter' => 'sometimes|string|max:50', - 'member_id' => 'sometimes|integer', - 'email' => 'sometimes|email:rfc|max:50', - 'on_site_phone' => 'sometimes|string|max:50', - 'registered' => 'sometimes|boolean', - 'is_confirmed' => 'sometimes|boolean', - 'checked_in' => 'sometimes|boolean', - 'registration_code' => 'sometimes|string', - 'available_for_bureau' => 'sometimes|boolean', - 'funded_travel' => 'sometimes|boolean', - 'willing_to_travel' => 'sometimes|boolean', - 'willing_to_present_video' => 'sometimes|boolean', - 'org_has_cloud' => 'sometimes|boolean', - 'country' => 'sometimes|country_iso_alpha2_code', - // collections - 'languages' => 'sometimes|int_array', - 'areas_of_expertise' => 'sometimes|string_array', - 'other_presentation_links' => 'sometimes|link_array', - 'travel_preferences' => 'sometimes|string_array', - 'organizational_roles' => 'sometimes|int_array', - 'other_organizational_rol' => 'sometimes|string|max:255', - 'active_involvements' => 'sometimes|int_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = [ - 'title', - 'bio', - ]; - - $speaker = $this->service->updateSpeakerBySummit($summit, $speaker, HTMLCleaner::cleanData($data->all(), $fields)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($speaker)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function addMySpeakerPhoto(LaravelRequest $request) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($speaker)) return $this->error404(); - - return $this->addSpeakerPhoto($request, $speaker->getId()); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $speaker_from_id - * @param $speaker_to_id - * @return mixed - */ - public function merge($speaker_from_id, $speaker_to_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $speaker_from = $this->speaker_repository->getById($speaker_from_id); - if (is_null($speaker_from)) return $this->error404(); - - $speaker_to = $this->speaker_repository->getById($speaker_to_id); - if (is_null($speaker_to)) return $this->error404(); - - $this->service->merge($speaker_from, $speaker_to, $data->all()); - - return $this->updated(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function addSpeaker() - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $rules = [ - 'title' => 'required|string|max:100', - 'first_name' => 'required|string|max:100', - 'last_name' => 'required|string|max:100', - 'bio' => 'sometimes|string', - 'notes' => 'sometimes|string', - 'irc' => 'sometimes|string|max:50', - 'twitter' => 'sometimes|string|max:50', - 'member_id' => 'sometimes|integer', - 'email' => 'sometimes|email:rfc|max:50', - 'funded_travel' => 'sometimes|boolean', - 'willing_to_travel' => 'sometimes|boolean', - 'willing_to_present_video' => 'sometimes|boolean', - 'org_has_cloud' => 'sometimes|boolean', - 'available_for_bureau' => 'sometimes|boolean', - 'country' => 'sometimes|country_iso_alpha2_code', - // collections - 'languages' => 'sometimes|int_array', - 'areas_of_expertise' => 'sometimes|string_array', - 'other_presentation_links' => 'sometimes|link_array', - 'travel_preferences' => 'sometimes|string_array', - 'organizational_roles' => 'sometimes|int_array', - 'other_organizational_rol' => 'sometimes|string|max:255', - 'active_involvements' => 'sometimes|int_array', - 'company' => 'sometimes|string|max:255', - 'phone_number' => 'sometimes|string|max:255', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = [ - 'title', - 'bio', - 'notes' - ]; - - $speaker = $this->service->addSpeaker(HTMLCleaner::cleanData($data->all(), $fields), $current_member); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($speaker, SerializerRegistry::SerializerType_Private)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $speaker_id - * @return mixed - */ - public function updateSpeaker($speaker_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) return $this->error404(); - - if (!$speaker->canBeEditedBy($current_member)) { - return $this->error403(); - } - - $rules = [ - 'title' => 'required|string|max:100', - 'first_name' => 'required|string|max:100', - 'last_name' => 'required|string|max:100', - 'bio' => 'sometimes|string', - 'notes' => 'sometimes|string', - 'irc' => 'sometimes|string|max:50', - 'twitter' => 'sometimes|string|max:50', - 'member_id' => 'sometimes|integer', - 'email' => 'sometimes|email:rfc|max:50', - 'available_for_bureau' => 'sometimes|boolean', - 'funded_travel' => 'sometimes|boolean', - 'willing_to_travel' => 'sometimes|boolean', - 'willing_to_present_video' => 'sometimes|boolean', - 'org_has_cloud' => 'sometimes|boolean', - 'country' => 'sometimes|country_iso_alpha2_code', - // collections - 'languages' => 'sometimes|int_array', - 'areas_of_expertise' => 'sometimes|string_array', - 'other_presentation_links' => 'sometimes|link_array', - 'travel_preferences' => 'sometimes|string_array', - 'organizational_roles' => 'sometimes|int_array', - 'other_organizational_rol' => 'sometimes|string|max:255', - 'active_involvements' => 'sometimes|int_array', - 'company' => 'sometimes|string|max:255', - 'phone_number' => 'sometimes|string|max:255', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = [ - 'title', - 'bio', - 'notes', - ]; - - $speaker = $this->service->updateSpeaker($speaker, HTMLCleaner::cleanData($data->all(), $fields)); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($speaker, SerializerRegistry::SerializerType_Private)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(['message' => $ex2->getMessage()]); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $speaker_id - * @return mixed - */ - public function deleteSpeaker($speaker_id) - { - try { - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) return $this->error404(); - $this->service->deleteSpeaker($speaker_id); - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $role - * @param $selection_plan_id - * @return mixedf - */ - public function getMySpeakerPresentationsByRoleAndBySelectionPlan($role, $selection_plan_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($speaker)) - return $this->error403(); - - $selection_plan = $this->selection_plan_repository->getById($selection_plan_id); - if (is_null($selection_plan)) - return $this->error404(['message' => 'missing selection plan']); - - switch ($role) { - case 'creator': - $role = PresentationSpeaker::ROLE_CREATOR; - break; - case 'speaker': - $role = PresentationSpeaker::ROLE_SPEAKER; - break; - case 'moderator': - $role = PresentationSpeaker::ROLE_MODERATOR; - break; - } - $presentations = $speaker->getPresentationsBySelectionPlanAndRole($selection_plan, $role); - - $response = new PagingResponse - ( - count($presentations), - count($presentations), - 1, - 1, - $presentations - ); - - return $this->ok($response->toArray($expand = Input::get('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $role - * @param $summit_id - * @return mixed - */ - public function getMySpeakerPresentationsByRoleAndBySummit($role, $summit_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($speaker)) - return $this->error403(); - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(['message' => 'missing selection summit']); - - - switch ($role) { - case 'creator': - $role = PresentationSpeaker::ROLE_CREATOR; - break; - case 'speaker': - $role = PresentationSpeaker::ROLE_SPEAKER; - break; - case 'moderator': - $role = PresentationSpeaker::ROLE_MODERATOR; - break; - } - $presentations = $speaker->getPresentationsBySummitAndRole($summit, $role); - - $response = new PagingResponse - ( - count($presentations), - count($presentations), - 1, - 1, - $presentations - ); - - return $this->ok($response->toArray($expand = Input::get('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $presentation_id - * @param $speaker_id - * @return mixed - */ - public function addSpeakerToMyPresentation($presentation_id, $speaker_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->addSpeaker2Presentation($current_member->getId(), $speaker_id, $presentation_id); - - return $this->updated(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $presentation_id - * @param $speaker_id - * @return mixed - */ - public function addModeratorToMyPresentation($presentation_id, $speaker_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->addModerator2Presentation($current_member->getId(), $speaker_id, $presentation_id); - - return $this->updated(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $presentation_id - * @param $speaker_id - * @return mixed - */ - public function removeSpeakerFromMyPresentation($presentation_id, $speaker_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->removeSpeakerFromPresentation($current_member->getId(), $speaker_id, $presentation_id); - - return $this->deleted(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $presentation_id - * @param $speaker_id - * @return mixed - */ - public function removeModeratorFromMyPresentation($presentation_id, $speaker_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $this->summit_service->removeModeratorFromPresentation($current_member->getId(), $speaker_id, $presentation_id); - - return $this->deleted(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $speaker_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function requestSpeakerEditPermission($speaker_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $request = $this->service->requestSpeakerEditPermission($current_member->getId(), $speaker_id); - - return $this->created( - SerializerRegistry::getInstance()->getSerializer($request) - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $speaker_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getSpeakerEditPermission($speaker_id) - { - try { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $request = $this->service->getSpeakerEditPermission($current_member->getId(), $speaker_id); - - return $this->ok( - SerializerRegistry::getInstance()->getSerializer($request)->serialize() - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $speaker_id - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function approveSpeakerEditPermission($speaker_id, $hash) - { - try { - $request = $this->service->approveSpeakerEditPermission($hash, $speaker_id); - return response()->view('speakers.edit_permissions.approved', [], 200); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return response()->view('speakers.edit_permissions.approved_validation_error', [], 412); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return response()->view('speakers.edit_permissions.approved_error', [], 404); - } catch (Exception $ex) { - Log::error($ex); - return response()->view('speakers.edit_permissions.approved_error', [], 500); - } - } - - /** - * @param $speaker_id - * @param $hash - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function declineSpeakerEditPermission($speaker_id, $hash) - { - try { - - $request = $this->service->rejectSpeakerEditPermission($hash, $speaker_id); - return response()->view('speakers.edit_permissions.rejected', [], 200); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return response()->view('speakers.edit_permissions.rejected_validation_error', [], 412); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return response()->view('speakers.edit_permissions.rejected_error', [], 404); - } catch (Exception $ex) { - Log::error($ex); - return response()->view('speakers.edit_permissions.rejected_error', [], 500); - } - } - - /** - * @param LaravelRequest $request - * @param $speaker_id - * @return mixed - */ - public function addSpeakerPhoto(LaravelRequest $request, $speaker_id) - { - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) return $this->error404(); - - if (!$speaker->canBeEditedBy($current_member)) { - return $this->error403(); - } - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $photo = $this->service->addSpeakerPhoto($speaker_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($photo)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deleteSpeakerPhoto($speaker_id) - { - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) return $this->error404(); - - if (!$speaker->canBeEditedBy($current_member)) { - return $this->error403(); - } - - $this->service->deleteSpeakerPhoto($speaker_id); - - return $this->deleted(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function addSpeakerBigPhoto(LaravelRequest $request, $speaker_id) - { - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) return $this->error404(); - - if (!$speaker->canBeEditedBy($current_member)) { - return $this->error403(); - } - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $photo = $this->service->addSpeakerBigPhoto($speaker_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($photo)->serialize()); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deleteSpeakerBigPhoto($speaker_id) - { - try { - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) return $this->error404(); - - if (!$speaker->canBeEditedBy($current_member)) { - return $this->error403(); - } - - $this->service->deleteSpeakerBigPhoto($speaker_id); - - return $this->deleted(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersAssistanceApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersAssistanceApiController.php deleted file mode 100644 index 2654bada..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersAssistanceApiController.php +++ /dev/null @@ -1,430 +0,0 @@ -summit_repository = $summit_repository; - $this->speaker_repository = $speaker_repository; - $this->service = $service; - $this->speakers_assistance_repository = $speakers_assistance_repository; - } - - /** - * @param $summit_id - * @return mixed - */ - public function getBySummit($summit_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $values = Input::all(); - - $rules = array - ( - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:10|max:100', - ); - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412($messages); - } - - // default values - $page = 1; - $per_page = 10; - - 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'), [ - 'id' => ['=='], - 'on_site_phone' => ['==', '=@'], - 'speaker_email' => ['==', '=@'], - 'speaker' => ['==', '=@'], - 'is_confirmed' => ['=='], - 'registered' => ['=='], - 'confirmation_date' => ['>', '<', '>=', '<='] - ]); - } - - $order = null; - if (Input::has('order')) { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'is_confirmed', - 'confirmation_date', - 'created', - 'registered', - ]); - } - - $serializer_type = SerializerRegistry::SerializerType_Private; - $result = $this->speakers_assistance_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - - return $this->ok - ( - $result->toArray - ( - Request::input('expand', ''), - [], - [], - [ - 'summit' => $summit, - 'serializer_type' => $serializer_type - ], - $serializer_type - ) - ); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getBySummitCSV($summit_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - // default values - $page = 1; - $per_page = PHP_INT_MAX; - - 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'), [ - 'id' => ['=='], - 'on_site_phone' => ['==', '=@'], - 'speaker_email' => ['==', '=@'], - 'speaker' => ['==', '=@'], - 'is_confirmed' => ['=='], - 'registered' => ['=='], - 'confirmation_date' => ['>', '<', '>=', '<='] - ]); - } - - $order = null; - if (Input::has('order')) { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'is_confirmed', - 'confirmation_date', - 'created', - 'registered', - ]); - } - - $serializer_type = SerializerRegistry::SerializerType_Private; - $data = $this->speakers_assistance_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - - $filename = "summit-speaker-assistances-" . date('Ymd'); - $list = $data->toArray(); - return $this->export( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - 'confirmation_date' => new EpochCellFormatter, - 'registered' => new BooleanCellFormatter, - 'is_confirmed' => new BooleanCellFormatter, - 'checked_in' => new BooleanCellFormatter, - ] - ); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addSpeakerSummitAssistance($summit_id) - { - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'speaker_id' => 'required:integer', - 'on_site_phone' => 'sometimes|string|max:50', - 'registered' => 'sometimes|boolean', - 'is_confirmed' => 'sometimes|boolean', - 'checked_in' => 'sometimes|boolean', - ]; - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $speaker_assistance = $this->service->addSpeakerAssistance($summit, $data); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($speaker_assistance)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $assistance_id - * @return mixed - */ - public function updateSpeakerSummitAssistance($summit_id, $assistance_id) - { - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json()->all(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'on_site_phone' => 'sometimes|string|max:50', - 'registered' => 'sometimes|boolean', - 'is_confirmed' => 'sometimes|boolean', - 'checked_in' => 'sometimes|boolean', - ]; - // Creates a Validator instance and validates the data. - $validation = Validator::make($data, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $speaker_assistance = $this->service->updateSpeakerAssistance($summit, $assistance_id, $data); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($speaker_assistance)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $summit_id - * @param $assistance_id - * @return mixed - */ - public function deleteSpeakerSummitAssistance($summit_id, $assistance_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->service->deleteSpeakerAssistance($summit, $assistance_id); - - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - - } - - /** - * @param $summit_id - * @param $assistance_id - * @return mixed - */ - public function getSpeakerSummitAssistanceBySummit($summit_id, $assistance_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $speaker_assistance = $summit->getSpeakerAssistanceById($assistance_id); - - if (is_null($speaker_assistance)) return $this->error404(); - - return $this->ok - ( - SerializerRegistry::getInstance()->getSerializer($speaker_assistance)->serialize - ( - Request::input('expand', '') - ) - ); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $assistance_id - * @return mixed - */ - public function sendSpeakerSummitAssistanceAnnouncementMail($summit_id, $assistance_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->service->sendSpeakerSummitAssistanceAnnouncementMail($summit, $assistance_id); - return $this->created(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSponsorApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSponsorApiController.php deleted file mode 100644 index cbde6e80..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSponsorApiController.php +++ /dev/null @@ -1,224 +0,0 @@ -summit_repository = $summit_repository; - $this->service = $service; - $this->repository = $repository; - } - - - /** - * @return array - */ - protected function getFilterRules():array{ - return [ - 'company_name' => ['==', '=@'], - 'sponsorship_name' => ['==', '=@'], - 'sponsorship_size' => ['==', '=@'], - 'badge_scans_count' => ['==', '<','>','<=','>=','<>'], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'company_name' => 'sometimes|required|string', - 'sponsorship_name' => 'sometimes|required|string', - 'sponsorship_size' => 'sometimes|required|string', - 'badge_scans_count' => 'sometimes|required|integer', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'order', - ]; - } - - use GetAllBySummit; - - use GetSummitChildElementById; - - use AddSummitChildElement; - - use UpdateSummitChildElement; - - use DeleteSummitChildElement; - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return SponsorValidationRulesFactory::build($payload); - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addSponsor($summit, $payload); - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param Summit $summit - * @param $child_id - * @return void - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteSponsor($summit, $child_id); - } - - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getSummitSponsorById($child_id); - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return SponsorValidationRulesFactory::build($payload, true); - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateSponsor($summit, $child_id, $payload); - } - - /** - * @param $summit_id - * @param $sponsor_id - * @param $member_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addSponsorUser($summit_id, $sponsor_id, $member_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $sponsor = $this->service->addSponsorUser($summit, $sponsor_id, $member_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($sponsor)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $sponsor_id - * @param $member_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeSponsorUser($summit_id, $sponsor_id, $member_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $sponsor = $this->service->removeSponsorUser($summit, $sponsor_id, $member_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($sponsor)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTaxTypeApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTaxTypeApiController.php deleted file mode 100644 index 052ad581..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTaxTypeApiController.php +++ /dev/null @@ -1,220 +0,0 @@ - ['=@', '=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'name' => 'sometimes|required|string', - ]; - } - /** - * @return array - */ - protected function getOrderRules():array{ - return [ - 'id', - 'name', - ]; - } - - public function __construct - ( - ISummitTaxTypeRepository $repository, - ISummitRepository $summit_repository, - ISummitTaxTypeService $service, - IResourceServerContext $resource_server_context - ) - { - parent::__construct($resource_server_context); - $this->repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param array $payload - * @return array - */ - protected function getAddValidationRules(array $payload): array - { - return TaxTypeValidationRulesFactory::build($payload); - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - * @throws EntityNotFoundException - * @throws ValidationException - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addTaxType($summit, $payload); - } - - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $summit->getTaxTypeById($child_id); - } - - /** - * @param array $payload - * @return array - */ - function getUpdateValidationRules(array $payload): array - { - return TaxTypeValidationRulesFactory::build($payload, true); - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - * @throws EntityNotFoundException - * @throws ValidationException - */ - protected function updateChild(Summit $summit, int $child_id, array $payload): IEntity - { - return $this->service->updateTaxType($summit, $child_id, $payload); - } - - /** - * @param Summit $summit - * @param $child_id - * @throws EntityNotFoundException - */ - protected function deleteChild(Summit $summit, $child_id): void - { - $this->service->deleteTaxType($summit, $child_id); - } - - /** - * @param $summit_id - * @param $tax_id - * @param $ticket_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addTaxToTicketType($summit_id, $tax_id, $ticket_type_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $child = $this->service->addTaxTypeToTicketType($summit, $tax_id, $ticket_type_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($child)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $tax_id - * @param $ticket_type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeTaxFromTicketType($summit_id, $tax_id, $ticket_type_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $child = $this->service->removeTaxTypeFromTicketType($summit, $tax_id, $ticket_type_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($child)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTicketApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTicketApiController.php deleted file mode 100644 index d1a731da..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTicketApiController.php +++ /dev/null @@ -1,694 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->service = $service; - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummit($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function(){ - return [ - 'number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - 'owner_name' => ['=@', '=='], - 'owner_first_name' => ['=@', '=='], - 'owner_last_name' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'owner_company' => ['=@', '=='], - 'summit_id' => ['=='], - 'owner_id' => ['=='], - 'order_id' => ['=='], - 'status' => ['==','<>'], - ]; - }, - function(){ - return [ - 'status' => sprintf('sometimes|in:%s',implode(',', IOrderConstants::ValidStatus)), - 'number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - 'owner_name' => 'sometimes|string', - 'owner_first_name' => 'sometimes|string', - 'owner_last_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'owner_company' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'owner_id' => 'sometimes|integer', - 'order_id' => 'sometimes|integer', - ]; - }, - function() - { - return [ - 'id', - 'number', - 'status', - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return ISummitAttendeeTicketSerializerTypes::AdminType; - } - ); - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummitCSV($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAllCSV( - function(){ - return [ - 'number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - 'owner_name' => ['=@', '=='], - 'owner_first_name' => ['=@', '=='], - 'owner_last_name' => ['=@', '=='], - 'owner_email' => ['=@', '=='], - 'owner_company' => ['=@', '=='], - 'summit_id' => ['=='], - 'owner_id' => ['=='], - 'order_id' => ['=='], - 'status' => ['=='], - ]; - }, - function(){ - return [ - 'status' => sprintf('sometimes|in:%s',implode(',', IOrderConstants::ValidStatus)), - 'number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - 'owner_name' => 'sometimes|string', - 'owner_first_name' => 'sometimes|string', - 'owner_last_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'owner_company' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'owner_id' => 'sometimes|integer', - 'order_id' => 'sometimes|integer', - ]; - }, - function() - { - return [ - 'id', - 'number', - 'status', - ]; - }, - function($filter) use($summit){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_CSV; - }, - function(){ - return [ - 'created' => new EpochCellFormatter(), - 'last_edited' => new EpochCellFormatter(), - 'bought_date' => new EpochCellFormatter(), - ]; - }, - function() use($summit){ - $allowed_columns = [ - 'id', - 'created', - 'last_edited', - 'number', - 'status', - 'attendee_id', - 'attendee_first_name', - 'attendee_last_name', - 'attendee_email', - 'attendee_company', - 'external_order_id', - 'external_attendee_id', - 'bought_date', - 'ticket_type_id', - 'ticket_type_name', - 'order_id', - 'badge_id', - 'promo_code_id', - 'promo_code', - 'raw_cost', - 'final_amount', - 'discount', - 'refunded_amount', - 'currency', - 'badge_type_id', - 'badge_type_name', - ]; - - foreach ($summit->getBadgeFeaturesTypes() as $featuresType){ - $allowed_columns[] = $featuresType->getName(); - } - - foreach ($summit->getOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage) as $question){ - $allowed_columns[] = $question->getLabel(); - } - - $columns_param = Input::get("columns", ""); - $columns = []; - if(!empty($columns_param)) - $columns = explode(',', $columns_param); - $diff = array_diff($columns, $allowed_columns); - if(count($diff) > 0){ - throw new ValidationException(sprintf("columns %s are not allowed!", implode(",", $diff))); - } - if(empty($columns)) - $columns = $allowed_columns; - return $columns; - }, - sprintf('tickets-%s-', $summit_id), - [ - 'features_types' => $summit->getBadgeFeaturesTypes(), - 'ticket_questions' => $summit->getOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage) - ] - ); - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function ingestExternalTicketData($summit_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $payload = $this->getJsonPayload([ - 'email_to' => 'nullable|email', - ]); - - $this->service->ingestExternalTicketData($summit, $payload); - - return $this->ok(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getImportTicketDataTemplate($summit_id){ - try { - /** - * id - * number - * attendee_email ( mandatory if id and number are missing) - * attendee_first_name (optional) - * attendee_last_name (optional) - * attendee_company (optional) - * ticket_type_name ( mandatory if id and number are missing) - * ticket_type_id ( mandatory if id and number are missing) - * badge_type_id (optional) - * badge_type_name (optional) - * badge_features (optional) - */ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $row = [ - 'id' => '', - 'number' => '', - 'attendee_email' => '', - 'attendee_first_name' => '', - 'attendee_last_name' => '', - 'attendee_company' => '', - 'ticket_type_name' => '', - 'ticket_type_id' => '', - 'badge_type_id' => '', - 'badge_type_name' => '', - ]; - - // badge features for summit - foreach ($summit->getBadgeFeaturesTypes() as $featuresType){ - $row[$featuresType->getName()] = '' ; - } - - $template = [ - $row - ]; - - return $this->export - ( - 'csv', - 'ticket-data-import-template', - $template, - [], - [] - ); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param LaravelRequest $request - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function importTicketData(LaravelRequest $request, $summit_id){ - - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $this->service->importTicketData($summit, $file); - - return $this->ok(); - - } catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412(array($ex2->getMessage())); - } catch (\HTTP401UnauthorizedException $ex3) { - Log::warning($ex3); - return $this->error401(); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function getAllMyTickets(){ - $owner = $this->getResourceServerContext()->getCurrentUser(); - return $this->_getAll( - function(){ - return [ - 'number' => ['=@', '=='], - 'order_number' => ['=@', '=='], - 'summit_id' => ['=='], - 'order_id' => ['=='], - 'status' => ['==','<>'], - ]; - }, - function(){ - return [ - 'number' => 'sometimes|string', - 'order_number' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'order_id' => 'sometimes|integer', - 'status' => sprintf('sometimes|in:%s',implode(',', IOrderConstants::ValidStatus)), - ]; - }, - function() - { - return [ - 'id', - 'number', - 'status', - ]; - }, - function($filter) use($owner){ - if($filter instanceof Filter){ - $filter->addFilterCondition(FilterElement::makeEqual('member_id', $owner->getId())); - $filter->addFilterCondition(FilterElement::makeEqual('is_active', true)); - } - return $filter; - }, - function(){ - return ISummitAttendeeTicketSerializerTypes::AdminType; - } - ); - } - - /** - * @return ISummitRepository - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - /** - * @param Summit $summit - * @param $child_id - * @return IEntity|null - * @throws \Exception - */ - protected function getChildFromSummit(Summit $summit, $child_id): ?IEntity - { - return $this->service->getTicket($summit, $child_id); - } - - /** - * @param $summit_id - * @param $ticket_id - * @return mixed - */ - public function refundTicket($summit_id, $ticket_id) - { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'amount' => 'required|numeric|greater_than:0', - ]); - - $ticket = $this->service->refundTicket($summit, $ticket_id, floatval($payload['amount'])); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket)->serialize( Request::input('expand', ''))); - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAttendeeBadge($summit_id, $ticket_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $ticket = is_int($ticket_id) ? $this->repository->getById(intval($ticket_id)) : $this->repository->getByNumber($ticket_id); - if(is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) return $this->error404();; - if($ticket->getOrder()->getSummitId() != $summit->getId()) return $this->error404(); - if(!$ticket->hasBadge()) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($ticket->getBadge())->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function createAttendeeBadge($summit_id, $ticket_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $this->getJsonPayload([ - 'badge_type_id' => 'sometimes|integer', - 'features' => 'sometimes|int_array', - ]); - - $badge = $this->service->createBadge($summit, $ticket_id, $payload); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($badge)->serialize( Request::input('expand', ''))); - } - catch(\InvalidArgumentException $ex){ - Log::warning($ex); - return $this->error400(); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function deleteAttendeeBadge($summit_id, $ticket_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->service->deleteBadge($summit, $ticket_id); - return $this->deleted(); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_id - * @param $type_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function updateAttendeeBadgeType($summit_id, $ticket_id, $type_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $badge = $this->service->updateBadgeType($summit, $ticket_id, $type_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($badge)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_id - * @param $feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addAttendeeBadgeFeature($summit_id, $ticket_id, $feature_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $badge = $this->service->addAttendeeBadgeFeature($summit, $ticket_id, $feature_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($badge)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_id - * @param $feature_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeAttendeeBadgeFeature($summit_id, $ticket_id, $feature_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $badge = $this->service->removeAttendeeBadgeFeature($summit, $ticket_id, $feature_id); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($badge)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function printAttendeeBadge($summit_id, $ticket_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - $badge = $this->service->printAttendeeBadge($summit, $ticket_id, $current_member); - - return $this->updated - ( - SerializerRegistry::getInstance()->getSerializer($badge)->serialize( Request::input('expand', '')) - ); - - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTrackChairsApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTrackChairsApiController.php deleted file mode 100644 index e754cbce..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTrackChairsApiController.php +++ /dev/null @@ -1,367 +0,0 @@ -repository = $repository; - $this->service = $service; - $this->summit_repository = $summit_repository; - } - - use ParametrizedGetAll; - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummit($summit_id){ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - return $this->_getAll( - function () { - return [ - 'member_first_name' => ['=@', '=='], - 'member_last_name' => ['=@', '=='], - 'member_full_name' => ['=@', '=='], - 'member_email' => ['=@', '=='], - 'member_id' => ['=='], - 'track_id' => ['=='], - 'summit_id' => ['=='], - ]; - }, - function () { - return [ - 'member_first_name' => 'sometimes|string', - 'member_last_name' => 'sometimes|string', - 'member_full_name' => 'sometimes|string', - 'member_email' => 'sometimes|string', - 'member_id' => 'sometimes|integer', - 'track_id' => 'sometimes|integer', - 'summit_id' => 'sometimes|integer', - ]; - }, - function () { - return [ - 'member_first_name', - 'member_last_name', - 'member_email', - 'member_full_name', - 'id', - 'track_id', - ]; - }, - function ($filter) use ($summit) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function () { - $current_user = $this->resource_server_context->getCurrentUser(); - if(!is_null($current_user)){ - if( - $current_user->isOnGroup(IGroup::Administrators) || - $current_user->isOnGroup(IGroup::SuperAdmins) || - $current_user->isOnGroup(IGroup::TrackChairsAdmins) || - $current_user->isOnGroup(IGroup::SummitAdministrators) - ) - return SerializerRegistry::SerializerType_Private; - } - return SerializerRegistry::SerializerType_Public; - } - ); - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) return $this->error403(); - - return $this->_getAllCSV( - function () { - return [ - 'member_first_name' => ['=@', '=='], - 'member_last_name' => ['=@', '=='], - 'member_full_name' => ['=@', '=='], - 'member_email' => ['=@', '=='], - 'member_id' => ['=='], - 'track_id' => ['=='], - 'summit_id' => ['=='], - ]; - }, - function () { - return [ - 'member_first_name' => 'sometimes|string', - 'member_last_name' => 'sometimes|string', - 'member_full_name' => 'sometimes|string', - 'member_email' => 'sometimes|string', - 'member_id' => 'sometimes|integer', - 'track_id' => 'sometimes|integer', - 'summit_id' => 'sometimes|integer', - ]; - }, - function () { - return [ - 'member_first_name', - 'member_last_name', - 'member_email', - 'member_full_name', - 'id', - 'track_id', - ]; - }, - function ($filter) use ($summit) { - if ($filter instanceof Filter) { - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit->getId())); - } - return $filter; - }, - function(){ - return SerializerRegistry::SerializerType_CSV; - }, - function(){ - return [ - 'created' => new EpochCellFormatter(), - 'last_edited' => new EpochCellFormatter(), - ]; - }, - function(){ - - $allowed_columns = [ - 'created', - 'last_edited', - 'member_first_name', - 'member_last_name', - 'member_email', - 'member_id', - 'categories', - 'summit_id' - ]; - - $columns_param = Input::get("columns", ""); - $columns = []; - if(!empty($columns_param)) - $columns = explode(',', $columns_param); - $diff = array_diff($columns, $allowed_columns); - if(count($diff) > 0){ - throw new ValidationException(sprintf("columns %s are not allowed!", implode(",", $diff))); - } - if(empty($columns)) - $columns = $allowed_columns; - return $columns; - }, - 'track-chairs-' - ); - } - - use AddSummitChildElement; - - /** - * @param array $payload - * @return array - */ - function getAddValidationRules(array $payload): array - { - return [ - 'member_id' => 'required|int', - 'categories' => 'required|int_array', - ]; - } - - /** - * @param Summit $summit - * @param array $payload - * @return IEntity - */ - protected function addChild(Summit $summit, array $payload): IEntity - { - return $this->service->addTrackChair($summit, $payload); - } - - /** - * @inheritDoc - */ - protected function getSummitRepository(): ISummitRepository - { - return $this->summit_repository; - } - - use UpdateSummitChildElement; - - function getUpdateValidationRules(array $payload): array{ - return [ - 'categories' => 'required|int_array', - ]; - } - - /** - * @param Summit $summit - * @param int $child_id - * @param array $payload - * @return IEntity - */ - protected function updateChild(Summit $summit,int $child_id, array $payload):IEntity{ - return $this->service->updateTrackChair($summit, $child_id, $payload); - } - - use DeleteSummitChildElement; - - /** - * @param Summit $summit - * @param $child_id - * @return void - */ - protected function deleteChild(Summit $summit, $child_id):void{ - $this->service->deleteTrackChair($summit, $child_id); - } - - use GetSummitChildElementById; - - /** - * @param Summit $summit - * @param $child_id - * @return IEntity|null - */ - protected function getChildFromSummit(Summit $summit, $child_id):?IEntity{ - return $summit->getTrackChair(intval($child_id)); - } - - /** - * @param $summit_id - * @param $track_chair_id - * @param $track_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addTrack2TrackChair($summit_id, $track_chair_id, $track_id){ - try{ - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $track_chair = $this->service->addTrack2TrackChair($summit, intval($track_chair_id), intval($track_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($track_chair)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch(HTTP403ForbiddenException $ex){ - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_chair_id - * @param $track_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeFromTrackChair($summit_id, $track_chair_id, $track_id){ - try{ - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $track_chair = $this->service->removeFromTrackChair($summit, intval($track_chair_id), intval($track_id)); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($track_chair)->serialize(Request::input('expand', ''))); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch(HTTP403ForbiddenException $ex){ - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTrackTagGroupsApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTrackTagGroupsApiController.php deleted file mode 100644 index f0247799..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTrackTagGroupsApiController.php +++ /dev/null @@ -1,460 +0,0 @@ -summit_repository = $summit_repository; - $this->track_tag_group_service = $track_tag_group_service; - $this->repository = $repository; - } - - /** - * @param $summit_id - * @return mixed - */ - public function getTrackTagGroupsBySummit($summit_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $track_tag_groups = $summit->getTrackTagGroups()->toArray(); - - $response = new PagingResponse - ( - count($track_tag_groups), - count($track_tag_groups), - 1, - 1, - $track_tag_groups - ); - - return $this->ok($response->toArray($expand = Input::get('expand',''))); - } - - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllowedTags($summit_id){ - - $values = Input::all(); - - $rules = [ - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ]; - - 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 = 5; - - 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'), array - ( - 'tag' => ['=@', '=='], - )); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), array - ( - 'tag', - 'id', - )); - } - - if(is_null($filter)) $filter = new Filter(); - - $data = $this->repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - $fields = Request::input('fields', ''); - $fields = !empty($fields) ? explode(',', $fields) : []; - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations - ) - ); - } - - catch (EntityNotFoundException $ex1) { - Log::warning($ex1); - return $this->error404(); - } - catch (ValidationException $ex2) { - Log::warning($ex2); - return $this->error412($ex2->getMessages()); - } - catch(FilterParserException $ex3){ - Log::warning($ex3); - return $this->error412($ex3->getMessages()); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addTrackTagGroup($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'name' => 'required|string|max:50', - 'label' => 'required|string|max:50', - 'is_mandatory' => 'required|boolean', - 'allowed_tags' => 'sometimes|string_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $track_tag_group = $this->track_tag_group_service->addTrackTagGroup($summit, $data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($track_tag_group)->serialize(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 (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_tag_group_id - * @return mixed - */ - public function updateTrackTagGroup($summit_id, $track_tag_group_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build - ( - $this->summit_repository, - $this->resource_server_context - )->find($summit_id); - - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'name' => 'sometimes|string|max:50', - 'label' => 'sometimes|string|max:50', - 'is_mandatory' => 'sometimes|boolean', - 'order' => 'sometimes|integer|min:1', - 'allowed_tags' => 'sometimes|string_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $track_tag_group = $this->track_tag_group_service->updateTrackTagGroup($summit, $track_tag_group_id, $data->all()); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($track_tag_group)->serialize(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 (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_tag_group_id - * @return mixed - */ - public function getTrackTagGroup($summit_id, $track_tag_group_id){ - try{ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $track_tag_group = $summit->getTrackTagGroup(intval($track_tag_group_id)); - if(is_null($track_tag_group)) - return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($track_tag_group)->serialize(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 (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_tag_group_id - * @return mixed - */ - public function deleteTrackTagGroup($summit_id, $track_tag_group_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->track_tag_group_service->deleteTrackTagGroup($summit, $track_tag_group_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function seedDefaultTrackTagGroups($summit_id){ - try{ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $track_tag_groups = $this->track_tag_group_service->seedDefaultTrackTagGroups($summit); - - $response = new PagingResponse - ( - count($track_tag_groups), - count($track_tag_groups), - 1, - 1, - $track_tag_groups - ); - return $this->created($response->toArray()); - - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $tag_id - * @return mixed - */ - public function seedTagOnAllTracks($summit_id, $tag_id){ - try{ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->track_tag_group_service->seedTagOnAllTrack($summit, $tag_id); - return $this->updated(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_tag_group_id - * @param $track_id - * @return mixed - */ - public function seedTagTrackGroupOnTrack($summit_id, $track_tag_group_id, $track_id){ - try{ - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->track_tag_group_service->seedTagTrackGroupTagsOnTrack($summit, $track_tag_group_id, $track_id); - return $this->updated(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTracksApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTracksApiController.php deleted file mode 100644 index c49af8aa..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitTracksApiController.php +++ /dev/null @@ -1,682 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->track_service = $track_service; - } - - /** - * @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'), [ - 'name' => ['=@', '=='], - 'description' => ['=@', '=='], - 'code' => ['=@', '=='], - 'group_name' => ['=@', '=='], - 'voting_visible' => ['=='], - 'chair_visible' => ['=='], - ]); - } - - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'code' => 'sometimes|string', - 'group_name' => 'sometimes|string', - 'voting_visible' => 'sometimes|boolean', - 'chair_visible' => 'sometimes|boolean', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'id', - 'code', - 'name' - ]); - } - - $data = $this->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(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - $values = Input::all(); - $rules = []; - - 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 = PHP_INT_MAX; - - 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' => ['=@', '=='], - 'description' => ['=@', '=='], - 'code' => ['=@', '=='], - 'group_name' => ['=@', '=='], - 'voting_visible' => ['=='], - 'chair_visible' => ['=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'code' => 'sometimes|string', - 'group_name' => 'sometimes|string', - 'voting_visible' => 'sometimes|boolean', - 'chair_visible' => 'sometimes|boolean', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'id', - 'code', - 'title' - ]); - } - - $data = $this->repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - - $filename = "tracks-" . date('Ymd'); - $list = $data->toArray(); - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - 'is_default' => new BooleanCellFormatter, - 'black_out_times' => new BooleanCellFormatter, - 'use_sponsors' => new BooleanCellFormatter, - 'are_sponsors_mandatory' => new BooleanCellFormatter, - 'allows_attachment' => new BooleanCellFormatter, - 'use_speakers' => new BooleanCellFormatter, - 'are_speakers_mandatory' => new BooleanCellFormatter, - 'use_moderator' => new BooleanCellFormatter, - 'is_moderator_mandatory' => new BooleanCellFormatter, - 'should_be_available_on_cfp' => new BooleanCellFormatter, - ] - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @return mixed - */ - public function getTrackBySummit($summit_id, $track_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $track = $summit->getPresentationCategory($track_id); - if(is_null($track)) - return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($track)->serialize(Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @return mixed - */ - public function getTrackExtraQuestionsBySummit($summit_id, $track_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $track = $summit->getPresentationCategory($track_id); - if(is_null($track)) - return $this->error404(); - $extra_questions = $track->getExtraQuestions()->toArray(); - $response = new PagingResponse( - count($extra_questions), - count($extra_questions), - 1, - 1, - $extra_questions - ); - - return $this->ok($response->toArray()); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @param $question_id - * @return mixed - */ - public function addTrackExtraQuestion($summit_id, $track_id, $question_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->track_service->addTrackExtraQuestion($track_id, $question_id); - - return $this->updated(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @param $question_id - * @return mixed - */ - public function removeTrackExtraQuestion($summit_id, $track_id, $question_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->track_service->removeTrackExtraQuestion($track_id, $question_id); - - return $this->deleted(); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function getTrackAllowedTagsBySummit($summit_id, $track_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $track = $summit->getPresentationCategory($track_id); - if(is_null($track)) - return $this->error404(); - $allowed_tags = $track->getAllowedTags()->toArray(); - - $response = new PagingResponse( - count($allowed_tags), - count($allowed_tags), - 1, - 1, - $allowed_tags - ); - $res = $response->toArray(); - $i = 0; - foreach($res["data"] as $allowed_tag){ - $track_tag_group = $summit->getTrackTagGroupForTagId($allowed_tag['id']); - if(is_null($track_tag_group)) continue; - $res["data"][$i]['track_tag_group']= SerializerRegistry::getInstance()->getSerializer($track_tag_group)->serialize(null, [], ['none']); - $i++; - } - return $this->ok($res); - - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addTrackBySummit($summit_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'name' => 'required|string|max:50', - 'description' => 'required|string|max:500', - 'code' => 'sometimes|string|max:5', - 'color' => 'sometimes|hex_color|max:50', - 'session_count' => 'sometimes|integer', - 'alternate_count' => 'sometimes|integer', - 'lightning_count' => 'sometimes|integer', - 'lightning_alternate_count' => 'sometimes|integer', - 'voting_visible' => 'sometimes|boolean', - 'chair_visible' => 'sometimes|boolean', - 'allowed_tags' => 'sometimes|string_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $track = $this->track_service->addTrack($summit, $data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($track)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $to_summit_id - * @return mixed - */ - public function copyTracksToSummit($summit_id, $to_summit_id){ - try { - - $from_summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($from_summit)) return $this->error404(); - - $to_summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($to_summit_id); - if (is_null($to_summit)) return $this->error404(); - - $tracks = $this->track_service->copyTracks($from_summit, $to_summit); - - $response = new PagingResponse - ( - count($tracks), - count($tracks), - 1, - 1, - $tracks - ); - - return $this->created($response->toArray()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @return mixed - */ - public function updateTrackBySummit($summit_id, $track_id){ - try { - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = [ - 'name' => 'sometimes|string|max:50', - 'description' => 'sometimes|string|max:500', - 'color' => 'sometimes|hex_color|max:50', - 'code' => 'sometimes|string|max:5', - 'session_count' => 'sometimes|integer', - 'alternate_count' => 'sometimes|integer', - 'lightning_count' => 'sometimes|integer', - 'lightning_alternate_count' => 'sometimes|integer', - 'voting_visible' => 'sometimes|boolean', - 'chair_visible' => 'sometimes|boolean', - 'allowed_tags' => 'sometimes|string_array', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $track = $this->track_service->updateTrack($summit, $track_id, $data->all()); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($track)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $track_id - * @return mixed - */ - public function deleteTrackBySummit($summit_id, $track_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->track_service->deleteTrack($summit, $track_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function addTrackIcon(LaravelRequest $request, $summit_id, $track_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $file = $request->file('file'); - if (is_null($file)) { - return $this->error412(array('file param not set!')); - } - - $image = $this->track_service->addTrackIcon($summit, $track_id, $file); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($image)->serialize()); - - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deleteTrackIcon($summit_id, $track_id) { - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $this->track_service->removeTrackIcon($summit, $track_id); - return $this->deleted(); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitsEventTypesApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitsEventTypesApiController.php deleted file mode 100644 index 0435c026..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitsEventTypesApiController.php +++ /dev/null @@ -1,573 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->event_type_service = $event_type_service; - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummit($summit_id){ - $values = Input::all(); - $rules = [ - - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ]; - - 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 = 5; - - 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'), [ - 'name' => ['=@', '=='], - 'class_name' => ['=='], - 'is_default' => ['=='], - 'black_out_times' => ['=='], - 'use_sponsors' => ['=='], - 'are_sponsors_mandatory' => ['=='], - 'allows_attachment' => ['=='], - 'use_speakers' => ['=='], - 'are_speakers_mandatory' => ['=='], - 'use_moderator' => ['=='], - 'is_moderator_mandatory' => ['=='], - 'should_be_available_on_cfp' => ['=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'class_name' => sprintf('sometimes|in:%s',implode(',', SummitEventTypeConstants::$valid_class_names)), - 'name' => 'sometimes|string', - 'is_default' => 'sometimes|boolean', - 'black_out_times' => 'sometimes|boolean', - 'use_sponsors' => 'sometimes|boolean', - 'are_sponsors_mandatory' => 'sometimes|boolean', - 'allows_attachment' => 'sometimes|boolean', - 'use_speakers' => 'sometimes|boolean', - 'are_speakers_mandatory' => 'sometimes|boolean', - 'use_moderator' => 'sometimes|boolean', - 'is_moderator_mandatory' => 'sometimes|boolean', - 'should_be_available_on_cfp' => 'sometimes|boolean', - ], [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitEventTypeConstants::$valid_class_names) - ), - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'id', - 'name', - ]); - } - - $data = $this->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(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - $values = Input::all(); - $rules = [ - ]; - - 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 = PHP_INT_MAX; - - 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'), [ - 'name' => ['=@', '=='], - 'class_name' => ['=='], - 'is_default' => ['=='], - 'black_out_times' => ['=='], - 'use_sponsors' => ['=='], - 'are_sponsors_mandatory' => ['=='], - 'allows_attachment' => ['=='], - 'use_speakers' => ['=='], - 'are_speakers_mandatory' => ['=='], - 'use_moderator' => ['=='], - 'is_moderator_mandatory' => ['=='], - 'should_be_available_on_cfp' => ['=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'class_name' => sprintf('sometimes|in:%s',implode(',', SummitEventTypeConstants::$valid_class_names)), - 'name' => 'sometimes|string', - 'is_default' => 'sometimes|boolean', - 'black_out_times' => 'sometimes|boolean', - 'use_sponsors' => 'sometimes|boolean', - 'are_sponsors_mandatory' => 'sometimes|boolean', - 'allows_attachment' => 'sometimes|boolean', - 'use_speakers' => 'sometimes|boolean', - 'are_speakers_mandatory' => 'sometimes|boolean', - 'use_moderator' => 'sometimes|boolean', - 'is_moderator_mandatory' => 'sometimes|boolean', - 'should_be_available_on_cfp' => 'sometimes|boolean', - ], [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitEventTypeConstants::$valid_class_names) - ), - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'id', - 'name', - ]); - } - - $data = $this->repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - - $filename = "event-types-" . date('Ymd'); - $list = $data->toArray(); - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - 'is_default' => new BooleanCellFormatter, - 'black_out_times' => new BooleanCellFormatter, - 'use_sponsors' => new BooleanCellFormatter, - 'are_sponsors_mandatory' => new BooleanCellFormatter, - 'allows_attachment' => new BooleanCellFormatter, - 'use_speakers' => new BooleanCellFormatter, - 'are_speakers_mandatory' => new BooleanCellFormatter, - 'use_moderator' => new BooleanCellFormatter, - 'is_moderator_mandatory' => new BooleanCellFormatter, - 'should_be_available_on_cfp' => new BooleanCellFormatter, - ] - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_type_id - * @return mixed - */ - public function getEventTypeBySummit($summit_id, $event_type_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $event_type = $summit->getEventType($event_type_id); - if(is_null($event_type)) - return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($event_type)->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addEventTypeBySummit($summit_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = EventTypeValidationRulesFactory::build($data->all()); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $event_type = $this->event_type_service->addEventType($summit, $data->all()); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($event_type)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_type_id - * @return mixed - */ - public function updateEventTypeBySummit($summit_id, $event_type_id) - { - try { - if (!Request::isJson()) return $this->error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = EventTypeValidationRulesFactory::build($data->all(), true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($data->all(), $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $event_type = $this->event_type_service->updateEventType($summit, $event_type_id, $data->all()); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($event_type)->serialize()); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_type_id - * @return mixed - */ - public function deleteEventTypeBySummit($summit_id, $event_type_id) - { - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->event_type_service->deleteEventType($summit, $event_type_id); - - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function seedDefaultEventTypesBySummit($summit_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $event_types = $this->event_type_service->seedDefaultEventTypes($summit); - - $response = new PagingResponse - ( - count($event_types), - count($event_types), - 1, - 1, - $event_types - ); - - return $this->created($response->toArray()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $event_type_id - * @param $document_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function addSummitDocument($summit_id, $event_type_id, $document_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - - $document = $this->event_type_service->addSummitDocumentToEventType - ( - $summit, - $event_type_id, - $document_id - ); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($document)->serialize()); - } - 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); - } - } - - /** - * @param $summit_id - * @param $event_type_id - * @param $document_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function removeSummitDocument($summit_id, $event_type_id, $document_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - - $document = $this->event_type_service->removeSummitDocumentFromEventType - ( - $summit, - $event_type_id, - $document_id - ); - return $this->updated(SerializerRegistry::getInstance()->getSerializer($document)->serialize()); - } - 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); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitsTicketTypesApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitsTicketTypesApiController.php deleted file mode 100644 index d8577172..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitsTicketTypesApiController.php +++ /dev/null @@ -1,437 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->ticket_type_service = $ticket_type_service; - } - - /** - * @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::DefaultPageSize, 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'), [ - 'name' => ['=@', '=='], - 'description' => ['=@', '=='], - 'external_id' => ['=@', '=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'external_id' => 'sometimes|string', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'name', - 'external_id' - ]); - } - - $data = $this->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(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllBySummitCSV($summit_id){ - - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - - // default values - $page = 1; - $per_page = PHP_INT_MAX; - - 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'), [ - 'name' => ['=@', '=='], - 'description' => ['=@', '=='], - 'external_id' => ['=@', '=='], - ]); - } - - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'external_id' => 'sometimes|string', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'name', - 'external_id' - ]); - } - - $data = $this->repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order); - - $filename = "ticket-types-" . date('Ymd'); - $list = $data->toArray(); - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - ] - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_type_id - * @return mixed - */ - public function getTicketTypeBySummit($summit_id, $ticket_type_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - if(is_null($ticket_type)) - return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($ticket_type)->serialize( 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 (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function addTicketTypeBySummit($summit_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitTicketTypeValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $ticket_type = $this->ticket_type_service->addTicketType($summit, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($ticket_type)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_type_id - * @return mixed - */ - public function updateTicketTypeBySummit($summit_id, $ticket_type_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $data = Input::json(); - $payload = $data->all(); - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $rules = SummitTicketTypeValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $ticket_type = $this->ticket_type_service->updateTicketType($summit, $ticket_type_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($ticket_type)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $ticket_type_id - * @return mixed - */ - public function deleteTicketTypeBySummit($summit_id, $ticket_type_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->ticket_type_service->deleteTicketType($summit, $ticket_type_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function seedDefaultTicketTypesBySummit($summit_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $ticket_types = $this->ticket_type_service->seedSummitTicketTypesFromEventBrite($summit); - - $response = new PagingResponse - ( - count($ticket_types), - count($ticket_types), - 1, - 1, - $ticket_types - ); - - return $this->created($response->toArray()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2TrackQuestionsTemplateApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2TrackQuestionsTemplateApiController.php deleted file mode 100644 index bf09991a..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2TrackQuestionsTemplateApiController.php +++ /dev/null @@ -1,479 +0,0 @@ -track_question_template_repository = $track_question_template_repository; - $this->track_question_template_service = $track_question_template_service; - } - - /** - * @return mixed - */ - public function getTrackQuestionTemplates(){ - $values = Input::all(); - $rules = [ - - 'page' => 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ]; - - try { - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = 5; - - 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'), [ - 'name' => ['=@', '=='], - 'label' => ['=@', '=='], - 'class_name' => ['=='], - ]); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'class_name' => sprintf('sometimes|in:%s',implode(',', TrackQuestionTemplateConstants::$valid_class_names)), - 'name' => 'sometimes|string', - 'label' => 'sometimes|string', - ], [ - 'class_name.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", TrackQuestionTemplateConstants::$valid_class_names) - ), - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'id', - 'name', - 'label', - ]); - } - - $data = $this->track_question_template_repository->getAllByPage(new PagingInfo($page, $per_page), $filter, $order); - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - [], - [], - [] - ) - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function addTrackQuestionTemplate(){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $rules = TrackQuestionTemplateValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $question = $this->track_question_template_service->addTrackQuestionTemplate($payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($question)->serialize( - 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 (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - - /** - * @param $track_question_template_id - * @return mixed - */ - public function getTrackQuestionTemplate($track_question_template_id){ - try { - - $track_question_template = $this->track_question_template_repository->getById($track_question_template_id); - if (is_null($track_question_template)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($track_question_template)->serialize( - 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 (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $track_question_template_id - * @return mixed - */ - public function updateTrackQuestionTemplate($track_question_template_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $rules = TrackQuestionTemplateValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $question = $this->track_question_template_service->updateTrackQuestionTemplate($track_question_template_id, $payload); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($question)->serialize( - 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 (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $track_question_template_id - * @return mixed - */ - public function deleteTrackQuestionTemplate($track_question_template_id){ - try { - - $this->track_question_template_service->deleteTrackQuestionTemplate($track_question_template_id); - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412([$ex1->getMessage()]); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(['message'=> $ex2->getMessage()]); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @return mixed - */ - public function getTrackQuestionTemplateMetadata(){ - return $this->ok - ( - $this->track_question_template_repository->getQuestionsMetadata() - ); - } - - /** - * values endpoints - */ - - /** - * @param $track_question_template_id - * @param $track_question_template_value_id - * @return mixed - */ - public function getTrackQuestionTemplateValue($track_question_template_id, $track_question_template_value_id){ - try { - - $track_question_template = $this->track_question_template_repository->getById($track_question_template_id); - if (is_null($track_question_template)) return $this->error404(); - - if (!$track_question_template instanceof TrackMultiValueQuestionTemplate) return $this->error404(); - - $value = $track_question_template->getValueById($track_question_template_value_id); - if (is_null($value)) return $this->error404(); - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($value)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $track_question_template_id - * @return mixed - */ - public function addTrackQuestionTemplateValue($track_question_template_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $rules = TrackQuestionValueTemplateValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->track_question_template_service->addTrackQuestionValueTemplate - ( - $track_question_template_id, - $payload - ); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($value)->serialize( - Request::input('expand', '') - )); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $track_question_template_id - * @param $track_question_template_value_id - * @return mixed - */ - public function updateTrackQuestionTemplateValue($track_question_template_id, $track_question_template_value_id){ - try { - - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - - $rules = TrackQuestionValueTemplateValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $value = $this->track_question_template_service->updateTrackQuestionValueTemplate - ( - $track_question_template_id, - $track_question_template_value_id, - $payload - ); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($value)->serialize( - Request::input('expand', '') - )); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $track_question_template_id - * @param $track_question_template_value_id - * @return mixed - */ - public function deleteTrackQuestionTemplateValue($track_question_template_id, $track_question_template_value_id){ - try { - $this->track_question_template_service->deleteTrackQuestionValueTemplate - ( - $track_question_template_id, - $track_question_template_value_id - ); - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMeAttendeeStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMeAttendeeStrategy.php deleted file mode 100644 index 891edabb..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMeAttendeeStrategy.php +++ /dev/null @@ -1,57 +0,0 @@ -resource_server_context = $resource_server_context; - } - - /** - * @param $attendee_id - * @param Summit $summit - * @return null|SummitAttendee - */ - public function check($attendee_id, Summit $summit) - { - if (strtolower($attendee_id) === 'me') { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) { - return null; - } - return $summit->getAttendeeByMemberId($current_member->getId()); - } - return null; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMeSpeakerStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMeSpeakerStrategy.php deleted file mode 100644 index c59d9f84..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMeSpeakerStrategy.php +++ /dev/null @@ -1,56 +0,0 @@ -resource_server_context = $resource_server_context; - } - - /** - * @param int $speaker_id - * @param Summit $summit - * @return null|PresentationSpeaker - */ - public function check($speaker_id, Summit $summit) - { - if (strtolower($speaker_id) === 'me') { - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) { - return null; - } - return $summit->getSpeakerByMemberId($current_member->getId(), false); - } - return $summit->getSpeaker(intval($speaker_id, false)); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMyOwnAttendeeStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMyOwnAttendeeStrategy.php deleted file mode 100644 index ab355dcc..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CheckMyOwnAttendeeStrategy.php +++ /dev/null @@ -1,40 +0,0 @@ -getMember()->getId()); - $current_member = $this->resource_server_context->getCurrentUser(); - if(is_null($current_member) || ($attendee_member_id !== $current_member->getId())) - throw new \HTTP401UnauthorizedException; - return $attendee; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CurrentSummitFinderStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/CurrentSummitFinderStrategy.php deleted file mode 100644 index 32d9d3d3..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/CurrentSummitFinderStrategy.php +++ /dev/null @@ -1,62 +0,0 @@ -resource_server_ctx = $resource_server_ctx; - $this->repository = $repository; - } - - /** - * @param mixed $summit_id - * @return null|Summit - */ - public function find($summit_id) - { - $summit = $summit_id === 'current' ? $this->repository->getCurrent() : $this->repository->getById(intval($summit_id)); - if(is_null($summit)) - $summit = $this->repository->getBySlug(strval($summit_id)); - return $summit; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/ICheckAttendeeStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/ICheckAttendeeStrategy.php deleted file mode 100644 index 7f170d96..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/ICheckAttendeeStrategy.php +++ /dev/null @@ -1,30 +0,0 @@ -addFilterCondition(FilterParser::buildFilter('published','==','1')); - return $filter; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllSummitEventsBySummitCSVStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllSummitEventsBySummitCSVStrategy.php deleted file mode 100644 index 163a8570..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllSummitEventsBySummitCSVStrategy.php +++ /dev/null @@ -1,24 +0,0 @@ -events_repository = $events_repository; - $this->summit_repository = $summit_repository; - $this->resource_server_context = $resource_server_context; - } - - /** - * @param array $params - * @return PagingResponse - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function getEvents(array $params = []) - { - $summit_id = isset($params['summit_id'])? $params['summit_id']:0; - $this->summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id); - if (is_null($this->summit)) throw new EntityNotFoundException('summit not found!'); - - return parent::getEvents($params); - } - - /** - * @return array - */ - protected function getValidFilters() - { - $valid_filters = parent::getValidFilters(); - $valid_filters['summit_id'] = ['==']; - $valid_filters['published'] = ['==']; - return $valid_filters; - } - - /** - * @return null|Filter - */ - protected function buildFilter(){ - $filter = parent::buildFilter(); - - if(is_null($filter)) - { - $filter = new Filter([]); - } - $filter->addFilterCondition(FilterParser::buildFilter('summit_id','==',$this->summit->getId())); - return $filter; - } - - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function retrieveEventsFromSource(PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - return $this->events_repository->getAllByPage($paging_info, $filter, $order); - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllSummitEventsStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllSummitEventsStrategy.php deleted file mode 100644 index cddd5916..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllSummitEventsStrategy.php +++ /dev/null @@ -1,63 +0,0 @@ -event_repository = $event_repository; - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function retrieveEventsFromSource(PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - return $this->event_repository->getAllByPage($paging_info, $filter, $order); - } - - /** - * @return array - */ - protected function getValidFilters() - { - $valid_filters = parent::getValidFilters(); - $valid_filters['summit_id'] = array('=='); - return $valid_filters; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllUnPublishedSummitEventsStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllUnPublishedSummitEventsStrategy.php deleted file mode 100644 index 2577056d..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveAllUnPublishedSummitEventsStrategy.php +++ /dev/null @@ -1,66 +0,0 @@ -addFilterCondition(FilterParser::buildFilter('published','==','0')); - return $filter; - } - - /** - * @return null|Order - */ - protected function buildOrder(){ - $order = null; - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'title', - 'start_date', - 'end_date', - 'id', - 'created', - 'track', - 'trackchairsel' - ]); - } - return $order; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrievePublishedSummitEventsBySummitStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrievePublishedSummitEventsBySummitStrategy.php deleted file mode 100644 index fe010107..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrievePublishedSummitEventsBySummitStrategy.php +++ /dev/null @@ -1,42 +0,0 @@ -addFilterCondition(FilterParser::buildFilter('published','==','1')); - return $filter; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveSummitEventsStrategy.php b/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveSummitEventsStrategy.php deleted file mode 100644 index 0248a542..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Strategies/events/RetrieveSummitEventsStrategy.php +++ /dev/null @@ -1,177 +0,0 @@ - 'integer|min:1', - 'per_page' => 'required_with:page|integer|min:5|max:100', - ]; - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - - list($page, $per_page) = $this->getPageParams(); - - return $this->retrieveEventsFromSource - ( - new PagingInfo($page, $per_page), $this->buildFilter(), $this->buildOrder() - ); - } - - /** - * @return null|Filter - */ - protected function buildFilter(){ - - $filter = null; - - if (Input::has('filter')) { - $filter = FilterParser::parse(Input::get('filter'), $this->getValidFilters()); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter_validator_rules = $this->getFilterValidatorRules(); - if(count($filter_validator_rules)) { - $filter->validate($filter_validator_rules); - } - - return $filter; - } - - /** - * @return null|Order - */ - protected function buildOrder(){ - $order = null; - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - - 'title', - 'start_date', - 'end_date', - 'id', - 'created', - 'track', - ]); - } - return $order; - } - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - abstract public function retrieveEventsFromSource(PagingInfo $paging_info, Filter $filter = null, Order $order = null); - - /** - * @return array - */ - protected function getValidFilters() - { - return [ - - 'title' => ['=@', '=='], - 'abstract' => ['=@', '=='], - 'social_summary' => ['=@', '=='], - 'tags' => ['=@', '=='], - 'level' => ['=@', '=='], - 'start_date' => ['>', '<', '<=', '>=', '=='], - 'end_date' => ['>', '<', '<=', '>=', '=='], - 'summit_type_id' => ['=='], - 'event_type_id' => ['=='], - 'track_id' => ['=='], - 'speaker_id' => ['=='], - 'sponsor_id' => ['=='], - 'sponsor' => ['=@', '=='], - 'location_id' => ['=='], - 'speaker' => ['=@', '=='], - 'speaker_email' => ['=@', '=='], - 'speaker_title' => ['=@', '=='], - 'speaker_company' => ['=@', '=='], - 'selection_status' => ['=='], - 'id' => ['=='], - 'selection_plan_id' => ['=='], - ]; - } - - /** - * @return array - */ - protected function getFilterValidatorRules():array{ - return [ - 'title' => 'sometimes|string', - 'abstract' => 'sometimes|string', - 'social_summary' => 'sometimes|string', - 'tags' => 'sometimes|string', - 'level' => 'sometimes|string', - 'speaker' => 'sometimes|string', - 'speaker_email' => 'sometimes|string', - 'speaker_title' => 'sometimes|string', - 'speaker_company' => 'sometimes|string', - 'start_date' => 'sometimes|date_format:U', - 'end_date' => 'sometimes|date_format:U', - 'summit_type_id' => 'sometimes|integer', - 'event_type_id' => 'sometimes|integer', - 'track_id' => 'sometimes|integer', - 'speaker_id' => 'sometimes|integer', - 'location_id' => 'sometimes|integer', - 'id' => 'sometimes|integer', - 'selection_plan_id' => 'sometimes|integer', - ]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/AddEntity.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/AddEntity.php deleted file mode 100644 index 7d97f116..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/AddEntity.php +++ /dev/null @@ -1,102 +0,0 @@ -error400(); - $data = Input::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $this->getAddValidationRules($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - $entity = $this->addEntity($payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($entity)->serialize - ( - Request::input('expand', ''), - $fields, - $relations - )); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/AddSummitChildElement.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/AddSummitChildElement.php deleted file mode 100644 index f736df06..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/AddSummitChildElement.php +++ /dev/null @@ -1,115 +0,0 @@ -error400(); - $data = Input::json(); - $payload = $data->all(); - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $this->getAddValidationRules($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $child = $this->addChild($summit, $payload); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->created(SerializerRegistry::getInstance()->getSerializer - ( - $child, - $this->addSerializerType() - )->serialize( - Request::input('expand', ''), - $fields, - $relations - )); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/BaseAPI.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/BaseAPI.php deleted file mode 100644 index e88e8abe..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/BaseAPI.php +++ /dev/null @@ -1,32 +0,0 @@ -deleteEntity($id); - return $this->deleted(); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/DeleteSummitChildElement.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/DeleteSummitChildElement.php deleted file mode 100644 index 08d8fb55..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/DeleteSummitChildElement.php +++ /dev/null @@ -1,59 +0,0 @@ -getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->deleteChild($summit, $child_id); - - return $this->deleted(); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAll.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAll.php deleted file mode 100644 index ca70b6b0..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAll.php +++ /dev/null @@ -1,146 +0,0 @@ - 'integer|min:1', - 'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::MinPageSize, PagingConstants::MaxPageSize), - ]; - - try { - - $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'), $this->getFilterRules()); - } - - if(is_null($filter)) $filter = new Filter(); - - $filter_validator_rules = $this->getFilterValidatorRules(); - if(count($filter_validator_rules)) { - $filter->validate($filter_validator_rules); - } - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), $this->getOrderRules()); - } - - $data = $this->getRepository()->getAllByPage(new PagingInfo($page, $per_page), $this->applyExtraFilters($filter), $order); - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - [], - [], - [ 'serializer_type' => $this->serializerType() ], - $this->serializerType() - ) - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAllBySummit.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAllBySummit.php deleted file mode 100644 index fb6b77f0..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAllBySummit.php +++ /dev/null @@ -1,49 +0,0 @@ -addFilterCondition(FilterElement::makeEqual("summit_id", intval($this->summit_id))); - return $filter; - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getAllBySummit($summit_id){ - $this->summit_id = $summit_id; - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($this->summit_id); - if (is_null($summit)) return $this->error404(); - return $this->getAll(); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAndValidateJsonPayload.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAndValidateJsonPayload.php deleted file mode 100644 index 983b4788..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetAndValidateJsonPayload.php +++ /dev/null @@ -1,47 +0,0 @@ -all(); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $validation_rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - $ex = new ValidationException(); - $ex->setMessages($messages); - throw $ex; - } - - return $payload; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetEntity.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/GetEntity.php deleted file mode 100644 index ae9305a6..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetEntity.php +++ /dev/null @@ -1,73 +0,0 @@ -getEntity(intval($id)); - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($entity)->serialize( - Request::input('expand', ''), - $fields, - $relations - )); - - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetSummitChildElementById.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/GetSummitChildElementById.php deleted file mode 100644 index 5ad024ac..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/GetSummitChildElementById.php +++ /dev/null @@ -1,69 +0,0 @@ -getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - $child = $this->getChildFromSummit($summit, $child_id); - if(is_null($child)) - return $this->error404(); - return $this->ok(SerializerRegistry::getInstance()->getSerializer($child, $this->getChildSerializer())->serialize( Request::input('expand', ''))); - } catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412($ex1->getMessages()); - } catch (EntityNotFoundException $ex2) { - Log::warning($ex2); - return $this->error404(['message' => $ex2->getMessage()]); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedAddEntity.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedAddEntity.php deleted file mode 100644 index 34531633..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedAddEntity.php +++ /dev/null @@ -1,91 +0,0 @@ -error400(); - $data = Input::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $getAddValidationRulesFn($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - $entity = $addEntityFn($payload, ...$args); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($entity)->serialize - ( - Request::input('expand', ''), - $fields, - $relations - )); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedDeleteEntity.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedDeleteEntity.php deleted file mode 100644 index 7b837278..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedDeleteEntity.php +++ /dev/null @@ -1,54 +0,0 @@ -deleted(); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedGetAll.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedGetAll.php deleted file mode 100644 index f0ac8237..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedGetAll.php +++ /dev/null @@ -1,331 +0,0 @@ -getRepository()->getAllByPage - ( - new PagingInfo($page, $per_page), - $filter, - $order - ); - } - - /** - * @param callable $getFilterRules - * @param callable $getFilterValidatorRules - * @param callable $getOrderRules - * @param callable $applyExtraFilters - * @param callable $serializerType - * @param callable|null $defaultOrderRules - * @param callable|null $defaultPageSize - * @param callable|null $queryCallable - * @param array $serializerParams - * @return mixed - */ - public function _getAll - ( - callable $getFilterRules, - callable $getFilterValidatorRules, - callable $getOrderRules, - callable $applyExtraFilters, - callable $serializerType, - callable $defaultOrderRules = null, - callable $defaultPageSize = null, - callable $queryCallable = null, - array $serializerParams = [] - ) - { - $values = Request::all(); - - $rules = [ - - 'page' => 'integer|min:1', - 'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::MinPageSize, PagingConstants::MaxPageSize), - ]; - - try { - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = is_null($defaultPageSize) ? PagingConstants::DefaultPageSize : call_user_func($defaultPageSize); - - if (Request::has('page')) { - $page = intval(Request::get('page')); - } - - if (Request::has('per_page')) { - $per_page = intval(Request::get('per_page')); - } - - $filter = null; - - if (Request::has('filter')) { - $filter = FilterParser::parse(Request::get('filter'), call_user_func($getFilterRules)); - } - - if (is_null($filter)) $filter = new Filter(); - - $filter_validator_rules = call_user_func($getFilterValidatorRules); - if (count($filter_validator_rules)) { - $filter->validate($filter_validator_rules); - } - - $order = null; - - if (Request::has('order')) { - $order = OrderParser::parse(Request::get('order'), call_user_func($getOrderRules)); - } else { - if (!is_null($defaultOrderRules)) { - $order = call_user_func($defaultOrderRules); - } - } - - if (!is_null($queryCallable)) - $data = call_user_func($queryCallable, - $page, - $per_page, - $filter, - $order, - $applyExtraFilters); - else - $data = $this->defaultQuery - ( - $page, - $per_page, - $filter, - $order, - $applyExtraFilters - ); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->ok - ( - $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations, - $serializerParams, - call_user_func($serializerType) - ) - ); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } - catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch(HTTP403ForbiddenException $ex){ - Log::warning($ex); - return $this->error403(); - } - catch(AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param callable $getFilterRules - * @param callable $getFilterValidatorRules - * @param callable $getOrderRules - * @param callable $applyExtraFilters - * @param callable $serializerType - * @param callable $getFormatters - * @param callable $getColumns - * @param string $file_prefix - * @param array $serializerParams - * @param callable|null $queryCallable - * @return mixed - */ - public function _getAllCSV - ( - callable $getFilterRules, - callable $getFilterValidatorRules, - callable $getOrderRules, - callable $applyExtraFilters, - callable $serializerType, - callable $getFormatters, - callable $getColumns, - string $file_prefix = 'file-', - array $serializerParams = [], - callable $queryCallable = null - ) - { - $values = Request::all(); - $rules = [ - 'page' => 'integer|min:1', - 'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::MinPageSize, PagingConstants::MaxPageSize), - ]; - - try { - - $validation = Validator::make($values, $rules); - - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - - // default values - $page = 1; - $per_page = PHP_INT_MAX; - - if (Request::has('page')) { - $page = intval(Request::get('page')); - $per_page = intval(Request::get('per_page')); - } - - if (Request::has('per_page')) { - $per_page = intval(Request::get('per_page')); - } - - $filter = null; - - if (Request::has('filter')) { - $filter = FilterParser::parse(Request::get('filter'), call_user_func($getFilterRules)); - } - - if (is_null($filter)) $filter = new Filter(); - - $filter_validator_rules = call_user_func($getFilterValidatorRules); - if (count($filter_validator_rules)) { - $filter->validate($filter_validator_rules); - } - - $order = null; - - if (Request::has('order')) { - $order = OrderParser::parse(Request::get('order'), call_user_func($getOrderRules)); - } - - if (!is_null($queryCallable)) - $data = call_user_func($queryCallable, - $page, - $per_page, - $filter, - $order, - $applyExtraFilters); - else - $data = $this->defaultQuery - ( - $page, - $per_page, - $filter, - $order, - $applyExtraFilters - ); - - $filename = $file_prefix . date('Ymd'); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - $list = $data->toArray - ( - Request::input('expand', ''), - $fields, - $relations, - $serializerParams, - call_user_func($serializerType) - ); - - return $this->export - ( - 'csv', - $filename, - $list['data'], - call_user_func($getFormatters), - call_user_func($getColumns) - ); - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412($ex->getMessages()); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch(AuthzException $ex){ - Log::warning($ex); - return $this->error403($ex->getMessage()); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedGetEntity.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedGetEntity.php deleted file mode 100644 index f0fe4487..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedGetEntity.php +++ /dev/null @@ -1,70 +0,0 @@ -ok(SerializerRegistry::getInstance()->getSerializer($entity)->serialize( - Request::input('expand', ''), - $fields, - $relations - )); - - } catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } catch (EntityNotFoundException $ex) { - Log::warning($ex); - return $this->error404(array('message' => $ex->getMessage())); - } catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedUpdateEntity.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedUpdateEntity.php deleted file mode 100644 index b4da5570..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/ParametrizedUpdateEntity.php +++ /dev/null @@ -1,96 +0,0 @@ -error400(); - $data = Input::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $getUpdateValidationRulesFn($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $entity = $updateEntityFn($id, $payload, ...$args); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($entity)->serialize - ( - Request::input('expand', ''), - $fields, - $relations - )); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/SummitBookableVenueRoomApi.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/SummitBookableVenueRoomApi.php deleted file mode 100644 index 854e8d90..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/SummitBookableVenueRoomApi.php +++ /dev/null @@ -1,1077 +0,0 @@ -reservation_repository->getById($id); - - if (is_null($reservation)) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($reservation)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getBookableVenueRooms($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 = $summit_id === 'current' ? $this->repository->getCurrent() : $this->repository->getById(intval($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'), [ - 'name' => ['==', '=@'], - 'description' => ['=@'], - 'capacity' => ['>', '<', '<=', '>=', '=='], - 'availability_day' => ['=='], - 'attribute' => ['=='], - ]); - } - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'name' => 'sometimes|string', - 'description' => 'sometimes|string', - 'capacity' => 'sometimes|integer', - 'availability_day' => 'sometimes|date_format:U', - 'attribute' => 'sometimes|string', - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'name', - 'capacity', - ]); - } - - $filter->addFilterCondition(FilterParser::buildFilter('class_name','==', SummitBookableVenueRoom::ClassName)); - - $data = $this->location_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order, false); - - 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); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllReservationsBySummit($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->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'), [ - 'summit_id' => ['=='], - 'room_name' => ['==', '=@'], - 'room_id' => ['=='], - 'owner_id' => ['=='], - 'owner_name' => ['==', '=@'], - 'owner_email' => ['==', '=@'], - 'status' => ['=='], - 'start_datetime' => ['>', '<', '<=', '>=', '=='], - 'end_datetime' => ['>', '<', '<=', '>=', '=='], - ]); - } - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'status' => sprintf('sometimes|in:%s',implode(',', SummitRoomReservation::$valid_status)), - 'room_name' => 'sometimes|string', - 'owner_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'room_id' => 'sometimes|integer', - 'owner_id' => 'sometimes|string', - 'start_datetime' => 'sometimes|required|date_format:U', - 'end_datetime' => 'sometimes|required_with:start_datetime|date_format:U|after:start_datetime', - - ], [ - 'status.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitRoomReservation::$valid_status) - ) - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'start_datetime', - 'end_datetime', - 'room_name', - 'room_id', - 'status', - 'created', - 'owner_name', - ]); - } - - $data = $this->reservation_repository->getAllBySummitByPage($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(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getAllReservationsBySummitCSV($summit_id){ - - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - // default values - $page = 1; - $per_page = PHP_INT_MAX; - - $filter = null; - - if (Input::has('filter')) { - $filter = FilterParser::parse(Input::get('filter'), [ - 'summit_id' => ['=='], - 'room_name' => ['==', '=@'], - 'room_id' => ['=='], - 'owner_id' => ['=='], - 'owner_name' => ['==', '=@'], - 'owner_email' => ['==', '=@'], - 'status' => ['=='], - 'start_datetime' => ['>', '<', '<=', '>=', '=='], - 'end_datetime' => ['>', '<', '<=', '>=', '=='], - ]); - } - if(is_null($filter)) $filter = new Filter(); - - $filter->validate([ - 'status' => sprintf('sometimes|in:%s',implode(',', SummitRoomReservation::$valid_status)), - 'room_name' => 'sometimes|string', - 'owner_name' => 'sometimes|string', - 'owner_email' => 'sometimes|string', - 'summit_id' => 'sometimes|integer', - 'room_id' => 'sometimes|integer', - 'owner_id' => 'sometimes|string', - 'start_datetime' => 'sometimes|required|date_format:U', - 'end_datetime' => 'sometimes|required_with:start_datetime|date_format:U|after:start_datetime', - - ], [ - 'status.in' => sprintf - ( - ":attribute has an invalid value ( valid values are %s )", - implode(", ", SummitRoomReservation::$valid_status) - ) - ]); - - $order = null; - - if (Input::has('order')) - { - $order = OrderParser::parse(Input::get('order'), [ - 'id', - 'start_datetime', - 'end_datetime', - 'room_name', - 'room_id', - 'status', - 'created', - 'owner_name', - ]); - } - - $data = $this->reservation_repository->getAllBySummitByPage($summit, new PagingInfo($page, $per_page), $filter, $order); - - $filename = "bookable-rooms-reservations-" . date('Ymd'); - $list = $data->toArray(); - return $this->export - ( - 'csv', - $filename, - $list['data'], - [ - 'created' => new EpochCellFormatter, - 'last_edited' => new EpochCellFormatter, - 'start_datetime' => new EpochCellFormatter, - 'end_datetime' => new EpochCellFormatter, - ] - ); - } - catch (ValidationException $ex1) - { - Log::warning($ex1); - return $this->error412(array( $ex1->getMessage())); - } - catch (EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message' => $ex2->getMessage())); - } - catch(\HTTP401UnauthorizedException $ex3) - { - Log::warning($ex3); - return $this->error401(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @return mixed - */ - public function getBookableVenueRoomByVenue($summit_id, $venue_id, $room_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation(intval($venue_id)); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $room = $venue->getRoom(intval($room_id)); - - if (is_null($room) || !$room instanceof SummitBookableVenueRoom) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @return mixed - */ - public function getBookableVenueRoom($summit_id, $room_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - - $room = $summit->getLocation(intval($room_id)); - - if (is_null($room) || !$room instanceof SummitBookableVenueRoom) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - /** - * @param $summit_id - * @param $room_id - * @param $day - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getBookableVenueRoomAvailability($summit_id, $room_id, $day){ - try { - $day = intval($day); - $summit = $summit_id === 'current' ? $this->repository->getCurrent() : $this->repository->getById(intval($summit_id)); - if (is_null($summit)) return $this->error404(); - - $room = $summit->getLocation($room_id); - - if(!$room instanceof SummitBookableVenueRoom) - return $this->error404(); - - $slots_definitions = $room->getAvailableSlots(new \DateTime("@$day")); - $list = []; - foreach($slots_definitions as $slot_label => $is_free){ - $dates = explode('|', $slot_label); - $list[] = - SerializerRegistry::getInstance()->getSerializer( new SummitBookableVenueRoomAvailableSlot - ( - $room, - $summit->convertDateFromTimeZone2UTC(new \DateTime($dates[0], $summit->getTimeZone())), - $summit->convertDateFromTimeZone2UTC(new \DateTime($dates[1], $summit->getTimeZone())), - $is_free - ))->serialize(); - } - - $response = new PagingResponse - ( - count($list), - count($list), - 1, - 1, - $list - ); - - return $this->ok( - $response->toArray() - ); - } - 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); - } - } - - /** - * @param $summit_id - * @param $room_id - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function createBookableVenueRoomReservation($summit_id, $room_id){ - try { - if(!Request::isJson()) return $this->error400(); - - $current_member = $this->resource_server_context->getCurrentUser(); - - if (is_null($current_member)) - return $this->error403(); - - $summit = $summit_id === 'current' ? $this->repository->getCurrent() : $this->repository->getById(intval($summit_id)); - if (is_null($summit)) return $this->error404(); - - $room = $summit->getLocation($room_id); - - if(!$room instanceof SummitBookableVenueRoom) - return $this->error404(); - - $payload = Input::json()->all(); - $payload['owner_id'] = $current_member->getId(); - $rules = SummitRoomReservationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - return $this->error412 - ( - $messages - ); - } - - $reservation = $this->location_service->addBookableRoomReservation($summit, $room_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($reservation)->serialize()); - - } - 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); - } - } - - /** - * @param $summit_id - * @return mixed - */ - public function getMyBookableVenueRoomReservations($summit_id){ - try{ - $current_member = $this->resource_server_context->getCurrentUser(); - - if (is_null($current_member)) - return $this->error403(); - - $summit = $summit_id === 'current' ? $this->repository->getCurrent() : $this->repository->getById(intval($summit_id)); - if (is_null($summit)) return $this->error404(); - - - $reservations = $current_member->getReservationsBySummit($summit); - - $response = new PagingResponse - ( - count($reservations), - count($reservations), - 1, - 1, - $reservations - ); - - return $this->ok( - $response->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); - } - } - - /** - * @param $summit_id - * @param $reservation_id - * @return mixed - */ - public function cancelMyBookableVenueRoomReservation($summit_id, $reservation_id){ - try{ - $current_member = $this->resource_server_context->getCurrentUser(); - - if (is_null($current_member)) - return $this->error403(); - - $summit = $summit_id === 'current' ? $this->repository->getCurrent() : $this->repository->getById(intval($summit_id)); - if (is_null($summit)) return $this->error404(); - - $reservation = $this->location_service->cancelReservation($summit, $current_member, $reservation_id); - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($reservation)->serialize()); - } - 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); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @return mixed - */ - public function updateVenueBookableRoom($summit_id, $venue_id, $room_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitBookableVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $room = $this->location_service->updateVenueBookableRoom($summit, $venue_id, $room_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function getVenueFloorBookableRoom($summit_id, $venue_id, $floor_id, $room_id){ - try { - - $expand = Request::input('expand', ''); - $relations = Request::input('relations', ''); - $relations = !empty($relations) ? explode(',', $relations) : []; - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - return $this->error404(); - } - - if (!$venue instanceof SummitVenue) { - return $this->error404(); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - return $this->error404(); - } - - $room = $floor->getRoom($room_id); - - if (is_null($room) || !$room instanceof SummitBookableVenueRoom) { - return $this->error404(); - } - - return $this->ok(SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand,[], $relations)); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $floor_id - * @param $room_id - * @return mixed - */ - public function updateVenueFloorBookableRoom($summit_id, $venue_id, $floor_id, $room_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitBookableVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload, true); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - if(!isset($payload['floor_id'])) - $payload['floor_id'] = intval($floor_id); - - $room = $this->location_service->updateVenueBookableRoom($summit, $venue_id, $room_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function deleteVenueBookableRoom($summit_id, $venue_id, $room_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $this->location_service->deleteVenueBookableRoom($summit, $venue_id, $room_id); - - return $this->deleted(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @return mixed - */ - public function addVenueBookableRoom($summit_id, $venue_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitBookableVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $room = $this->location_service->addVenueBookableRoom($summit, $venue_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @return mixed - */ - public function addVenueFloorBookableRoom($summit_id, $venue_id, $floor_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - $payload['class_name'] = SummitBookableVenueRoom::ClassName; - $rules = SummitLocationValidationRulesFactory::build($payload); - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $payload['floor_id'] = intval($floor_id); - - $room = $this->location_service->addVenueBookableRoom($summit, $venue_id, $payload); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @param $attribute_id - * @return mixed - */ - public function addVenueBookableRoomAttribute($summit_id, $venue_id, $room_id, $attribute_id){ - try { - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $room = $this->location_service->addVenueBookableRoomAttribute($summit, $venue_id, $room_id, $attribute_id); - - return $this->created(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - /** - * @param $summit_id - * @param $venue_id - * @param $room_id - * @param $attribute_id - * @return mixed - */ - public function deleteVenueBookableRoomAttribute($summit_id, $venue_id, $room_id, $attribute_id){ - try { - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $room = $this->location_service->deleteVenueBookableRoomAttribute($summit, $venue_id, $room_id, $attribute_id); - - return $this->deleted(SerializerRegistry::getInstance()->getSerializer($room)->serialize()); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - - public function refundBookableVenueRoomReservation($summit_id, $room_id, $reservation_id){ - try { - if(!Request::isJson()) return $this->error400(); - $payload = Input::json()->all(); - $rules = [ - 'amount' => 'required|integer|greater_than:0', - ]; - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $rules); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $summit = SummitFinderStrategyFactory::build($this->repository, $this->resource_server_context)->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $room = $summit->getLocation($room_id); - if (is_null($room)) return $this->error404(); - if (!$room instanceof SummitBookableVenueRoom) return $this->error404(); - - $amount = intval($payload['amount']); - $reservation = $this->location_service->refundReservation($room, $reservation_id, $amount); - - return SerializerRegistry::getInstance()->getSerializer($reservation)->serialize(); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/UpdateEntity.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/UpdateEntity.php deleted file mode 100644 index 405b768b..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/UpdateEntity.php +++ /dev/null @@ -1,105 +0,0 @@ -error400(); - $data = Input::json(); - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $this->getUpdateValidationRules($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $entity = $this->updateEntity($id, $payload); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->updated(SerializerRegistry::getInstance()->getSerializer($entity)->serialize - ( - Request::input('expand', ''), - $fields, - $relations - )); - } - catch (ValidationException $ex) { - Log::warning($ex); - return $this->error412(array($ex->getMessage())); - } - catch(EntityNotFoundException $ex) - { - Log::warning($ex); - return $this->error404(array('message'=> $ex->getMessage())); - } - catch (\HTTP401UnauthorizedException $ex) { - Log::warning($ex); - return $this->error401(); - } - catch (HTTP403ForbiddenException $ex) { - Log::warning($ex); - return $this->error403(); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/UpdateSummitChildElement.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/UpdateSummitChildElement.php deleted file mode 100644 index 20e89e4d..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/UpdateSummitChildElement.php +++ /dev/null @@ -1,110 +0,0 @@ -error400(); - $data = Input::json(); - - $summit = SummitFinderStrategyFactory::build($this->getSummitRepository(), $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); - - $payload = $data->all(); - - // Creates a Validator instance and validates the data. - $validation = Validator::make($payload, $this->getUpdateValidationRules($payload)); - - if ($validation->fails()) { - $messages = $validation->messages()->toArray(); - - return $this->error412 - ( - $messages - ); - } - - $child = $this->updateChild($summit, $child_id, $payload); - - $fields = Request::input('fields', ''); - $relations = Request::input('relations', ''); - - $relations = !empty($relations) ? explode(',', $relations) : []; - $fields = !empty($fields) ? explode(',', $fields) : []; - - return $this->updated(SerializerRegistry::getInstance()->getSerializer - ( - $child, - $this->updateSerializerType() - )->serialize( - Request::input('expand', ''), - $fields, - $relations - )); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/Protected/Summit/Traits/ValidateEventUri.php b/app/Http/Controllers/Apis/Protected/Summit/Traits/ValidateEventUri.php deleted file mode 100644 index 0f242a62..00000000 --- a/app/Http/Controllers/Apis/Protected/Summit/Traits/ValidateEventUri.php +++ /dev/null @@ -1,56 +0,0 @@ -header('Referer', null); - } - - if(isset($payload['event_uri']) && !empty($payload['event_uri'])){ - $allowed_return_uris = $this->resource_server_context->getAllowedReturnUris(); - if(!empty($allowed_return_uris)){ - Log::debug(sprintf("validateEventUri: event_uri %s allowed_return_uris %s", $payload['event_uri'], $allowed_return_uris)); - // validate the event_uri against the allowed returned uris of the current client - // check using host name - $test_host = parse_url($payload['event_uri'], PHP_URL_HOST); - $valid_event_uri = false; - foreach(explode(",", $allowed_return_uris) as $allowed_uri){ - if($test_host == parse_url($allowed_uri, PHP_URL_HOST)){ - $valid_event_uri = true; - Log::debug(sprintf("validateEventUri: valid host %s", $test_host)); - break; - } - } - if(!$valid_event_uri){ - unset($payload['event_uri'] ); - } - } - } - - return $payload; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Apis/TimezonesApiController.php b/app/Http/Controllers/Apis/TimezonesApiController.php deleted file mode 100644 index d3e43d20..00000000 --- a/app/Http/Controllers/Apis/TimezonesApiController.php +++ /dev/null @@ -1,57 +0,0 @@ -ok($response->toArray($expand = Input::get('expand',''))); - } - catch (ValidationException $ex1) { - Log::warning($ex1); - return $this->error412(array($ex1->getMessage())); - } - catch(EntityNotFoundException $ex2) - { - Log::warning($ex2); - return $this->error404(array('message'=> $ex2->getMessage())); - } - catch (\Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/ConfigurationsController.php b/app/Http/Controllers/ConfigurationsController.php deleted file mode 100644 index 30374158..00000000 --- a/app/Http/Controllers/ConfigurationsController.php +++ /dev/null @@ -1,80 +0,0 @@ -repository = $repository; - } - - /** - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function getEndpointsDefinitions(){ - try { - $items = []; - foreach ($this->repository->getAll() as $i) { - if ($i instanceof IEntity) { - $i = SerializerRegistry::getInstance()->getSerializer($i, SerializerRegistry::SerializerType_Public)->serialize(Request::input('expand', '')); - } - $items[] = $i; - } - - $routeCollection = Route::getRoutes(); - - $public_endpoints = []; - foreach ($routeCollection as $value) { - $uri = $value->uri; - if(!str_contains($uri, 'api/public/v1')) continue; - $public_endpoints[] = [ - 'route' => $uri, - 'http_methods' => $value->methods, - ]; - } - - return $this->ok( - [ - 'oauth2_endpoints' => $items, - 'public_endpoints' => $public_endpoints, - ] - ); - } - catch (Exception $ex) { - Log::error($ex); - return $this->error500($ex); - } - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php deleted file mode 100644 index 7a3a88cd..00000000 --- a/app/Http/Controllers/Controller.php +++ /dev/null @@ -1,16 +0,0 @@ - 'server error'), 500); - } - - - protected function created($data = 'ok') - { - $res = Response::json($data, 201); - //jsonp - if (Input::has('callback')) { - $res->setCallback(Input::get('callback')); - } - - return $res; - } - - protected function deleted($data = 'ok') - { - $res = Response::json($data, 204); - //jsonp - if (Input::has('callback')) { - $res->setCallback(Input::get('callback')); - } - - return $res; - } - - protected function updated($data = 'ok', $has_content = true) - { - $res = Response::json($data, $has_content ? 201 : 204); - //jsonp - if (Input::has('callback')) { - $res->setCallback(Input::get('callback')); - } - return $res; - } - - - /** - * @param mixed $data - * @return mixed - */ - protected function ok($data = 'ok') - { - $res = $this->response2XX(200, $data); - - //jsonp - if (Input::has('callback')) { - $res->setCallback(Input::get('callback')); - } - - return $res; - } - - protected function error400($data = ['message' => 'Bad Request']) - { - return Response::json($data, 400); - } - - protected function error404($data = ['message' => 'Entity Not Found']) - { - if(!is_array($data)){ - $data = ['message' => $data]; - } - return Response::json($data, 404); - } - - protected function error403($data = ['message' => 'Forbidden']) - { - if(!is_array($data)){ - $data = ['message' => $data]; - } - return Response::json($data, 403); - } - - protected function error401($data = ['message' => 'You don\'t have access to this item through the API.']) - { - if(!is_array($data)){ - $data = ['message' => $data]; - } - return Response::json($data, 401); - } - - protected function response2XX($code = 200, $data = '') - { - return Response::json($data, $code); - } - - /** - * { - * "message": "Validation Failed", - * "errors": [ - * { - * "resource": "Issue", - * "field": "title", - * "code": "missing_field" - * } - * ] - * } - * @param $messages - * @return mixed - */ - protected function error412($messages) - { - if(!is_array($messages)){ - $messages = [$messages]; - } - return Response::json(array('message' => 'Validation Failed', 'errors' => $messages), 412); - } - - /** - * @param string $format - * @param string $filename - * @param array $items - * @param array $formatters - * @param array $columns - * @return \Illuminate\Http\Response - */ - protected function export($format, $filename, array $items, array $formatters = [], array $columns = []){ - if($format == 'csv') return $this->csv($filename, $items, $formatters, ",", 'application/vnd.ms-excel', $columns); - } - - /** - * @param string $filename - * @param array $items - * @param array $formatters - * @param string $field_separator - * @param string $mime_type - * @param array $columns - * @return \Illuminate\Http\Response - */ - protected function csv($filename, array $items, array $formatters = [], $field_separator = ",", $mime_type = 'application/vnd.ms-excel', array $columns = []){ - $headers = [ - 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0', - 'Content-type' => $mime_type, - 'Content-Transfer-Encoding' => 'binary', - 'Content-Disposition' => 'attachment; filename='.$filename.".csv", - 'Last-Modified: ' => gmdate('D, d M Y H:i:s').' GMT', - 'Expires' => '0', - 'Pragma' => 'public', - ]; - - return $this->rawContent - ( - CSVExporter::getInstance()->export($items, $field_separator, $columns, $formatters), - $headers - ); - } - - /** - * @param string $body - * @param array $headers - * @return \Illuminate\Http\Response - */ - public function rawContent(string $body, array $headers = []){ - return Response::make - ( - $body, - 200, - $headers - ); - } - - /** - * @param string $filename - * @param string $content - * @return \Illuminate\Http\Response - */ - protected function pdf(string $filename, string $content){ - $headers = [ - 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0', - 'Content-type' => "application/pdf", - 'Content-Transfer-Encoding' => 'binary', - 'Content-Disposition' => 'attachment; filename='.basename($filename), - 'Expires' => '0', - 'Last-Modified: ' => gmdate('D, d M Y H:i:s').' GMT', - 'Pragma' => 'public', - ]; - - return Response::make($content, 200, $headers); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/OAuth2ProtectedController.php b/app/Http/Controllers/OAuth2ProtectedController.php deleted file mode 100644 index be72a77e..00000000 --- a/app/Http/Controllers/OAuth2ProtectedController.php +++ /dev/null @@ -1,58 +0,0 @@ -resource_server_context = $resource_server_context; - } - - /** - * @return IResourceServerContext - */ - protected function getResourceServerContext(): IResourceServerContext - { - return $this->resource_server_context; - } - - /** - * @return IBaseRepository - */ - protected function getRepository(): IBaseRepository - { - return $this->repository; - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/PaymentGatewayWebHookController.php b/app/Http/Controllers/PaymentGatewayWebHookController.php deleted file mode 100644 index 76b2111c..00000000 --- a/app/Http/Controllers/PaymentGatewayWebHookController.php +++ /dev/null @@ -1,196 +0,0 @@ -summit_repository = $summit_repository; - $this->resource_server_context = $resource_server_context; - $this->location_service = $location_service; - $this->order_service = $order_service; - $this->default_payment_gateway_strategy = $default_payment_gateway_strategy;; - } - - /** - * @param string $application_type - * @return IProcessPaymentService|null - */ - private function getProcessPaymentService(string $application_type):?IProcessPaymentService { - if($application_type == IPaymentConstants::ApplicationTypeRegistration) - return $this->order_service; - if($application_type == IPaymentConstants::ApplicationTypeBookableRooms) - return $this->location_service; - return null; - } - - /** - * @param $application_type - * @param LaravelRequest $request - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function genericConfirm($application_type, LaravelRequest $request){ - try { - - Log::debug(sprintf("PaymentGatewayWebHookController::genericConfirm application_type %s ", $application_type)); - - // get api - $paymentGatewayApi = $this->default_payment_gateway_strategy->build($application_type); - - if(is_null($paymentGatewayApi)) { - Log::debug(sprintf("PaymentGatewayWebHookController::genericConfirm application_type %s profile payment not found.", $application_type)); - return $this->error412([sprintf("application_type %s profile payment not found.", $application_type)]); - } - - $service = $this->getProcessPaymentService($application_type); - - if(is_null($service)) { - Log::debug(sprintf("PaymentGatewayWebHookController::genericConfirm application_type %s service not found.", $application_type)); - return $this->error412([sprintf("application_type %s service not found.", $application_type)]); - } - - $service->processPayment($paymentGatewayApi->buildPaymentGatewayApi()->processCallback($request)); - - return $this->ok(); - } - catch(EntityNotFoundException $ex){ - Log::warning($ex); - return $this->response2XX(208, ['error' => 'already reported']); - } - catch(ValidationException $ex){ - Log::warning($ex); - return $this->error412(["error" => 'payload error']); - } - catch (Exception $ex){ - Log::error($ex); - return $this->error400(["error" => 'payload error']); - } - return $this->error400(["error" => 'invalid event type']); - } - - /** - * @param $summit_id - * @param $application_type - * @param LaravelRequest $request - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function confirm($summit_id, $application_type, LaravelRequest $request){ - - try { - - Log::debug(sprintf("PaymentGatewayWebHookController::confirm summit %s application_type %s ", $summit_id, $application_type)); - - // get current summit - $summit = SummitFinderStrategyFactory::build - ( - $this->summit_repository, - $this->resource_server_context - )->find($summit_id); - - if (is_null($summit) || !$summit instanceof Summit){ - Log::debug(sprintf("PaymentGatewayWebHookController::confirm summit %s not found.", $summit_id)); - return $this->error412([sprintf("application_type %s summit not found.", $application_type)]); - } - - // get api - $paymentGatewayApi = $summit->getPaymentGateWayPerApp($application_type, $this->default_payment_gateway_strategy); - - if(is_null($paymentGatewayApi)) { - Log::debug(sprintf("PaymentGatewayWebHookController::confirm summit %s profile payment not found.", $summit_id)); - return $this->error412([sprintf("application_type %s summit not found.", $application_type)]); - } - - $service = $this->getProcessPaymentService($application_type); - - if(is_null($service)) { - Log::debug(sprintf("PaymentGatewayWebHookController::confirm summit %s service not found.", $summit_id)); - return $this->error412([sprintf("application_type %s service not found.", $application_type)]); - } - - $service->processPayment($paymentGatewayApi->processCallback($request), $summit); - - return $this->ok(); - } - catch(EntityNotFoundException $ex){ - Log::warning($ex); - return $this->response2XX(208, ['error' => 'already reported']); - } - catch(ValidationException $ex){ - Log::warning($ex); - return $this->error412(["error" => 'payload error']); - } - catch (Exception $ex){ - Log::error($ex); - return $this->error400(["error" => 'payload error']); - } - return $this->error400(["error" => 'invalid event type']); - } - -} \ No newline at end of file diff --git a/app/Http/Exceptions/HTTP401UnauthorizedException.php b/app/Http/Exceptions/HTTP401UnauthorizedException.php deleted file mode 100644 index d14555e9..00000000 --- a/app/Http/Exceptions/HTTP401UnauthorizedException.php +++ /dev/null @@ -1,18 +0,0 @@ - [ - ], - 'api' => [ - ], - ]; - - /** - * The application's route middleware. - * - * These middleware may be assigned to groups or used individually. - * - * @var array - */ - protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'oauth2.protected' => \App\Http\Middleware\OAuth2BearerAccessTokenRequestValidator::class, - 'rate.limit' => \App\Http\Middleware\RateLimitMiddleware::class, - 'etags' => \App\Http\Middleware\ETagsMiddleware::class, - 'cache' => \App\Http\Middleware\CacheMiddleware::class, - 'ssl' => \App\Http\Middleware\SSLMiddleware::class, - 'auth.user' => \App\Http\Middleware\UserAuthEndpoint::class, - ]; -} diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php deleted file mode 100644 index 67abcaea..00000000 --- a/app/Http/Middleware/Authenticate.php +++ /dev/null @@ -1,30 +0,0 @@ -guest()) { - if ($request->ajax() || $request->wantsJson()) { - return response('Unauthorized.', 401); - } else { - return redirect()->guest('login'); - } - } - - return $next($request); - } -} diff --git a/app/Http/Middleware/CORSMiddleware.php b/app/Http/Middleware/CORSMiddleware.php deleted file mode 100644 index 199e9194..00000000 --- a/app/Http/Middleware/CORSMiddleware.php +++ /dev/null @@ -1,531 +0,0 @@ -endpoint_repository = $endpoint_repository; - $this->cache_service = $cache_service; - $this->allowed_headers = Config::get('cors.allowed_headers', self::DefaultAllowedHeaders); - $this->allowed_methods = Config::get('cors.allowed_methods', self::DefaultAllowedMethods); - } - - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @return mixed - */ - public function handle($request, Closure $next) - { - if ($response = $this->preProcess($request)) - { - return $response; - } - //normal processing - $response = $next($request); - $this->postProcess($request, $response); - return $response; - } - - private function generatePreflightCacheKey($request) - { - $cache_id = 'pre-flight-'. $request->getClientIp(). '-' . $request->getRequestUri(). '-' . $request->getMethod(); - if($request->headers->has('Origin')){ - $origin = $request->headers->get('Origin'); - $cache_id .= "-".$origin; - } - return $cache_id; - } - - /** - * @param Request $request - * @return Response - */ - public function preProcess(Request $request) - { - $actual_request = false; - Log::debug(sprintf("CORSMiddleware::preProcess ip %s uri %s method %s", $request->getClientIp(), $request->getRequestUri(), $request->getMethod())); - if ($this->isValidCORSRequest($request)) - { - Log::debug(sprintf("CORSMiddleware::preProcess isValidCORSRequest true")); - - /* Step 01 : Determine the type of the incoming request */ - $type = $this->getRequestType($request); - /* Step 02 : Process request according to is type */ - Log::debug(sprintf("CORSMiddleware::preProcess getRequestType %s", $type)); - switch($type) - { - case CORSRequestPreflightType::REQUEST_FOR_PREFLIGHT: - { - // HTTP request send by client to preflight a further 'Complex' request - // sets the original method on request in order to be able to find the - // correct route - $real_method = $request->headers->get('Access-Control-Request-Method'); - $request->setMethod($real_method); - - $route_path = RequestUtils::getCurrentRoutePath($request); - if (!$route_path || !$this->checkEndPoint($route_path, $real_method)) - { - Log::debug(sprintf("CORSMiddleware::preProcess checkEndPoint path %s real method %s returning 403", $route_path, $real_method)); - $response = new Response(); - $response->setStatusCode(403); - return $response; - } - // ----Step 2b: Store pre-flight request data in the Cache to keep (mark) the request as correctly followed the request pre-flight process - $data = new CORSRequestPreflightData($request, is_null($this->current_endpoint)? false : $this->current_endpoint->isAllowCredentials()); - $cache_id = $this->generatePreflightCacheKey($request); - $this->cache_service->storeHash($cache_id, $data->toArray(), CORSRequestPreflightData::$cache_lifetime); - // ----Step 2c: Return corresponding response - This part should be customized with application specific constraints..... - return $this->makePreflightResponse($request); - } - break; - case CORSRequestPreflightType::COMPLEX_REQUEST: - { - $cache_id = $this->generatePreflightCacheKey($request); - // ----Step 2a: Check if the current request has an entry into the preflighted requests Cache - $data = $this->cache_service->getHash($cache_id, CORSRequestPreflightData::$cache_attributes); - if (!count($data)) - { - // there wasnt preflight so just regular processing - return null; - } - // ----Step 2b: Check that pre-flight information declared during the pre-flight request match the current request on key information - $match = false; - // ------Start with comparison of "Origin" HTTP header (according to utility method impl. used to retrieve header reference cannot be null)... - if ($request->headers->get('Origin') === $data['origin']) - { - // ------Continue with HTTP method... - if ($request->getMethod() === $data['expected_method']) - { - // ------Finish with custom HTTP headers (use an method to avoid manual iteration on collection to increase the speed)... - $x_headers = self::getCustomHeaders($request); - $x_headers_pre = explode(',', $data['expected_custom_headers']); - sort($x_headers); - sort($x_headers_pre); - if (count(array_diff($x_headers, $x_headers_pre)) === 0) - { - $match = true; - } - } - } - if (!$match) - { - Log::debug(sprintf("CORSMiddleware::preProcess checkEndPoint match false returning 403")); - $response = new Response(); - $response->setStatusCode(403); - return $response; - } - $actual_request = true; - } - break; - case CORSRequestPreflightType::SIMPLE_REQUEST: - { - // origins, do not set any additional headers and terminate this set of steps. - if (!$this->isAllowedOrigin($request)) { - Log::debug(sprintf("CORSMiddleware::preProcess isAllowedOrigin false returning 403")); - $response = new Response(); - $response->setStatusCode(403); - return $response; - } - $actual_request = true; - // If the resource supports credentials add a single Access-Control-Allow-Origin header, with the value - // of the Origin header as value, and add a single Access-Control-Allow-Credentials header with the - // case-sensitive string "true" as value. - // Otherwise, add a single Access-Control-Allow-Origin header, with either the value of the Origin header - // or the string "*" as value. - } - break; - } - } - if ($actual_request) - { - Log::debug(sprintf("CORSMiddleware::preProcess actual_request is true")); - // Save response headers - $cache_id = $this->generatePreflightCacheKey($request); - // ----Step 2a: Check if the current request has an entry into the preflighted requests Cache - $data = $this->cache_service->getHash($cache_id, CORSRequestPreflightData::$cache_attributes); - $this->headers['Access-Control-Allow-Origin'] = $request->headers->get('Origin'); - if (isset($data['allows_credentials']) && $data['allows_credentials'] == true) - { - $this->headers['Access-Control-Allow-Credentials'] = 'true'; - } - /** - * During a CORS request, the getResponseHeader() method can only access simple response headers. - * Simple response headers are defined as follows: - ** Cache-Control - ** Content-Language - ** Content-Type - ** Expires - ** Last-Modified - ** Pragma - * If you want clients to be able to access other headers, - * you have to use the Access-Control-Expose-Headers header. - * The value of this header is a comma-delimited list of response headers you want to expose - * to the client. - */ - $exposed_headers = Config::get('cors.exposed_headers', 'Content-Type, Expires'); - if (!empty($exposed_headers)) - { - $this->headers['Access-Control-Expose-Headers'] = $exposed_headers ; - } - } - } - - public function postProcess(Request $request, Response $response) - { - // add CORS response headers - if (count($this->headers) > 0) - { - $response->headers->add($this->headers); - } - return $response; - } - - /** - * @param Request $request - * @return Response - */ - private function makePreflightResponse(Request $request) - { - $response = new Response(); - if (!$this->isAllowedOrigin($request)) - { - Log::debug(sprintf("CORSMiddleware::makePreflightResponse isAllowedOrigin is false returning 403")); - $response->headers->set('Access-Control-Allow-Origin', 'null'); - $response->setStatusCode(403); - return $response; - } - $response->headers->set('Access-Control-Allow-Origin', $request->headers->get('Origin')); - // The Access-Control-Request-Method header indicates which method will be used in the actual - // request as part of the preflight request - // check request method - if (!is_null($this->current_endpoint) && $request->headers->get('Access-Control-Request-Method') != $this->current_endpoint->getHttpMethod()) - { - Log::debug(sprintf("CORSMiddleware::makePreflightResponse returning 405")); - $response->setStatusCode(405); - return $response; - } - // The Access-Control-Allow-Credentials header indicates whether the response to request - // can be exposed when the omit credentials flag is unset. When part of the response to a preflight request - // it indicates that the actual request can include user credentials. - if (!is_null($this->current_endpoint) && $this->current_endpoint->isAllowCredentials()) - { - $response->headers->set('Access-Control-Allow-Credentials', 'true'); - } - if (Config::get('cors.use_pre_flight_caching', false)) - { - // The Access-Control-Max-Age header indicates how long the response can be cached, so that for - // subsequent requests, within the specified time, no preflight request has to be made. - $response->headers->set('Access-Control-Max-Age', Config::get('cors.max_age', 32000)); - } - // The Access-Control-Allow-Headers header indicates, as part of the response to a preflight request, - // which header field names can be used during the actual request - $response->headers->set('Access-Control-Allow-Headers', $this->allowed_headers); - - //The Access-Control-Allow-Methods header indicates, as part of the response to a preflight request, - // which methods can be used during the actual request. - $response->headers->set('Access-Control-Allow-Methods', $this->allowed_methods); - // The Access-Control-Request-Headers header indicates which headers will be used in the actual request - // as part of the preflight request. - $headers = $request->headers->get('Access-Control-Request-Headers'); - if ($headers) - { - $headers = trim(strtolower($headers)); - $allow_headers = explode(', ', $this->allowed_headers); - foreach (preg_split('{, *}', $headers) as $header) - { - //if they are simple headers then skip them - if (in_array($header, self::$simple_headers, true)) - { - continue; - } - //check is the requested header is on the list of allowed headers - if (!in_array($header, $allow_headers, true)) - { - Log::debug(sprintf("CORSMiddleware::makePreflightResponse header %s is not on allowed headers returning 400", $header)); - $response->setStatusCode(400); - $response->setContent('Unauthorized header '.$header); - break; - } - } - } - //OK - No Content - $response->setStatusCode(204); - return $response; - } - - /** - * @param Request $request - * @returns bool - */ - private function isValidCORSRequest(Request $request) - { - /** - * The presence of the Origin header does not necessarily mean that the request is a cross-origin request. - * While all cross-origin requests will contain an Origin header, - - * Origin header on same-origin requests. But Chrome and Safari include an Origin header on - * same-origin POST/PUT/DELETE requests (same-origin GET requests will not have an Origin header). - */ - return $request->headers->has('Origin'); - } - - /** - * https://www.owasp.org/index.php/CORS_OriginHeaderScrutiny - * Filter that will ensure the following points for each incoming HTTP CORS requests: - * - Have only one and non empty instance of the origin header, - * - Have only one and non empty instance of the host header, - * - The value of the origin header is present in a internal allowed domains list (white list). As we act before the - * step 2 of the CORS HTTP requests/responses exchange process, allowed domains list is yet provided to client, - * - Cache IP of the sender for 1 hour. If the sender send one time a origin domain that is not in the white list - * then all is requests will return an HTTP 403 response (protract allowed domain guessing). - * We use the method above because it's not possible to identify up to 100% that the request come from one expected - * client application, since: - * - All information of a HTTP request can be faked, - * - It's the browser (or others tools) that send the HTTP request then the IP address that we have access to is the - * client IP address. - * @param Request $request - * @return bool - */ - private function testOriginHeaderScrutiny(Request $request) - { - /* Step 0 : Check presence of client IP in black list */ - $client_ip = $request->getClientIp(); - if (Cache::has(self::CORS_IP_BLACKLIST_PREFIX . $client_ip)) - { - Log::debug(sprintf("CORSMiddleware::testOriginHeaderScrutiny ip %s is blacklisted", $client_ip)); - return false; - } - /* Step 1 : Check that we have only one and non empty instance of the "Origin" header */ - $origin = $request->headers->get('Origin', null, false); - if (is_array($origin) && count($origin) > 1) - { - // If we reach this point it means that we have multiple instance of the "Origin" header - // Add client IP address to black listed client - $expiresAt = Carbon::now()->addMinutes(60); - Cache::put(self::CORS_IP_BLACKLIST_PREFIX . $client_ip, self::CORS_IP_BLACKLIST_PREFIX . $client_ip, $expiresAt); - Log::debug(sprintf("CORSMiddleware::testOriginHeaderScrutiny ip %s is blacklisted", $client_ip)); - return false; - } - /* Step 2 : Check that we have only one and non empty instance of the "Host" header */ - $host = $request->headers->get('Host', null, false); - //Have only one and non empty instance of the host header, - if (is_array($host) && count($host) > 1) - { - // If we reach this point it means that we have multiple instance of the "Host" header - $expiresAt = Carbon::now()->addMinutes(60); - Cache::put(self::CORS_IP_BLACKLIST_PREFIX . $client_ip, self::CORS_IP_BLACKLIST_PREFIX . $client_ip, $expiresAt); - Log::debug(sprintf("CORSMiddleware::testOriginHeaderScrutiny ip %s is blacklisted", $client_ip)); - return false; - } - /* Step 3 : Perform analysis - Origin header is required */ - - $origin = $request->headers->get('Origin'); - $host = $request->headers->get('Host'); - $server_name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null; - $origin_host = @parse_url($origin, PHP_URL_HOST); - - // check origin not empty and allowed - - if (!$this->isAllowedOrigin($origin)) - { - $expiresAt = Carbon::now()->addMinutes(60); - Cache::put(self::CORS_IP_BLACKLIST_PREFIX . $client_ip, self::CORS_IP_BLACKLIST_PREFIX . $client_ip, $expiresAt); - Log::debug(sprintf("CORSMiddleware::testOriginHeaderScrutiny ip %s is blacklisted", $client_ip)); - return false; - } - - if (is_null($host) || $server_name != $host || is_null($origin_host) || $origin_host == $server_name) - { - $expiresAt = Carbon::now()->addMinutes(60); - Cache::put(self::CORS_IP_BLACKLIST_PREFIX . $client_ip, self::CORS_IP_BLACKLIST_PREFIX . $client_ip, $expiresAt); - Log::debug(sprintf("CORSMiddleware::testOriginHeaderScrutiny ip %s is blacklisted", $client_ip)); - return false; - } - - /* Step 4 : Finalize request next step */ - return true; - } - - /** - * @param $endpoint_path - * @param $http_method - * @return bool - */ - private function checkEndPoint($endpoint_path, $http_method) - { - $this->current_endpoint = $this->endpoint_repository->getApiEndpointByUrlAndMethod($endpoint_path, $http_method); - if (is_null($this->current_endpoint)) - { - return true; - } - if (!$this->current_endpoint->isAllowCors() || !$this->current_endpoint->isActive()) - { - return false; - } - return true; - } - - /** - * @param string $origin - * @return bool - */ - private function isAllowedOrigin($origin) - { - return true; - } - - private static function getRequestType(Request $request) - { - - $type = CORSRequestPreflightType::UNKNOWN; - $http_method = $request->getMethod(); - $content_type = $request->headers->has('Content-Type') ? strtolower( $request->headers->get('Content-Type')) : null; - - if (false !== $pos = strpos($content_type, ';')) { - $content_type = substr($content_type, 0, $pos); - } - - $http_method = strtoupper($http_method); - - if ($http_method === 'OPTIONS' && $request->headers->has('Access-Control-Request-Method')) - { - $type = CORSRequestPreflightType::REQUEST_FOR_PREFLIGHT; - } - else - { - if (self::hasCustomHeaders($request)) - { - $type = CORSRequestPreflightType::COMPLEX_REQUEST; - } - elseif ($http_method === 'POST' && !in_array($content_type, self::$simple_content_header_values, true)) - { - $type = CORSRequestPreflightType::COMPLEX_REQUEST; - } - elseif (!in_array($http_method, self::$simple_http_methods, true)) - { - $type = CORSRequestPreflightType::COMPLEX_REQUEST; - } - else - { - $type = CORSRequestPreflightType::SIMPLE_REQUEST; - } - } - return $type; - } - - - private static function getCustomHeaders(Request $request) - { - $custom_headers = array(); - foreach ($request->headers->all() as $k => $h) - { - if (starts_with('X-', strtoupper(trim($k)))) - { - array_push($custom_headers, strtoupper(trim($k))); - } - } - return $custom_headers; - } - - private static function hasCustomHeaders(Request $request) - { - return count(self::getCustomHeaders($request)) > 0; - } -} diff --git a/app/Http/Middleware/CORSRequestPreflightData.php b/app/Http/Middleware/CORSRequestPreflightData.php deleted file mode 100644 index ffeb1bac..00000000 --- a/app/Http/Middleware/CORSRequestPreflightData.php +++ /dev/null @@ -1,82 +0,0 @@ -sender = $request->getClientIp(); - $this->uri = $request->getRequestUri(); - $this->origin = $request->headers->get('Origin'); - $this->expected_method = $request->headers->get('Access-Control-Request-Method'); - $this->allows_credentials = $allows_credentials; - - $tmp = $request->headers->get("Access-Control-Request-Headers"); - if (!empty($tmp)) - { - $hs = explode(',', $tmp); - foreach ($hs as $h) - { - array_push($this->expected_custom_headers, strtoupper(trim($h))); - } - } - } - - /** - * @return array - */ - public function toArray() - { - $res = []; - $res['sender'] = $this->sender; - $res['uri'] = $this->uri; - $res['origin'] = $this->origin; - $res['allows_credentials'] = $this->allows_credentials; - $res['expected_method'] = $this->expected_method; - $res['expected_custom_headers'] = implode(',', $this->expected_custom_headers); - return $res; - } - -} \ No newline at end of file diff --git a/app/Http/Middleware/CORSRequestPreflightType.php b/app/Http/Middleware/CORSRequestPreflightType.php deleted file mode 100644 index 4dcf2a82..00000000 --- a/app/Http/Middleware/CORSRequestPreflightType.php +++ /dev/null @@ -1,36 +0,0 @@ -context = $context; - $this->cache_service = $cache_service; - } - - - /** - * @param $request - * @param Closure $next - * @param $cache_lifetime - * @return JsonResponse - */ - public function handle($request, Closure $next, $cache_lifetime) - { - Log::debug('CacheMiddleware::handle'); - $cache_lifetime = intval($cache_lifetime); - if ($request->getMethod() !== 'GET') { - // short circuit - Log::debug('CacheMiddleware::handle method is not GET'); - return $next($request); - } - - $key = $request->getPathInfo(); - $query = $request->getQueryString(); - $current_time = time(); - $evict_cache = false; - if (!empty($query)) { - Log::debug(sprintf('CacheMiddleware::handle query %s', $query)); - $query = explode('&', $query); - foreach ($query as $q) { - $q = explode('=', $q); - if(strtolower($q[0]) === "evict_cache"){ - if(strtolower($q[1]) === '1') { - Log::debug('CacheMiddleware::handle cache will be evicted'); - $evict_cache = true; - } - continue; - } - - if (strtolower($q[0]) === 'q' || strtolower($q[0]) === 'access_token' || strtolower($q[0]) === 'token_type') continue; - $key .= "." . implode("=", $q); - } - } - - if (str_contains($request->getPathInfo(), '/me')) { - $current_member = $this->context->getCurrentUser(); - if (!is_null($current_member)) - $key .= ':' . $current_member->getId(); - } - - $data = $this->cache_service->getSingleValue($key); - $time = $this->cache_service->getSingleValue($key . ".generated"); - - if (empty($data) || empty($time) || $evict_cache) { - $time = $current_time; - Log::debug(sprintf("CacheMiddleware::handle cache value not found for key %s , getting from api...", $key)); - // normal flow ... - $response = $next($request); - if ($response instanceof JsonResponse && $response->getStatusCode() === 200) { - // and if its json, store it on cache ... - $data = $response->getData(true); - $this->cache_service->setSingleValue($key, gzdeflate(json_encode($data), 9), $cache_lifetime); - $this->cache_service->setSingleValue($key . ".generated", $time, $cache_lifetime); - } - } else { - $ttl = $this->cache_service->ttl($key); - // cache hit ... - Log::debug(sprintf("CacheMiddleware::handle cache hit for %s - ttl %s ...", $key, $ttl)); - $response = new JsonResponse(json_decode(gzinflate($data), true), 200, [ - 'content-type' => 'application/json', - ] - ); - } - - $response->headers->set('xcontent-timestamp', $time); - $response->headers->set('Cache-Control', sprintf('private, max-age=%s', $cache_lifetime)); - $response->headers->set('Expires', gmdate('D, d M Y H:i:s \G\M\T', $time + $cache_lifetime)); - - return $response; - } -} \ No newline at end of file diff --git a/app/Http/Middleware/DoctrineMiddleware.php b/app/Http/Middleware/DoctrineMiddleware.php deleted file mode 100644 index 5b91b641..00000000 --- a/app/Http/Middleware/DoctrineMiddleware.php +++ /dev/null @@ -1,49 +0,0 @@ -getConnection()->close(); - $em->close(); - } - } - catch (\Exception $ex){ - Log::error($ex); - } - return $response; - } -} \ No newline at end of file diff --git a/app/Http/Middleware/ETagsMiddleware.php b/app/Http/Middleware/ETagsMiddleware.php deleted file mode 100644 index 6355bb38..00000000 --- a/app/Http/Middleware/ETagsMiddleware.php +++ /dev/null @@ -1,48 +0,0 @@ -getStatusCode() === 200 && $request->getMethod() === 'GET') - { - $etag = md5($response->getContent()); - $requestETag = str_replace('"', '', $request->getETags()); - $requestETag = str_replace('-gzip', '', $requestETag); - - if ($requestETag && $requestETag[0] == $etag) - { - $response->setNotModified(); - } - $response->setEtag($etag); - } - - return $response; - } -} \ No newline at end of file diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php deleted file mode 100644 index 7564ea27..00000000 --- a/app/Http/Middleware/EncryptCookies.php +++ /dev/null @@ -1,58 +0,0 @@ -cookies as $key => $cookie) { - if ($this->isDisabled($key)) { - continue; - } - - try { - $request->cookies->set($key, $this->decryptCookie($key, $cookie)); - } catch (DecryptException $e) { - $request->cookies->set($key, null); - } - catch(\ErrorException $e1){ - $request->cookies->set($key, null); - } - } - - return $request; - } - -} diff --git a/app/Http/Middleware/OAuth2BearerAccessTokenRequestValidator.php b/app/Http/Middleware/OAuth2BearerAccessTokenRequestValidator.php deleted file mode 100644 index 22d29d75..00000000 --- a/app/Http/Middleware/OAuth2BearerAccessTokenRequestValidator.php +++ /dev/null @@ -1,290 +0,0 @@ -context = $context; - $this->headers = $this->getHeaders(); - $this->endpoint_repository = $endpoint_repository; - $this->token_service = $token_service; - } - - /** - * @param \Illuminate\Http\Request $request - * @param Closure $next - * @return OAuth2WWWAuthenticateErrorResponse - */ - public function handle($request, Closure $next) - { - $url = $request->getRequestUri(); - $method = $request->getMethod(); - $realm = $request->getHost(); - - try { - - $route = RequestUtils::getCurrentRoutePath($request); - if (!$route) { - throw new OAuth2ResourceServerException( - 400, - OAuth2Protocol::OAuth2Protocol_Error_InvalidRequest, - sprintf('API endpoint does not exists! (%s:%s)', $url, $method) - ); - } - - Log::debug($request->headers->__toString()); - // http://tools.ietf.org/id/draft-abarth-origin-03.html - $origin = $request->headers->has('Origin') ? $request->headers->get('Origin') : null; - if (!empty($origin)) { - $nm = new Normalizer($origin); - $origin = $nm->normalize(); - } - - //check first http basic auth header - $auth_header = isset($this->headers['authorization']) ? $this->headers['authorization'] : null; - if (!is_null($auth_header) && !empty($auth_header)) { - $access_token_value = BearerAccessTokenAuthorizationHeaderParser::getInstance()->parse($auth_header); - } else { - // http://tools.ietf.org/html/rfc6750#section-2- 2 - // if access token is not on authorization header check on POST/GET params - $access_token_value = Request::input(OAuth2Protocol::OAuth2Protocol_AccessToken, ''); - } - - if (is_null($access_token_value) || empty($access_token_value)) { - //if access token value is not set, then error - throw new OAuth2ResourceServerException( - 400, - OAuth2Protocol::OAuth2Protocol_Error_InvalidRequest, - 'missing access token' - ); - } - - $endpoint = $this->endpoint_repository->getApiEndpointByUrlAndMethod($route, $method); - - //api endpoint must be registered on db and active - if (is_null($endpoint) || !$endpoint->isActive()) { - throw new OAuth2ResourceServerException( - 400, - OAuth2Protocol::OAuth2Protocol_Error_InvalidRequest, - sprintf('API endpoint does not exits! (%s:%s)', $route, $method) - ); - } - - $token_info = $this->token_service->get($access_token_value); - - if(!is_null($token_info)) - Log::debug(sprintf("token lifetime %s", $token_info->getLifetime())); - - //check lifetime - if (is_null($token_info)) { - throw new InvalidGrantTypeException(OAuth2Protocol::OAuth2Protocol_Error_InvalidToken); - } - //check token audience - Log::debug('checking token audience ...'); - $audience = explode(' ', $token_info->getAudience()); - if ((!in_array($realm, $audience))) { - throw new InvalidGrantTypeException(OAuth2Protocol::OAuth2Protocol_Error_InvalidToken); - } - if ( - $token_info->getApplicationType() === 'JS_CLIENT' - && (is_null($origin) || empty($origin)|| str_contains($token_info->getAllowedOrigins(), $origin) === false ) - ) { - //check origins - throw new OAuth2ResourceServerException( - 403, - OAuth2Protocol::OAuth2Protocol_Error_UnauthorizedClient, - sprintf('invalid origin %s - allowed ones (%s)', $origin, $token_info->getAllowedOrigins()) - ); - } - //check scopes - Log::debug('checking token scopes ...'); - $endpoint_scopes = $endpoint->getScopesNames(); - Log::debug(sprintf("endpoint scopes %s", implode(' ',$endpoint_scopes))); - Log::debug(sprintf("token scopes %s", $token_info->getScope())); - $token_scopes = explode(' ', $token_info->getScope()); - - //check token available scopes vs. endpoint scopes - if (count(array_intersect($endpoint_scopes, $token_scopes)) == 0) { - Log::warning( - sprintf( - 'access token scopes (%s) does not allow to access to api url %s , needed scopes %s', - $token_info->getScope(), - $url, - implode(' OR ', $endpoint_scopes) - ) - ); - - throw new OAuth2ResourceServerException( - 403, - OAuth2Protocol::OAuth2Protocol_Error_InsufficientScope, - 'the request requires higher privileges than provided by the access token', - implode(' ', $endpoint_scopes) - ); - } - Log::debug('setting resource server context ...'); - //set context for api and continue processing - $context = [ - 'access_token' => $access_token_value, - 'expires_in' => $token_info->getLifetime(), - 'client_id' => $token_info->getClientId(), - 'scope' => $token_info->getScope(), - 'application_type' => $token_info->getApplicationType(), - 'allowed_origins' => $token_info->getAllowedOrigins(), - 'allowed_return_uris' => $token_info->getAllowedReturnUris() - ]; - - if (!is_null($token_info->getUserId())) - { - Log::debug(sprintf("OAuth2BearerAccessTokenRequestValidator::handle user id is not null (%s)", $token_info->getUserId())); - $context['user_id'] = $token_info->getUserId(); - $context['user_external_id'] = $token_info->getUserExternalId(); - $context['user_identifier'] = $token_info->getUserIdentifier(); - $context['user_email'] = $token_info->getUserEmail(); - $context['user_email_verified'] = $token_info->isUserEmailVerified(); - $context['user_first_name'] = $token_info->getUserFirstName(); - $context['user_last_name'] = $token_info->getUserLastName(); - $context['user_groups'] = $token_info->getUserGroups(); - } - - $this->context->setAuthorizationContext($context); - - } - catch (OAuth2ResourceServerException $ex1) - { - Log::warning($ex1); - $response = new OAuth2WWWAuthenticateErrorResponse( - $realm, - $ex1->getError(), - $ex1->getErrorDescription(), - $ex1->getScope(), - $ex1->getHttpCode() - ); - $http_response = Response::json($response->getContent(), $response->getHttpCode()); - $http_response->header('WWW-Authenticate', $response->getWWWAuthenticateHeaderValue()); - - return $http_response; - } - catch (InvalidGrantTypeException $ex2) - { - Log::warning($ex2); - $response = new OAuth2WWWAuthenticateErrorResponse( - $realm, - OAuth2Protocol::OAuth2Protocol_Error_InvalidToken, - 'the access token provided is expired, revoked, malformed, or invalid for other reasons.', - null, - 401 - ); - $http_response = Response::json($response->getContent(), $response->getHttpCode()); - $http_response->header('WWW-Authenticate', $response->getWWWAuthenticateHeaderValue()); - - return $http_response; - } catch (\Exception $ex) { - Log::error($ex); - $response = new OAuth2WWWAuthenticateErrorResponse( - $realm, - OAuth2Protocol::OAuth2Protocol_Error_InvalidRequest, - 'invalid request', - null, - 400 - ); - $http_response = Response::json($response->getContent(), $response->getHttpCode()); - $http_response->header('WWW-Authenticate', $response->getWWWAuthenticateHeaderValue()); - - return $http_response; - } - $response = $next($request); - - return $response; - } - - /** - * @return array - */ - protected function getHeaders() - { - $headers = []; - if (function_exists('getallheaders')) { - foreach (getallheaders() as $name => $value) { - $headers[strtolower($name)] = $value; - } - } - - if(count($headers) == 0 ) - { - - foreach ($_SERVER as $name => $value) { - if (substr($name, 0, 5) == 'HTTP_') { - $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5))))); - $headers[strtolower($name)] = $value; - } - } - foreach (Request::header() as $name => $value) { - if (!array_key_exists($name, $headers)) { - $headers[strtolower($name)] = $value[0]; - } - } - } - - return $headers; - } -} \ No newline at end of file diff --git a/app/Http/Middleware/ParseMultipartFormDataInputForNonPostRequests.php b/app/Http/Middleware/ParseMultipartFormDataInputForNonPostRequests.php deleted file mode 100644 index 2c81ede5..00000000 --- a/app/Http/Middleware/ParseMultipartFormDataInputForNonPostRequests.php +++ /dev/null @@ -1,56 +0,0 @@ -method() == 'POST' || $request->method() == 'GET') { - return $next($request); - } - - if (preg_match('/multipart\/form-data/', $request->headers->get('Content-Type')) or - preg_match('/multipart\/form-data/', $request->headers->get('content-type')) - ) { - $parser = new ParseMultiPartFormDataInputStream(file_get_contents('php://input')); - $params = $parser->getInput(); - $data = $params['parameters']; - $files = $params['files']; - if (count($files) > 0) { - Log::debug("ParseMultipartFormDataInputForNonPostRequests: files ".json_encode($files)); - $request->files->add($files); - } - - if (count($data) > 0) { - Log::debug("ParseMultipartFormDataInputForNonPostRequests: parameters ".json_encode($data)); - $request->request->add($data); - } - } - return $next($request); - } -} \ No newline at end of file diff --git a/app/Http/Middleware/RateLimitMiddleware.php b/app/Http/Middleware/RateLimitMiddleware.php deleted file mode 100644 index c003b2ad..00000000 --- a/app/Http/Middleware/RateLimitMiddleware.php +++ /dev/null @@ -1,109 +0,0 @@ -endpoint_repository = $endpoint_repository; - $this->endpoint_rate_limit_by_ip_repository = $endpoint_rate_limit_by_ip_repository; - } - - /** - * @param \Illuminate\Http\Request $request - * @param Closure $next - * @param int $max_attempts - * @param int $decay_minutes - * @return \Illuminate\Http\Response|mixed - */ - public function handle($request, Closure $next, $max_attempts = 0, $decay_minutes = 0) - { - $route = RequestUtils::getCurrentRoutePath($request); - $method = $request->getMethod(); - $endpoint = $this->endpoint_repository->getApiEndpointByUrlAndMethod($route, $method); - $key = $this->resolveRequestSignature($request); - $client_ip = $request->getClientIp(); - - if (!is_null($endpoint) && $endpoint->getRateLimit() > 0) { - $max_attempts = $endpoint->getRateLimit(); - } - - if (!is_null($endpoint) && $endpoint->getRateLimitDecay() > 0) { - $decay_minutes = $endpoint->getRateLimitDecay(); - } - - $endpoint_rate_limit_by_ip = $this->endpoint_rate_limit_by_ip_repository->getByIPRouteMethod - ( - $client_ip, - $route, - $method - ); - - if(!is_null($endpoint_rate_limit_by_ip)){ - $max_attempts = $endpoint_rate_limit_by_ip->getRateLimit(); - $decay_minutes = $endpoint_rate_limit_by_ip->getRateLimitDecay(); - } - - if ($max_attempts == 0 || $decay_minutes == 0) { - // short circuit (infinite) - return $next($request); - } - - if ($this->limiter->tooManyAttempts($key, $max_attempts)) { - return $this->buildException($key, $max_attempts); - } - - $this->limiter->hit($key, $decay_minutes); - - $response = $next($request); - - return $this->addHeaders( - $response, $max_attempts, - $this->calculateRemainingAttempts($key, $max_attempts) - ); - } -} \ No newline at end of file diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php deleted file mode 100644 index d4d20374..00000000 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ /dev/null @@ -1,26 +0,0 @@ -check()) { - return redirect('/'); - } - - return $next($request); - } -} diff --git a/app/Http/Middleware/SSLMiddleware.php b/app/Http/Middleware/SSLMiddleware.php deleted file mode 100644 index d8513aa8..00000000 --- a/app/Http/Middleware/SSLMiddleware.php +++ /dev/null @@ -1,33 +0,0 @@ -headers->set('X-content-type-options', 'nosniff'); - $response->headers->set('X-xss-protection', '1; mode=block'); - // http://tools.ietf.org/html/rfc6797 - /** - * The HSTS header field below stipulates that the HSTS Policy is to - * remain in effect for one year (there are approximately 31536000 - * seconds in a year) - * applies to the domain of the issuing HSTS Host and all of its - * subdomains: - */ - //$response->headers->set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains'); - return $response; - } -} \ No newline at end of file diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php deleted file mode 100644 index 5a50e7b5..00000000 --- a/app/Http/Middleware/TrimStrings.php +++ /dev/null @@ -1,18 +0,0 @@ -context = $context; - $this->member_repository = $member_repository; - $this->endpoint_repository = $endpoint_repository; - } - - /** - * @param $request - * @param Closure $next - * @param $required_groups - * @return \Illuminate\Http\JsonResponse|mixed - */ - public function handle($request, Closure $next) - { - $current_member = $this->context->getCurrentUser(); - if (is_null($current_member)) return $next($request); - $method = $request->getMethod(); - $route = RequestUtils::getCurrentRoutePath($request); - $endpoint = $this->endpoint_repository->getApiEndpointByUrlAndMethod($route, $method); - if(is_null($endpoint)) return $next($request); - if(!$endpoint instanceof ApiEndpoint) return $next($request); - $required_groups = $endpoint->getAuthzGroups(); - - foreach ($required_groups as $required_group) { - Log::debug(sprintf("UserAuthEndpoint::handle route %s method %s member %s (%s) required group %s", - $route, $method, $current_member->getId(), $current_member->getEmail(), $required_group->getSlug())); - - if($current_member->isOnGroup($required_group->getSlug())) - return $next($request); - } - - $http_response = Response::json(['error' => 'unauthorized member'], 403); - return $http_response; - } -} \ No newline at end of file diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php deleted file mode 100644 index 0c13b854..00000000 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ /dev/null @@ -1,17 +0,0 @@ -ticket = $ticket; - } - - public function render(): string - { - $order = $this->ticket->getOrder(); - $summit = $order->getSummit(); - $summit_name = $summit->getName(); - $main_venues = $summit->getMainVenues(); - $price = $this->ticket->getRawCost().' '.$this->ticket->getCurrency(); - $ticket_number = $this->ticket->getNumber(); - $location_name = ""; - if(count($main_venues) > 0){ - $location_name = $main_venues[0]->getName().', '.$main_venues[0]->getFullAddress(); - } - $order_number = $order->getNumber(); - $dates = $summit->getDatesLabel(); - $owner_full_name = $order->getOwnerFullName(); - $order_creation_date = $order->getCreatedUTC()->format("Y-m-d H:i:s"); - $ticket_type = $this->ticket->getTicketType()->getName(); - $attendee_name = $this->ticket->hasOwner() ? $this->ticket->getOwner()->getFullName() : 'TBD'; - // create new PDF document - $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - - // set document information - $pdf->SetCreator(PDF_CREATOR); - $pdf->SetTitle($summit_name. ' '.$this->ticket->getNumber()); - - // remove default header/footer - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - - // set header and footer fonts - $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); - $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - - // set default monospaced font - $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - - // set margins - $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); - $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); - $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); - - // set auto page breaks - $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - - // set image scale factor - $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - - // set font - $pdf->SetFont('helvetica', '', 8); - - // add a page - $pdf->AddPage(); - - $html = view('tickets.raw',[ - 'summit_name' => $summit_name, - 'ticket_type' => $ticket_type, - 'price' => $price, - 'location_name' => $location_name, - 'dates' => $dates, - 'order_number' => $order_number, - 'owner_full_name' => $owner_full_name, - 'order_creation_date' => $order_creation_date, - 'attendee_name' => $attendee_name, - ])->render(); - - $pdf->writeHTMLCell(100, 80, 10, 25 , $html, $border=1, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true); - - $pdf->SetFont('helvetica', '', 5.7); - - // set style for barcode - $style = [ - 'border' => 2, - 'vpadding' => 'auto', - 'hpadding' => 'auto', - 'fgcolor' => [0, 0, 0], - 'bgcolor' => false, //array(255,255,255) - 'module_width' => 1, // width of a single module in points - 'module_height' => 1 // height of a single module in points - ]; - - // QRCODE,L : QR-CODE Low error correction - $this->ticket->generateQRCode(); - $pdf->write2DBarcode($this->ticket->getQRCode(), 'QRCODE,L', 125, 25, 50, 50, $style, 'N'); - $pdf->Text(124, 85, $ticket_number); - - //Close and output PDF document - return $pdf->Output($ticket_number.'.pdf', 'S'); - } -} \ No newline at end of file diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php deleted file mode 100644 index 76b2ffd4..00000000 --- a/app/Http/Requests/Request.php +++ /dev/null @@ -1,10 +0,0 @@ - 'App\Http\Controllers', - 'prefix' => 'api/public/v1', - 'before' => [], - 'after' => [], - 'middleware' => [ - 'ssl', - 'rate.limit:10000,1', // 10000 request per minute - 'etags' - ] -], function () { - - Route::group(['prefix' => 'sponsored-projects'], function(){ - Route::get('', 'OAuth2SponsoredProjectApiController@getAll'); - Route::group(['prefix'=>'{id}'], function(){ - Route::get('', [ 'uses' => 'OAuth2SponsoredProjectApiController@get']); - Route::group(['prefix'=>'sponsorship-types'], function(){ - Route::get('', 'OAuth2SponsoredProjectApiController@getAllSponsorshipTypes'); - Route::group(['prefix'=>'{sponsorship_type_id}'], function(){ - Route::get('', [ 'uses' => 'OAuth2SponsoredProjectApiController@getSponsorshipType']); - Route::group(['prefix'=>'supporting-companies'], function(){ - Route::get('', [ 'uses' => 'OAuth2SponsoredProjectApiController@getSupportingCompanies']); - }); - }); - }); - }); - }); - - // files - Route::group(['prefix' => 'files'], function () { - Route::post('upload','OAuth2ChunkedFilesApiController@uploadFile' ); - }); - - // members - Route::group(['prefix' => 'members'], function () { - Route::get('', 'OAuth2MembersApiController@getAll'); - }); - - // members - Route::group(['prefix' => 'legal-documents'], function () { - Route::get('{id}', 'OAuth2LegalDocumentsApiController@getById'); - }); - - // speakers - Route::group(['prefix' => 'speakers'], function () { - Route::group(['prefix' => '{speaker_id}'], function () { - Route::group(['prefix' => 'edit-permission'], function () { - Route::group(['prefix' => '{token}'], function () { - Route::get('approve', 'OAuth2SummitSpeakersApiController@approveSpeakerEditPermission'); - Route::get('decline', 'OAuth2SummitSpeakersApiController@declineSpeakerEditPermission'); - }); - }); - }); - }); - - // summits - Route::group(['prefix' => 'summits'], function () { - Route::get('', ['middleware' => 'cache:' . Config::get('cache_api_response.get_summit_response_lifetime', 600), 'uses' => 'OAuth2SummitApiController@getSummits']); - - Route::group(['prefix' => 'all'], function () { - - Route::get('', 'OAuth2SummitApiController@getAllSummits'); - Route::get('current', 'OAuth2SummitApiController@getAllCurrentSummit'); - Route::get('{id}', 'OAuth2SummitApiController@getAllSummitByIdOrSlug'); - - Route::group(['prefix' => 'payments'], function () { - Route::group(['prefix' => '{application_name}'], function () { - Route::post('confirm', 'PaymentGatewayWebHookController@genericConfirm'); - }); - }); - - Route::group(['prefix' => 'orders'], function () { - Route::group(['prefix' => '{order_hash}'], function () { - Route::group(['prefix' => 'tickets'], function () { - Route::put('', "OAuth2SummitOrdersApiController@updateTicketsByOrderHash"); - }); - }); - - Route::group(['prefix' => 'all'], function () { - Route::group(['prefix' => 'tickets'], function () { - Route::group(['prefix' => '{hash}'], function () { - Route::get('', "OAuth2SummitOrdersApiController@getTicketByHash"); - Route::put('', "OAuth2SummitOrdersApiController@updateTicketByHash"); - Route::put('regenerate', "OAuth2SummitOrdersApiController@regenerateTicketHash"); - Route::get('pdf', "OAuth2SummitOrdersApiController@getTicketPDFByHash"); - }); - }); - }); - }); - }); - - Route::group(['prefix' => '{id}'], function () { - - Route::group(['prefix' => 'payments'], function () { - Route::group(['prefix' => '{application_name}'], function () { - Route::post('confirm', 'PaymentGatewayWebHookController@confirm'); - }); - }); - - Route::group(['prefix' => 'selection-plans'], function () { - Route::get('current/{status}', 'OAuth2SummitSelectionPlansApiController@getCurrentSelectionPlanByStatus')->where('status', 'submission|selection|voting'); - }); - - - Route::get('', [ 'middleware' => 'cache:'.Config::get('cache_api_response.get_summit_response_lifetime', 1200), 'uses' => 'OAuth2SummitApiController@getSummit'])->where('id', 'current|[0-9]+'); - // members - Route::group(['prefix' => 'members'], function () { - Route::group(['prefix' => 'all'], function () { - Route::group(['prefix' => 'schedule'], function () { - Route::group(['prefix' => 'ics'], function () { - Route::get('{cid}', 'OAuth2SummitMembersApiController@getCalendarFeedICS'); - }); - }); - }); - }); - // events - Route::group(['prefix' => 'events'], function () { - Route::group(['prefix' => 'published'], function () { - Route::get('', [ 'middleware' => 'cache:1200', 'uses' => 'OAuth2SummitEventsApiController@getScheduledEvents']); - }); - - Route::group(array('prefix' => '{event_id}'), function () { - Route::group(['prefix' => 'published'], function () { - Route::get('', [ 'middleware' => 'cache:'.Config::get('cache_api_response.get_published_event_response_lifetime', 300), 'uses' => 'OAuth2SummitEventsApiController@getScheduledEvent']); - }); - }); - - Route::group(['prefix' => 'all'], function () { - Route::group(['prefix' => 'published'], function () { - Route::get('tags', 'OAuth2SummitEventsApiController@getScheduledEventsTags'); - }); - }); - }); - - // locations - Route::group(['prefix' => 'locations'], function () { - Route::group(['prefix' => '{location_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getLocation'); - Route::get('/events/published', 'OAuth2SummitLocationsApiController@getLocationPublishedEvents'); - Route::group(['prefix' => 'banners'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getLocationBanners'); - }); - }); - }); - - // notifications - Route::group(['prefix' => 'notifications'], function () { - Route::get('sent', 'OAuth2SummitNotificationsApiController@getAllApprovedByUser'); - }); - - // speakers - Route::group(['prefix' => 'speakers'], function () { - Route::get('', 'OAuth2SummitSpeakersApiController@getSpeakers'); - Route::group(['prefix' => '{speaker_id}'], function () { - Route::get('', 'OAuth2SummitSpeakersApiController@getSummitSpeaker')->where('speaker_id', '[0-9]+'); - }); - }); - - // orders - Route::group(['prefix' => 'orders'], function () { - Route::post('reserve', 'OAuth2SummitOrdersApiController@reserve'); - Route::group(['prefix' => '{hash}'], function () { - Route::put('checkout', 'OAuth2SummitOrdersApiController@checkout'); - Route::group(['prefix' => 'tickets'], function () { - Route::get('mine', 'OAuth2SummitOrdersApiController@getMyTicketByOrderHash'); - }); - Route::delete('', 'OAuth2SummitOrdersApiController@cancel'); - }); - }); - - // registration invitations - Route::group(['prefix' => 'registration-invitations'], function () { - Route::group(['prefix' => '{email}'], function () { - Route::get('', 'OAuth2SummitOrdersApiController@getByEmail'); - }); - }); - }); - }); - - // marketplace - Route::group(array('prefix' => 'marketplace'), function () { - - Route::group(array('prefix' => 'appliances'), function () { - Route::get('', 'AppliancesApiController@getAll'); - }); - - Route::group(array('prefix' => 'distros'), function () { - Route::get('', 'DistributionsApiController@getAll'); - }); - - Route::group(array('prefix' => 'consultants'), function () { - Route::get('', 'ConsultantsApiController@getAll'); - }); - - Route::group(array('prefix' => 'hosted-private-clouds'), function () { - Route::get('', 'PrivateCloudsApiController@getAll'); - }); - - Route::group(array('prefix' => 'remotely-managed-private-clouds'), function () { - Route::get('', 'RemoteCloudsApiController@getAll'); - }); - - Route::group(array('prefix' => 'public-clouds'), function () { - Route::get('', 'PublicCloudsApiController@getAll'); - }); - }); - - // countries - Route::group(array('prefix' => 'countries'), function () { - Route::get('', 'CountriesApiController@getAll'); - }); - - // languages - Route::group(array('prefix' => 'languages'), function () { - Route::get('', 'LanguagesApiController@getAll'); - }); - - - // timezones - Route::group(array('prefix' => 'timezones'), function () { - Route::get('', 'TimezonesApiController@getAll'); - }); - -}); - -Route::group([ - 'namespace' => 'App\Http\Controllers', - 'prefix' => '.well-known', - 'before' => [], - 'after' => [], - 'middleware' => [ - 'ssl', - 'rate.limit:1000,1', // 1000 request per minute - ] -], function(){ - Route::get('endpoints', 'ConfigurationsController@getEndpointsDefinitions'); -}); \ No newline at end of file diff --git a/app/Http/Utils/CSV/BooleanCellFormatter.php b/app/Http/Utils/CSV/BooleanCellFormatter.php deleted file mode 100644 index e5fd1680..00000000 --- a/app/Http/Utils/CSV/BooleanCellFormatter.php +++ /dev/null @@ -1,30 +0,0 @@ -format($val); - if(is_array($val)) $val = ''; - $values[] = $val; - } - $output .= implode($field_separator, $values) . PHP_EOL;; - } - return $output; - } - - function cleanData(&$str) - { - if (is_null($str)) {$str = ''; return;}; - if (is_array($str)) {return;}; - $str = preg_replace("/\t/", "\\t", $str); - $str = preg_replace("/\r?\n/", "\\n", $str); - $str = preg_replace("/,/", "-", $str); - if (strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"'; - } -} \ No newline at end of file diff --git a/app/Http/Utils/CSV/CurrentAffiliationsCellFormatter.php b/app/Http/Utils/CSV/CurrentAffiliationsCellFormatter.php deleted file mode 100644 index 5bf536de..00000000 --- a/app/Http/Utils/CSV/CurrentAffiliationsCellFormatter.php +++ /dev/null @@ -1,40 +0,0 @@ -format = $format; - } - - /** - * @param string $val - * @return string - */ - public function format($val) - { - if(empty($val)) return ''; - $date = new DateTime("@$val"); - return $date->format($this->format); - } -} \ No newline at end of file diff --git a/app/Http/Utils/CSV/ICellFormatter.php b/app/Http/Utils/CSV/ICellFormatter.php deleted file mode 100644 index 74075f3d..00000000 --- a/app/Http/Utils/CSV/ICellFormatter.php +++ /dev/null @@ -1,23 +0,0 @@ -= $start2; - } -} \ No newline at end of file diff --git a/app/Http/Utils/FileSizeUtil.php b/app/Http/Utils/FileSizeUtil.php deleted file mode 100644 index f433a4e7..00000000 --- a/app/Http/Utils/FileSizeUtil.php +++ /dev/null @@ -1,20 +0,0 @@ -file = $file; - $this->fileName = $fileName; - $this->fileExt = $fileExt; - $this->size = $size; - } - - /** - * @param LaravelRequest $request - * @param array $payload - * @return FileUploadInfo|null - * @throws ValidationException - */ - public static function build(LaravelRequest $request, array $payload):?FileUploadInfo { - - $file = null; - $fileName = null; - $fileExt = null; - $size = 0; - - if($request->hasFile('file')) { - Log::debug(sprintf("FileUploadInfo::build build file is present on request ( MULTIFORM )")); - $file = $request->file('file'); - // get in bytes should be converted to KB - $size = $file->getSize(); - if($size == 0) - throw new ValidationException("File size is zero."); - $fileName = $file->getClientOriginalName(); - $fileExt = pathinfo($fileName, PATHINFO_EXTENSION); - } - - if(is_null($file) && isset($payload['filepath'])){ - Log::debug(sprintf("FileUploadInfo::build build file is present on as local storage (%s)", $payload['filepath'])); - $disk = Storage::disk('local'); - - if(!$disk->exists($payload['filepath'])) - throw new ValidationException(sprintf("file provide on filepath %s does not exists on local storage.", $payload['filepath'])); - - // get in bytes should be converted to KB - $size = $disk->size($payload['filepath']); - if($size == 0) - throw new ValidationException("File size is zero."); - - $fileName = pathinfo($payload['filepath'],PATHINFO_BASENAME); - $fileExt = pathinfo($fileName, PATHINFO_EXTENSION); - $file = new UploadedFile($disk->path($payload['filepath']), $fileName); - } - - if(is_null($file)) return null; - - $fileName = FileNameSanitizer::sanitize($fileName); - - return new self($file, $fileName, $fileExt, $size); - } - - /** - * @param string $unit - * @return int|null - */ - public function getSize(string $unit = FileSizeUtil::Kb): ?int - { - if($unit === FileSizeUtil::Kb){ - return $this->size / 1024; - } - - return $this->size; - } - - - /** - * @return UploadedFile - */ - public function getFile(): ?UploadedFile - { - return $this->file; - } - - /** - * @return string - */ - public function getFileName(): ?string - { - return $this->fileName; - } - - /** - * @return string - */ - public function getFileExt(): ?string - { - return $this->fileExt; - } - - public function delete(){ - if(is_null($this->file)) return; - $realPath = $this->file->getRealPath(); - Log::debug(sprintf("FileUploadInfo::delete deleting file %s", $realPath)); - unlink($realPath); - } - -} \ No newline at end of file diff --git a/app/Http/Utils/FileUploader.php b/app/Http/Utils/FileUploader.php deleted file mode 100644 index 840a755d..00000000 --- a/app/Http/Utils/FileUploader.php +++ /dev/null @@ -1,141 +0,0 @@ -folder_service = $folder_service; - $this->folder_repository = $folder_repository; - } - - private static $default_replacements = [ - '/\s/' => '-', // remove whitespace - '/_/' => '-', // underscores to dashes - '/[^A-Za-z0-9+.\-]+/' => '', // remove non-ASCII chars, only allow alphanumeric plus dash and dot - '/[\-]{2,}/' => '-', // remove duplicate dashes - '/^[\.\-_]+/' => '', // Remove all leading dots, dashes or underscores - ]; - - /** - * @param UploadedFile $file - * @param string $path - * @param bool $is_image - * @return File - * @throws \Exception - */ - public function build(UploadedFile $file, string $path, bool $is_image = false){ - $attachment = new File(); - try { - - $client_original_name = $file->getClientOriginalName(); - $ext = pathinfo($client_original_name, PATHINFO_EXTENSION); - $client_original_name = FileNameSanitizer::sanitize($client_original_name); - - $idx = 1; - $name = pathinfo($client_original_name, PATHINFO_FILENAME); - if(empty($name)){ - $client_original_name = uniqid().'.'.$ext; - $name = pathinfo($client_original_name, PATHINFO_FILENAME); - } - - while($this->folder_repository->existByName($client_original_name)){ - $client_original_name = $name.$idx.'.'.$ext; - ++$idx; - } - - $title = pathinfo($client_original_name, PATHINFO_FILENAME); - - if(empty($title)){ - throw new ValidationException("empty file name is not valid"); - } - - Log::debug(sprintf("FileUploader::build: folder_name %s client original name %s", $path, $client_original_name)); - - $local_path = Storage::disk('public')->putFileAs - ( - $path, - $file, - $client_original_name - ); - - Log::debug(sprintf("FileUploader::build: saved to local path %s", $local_path)); - - Log::debug(sprintf("FileUploader::build: invoking folder service findOrMake folder_name %s", $path)); - $folder = $this->folder_service->findOrMake($path); - $local_path = Storage::disk('public')->path($local_path); - $attachment->setParent($folder); - $attachment->setName($client_original_name); - $file_name = sprintf("assets/%s/%s", $path, $client_original_name); - Log::debug(sprintf("FileUploader::build file_name %s", $file_name)); - $attachment->setFilename($file_name); - $title = str_replace(['-','_'],' ', preg_replace('/\.[^.]+$/', '', $title)); - Log::debug(sprintf("FileUploader::build title %s", $title)); - $attachment->setTitle($title); - $attachment->setShowInSearch(true); - if ($is_image) // set className - $attachment->setImage(); - Log::debug(sprintf("FileUploader::build uploading to bucket %s", $local_path)); - // store at cloud - Storage::disk('assets')->putFileAs - ( - $path, - $file, - $client_original_name - ); - $attachment->setCloudMeta('LastPut', time()); - $attachment->setCloudStatus('Live'); - $attachment->setCloudSize(filesize($local_path)); - } - catch(ValidationException $ex){ - Log::warning($ex); - throw $ex; - } - catch (\Exception $ex){ - Log::error($ex); - throw $ex; - } - return $attachment; - } -} \ No newline at end of file diff --git a/app/Http/Utils/FilterAvailableSummitsStrategy.php b/app/Http/Utils/FilterAvailableSummitsStrategy.php deleted file mode 100644 index e97efaed..00000000 --- a/app/Http/Utils/FilterAvailableSummitsStrategy.php +++ /dev/null @@ -1,34 +0,0 @@ -getCurrentScope(); - $current_realm = Config::get('app.scope_base_realm'); - $needed_scope = sprintf(SummitScopes::ReadAllSummitData, $current_realm); - return in_array($needed_scope, $scopes); - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/AbstractFilterElement.php b/app/Http/Utils/Filters/AbstractFilterElement.php deleted file mode 100644 index 028a3f62..00000000 --- a/app/Http/Utils/Filters/AbstractFilterElement.php +++ /dev/null @@ -1,36 +0,0 @@ -operator = $operator; - } - - /** - * @return string - */ - public function getOperator(){ - return $this->operator; - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineCaseFilterMapping.php b/app/Http/Utils/Filters/DoctrineCaseFilterMapping.php deleted file mode 100644 index 422ad4e8..00000000 --- a/app/Http/Utils/Filters/DoctrineCaseFilterMapping.php +++ /dev/null @@ -1,53 +0,0 @@ -value = $value; - $this->condition = $condition; - } - - /** - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * @return string - */ - public function getCondition() - { - return $this->condition; - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineCollectionFieldsFilterMapping.php b/app/Http/Utils/Filters/DoctrineCollectionFieldsFilterMapping.php deleted file mode 100644 index 08244303..00000000 --- a/app/Http/Utils/Filters/DoctrineCollectionFieldsFilterMapping.php +++ /dev/null @@ -1,171 +0,0 @@ -allowed_collection_fields = $allowed_collection_fields; - $this->joins = $joins; - parent::__construct($table, $alias, ""); - } - - /** - * @param FilterElement $filter - * @throws \Exception - */ - public function toRawSQL(FilterElement $filter) - { - throw new \Exception; - } - - /** - * @param string $exp - * @return FilterElement|null - * @throws FilterParserException - */ - private function parseFilter(string $exp):?FilterElement - { - list ($field, $op, $value) = FilterParser::filterExpresion($exp); - if (!key_exists($field, $this->allowed_collection_fields)) - throw new FilterParserException(sprintf("Field %s is not allowed as filter", $field)); - - return FilterParser::buildFilter($this->allowed_collection_fields[$field], $op, $value); - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return QueryBuilder - * @throws \models\exceptions\ValidationException - */ - public function apply(QueryBuilder $query, FilterElement $filter) - { - $value = $filter->getValue(); - - - - if (is_array($value)) { - - $inner_where = ''; - - foreach ($value as $val) { - - $filterElement = $this->parseFilter($val); - $param_count = $query->getParameters()->count() + 1; - if (!empty($inner_where)) - $inner_where .= sprintf(" %s ", $filter->getSameFieldOp()); - $inner_where .= sprintf("%s %s %s", $filterElement->getField(), $filterElement->getOperator(), ":value_" . $param_count); - $query->setParameter(":value_" . $param_count, $filterElement->getValue()); - } - - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - foreach ($this->joins as $join => $join_alias){ - $query->innerJoin(sprintf("%s.%s", $this->alias, $join), $join_alias, Join::WITH); - } - - $inner_where = sprintf("( %s )", $inner_where); - - return $query->andWhere($inner_where); - - } - - $param_count = $query->getParameters()->count() + 1; - $filterElement = $this->parseFilter($value); - $where = sprintf("%s %s %s", $filterElement->getField(), $filterElement->getOperator(), ":value_" . $param_count); - $query->setParameter(":value_" . $param_count, $filterElement->getValue()); - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - foreach ($this->joins as $join => $join_alias){ - $query->innerJoin(sprintf("%s.%s", $this->alias, $join), $join_alias, Join::WITH); - } - - return $query->andWhere($where); - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return string - */ - public function applyOr(QueryBuilder $query, FilterElement $filter) - { - $value = $filter->getValue(); - - if (is_array($value)) { - $inner_where = ''; - - foreach ($value as $val) { - $filterElement = $this->parseFilter($val); - $param_count = $query->getParameters()->count() + 1; - if (!empty($inner_where)) - $inner_where .= sprintf(" %s ", $filter->getSameFieldOp()); - $inner_where .= sprintf("%s %s %s", $filterElement->getField(), $filterElement->getOperator(), ":value_" . $param_count); - $query->setParameter(":value_" . $param_count, $filterElement->getValue()); - } - - $inner_where = sprintf("( %s )", $inner_where); - - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - foreach ($this->joins as $join => $join_alias){ - $query->innerJoin(sprintf("%s.%s", $this->alias, $join), $join_alias, Join::WITH); - } - - return $inner_where; - } - - $param_count = $query->getParameters()->count() + 1; - $filterElement = $this->parseFilter($value); - $where = sprintf("%s %s %s", $filterElement->getField(), $filterElement->getOperator(), ":value_" . $param_count); - $query->setParameter(":value_" . $param_count, $filterElement->getValue()); - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - foreach ($this->joins as $join => $join_alias){ - $query->innerJoin(sprintf("%s.%s", $this->alias, $join), $join_alias, Join::WITH); - } - - return $where; - } - -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineFilterMapping.php b/app/Http/Utils/Filters/DoctrineFilterMapping.php deleted file mode 100644 index 99ed4dce..00000000 --- a/app/Http/Utils/Filters/DoctrineFilterMapping.php +++ /dev/null @@ -1,152 +0,0 @@ -getValue(); - if (is_array($value)) { - $inner_where = '( '; - - foreach ($value as $val) { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if ($has_param) { - $query = $query->setParameter(":value_" . $param_count, $val); - } - $inner_where .= $where . " " . $filter->getSameFieldOp() . " "; - } - $inner_where = substr($inner_where, 0, (strlen($filter->getSameFieldOp()) + 1) * -1); - $inner_where .= ' )'; - - $query = $query->andWhere($inner_where); - } else { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - $query = $query->andWhere($where); - - if ($has_param) { - $query = $query->setParameter(":value_" . $param_count, $filter->getValue()); - } - } - return $query; - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return string - */ - public function applyOr(QueryBuilder $query, FilterElement $filter) - { - $value = $filter->getValue(); - if (is_array($value)) { - - $inner_where = '( '; - - foreach ($value as $val) { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if ($has_param) { - $query->setParameter(":value_" . $param_count, $value); - } - - $inner_where .= $where . " " . $filter->getSameFieldOp() . " "; - } - - $inner_where = substr($inner_where, 0, (strlen($filter->getSameFieldOp()) + 1) * -1); - $inner_where .= ' )'; - - return $inner_where; - } - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if ($has_param) { - $query->setParameter(":value_" . $param_count, $filter->getValue()); - } - return $where; - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineHavingFilterMapping.php b/app/Http/Utils/Filters/DoctrineHavingFilterMapping.php deleted file mode 100644 index 2102b903..00000000 --- a/app/Http/Utils/Filters/DoctrineHavingFilterMapping.php +++ /dev/null @@ -1,110 +0,0 @@ -groupBy = $groupBy; - $this->having = $having; - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return QueryBuilder - */ - public function apply(QueryBuilder $query, FilterElement $filter) - { - $param_count = $query->getParameters()->count(); - $where = $this->where; - $has_param = false; - - $value = $filter->getValue(); - - if(trim($value) == '' || is_null($value) ) return $query; - - if(is_array($value) && count($value) == 0) return $query; - - if (!empty($where)) { - if (strstr($where, ":value")) { - ++$param_count; - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - $query = $query->andWhere($where); - - if ($has_param) { - $query = $query->setParameter(":value_" . $param_count, $value); - } - } - - if (!empty($this->groupBy)) { - $query = $query->addGroupBy($this->groupBy); - } - - if (!empty($this->having)) { - $has_param = false; - if (strstr($this->having, ":value_count") && is_array($value)) { - $this->having = str_replace(":value_count", count($value), $this->having); - } - - if (strstr($this->having, ":value_count")) { - $this->having = str_replace(":value_count", 1, $this->having); - } - - if (strstr($this->having, ":value")) { - ++$param_count; - $this->having = str_replace(":value", ":value_" . $param_count, $this->having); - $has_param = true; - } - - if (strstr($this->having, ":operator")) - $this->having = str_replace(":operator", $filter->getOperator(), $this->having); - - if ($has_param) { - $query = $query->setParameter(":value_" . $param_count, $value); - } - - $query = $query->andHaving($this->having); - } - - return $query; - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineInstanceOfFilterMapping.php b/app/Http/Utils/Filters/DoctrineInstanceOfFilterMapping.php deleted file mode 100644 index af4ef544..00000000 --- a/app/Http/Utils/Filters/DoctrineInstanceOfFilterMapping.php +++ /dev/null @@ -1,66 +0,0 @@ -class_names = $class_names; - parent::__construct($alias, sprintf("%s %s :class_name", $alias, self::InstanceOfDoctrine)); - } - - /** - * @param FilterElement $filter - * @throws \Exception - */ - public function toRawSQL(FilterElement $filter) - { - throw new \Exception; - } - - const InstanceOfDoctrine = 'INSTANCE OF'; - - private function translateClassName($value){ - if(isset($this->class_names[$value])) return $this->class_names[$value]; - return $value; - } - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return QueryBuilder - */ - public function apply(QueryBuilder $query, FilterElement $filter){ - $where = str_replace(":class_name", $this->translateClassName($filter->getValue()), $this->where); - return $query->andWhere($where); - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return string - */ - public function applyOr(QueryBuilder $query, FilterElement $filter){ - $where = str_replace(":class_name", $this->translateClassName($filter->getValue()), $this->where); - return $where; - } - -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineJoinFilterMapping.php b/app/Http/Utils/Filters/DoctrineJoinFilterMapping.php deleted file mode 100644 index 04ca97da..00000000 --- a/app/Http/Utils/Filters/DoctrineJoinFilterMapping.php +++ /dev/null @@ -1,177 +0,0 @@ -alias = $alias; - } - - /** - * @param FilterElement $filter - * @throws \Exception - */ - public function toRawSQL(FilterElement $filter) - { - throw new \Exception; - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return QueryBuilder - */ - public function apply(QueryBuilder $query, FilterElement $filter) - { - $value = $filter->getValue(); - - if (is_array($value)) { - $inner_where = '( '; - - foreach ($value as $val) { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if ($has_param) { - $query = $query->setParameter(":value_" . $param_count, $val); - } - $inner_where .= $where . " " . $filter->getSameFieldOp() . " "; - } - $inner_where = substr($inner_where, 0, (strlen($filter->getSameFieldOp()) + 1) * -1); - $inner_where .= ' )'; - - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - $query = $query->andWhere($inner_where); - - } else { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - $query = $query->andWhere($where); - - if ($has_param) { - $query = $query->setParameter(":value_" . $param_count, $filter->getValue()); - } - } - - return $query; - - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return string - */ - public function applyOr(QueryBuilder $query, FilterElement $filter) - { - $value = $filter->getValue(); - if (is_array($value)) { - $inner_where = '( '; - - foreach ($value as $val) { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if ($has_param) { - $query->setParameter(":value_" . $param_count, $value); - } - - $inner_where .= $where . " " . $filter->getSameFieldOp() . " "; - } - - $inner_where = substr($inner_where, 0, (strlen($filter->getSameFieldOp()) + 1) * -1); - $inner_where .= ' )'; - - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - return $inner_where; - } - - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if (!in_array($this->alias, $query->getAllAliases())) - $query->innerJoin($this->table, $this->alias, Join::WITH); - - if ($has_param) { - $query->setParameter(":value_" . $param_count, $value); - } - - return $where; - } - -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineLeftJoinFilterMapping.php b/app/Http/Utils/Filters/DoctrineLeftJoinFilterMapping.php deleted file mode 100644 index cce29e2b..00000000 --- a/app/Http/Utils/Filters/DoctrineLeftJoinFilterMapping.php +++ /dev/null @@ -1,147 +0,0 @@ -getValue(); - if(is_array($value)){ - - $inner_where = '( '; - - foreach ($value as $val) { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if ($has_param) { - $query = $query->setParameter(":value_" . $param_count, $val); - } - $inner_where .= $where . " " . $filter->getSameFieldOp() . " "; - } - $inner_where = substr($inner_where, 0, (strlen($filter->getSameFieldOp()) + 1) * -1); - $inner_where .= ' )'; - - $query = $query->andWhere($inner_where); - - if(!in_array($this->alias, $query->getAllAliases())) - $query->leftJoin($this->table, $this->alias, Join::WITH); - - return $query; - - } - - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if(strstr($where,":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if(strstr($where,":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - $query = $query->andWhere($where); - - if($has_param){ - $query = $query->setParameter(":value_".$param_count, $value); - } - - if(!in_array($this->alias, $query->getAllAliases())) - $query->leftJoin($this->table, $this->alias, Join::WITH); - - return $query; - } - - /** - * @param QueryBuilder $query - * @param FilterElement $filter - * @return string - */ - public function applyOr(QueryBuilder $query, FilterElement $filter){ - $value = $filter->getValue(); - if(is_array($value)){ - $inner_where = '( '; - - foreach ($value as $val) { - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if (strstr($where, ":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if (strstr($where, ":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if ($has_param) { - $query->setParameter(":value_" . $param_count, $value); - } - - $inner_where .= $where . " " . $filter->getSameFieldOp() . " "; - } - - $inner_where = substr($inner_where, 0, (strlen($filter->getSameFieldOp()) + 1) * -1); - $inner_where .= ' )'; - - if(!in_array($this->alias, $query->getAllAliases())) - $query->leftJoin($this->table, $this->alias, Join::WITH); - - return $inner_where; - } - - $param_count = $query->getParameters()->count() + 1; - $where = $this->where; - $has_param = false; - - if(strstr($where,":value")) { - $where = str_replace(":value", ":value_" . $param_count, $where); - $has_param = true; - } - - if(strstr($where,":operator")) - $where = str_replace(":operator", $filter->getOperator(), $where); - - if($has_param){ - $query->setParameter(":value_".$param_count, $value); - } - - if(!in_array($this->alias, $query->getAllAliases())) - $query->leftJoin($this->table, $this->alias, Join::WITH); - - return $where; - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/DoctrineSwitchFilterMapping.php b/app/Http/Utils/Filters/DoctrineSwitchFilterMapping.php deleted file mode 100644 index 5c55d4a3..00000000 --- a/app/Http/Utils/Filters/DoctrineSwitchFilterMapping.php +++ /dev/null @@ -1,64 +0,0 @@ -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(); - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/Filter.php b/app/Http/Utils/Filters/Filter.php deleted file mode 100644 index 6b0a924a..00000000 --- a/app/Http/Utils/Filters/Filter.php +++ /dev/null @@ -1,572 +0,0 @@ -filters = $filters; - } - - /** - * @param FilterElement|array $filter - * @return $this - */ - public function addFilterCondition($filter) - { - $this->filters[] = $filter; - return $this; - } - - /** - * will return an array of filter elements, OR filters are returned on a sub array - * @param string $field - * @return null|FilterElement[] - */ - public function getFilter($field) - { - $res = []; - foreach ($this->filters as $filter) { - - if ($filter instanceof FilterElement && $filter->getField() === $field) { - $res[] = $filter; - } - else if (is_array($filter)) { - // OR - $or_res = []; - foreach ($filter as $e) { - if ($e instanceof FilterElement && $e->getField() === $field) { - $or_res[] = $e; - } - } - if (count($or_res)) $res[] = $or_res; - } - } - return $res; - } - - /** - * @param string $field - * @return null|FilterElement - */ - public function getUniqueFilter($field){ - $res = $this->getFilter($field); - return count($res) == 1 ? $res[0]:null; - } - - - /** - * @param string $field - * @return bool - */ - public function hasFilter($field){ - return count($this->getFilter($field)) > 0; - } - - /** - * @param string $field - * @return null|FilterElement[] - */ - public function getFlatFilter($field) - { - $res = []; - foreach ($this->filters as $filter) { - - if ($filter instanceof FilterElement && $filter->getField() === $field) { - $res[] = $filter; - } - else if (is_array($filter)) { - // OR - foreach ($filter as $e) { - if ($e instanceof FilterElement && $e->getField() === $field) { - $res[] = $e; - } - } - - } - } - return $res; - } - - /** - * @return array - */ - public function getFiltersKeyValues(){ - $res = []; - foreach ($this->filters as $filter) { - - if ($filter instanceof FilterElement) { - $res[$filter->getField()] = $filter->getValue(); - } - else if (is_array($filter)) { - // OR - foreach ($filter as $e) { - if ($e instanceof FilterElement) { - if(!isset($res[$e->getField()])) $res[$e->getField()] = []; - $res[$e->getField()][] = $e->getValue(); - } - } - } - } - return $res; - } - - /** - * @param array $rules - * @param array $messages - * @throws ValidationException - */ - public function validate(array $rules, array $messages = []){ - $filter_key_values = $this->getFiltersKeyValues(); - foreach($rules as $field => $rule) { - if(!isset($filter_key_values[$field])) continue; - $values = $filter_key_values[$field]; - if(!is_array($values)) $values = [$values]; - foreach ($values as $val) { - if(is_array($val)){ - foreach($val as $sub_val){ - self::_validate($field, $sub_val, $rule, $messages); - } - } - else { - self::_validate($field, $val, $rule, $messages); - } - } - } - } - - private static function _validate($field, $val, $rule, $messages){ - $validation = Validator::make - ( - [$field => $val], - [$field => $rule], - $messages - ); - if ($validation->fails()) { - $ex = new ValidationException(); - throw $ex->setMessages($validation->messages()->toArray()); - } - } - - /** - * @param Criteria $criteria - * @param array $mappings - * @return Criteria - */ - public function apply2Criteria(Criteria $criteria, array $mappings) - { - foreach ($this->filters as $filter) { - if ($filter instanceof FilterElement) { - if (isset($mappings[$filter->getField()])) { - $mapping = $mappings[$filter->getField()]; - - if ($mapping instanceof FilterMapping) { - continue; - } - - $mapping = explode(':', $mapping); - $value = $filter->getValue(); - - if (count($mapping) > 1) { - $value = $this->convertValue($value, $mapping[1]); - } - $criteria->andWhere(Criteria::expr()->eq($mapping[0], $value)); - } - } else if (is_array($filter)) { - // OR - - foreach ($filter as $e) { - if ($e instanceof FilterElement && isset($mappings[$e->getField()])) { - $mapping = $mappings[$e->getField()]; - if ($mapping instanceof FilterMapping) { - continue; - } - $mapping = explode(':', $mapping); - $value = $filter->getValue(); - if (count($mapping) > 1) { - $value = $this->convertValue($value, $mapping[1]); - } - $criteria->orWhere(Criteria::expr()->eq($mapping[0], $value)); - - } - } - - } - } - return $criteria; - } - - /** - * @param QueryBuilder $query - * @param array $mappings - * @return $this - */ - public function apply2Query(QueryBuilder $query, array $mappings) - { - $param_prefix = "param_%s"; - $param_idx = 1; - $bindings = []; - - foreach ($this->filters as $filter) { - if ($filter instanceof FilterElement && isset($mappings[$filter->getField()])) { - $mapping = $mappings[$filter->getField()]; - - if ($mapping instanceof DoctrineJoinFilterMapping) { - $query = $mapping->apply($query, $filter); - continue; - } - if ($mapping instanceof DoctrineSwitchFilterMapping) { - $query = $mapping->apply($query, $filter); - continue; - } - if ($mapping instanceof DoctrineFilterMapping) { - $query = $mapping->apply($query, $filter); - continue; - } - if ($mapping instanceof DoctrineInstanceOfFilterMapping) { - $query = $mapping->apply($query, $filter); - continue; - } - else if(is_array($mapping)){ - $condition = ''; - foreach ($mapping as $mapping_or){ - $mapping_or = explode(':', $mapping_or); - $value = $filter->getValue(); - if (count($mapping_or) > 1) { - $value = $this->convertValue($value, $mapping_or[1]); - } - - if(!empty($condition)) $condition .= ' OR '; - /**********************/ - if(is_array($value)){ - $inner_condition = '( '; - foreach ($value as $val) { - $inner_condition .= sprintf(" %s %s :%s %s ", $mapping[0], $filter->getOperator(), sprintf($param_prefix, $param_idx), $filter->getSameFieldOp()); - $bindings[sprintf($param_prefix, $param_idx)] = $val; - ++$param_idx; - } - $inner_condition = substr($inner_condition, 0, (strlen($filter->getSameFieldOp())+1) * -1); - $inner_condition .= ' )'; - $condition .= $inner_condition; - } - else { - $bindings[sprintf($param_prefix, $param_idx)] = $value; - $condition .= sprintf("%s %s :%s", $mapping_or[0], $filter->getOperator(), sprintf($param_prefix, $param_idx)); - ++$param_idx; - } - /**********************/ - - } - $query->andWhere($condition); - } - else { - $mapping = explode(':', $mapping); - $value = $filter->getValue(); - $condition = ''; - - if (count($mapping) > 1) { - $value = $this->convertValue($value, $mapping[1]); - } - - if(is_array($value)){ - $inner_condition = '( '; - foreach ($value as $val) { - $inner_condition .= sprintf(" %s %s :%s %s ", $mapping[0], $filter->getOperator(), sprintf($param_prefix, $param_idx), $filter->getSameFieldOp()); - $bindings[sprintf($param_prefix, $param_idx)] = $val; - ++$param_idx; - } - $inner_condition = substr($inner_condition, 0, (strlen($filter->getSameFieldOp())+1) * -1); - $inner_condition .= ' )'; - $condition .= $inner_condition; - } - else { - $bindings[sprintf($param_prefix, $param_idx)] = $value; - $condition .= sprintf("%s %s :%s", $mapping[0], $filter->getOperator(), sprintf($param_prefix, $param_idx)); - ++$param_idx; - } - - $query->andWhere($condition); - } - } - else if (is_array($filter)) { - // OR - $sub_or_query = ''; - foreach ($filter as $e) { - if ($e instanceof FilterElement && isset($mappings[$e->getField()])) { - - $mapping = $mappings[$e->getField()]; - if ($mapping instanceof DoctrineJoinFilterMapping) { - $condition = $mapping->applyOr($query, $e); - 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; - continue; - } - if ($mapping instanceof DoctrineInstanceOfFilterMapping) { - $condition = $mapping->applyOr($query, $e); - if(!empty($sub_or_query)) $sub_or_query .= ' OR '; - $sub_or_query .= $condition; - continue; - } - else if(is_array($mapping)){ - $condition = ''; - foreach ($mapping as $mapping_or){ - $mapping_or = explode(':', $mapping_or); - $value = $e->getValue(); - if (count($mapping_or) > 1) { - $value = $this->convertValue($value, $mapping_or[1]); - } - - if(!empty($condition)) $condition .= ' OR '; - - if(is_array($value)){ - $inner_condition = '( '; - foreach ($value as $val) { - $inner_condition .= sprintf(" %s %s :%s %s ", $mapping_or[0], $e->getOperator(), sprintf($param_prefix, $param_idx), $e->getSameFieldOp()); - $bindings[sprintf($param_prefix, $param_idx)] = $val; - ++$param_idx; - } - $inner_condition = substr($inner_condition, 0, (strlen($e->getSameFieldOp())+1) * -1); - $inner_condition .= ' )'; - $condition .= $inner_condition; - } - else { - $bindings[sprintf($param_prefix, $param_idx)] = $value; - $condition .= sprintf("%s %s :%s", $mapping_or[0], $e->getOperator(), sprintf($param_prefix, $param_idx)); - ++$param_idx; - } - } - if(!empty($sub_or_query)) $sub_or_query .= ' OR '; - $sub_or_query .= ' ( '.$condition.' ) '; - } - else { - $mapping = explode(':', $mapping); - $value = $e->getValue(); - - if (count($mapping) > 1) { - $value = $this->convertValue($value, $mapping[1]); - } - - if(!empty($sub_or_query)) $sub_or_query .= ' OR '; - - if(is_array($value)){ - $inner_condition = '( '; - foreach ($value as $val) { - $inner_condition .= sprintf(" %s %s :%s %s ", $mapping[0], $e->getOperator(), sprintf($param_prefix, $param_idx), $e->getSameFieldOp()); - $bindings[sprintf($param_prefix, $param_idx)] = $val; - ++$param_idx; - } - $inner_condition = substr($inner_condition, 0, (strlen($e->getSameFieldOp())+1) * -1); - $inner_condition .= ' )'; - $sub_or_query .= $inner_condition; - } - else { - $bindings[sprintf($param_prefix, $param_idx)] = $value; - $sub_or_query .= sprintf("%s %s :%s", $mapping[0], $e->getOperator(), sprintf($param_prefix, $param_idx)); - ++$param_idx; - } - } - } - } - $query->andWhere($sub_or_query); - } - } - foreach($bindings as $param => $value) - $query->setParameter($param, $value); - return $this; - } - - /** - * @param string $value - * @param string $original_format - * @return mixed - */ - private function convertValue($value, $original_format) - { - switch ($original_format) { - case 'datetime_epoch': - if(is_array($value)){ - $res = []; - foreach ($value as $val){ - $datetime = new \DateTime("@$val"); - $res[] = sprintf("%s", $datetime->format("Y-m-d H:i:s")); - } - return $res; - } - $datetime = new \DateTime("@$value"); - return sprintf("%s", $datetime->format("Y-m-d H:i:s")); - break; - case 'json_int': - if(is_array($value)){ - $res = []; - foreach ($value as $val){ - $res[] = intval($val); - } - return $res; - } - return intval($value); - break; - case 'json_string': - if(is_array($value)){ - $res = []; - foreach ($value as $val){ - $res[] = sprintf("%s", $val); - } - return $res; - } - return sprintf("%s", $value); - break; - default: - return $value; - break; - } - } - - /** - * @return array - */ - public function getSQLBindings() - { - return $this->bindings; - } - - /** - * @param array $mappings - * @return string - */ - public function toRawSQL(array $mappings, int $param_idx = 1) - { - $sql = ''; - $this->bindings = []; - $param_prefix = "param_%s"; - - foreach ($this->filters as $filter) { - if ($filter instanceof FilterElement) { - if (isset($mappings[$filter->getField()])) { - - $mapping = $mappings[$filter->getField()]; - $mapping = explode(':', $mapping); - $value = $filter->getValue(); - $op = $filter->getOperator(); - if (count($mapping) > 1) { - $filter->setValue($this->convertValue($value, $mapping[1])); - } - if(is_array($value)){ - $cond = '( '; - foreach ($value as $val) { - $cond .= sprintf(" %s %s :%s %s ", $mapping[0], $op, sprintf($param_prefix, $param_idx), $filter->getSameFieldOp()); - $this->bindings[sprintf($param_prefix, $param_idx)] = $val; - ++$param_idx; - } - $cond = substr($cond, 0, (strlen($filter->getSameFieldOp())+1) * -1); - $cond .= ' )'; - } - else { - $cond = sprintf(' %s %s :%s', $mapping[0], $op, sprintf($param_prefix, $param_idx)); - $this->bindings[sprintf($param_prefix, $param_idx)] = $filter->getValue(); - ++$param_idx; - } - if (!empty($sql)) $sql .= " AND "; - $sql .= $cond; - } - } else if (is_array($filter)) { - // OR - $sql .= " ( "; - $sql_or = ''; - foreach ($filter as $e) { - if ($e instanceof FilterElement && isset($mappings[$e->getField()])) { - $mapping = $mappings[$e->getField()]; - $mapping = explode(':', $mapping); - $value = $e->getValue(); - $op = $e->getOperator(); - if (count($mapping) > 1) { - $e->setValue($this->convertValue($value, $mapping[1])); - } - - if(is_array($value)){ - $cond = '( '; - foreach ($value as $val) { - $cond .= sprintf(" %s %s :%s %s ", $mapping[0], $op, sprintf($param_prefix, $param_idx), $e->getSameFieldOp()); - $this->bindings[sprintf($param_prefix, $param_idx)] = $val; - ++$param_idx; - } - $cond = substr($cond, 0, (strlen($e->getSameFieldOp())+1) * -1); - $cond .= ' )'; - } - else { - $cond = sprintf(" %s %s :%s", $mapping[0], $op, sprintf($param_prefix, $param_idx)); - $this->bindings[sprintf($param_prefix, $param_idx)] = $e->getValue(); - ++$param_idx; - } - if (!empty($sql_or)) $sql_or .= " OR "; - $sql_or .= $cond; - } - } - $sql .= $sql_or . " ) "; - } - } - return $sql; - } - - /** - * @param string $field - * @return array - */ - public function getFilterCollectionByField($field){ - $list = []; - $filter = $this->getFilter($field); - - if(is_array($filter)){ - if(is_array($filter[0])){ - foreach ($filter[0] as $filter_element) - $list[] = intval($filter_element->getValue()); - } - else{ - $list[] = intval($filter[0]->getValue()); - } - } - return $list; - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/FilterElement.php b/app/Http/Utils/Filters/FilterElement.php deleted file mode 100644 index 98631039..00000000 --- a/app/Http/Utils/Filters/FilterElement.php +++ /dev/null @@ -1,127 +0,0 @@ -field = $field; - if($this->field == 'start_date'){ - $value = intval($value); - } - $this->value = $value; - $this->same_field_op = $same_field_op; - } - - /** - * @param mixed $value - * @return $this - */ - public function setValue($value) - { - $this->value = $value; - return $this; - } - - /** - * @return string - */ - public function getField() - { - return $this->field; - } - - /** - * @return mixed - */ - public function getValue() - { - switch($this->operator) - { - case 'like': - if(is_array($this->value)){ - $res = []; - foreach ($this->value as $val){ - $res[]= empty($val) ? '' : "%".$val."%"; - } - return $res; - } - return empty($this->value) ? '' : "%".$this->value."%"; - break; - default: - return $this->value; - break; - } - } - - public function getSameFieldOp():?string { - return $this->same_field_op; - } - - public static function makeEqual($field, $value, $same_field_op = null) - { - return new self($field, $value, '=', $same_field_op); - } - - public static function makeGreather($field, $value, $same_field_op = null) - { - return new self($field, $value, '>', $same_field_op); - } - - public static function makeGreatherOrEqual($field, $value, $same_field_op = null) - { - return new self($field, $value, '>=', $same_field_op); - } - - public static function makeLower($field, $value, $same_field_op = null) - { - return new self($field, $value, '<', $same_field_op); - } - - public static function makeLowerOrEqual($field, $value, $same_field_op = null) - { - return new self($field, $value, '<=', $same_field_op); - } - - public static function makeNotEqual($field, $value, $same_field_op = null) - { - return new self($field, $value, '<>', $same_field_op); - } - - public static function makeLike($field, $value, $same_field_op = null) - { - return new self($field, $value, 'like', $same_field_op); - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/FilterMapping.php b/app/Http/Utils/Filters/FilterMapping.php deleted file mode 100644 index dd95ead9..00000000 --- a/app/Http/Utils/Filters/FilterMapping.php +++ /dev/null @@ -1,48 +0,0 @@ -table = $table; - $this->where = $where; - } - - /** - * @param FilterElement $filter - * @return string - */ - public abstract function toRawSQL(FilterElement $filter); -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/FilterParser.php b/app/Http/Utils/Filters/FilterParser.php deleted file mode 100644 index 866cc093..00000000 --- a/app/Http/Utils/Filters/FilterParser.php +++ /dev/null @@ -1,169 +0,0 @@ - 1) { - $f = []; - foreach ($or_filters as $of) { - - //single filter - if(empty($of)) continue; - - list($field, $op, $value) = self::filterExpresion($of); - - if (!isset($allowed_fields[$field])){ - throw new FilterParserException(sprintf("filter by field %s is not allowed", $field)); - } - if (!in_array($op, $allowed_fields[$field])){ - throw new FilterParserException(sprintf("%s op is not allowed for filter by field %s",$op, $field)); - } - // check if value has AND or OR values on same field - $same_field_op = null; - if(str_contains($value, '&&')){ - $values = explode('&&', $value); - if (count($values) > 1) { - $value = $values; - $same_field_op = 'AND'; - } - } - else if(str_contains($value, '||')){ - $values = explode('||', $value); - if (count($values) > 1) { - $value = $values; - $same_field_op = 'OR'; - } - } - - $f_or = self::buildFilter($field, $op, $value, $same_field_op); - if (!is_null($f_or)) - $f[] = $f_or; - } - } else { - //single filter - - list($field, $op, $value) = self::filterExpresion($filter); - - // check if value has AND or OR values on same field - $same_field_op = null; - if(str_contains($value, '&&')){ - $values = explode('&&', $value); - if (count($values) > 1) { - $value = $values; - $same_field_op = 'AND'; - } - } - else if(str_contains($value, '||')){ - $values = explode('||', $value); - if (count($values) > 1) { - $value = $values; - $same_field_op = 'OR'; - } - } - - if (!isset($allowed_fields[$field])){ - throw new FilterParserException(sprintf("filter by field %s is not allowed", $field)); - } - if (!in_array($op, $allowed_fields[$field])){ - throw new FilterParserException(sprintf("%s op is not allowed for filter by field %s",$op, $field)); - - } - - $f = self::buildFilter($field, $op, $value, $same_field_op); - } - - if (!is_null($f)) - $res[] = $f; - } - return new Filter($res); - } - - /** - * @param string $exp - * @return array - * @throws FilterParserException - */ - public static function filterExpresion(string $exp){ - - preg_match('/[=<>][=>@]{0,1}/', $exp, $matches); - - if (count($matches) != 1) - throw new FilterParserException(sprintf("invalid OR filter format %s (should be [:FIELD_NAME:OPERAND:VALUE])", $exp)); - - $op = $matches[0]; - $operands = explode($op, $exp, 2); - $field = $operands[0]; - $value = $operands[1]; - - return [$field, $op, $value]; - } - /** - * Factory Method - * - * @param string $field - * @param string $op - * @param mixed $value - * @param string $same_field_op - * @return FilterElement|null - */ - public static function buildFilter($field, $op, $value, $same_field_op = null ) - { - switch ($op) { - case '==': - return FilterElement::makeEqual($field, $value, $same_field_op); - break; - case '=@': - return FilterElement::makeLike($field, $value, $same_field_op); - break; - case '>': - return FilterElement::makeGreather($field, $value, $same_field_op); - break; - case '>=': - return FilterElement::makeGreatherOrEqual($field, $value, $same_field_op); - break; - case '<': - return FilterElement::makeLower($field, $value, $same_field_op); - break; - case '<=': - return FilterElement::makeLowerOrEqual($field, $value, $same_field_op); - break; - case '<>': - return FilterElement::makeNotEqual($field, $value, $same_field_op); - break; - } - return null; - } -} \ No newline at end of file diff --git a/app/Http/Utils/Filters/FilterParserException.php b/app/Http/Utils/Filters/FilterParserException.php deleted file mode 100644 index 0750646b..00000000 --- a/app/Http/Utils/Filters/FilterParserException.php +++ /dev/null @@ -1,26 +0,0 @@ -cacheService = $cacheService; - $this->from = $from; - $this->to = is_array($to) ? $to : array($to); - $this->subject = $subject; - $this->addHeader(sprintf('From: %s', $from)); - $this->maxColumnWidth = $maxColumnWidth; - } - - /** - * Add headers to the message - * - * @param string|array $headers Custom added headers - * @return self - */ - public function addHeader($headers) - { - foreach ((array) $headers as $header) { - if (strpos($header, "\n") !== false || strpos($header, "\r") !== false) { - throw new \InvalidArgumentException('Headers can not contain newline characters for security reasons'); - } - $this->headers[] = $header; - } - - return $this; - } - - /** - * Add parameters to the message - * - * @param string|array $parameters Custom added parameters - * @return self - */ - public function addParameter($parameters) - { - $this->parameters = array_merge($this->parameters, (array) $parameters); - - return $this; - } - - /** - * {@inheritdoc} - */ - protected function send($content, array $records) - { - $content = wordwrap($content, $this->maxColumnWidth); - - - $subject = $this->subject; - if ($records) { - $subjectFormatter = new LineFormatter($this->subject); - $subject = $subjectFormatter->format($this->getHighestRecord($records)); - } - - // to avoid bloating inboxes/quotas - if($this->cacheService){ - if($this->cacheService->exists(self::SENT_ERROR_EMAIL)){ - // short circuit - Log::debug(sprintf("LaravelMailerHandler::send skipping exception %s %s", $subject, $content)); - return; - } - $this->cacheService->setSingleValue(self::SENT_ERROR_EMAIL, self::SENT_ERROR_EMAIL, self::TIME_BETWEEN_ERRORS); - } - - foreach ($this->to as $to) { - Mail::raw($content, function(Message $message) use($to, $subject, $content){ - $message - ->to($to) - ->subject($subject) - ->setBody($content, 'text/html') - ->setFrom($this->from); - }); - } - } - - /** - * @return string $contentType - */ - public function getContentType() - { - return $this->contentType; - } - - /** - * @return string $encoding - */ - public function getEncoding() - { - return $this->encoding; - } - - /** - * @param string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML - * messages. - * @return self - */ - public function setContentType($contentType) - { - if (strpos($contentType, "\n") !== false || strpos($contentType, "\r") !== false) { - throw new \InvalidArgumentException('The content type can not contain newline characters to prevent email header injection'); - } - - $this->contentType = $contentType; - - return $this; - } - - /** - * @param string $encoding - * @return self - */ - public function setEncoding($encoding) - { - if (strpos($encoding, "\n") !== false || strpos($encoding, "\r") !== false) { - throw new \InvalidArgumentException('The encoding can not contain newline characters to prevent email header injection'); - } - - $this->encoding = $encoding; - - return $this; - } -} diff --git a/app/Http/Utils/MultipartFormDataCleaner.php b/app/Http/Utils/MultipartFormDataCleaner.php deleted file mode 100644 index 80ffdc6e..00000000 --- a/app/Http/Utils/MultipartFormDataCleaner.php +++ /dev/null @@ -1,68 +0,0 @@ -ordering = $ordering; - } - - /** - * @param string $field - * @return bool - */ - public function hasOrder(string $field):bool{ - foreach ($this->ordering as $order){ - if ($order instanceof OrderElement && $order->getField() == $field) { - return true; - } - } - return false; - } - - /** - * @param QueryBuilder $query - * @param array $mappings - * @return $this - */ - public function apply2Query(QueryBuilder $query, array $mappings) - { - $hidden_ord_idx = 0; - foreach ($this->ordering as $order) { - if ($order instanceof OrderElement) { - if (isset($mappings[$order->getField()])) { - $mapping = $mappings[$order->getField()]; - $orders[$mapping] = $order->getDirection(); - // @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/dql-doctrine-query-language.html#select-expressions - if(str_contains(strtoupper($mapping),"CASE WHEN") || str_contains(strtoupper($mapping),"COALESCE")){ - $query->addSelect("({$mapping}) AS HIDDEN ORD_{$hidden_ord_idx}"); - $mapping = "ORD_{$hidden_ord_idx}"; - ++$hidden_ord_idx; - } - $query->addOrderBy($mapping, $order->getDirection()); - } - } - } - return $this; - } - - /** - * @param Criteria $criteria - * @param array $mappings - * @return $this - */ - public function apply2Criteria(Criteria $criteria, array $mappings) - { - $orders = []; - foreach ($this->ordering as $order) { - if ($order instanceof OrderElement) { - if (isset($mappings[$order->getField()])) { - $mapping = $mappings[$order->getField()]; - $orders[$mapping] = $order->getDirection(); - } - } - } - if(count($orders) > 0) - $criteria->orderBy($orders); - return $this; - } - - - /** - * @param array $mappings - * @return string - */ - public function toRawSQL(array $mappings) - { - $sql = ' ORDER BY '; - foreach ($this->ordering as $order) { - if ($order instanceof OrderElement) { - if (isset($mappings[$order->getField()])) { - $mapping = $mappings[$order->getField()]; - $sql .= sprintf('%s %s, ', $mapping, $order->getDirection()); - } - } - } - return substr($sql, 0 , strlen($sql) - 2); - } -} \ No newline at end of file diff --git a/app/Http/Utils/OrderElement.php b/app/Http/Utils/OrderElement.php deleted file mode 100644 index 68d0dfdb..00000000 --- a/app/Http/Utils/OrderElement.php +++ /dev/null @@ -1,74 +0,0 @@ -field = $field; - $this->direction = $direction; - } - - public static function buildAscFor($field) - { - return new OrderElement($field, 'ASC'); - } - - public static function buildDescFor($field) - { - return new OrderElement($field, 'DESC'); - } - - /** - * @return string - */ - public function getField() - { - return $this->field; - } - - public function isAsc() - { - return $this->direction === 'ASC'; - } - - /** - * @return string - */ - public function getDirection() - { - return $this->direction; - } -} \ No newline at end of file diff --git a/app/Http/Utils/OrderParser.php b/app/Http/Utils/OrderParser.php deleted file mode 100644 index a8d4582a..00000000 --- a/app/Http/Utils/OrderParser.php +++ /dev/null @@ -1,61 +0,0 @@ -= MinPageSize and <= MaxPageSize - const MinPageSize = 5; - const MaxPageSize = 100; -} \ No newline at end of file diff --git a/app/Http/Utils/PagingInfo.php b/app/Http/Utils/PagingInfo.php deleted file mode 100644 index dedddd3c..00000000 --- a/app/Http/Utils/PagingInfo.php +++ /dev/null @@ -1,67 +0,0 @@ -page = $page; - $this->per_page = $per_page; - } - - /** - * @return int - */ - public function getCurrentPage() - { - return $this->page; - } - - /** - * @return int - */ - public function getPerPage() - { - return $this->per_page; - } - - /** - * @return int - */ - public function getOffset() - { - return ($this->page - 1) * $this->per_page; - } - - /** - * @param int $count - * @return int - */ - public function getLastPage($count){ - return intval(ceil($count/$this->per_page)); - } -} \ No newline at end of file diff --git a/app/Http/Utils/PagingResponse.php b/app/Http/Utils/PagingResponse.php deleted file mode 100644 index f309f487..00000000 --- a/app/Http/Utils/PagingResponse.php +++ /dev/null @@ -1,138 +0,0 @@ -total = $total; - $this->per_page = $per_page; - $this->page = $page; - $this->last_page = $last_page; - $this->items = $items; - } - - public function getTotal() - { - return $this->total; - } - - /** - * @return int - */ - public function getPerPage() - { - return $this->per_page; - } - - /** - * @return int - */ - public function getCurrentPage() - { - return $this->page; - } - - /** - * @return int - */ - public function getLastPage() - { - return $this->last_page; - } - - /** - * @return array - */ - public function getItems() - { - return $this->items; - } - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @param string $serializer_type - * @return array - */ - public function toArray($expand = null, array $fields = [], array $relations = [], array $params = [], $serializer_type = SerializerRegistry::SerializerType_Public ) - { - $items = []; - foreach($this->items as $i) - { - if($i instanceof IEntity) - { - $start = microtime(true); - $i = SerializerRegistry::getInstance()->getSerializer($i, $serializer_type)->serialize($expand, $fields, $relations, $params); - $end = microtime(true); - Log::debug(sprintf("PagingResponse::toArray serialization delta %s", $end - $start)); - } - $items[] = $i; - } - - return - [ - 'total' => $this->total, - 'per_page' => $this->per_page, - 'current_page' => $this->page, - 'last_page' => $this->last_page, - 'data' => $items, - ]; - } - - /** - * @return bool - */ - public function hasMoreItems():bool { - return $this->page < $this->last_page; - } -} \ No newline at end of file diff --git a/app/Http/Utils/ParseMultiPartFormDataInputStream.php b/app/Http/Utils/ParseMultiPartFormDataInputStream.php deleted file mode 100644 index 35466cdb..00000000 --- a/app/Http/Utils/ParseMultiPartFormDataInputStream.php +++ /dev/null @@ -1,380 +0,0 @@ -input = $input; - } - - /** - * @return array - */ - public function getInput(){ - - $boundary = $this->boundary(); - - if (!strlen($boundary)) { - return [ - 'parameters' => $this->parse(), - 'files' => [] - ]; - } - - $blocks = $this->split($boundary); - - return $this->blocks($blocks); - } - - /** - * @function boundary - * @returns string - */ - private function boundary() - { - if(!isset($_SERVER['CONTENT_TYPE'])) { - return null; - } - - preg_match('/boundary=(.*)$/', $_SERVER['CONTENT_TYPE'], $matches); - return $matches[1]; - } - - /** - * @function parse - * @returns array - */ - private function parse() - { - parse_str(urldecode($this->input), $result); - return $result; - } - - /** - * @function split - * @param $boundary string - * @returns array - */ - private function split($boundary) - { - $result = preg_split("/-+$boundary/", $this->input); - array_pop($result); - return $result; - } - - /** - * @function blocks - * @param $array array - * @returns array - */ - private function blocks($array) - { - $results = [ - 'parameters' => [], - 'files' => [] - ]; - - foreach($array as $key => $value) - { - if (empty($value)) - continue; - - $block = $this->decide($value); - - foreach ($block['parameters'] as $key => $val ) { - if(key_exists($key, $results['parameters']) && is_array($results['parameters'][$key] ) && is_array($val)) - $results['parameters'][$key] = array_merge($results['parameters'][$key], $val); - else - $results['parameters'][$key] = $val; - } - - foreach ( $block['files'] as $key => $val ) { - $results['files'][$key] = $val; - } - } - - return $results; - } - - /** - * @function decide - * @param $string string - * @returns array - */ - private function decide($string) - { - if (strpos($string, 'application/octet-stream') !== FALSE) - { - return [ - 'parameters' => $this->file($string), - 'files' => [] - ]; - } - - if (strpos($string, 'filename') !== FALSE) - { - return [ - 'parameters' => [], - 'files' => $this->file_stream($string) - ]; - } - - return [ - 'parameters' => $this->parameter($string), - 'files' => [] - ]; - } - - /** - * @function file - * - * @param $string - * - * @return array - */ - private function file($string) - { - preg_match('/name=\"([^\"]*)\".*stream[\n|\r]+([^\n\r].*)?$/s', $string, $match); - return [ - $match[1] => ($match[2] !== NULL ? $match[2] : '') - ]; - } - - /** - * @function file_stream - * - * @param $string - * - * @return array - */ - private function file_stream($data) - { - $result = []; - $data = ltrim($data); - - $idx = strpos( $data, "\r\n\r\n" ); - if ( $idx === FALSE ) { - Log::warning( "ParseMultiPartFormDataInputStream.file_stream(): Could not locate header separator in data:" ); - Log::warning( $data ); - } else { - $headers = substr( $data, 0, $idx ); - $content = substr( $data, $idx + 4, -2 ); // Skip the leading \r\n and strip the final \r\n - - $name = '-unknown-'; - $filename = '-unknown-'; - $filetype = 'application/octet-stream'; - - $header = strtok( $headers, "\r\n" ); - while ( $header !== FALSE ) { - if ( substr($header, 0, strlen("Content-Disposition: ")) == "Content-Disposition: " ) { - // Content-Disposition: form-data; name="attach_file[TESTING]"; filename="label2.jpg" - if ( preg_match('/name=\"([^\"]*)\"/', $header, $nmatch ) ) { - $name = $nmatch[1]; - } - if ( preg_match('/filename=\"([^\"]*)\"/', $header, $nmatch ) ) { - $filename = $nmatch[1]; - } - } elseif ( substr($header, 0, strlen("Content-Type: ")) == "Content-Type: " ) { - // Content-Type: image/jpg - $filetype = trim( substr($header, strlen("Content-Type: ")) ); - } else { - Log::debug( "PARSEINPUTSTREAM: Skipping Header: " . $header ); - } - - $header = strtok("\r\n"); - } - - if ( substr($data, -2) === "\r\n" ) { - $data = substr($data, 0, -2); - } - - $path = sys_get_temp_dir() . '/php' . substr( sha1(rand()), 0, 6 ); - - $bytes = file_put_contents( $path, $content ); - - if ( $bytes !== FALSE ) { - $file = new UploadedFile( $path, $filename, $filetype, $bytes, UPLOAD_ERR_OK ); - $result = array( $name => $file ); - } - } - - return $result; - } - - /** - * @function parameter - * - * @param $string - * - * @return array - */ - private function parameter($string) - { - $string = trim($string); - $data = []; - if ( preg_match('/name=\"([^\"]*)\"[\n|\r]+([^\n\r].*)$/s', $string, $match) ) { - $val = ($match[2] !== NULL ? $match[2] : ''); - if(!empty($val) && is_bool($val)) - $val = boolval($val); - if(!empty($val) && is_string($val) && self::checkBool($val)) - $val = self::boolVal($val); - if(!empty($val) && is_int($val)) - $val = intval($val); - if(!empty($val) && is_double($val)) - $val = doubleval($val); - if(!empty($val) && is_numeric($val)) - $val = $val + 0; - if (preg_match('/^(.*)\[\]$/i', $match[1], $tmp)) { - $data[$tmp[1]][] = $val; - } else { - $data[$match[1]] = $val; - } - } - return $data; - } - - static function checkBool($string){ - $string = strtolower($string); - return (in_array($string, array("true", "false", "1", "0", "yes", "no"), true)); - } - - static function boolVal($string){ - $string = strtolower($string); - if(in_array($string, ["true", "1", "yes"])) return true; - return false; - } - - /** - * @function merge - * @param $array array - * - * Ugly ugly ugly - * - * @returns array - */ - private function merge($array) - { - $results = [ - 'parameters' => [], - 'files' => [] - ]; - - if (count($array['parameters']) > 0) { - foreach($array['parameters'] as $key => $value) { - foreach($value as $k => $v) { - if (is_array($v)) { - foreach($v as $kk => $vv) { - $results['parameters'][$k][] = $vv; - } - } else { - $results['parameters'][$k] = $v; - } - } - } - } - - if (count($array['files']) > 0) { - foreach($array['files'] as $key => $value) { - foreach($value as $k => $v) { - if (is_array($v)) { - foreach($v as $kk => $vv) { - if(is_array($vv) && (count($vv) === 1)) { - $results['files'][$k][$kk] = $vv[0]; - } else { - $results['files'][$k][$kk][] = $vv[0]; - } - } - } else { - $results['files'][$k][$key] = $v; - } - } - } - } - - return $results; - } - - function parse_parameter( &$params, $parameter, $value ) { - if ( strpos($parameter, '[') !== FALSE ) { - $matches = array(); - if ( preg_match( '/^([^[]*)\[([^]]*)\](.*)$/', $parameter, $match ) ) { - $name = $match[1]; - $key = $match[2]; - $rem = $match[3]; - - if ( $name !== '' && $name !== NULL ) { - if ( ! isset($params[$name]) || ! is_array($params[$name]) ) { - $params[$name] = array(); - } else { - } - if ( strlen($rem) > 0 ) { - if ( $key === '' || $key === NULL ) { - $arr = array(); - $this->parse_parameter( $arr, $rem, $value ); - $params[$name][] = $arr; - } else { - if ( !isset($params[$name][$key]) || !is_array($params[$name][$key]) ) { - $params[$name][$key] = array(); - } - $this->parse_parameter( $params[$name][$key], $rem, $value ); - } - } else { - if ( $key === '' || $key === NULL ) { - $params[$name][] = $value; - } else { - $params[$name][$key] = $value; - } - } - } else { - if ( strlen($rem) > 0 ) { - if ( $key === '' || $key === NULL ) { - // REVIEW Is this logic correct?! - $this->parse_parameter( $params, $rem, $value ); - } else { - if ( ! isset($params[$key]) || ! is_array($params[$key]) ) { - $params[$key] = array(); - } - $this->parse_parameter( $params[$key], $rem, $value ); - } - } else { - if ( $key === '' || $key === NULL ) { - $params[] = $value; - } else { - $params[$key] = $value; - } - } - } - } else { - Log::warning( "ParseMultiPartFormDataInputStream.parse_parameter() Parameter name regex failed: '" . $parameter . "'" ); - } - } else { - $params[$parameter] = $value; - } - } -} \ No newline at end of file diff --git a/app/Http/Utils/UtilsProvider.php b/app/Http/Utils/UtilsProvider.php deleted file mode 100644 index 79570cfb..00000000 --- a/app/Http/Utils/UtilsProvider.php +++ /dev/null @@ -1,33 +0,0 @@ - 'App\Http\Controllers', - 'prefix' => 'api/v1', - 'before' => [], - 'after' => [], - 'middleware' => ['ssl', 'oauth2.protected', 'rate.limit','etags'] -], function () { - - // members - Route::group(['prefix'=>'members'], function(){ - Route::get('', 'OAuth2MembersApiController@getAll'); - - Route::group(['prefix'=>'me'], function(){ - // get my member info - Route::get('', 'OAuth2MembersApiController@getMyMember'); - - // my affiliations - Route::group(['prefix' => 'affiliations'], function(){ - Route::get('', [ 'uses' => 'OAuth2MembersApiController@getMyMemberAffiliations']); - Route::post('', [ 'uses' => 'OAuth2MembersApiController@addMyAffiliation']); - Route::group(['prefix' => '{affiliation_id}'], function(){ - Route::put('', ['uses' => 'OAuth2MembersApiController@updateMyAffiliation']); - Route::delete('', [ 'uses' => 'OAuth2MembersApiController@deleteMyAffiliation']); - }); - }); - - Route::group(['prefix' => 'membership'], function(){ - Route::put('foundation', ['uses' => 'OAuth2MembersApiController@signFoundationMembership']); - Route::put('community', ['uses' => 'OAuth2MembersApiController@signCommunityMembership']); - Route::delete('resign', ['uses' => 'OAuth2MembersApiController@resignMembership']); - }); - }); - - Route::group(['prefix'=>'{member_id}'], function(){ - - Route::group(['prefix' => 'affiliations'], function(){ - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2MembersApiController@getMemberAffiliations']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2MembersApiController@addAffiliation']); - Route::group(['prefix' => '{affiliation_id}'], function(){ - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2MembersApiController@updateAffiliation']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2MembersApiController@deleteAffiliation']); - }); - }); - - Route::group(array('prefix' => 'rsvp'), function () { - Route::group(['prefix' => '{rsvp_id}'], function () { - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2MembersApiController@deleteRSVP']); - }); - }); - }); - }); - - // tags - Route::group(['prefix'=>'tags'], function(){ - Route::get('', 'OAuth2TagsApiController@getAll'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2TagsApiController@addTag']); - }); - - // companies - - Route::group(['prefix'=>'companies'], function(){ - Route::get('', 'OAuth2CompaniesApiController@getAllCompanies'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2CompaniesApiController@add']); - Route::group(['prefix'=>'{id}'], function(){ - Route::get('', [ 'uses' => 'OAuth2CompaniesApiController@get']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2CompaniesApiController@update']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2CompaniesApiController@delete']); - Route::group(['prefix'=>'logo'], function(){ - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2CompaniesApiController@addCompanyLogo']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2CompaniesApiController@deleteCompanyLogo']); - Route::group(['prefix'=>'big'], function(){ - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2CompaniesApiController@addCompanyBigLogo']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2CompaniesApiController@deleteCompanyBigLogo']); - }); - }); - }); - }); - - // sponsored projects - - Route::group(['prefix'=>'sponsored-projects'], function(){ - Route::get('', 'OAuth2SponsoredProjectApiController@getAll'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@add']); - - Route::group(['prefix'=>'{id}'], function(){ - - Route::get('', [ 'uses' => 'OAuth2SponsoredProjectApiController@get']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@update']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@delete']); - - Route::group(['prefix'=>'sponsorship-types'], function(){ - Route::get('', 'OAuth2SponsoredProjectApiController@getAllSponsorshipTypes'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@addSponsorshipType']); - Route::group(['prefix'=>'{sponsorship_type_id}'], function(){ - - Route::get('', [ 'uses' => 'OAuth2SponsoredProjectApiController@getSponsorshipType']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@updateSponsorshipType']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@deleteSponsorshipType']); - - Route::group(['prefix'=>'supporting-companies'], function(){ - Route::get('', [ 'uses' => 'OAuth2SponsoredProjectApiController@getSupportingCompanies']); - Route::post('', [ 'uses' => 'OAuth2SponsoredProjectApiController@addSupportingCompanies']); - Route::group(['prefix'=>'{company_id}'], function(){ - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@getSupportingCompany']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@updateSupportingCompanies']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SponsoredProjectApiController@deleteSupportingCompanies']); - }); - }); - }); - }); - }); - }); - - // organizations - Route::group(['prefix'=>'organizations'], function(){ - Route::get('', 'OAuth2OrganizationsApiController@getAll'); - Route::post('', 'OAuth2OrganizationsApiController@addOrganization'); - }); - - // groups - Route::group(['prefix'=>'groups'], function(){ - Route::get('', 'OAuth2GroupsApiController@getAll'); - }); - - // summit-media-file-types - Route::group(['prefix'=>'summit-media-file-types'], function(){ - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaFileTypeApiController@getAll']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaFileTypeApiController@add']); - Route::group(['prefix'=>'{id}'], function(){ - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaFileTypeApiController@get']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaFileTypeApiController@update']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaFileTypeApiController@delete']); - }); - }); - - // summits - Route::group(array('prefix' => 'summits'), function () { - - Route::get('', [ 'middleware' => 'cache:'.Config::get('cache_api_response.get_summits_response_lifetime', 600), 'uses' => 'OAuth2SummitApiController@getSummits']); - - Route::group(['prefix' => 'all'], function () { - - Route::get('', 'OAuth2SummitApiController@getAllSummits'); - Route::get('{id}', 'OAuth2SummitApiController@getAllSummitByIdOrSlug'); - - Route::group(['prefix' => 'locations'], function () { - // GET /api/v1/summits/all/locations/bookable-rooms/all/reservations/{id} - Route::get('bookable-rooms/all/reservations/{id}', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@getReservationById']); - }); - - Route::group(['prefix' => 'registration-invitations'], function () { - Route::group(['prefix' => '{token}'], function () { - Route::get('', ['uses' => 'OAuth2SummitRegistrationInvitationApiController@getInvitationByToken']); - }); - }); - - Route::group(['prefix' => 'orders'], function () { - Route::get('me', 'OAuth2SummitOrdersApiController@getAllMyOrders'); - - Route::group(['prefix' => 'all'], function () { - Route::group(['prefix' => 'tickets'], function () { - Route::group(['prefix' => '{ticket_id}'], function () { - Route::put('', 'OAuth2SummitOrdersApiController@updateTicketById'); - Route::get('pdf', 'OAuth2SummitOrdersApiController@getTicketPDFById'); - }); - - Route::group(['prefix' => 'me'], function () { - Route::get('', 'OAuth2SummitTicketApiController@getAllMyTickets'); - }); - }); - }); - - Route::group(['prefix' => '{order_id}'], function () { - Route::group(['prefix' => 'refund'], function () { - Route::delete('', 'OAuth2SummitOrdersApiController@requestRefundMyOrder'); - Route::delete('cancel', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrdersApiController@cancelRefundRequestOrder']); - }); - - Route::put('resend', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrdersApiController@reSendOrderEmail']); - Route::put('', 'OAuth2SummitOrdersApiController@updateMyOrder'); - Route::group(['prefix' => 'tickets'], function () { - Route::group(['prefix' => '{ticket_id}'], function () { - Route::get('pdf', 'OAuth2SummitOrdersApiController@getTicketPDFByOrderId'); - Route::group(['prefix' => 'refund'], function () { - Route::delete('', 'OAuth2SummitOrdersApiController@requestRefundMyTicket'); - Route::delete('cancel', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrdersApiController@cancelRefundRequestTicket']); - }); - - Route::group(['prefix' => 'attendee'], function () { - Route::put('', 'OAuth2SummitOrdersApiController@assignAttendee'); - Route::put('reinvite', 'OAuth2SummitOrdersApiController@reInviteAttendee'); - Route::delete('', 'OAuth2SummitOrdersApiController@removeAttendee'); - }); - }); - }); - }); - - }); - }); - - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@addSummit']); - - Route::group(['prefix' => '{id}'], function () { - - Route::group(['prefix' => 'metrics'], function () { - Route::put('enter', 'OAuth2SummitMetricsApiController@enter'); - Route::post('leave', 'OAuth2SummitMetricsApiController@leave'); - }); - - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@updateSummit']); - Route::post('logo', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@addSummitLogo']); - Route::delete('logo', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@deleteSummitLogo']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@deleteSummit']); - Route::get('', [ 'middleware' => 'cache:'.Config::get('cache_api_response.get_summit_response_lifetime', 1200), 'uses' => 'OAuth2SummitApiController@getSummit'])->where('id', 'current|[0-9]+'); - - // selection plans crud - Route::group(['prefix' => 'selection-plans'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@addSelectionPlan']); - Route::group(['prefix' => '{selection_plan_id}'], function () { - - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@updateSelectionPlan']); - Route::get('', ['uses' => 'OAuth2SummitSelectionPlansApiController@getSelectionPlan']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@deleteSelectionPlan']); - - Route::group(['prefix' => 'track-groups'], function () { - Route::put('{track_group_id}', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@addTrackGroupToSelectionPlan']); - Route::delete('{track_group_id}', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@deleteTrackGroupToSelectionPlan']); - }); - - // extra questions - - Route::group(['prefix' => 'extra-questions'], function(){ - Route::get('', ['uses' => 'OAuth2SummitSelectionPlansApiController@getExtraQuestions']); - Route::get('metadata', [ 'uses' => 'OAuth2SummitSelectionPlansApiController@getExtraQuestionsMetadata']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@addExtraQuestion']); - Route::group(['prefix' => '{question_id}'], function(){ - Route::get('', ['uses' => 'OAuth2SummitSelectionPlansApiController@getExtraQuestion']); - Route::put('', ['uses' => 'OAuth2SummitSelectionPlansApiController@updateExtraQuestion']); - Route::delete('', ['uses' => 'OAuth2SummitSelectionPlansApiController@deleteExtraQuestion']); - Route::group(['prefix' => 'values'], function () { - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@addExtraQuestionValue']); - Route::group(['prefix' => '{value_id}'], function () { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@updateExtraQuestionValue']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@deleteExtraQuestionValue']); - }); - }); - }); - }); - - // presentations - - Route::group(['prefix' => 'presentations'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@getSelectionPlanPresentations']); - Route::get('csv', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@getSelectionPlanPresentationsCSV']); - - Route::group(['prefix' => 'all'], function () { - // category-change-requests - Route::group(['prefix' => 'category-change-requests'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@getAllPresentationCategoryChangeRequest']); - }); - }); - - Route::group(['prefix' => '{presentation_id}'], function () { - - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@getSelectionPlanPresentation']); - Route::put('view', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@markPresentationAsViewed']); - Route::group(['prefix' => 'comments'], function () { - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@addCommentToPresentation']); - }); - - // category-change-requests - Route::group(['prefix' => 'category-change-requests'], function () { - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@createPresentationCategoryChangeRequest']); - Route::group(['prefix' => '{category_change_request_id}'], function () { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSelectionPlansApiController@resolvePresentationCategoryChangeRequest']); - }); - }); - // presentation actions - - Route::group(['prefix' => 'actions'], function () { - Route::group(['prefix' => '{action_id}'], function () { - Route::put('complete', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionApiController@complete']); - Route::delete('incomplete', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionApiController@uncomplete']); - }); - }); - - }); - }); - }); - }); - - // RSVP templates - Route::group(['prefix' => 'rsvp-templates'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@getAllBySummit']); - - Route::group(['prefix' => 'questions'], function () { - Route::get('metadata', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@getRSVPTemplateQuestionsMetadata']); - }); - - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@addRSVPTemplate']); - Route::group(['prefix' => '{template_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@getRSVPTemplate']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@updateRSVPTemplate']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@deleteRSVPTemplate']); - Route::group(['prefix' => 'questions'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@addRSVPTemplateQuestion']); - Route::group(['prefix' => '{question_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@updateRSVPTemplateQuestion']); - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@getRSVPTemplateQuestion']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@deleteRSVPTemplateQuestion']); - // multi values questions - Route::group(['prefix' => 'values'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@addRSVPTemplateQuestionValue']); - Route::group(['prefix' => '{value_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@getRSVPTemplateQuestionValue']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@updateRSVPTemplateQuestionValue']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@deleteRSVPTemplateQuestionValue']); - }); - }); - }); - }); - }); - }); - - Route::get('entity-events', 'OAuth2SummitApiController@getSummitEntityEvents'); - - // notifications - Route::group(['prefix' => 'notifications'], function () { - Route::get('sent', 'OAuth2SummitNotificationsApiController@getAllApprovedByUser'); - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitNotificationsApiController@getAll']); - Route::get('csv', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitNotificationsApiController@getAllCSV']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitNotificationsApiController@addPushNotification']); - Route::group(['prefix' => '{notification_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitNotificationsApiController@getById']); - Route::put('approve', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitNotificationsApiController@approveNotification']); - Route::delete('approve', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitNotificationsApiController@unApproveNotification']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitNotificationsApiController@deleteNotification']); - }); - }); - - // speakers - Route::group(['prefix' => 'speakers'], function () { - - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersApiController@addSpeakerBySummit']); - Route::get('', 'OAuth2SummitSpeakersApiController@getSpeakers'); - Route::get('on-schedule', 'OAuth2SummitSpeakersApiController@getSpeakersOnSchedule'); - Route::get('me', 'OAuth2SummitSpeakersApiController@getMySummitSpeaker'); - - Route::group(['prefix' => '{speaker_id}'], function () { - Route::get('', 'OAuth2SummitSpeakersApiController@getSummitSpeaker')->where('speaker_id', '[0-9]+'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersApiController@updateSpeakerBySummit'])->where('speaker_id', 'me|[0-9]+'); - }); - }); - - // speakers assistance - Route::group(['prefix' => 'speakers-assistances'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersAssistanceApiController@getBySummit']); - Route::get('csv', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersAssistanceApiController@getBySummitCSV']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersAssistanceApiController@addSpeakerSummitAssistance']); - Route::group(['prefix' => '{assistance_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersAssistanceApiController@getSpeakerSummitAssistanceBySummit']); - Route::delete('',[ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersAssistanceApiController@deleteSpeakerSummitAssistance']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersAssistanceApiController@updateSpeakerSummitAssistance']); - Route::post('mail', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersAssistanceApiController@sendSpeakerSummitAssistanceAnnouncementMail']); - }); - }); - - // events - Route::group(array('prefix' => 'events'), function () { - - Route::get('',[ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@getEvents']); - - - Route::group(['prefix' => 'csv'], function () { - Route::get('',[ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@getEventsCSV']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitEventsApiController@importEventData']); - }); - // bulk actions - Route::delete('/publish', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@unPublishEvents']); - Route::put('/publish', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@updateAndPublishEvents']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@updateEvents']); - - Route::group(array('prefix' => 'unpublished'), function () { - Route::get('', 'OAuth2SummitEventsApiController@getUnpublishedEvents'); - //Route::get('{event_id}', 'OAuth2SummitEventsApiController@getUnpublisedEvent'); - }); - - Route::group(array('prefix' => 'published'), function () { - Route::get('', 'OAuth2SummitEventsApiController@getScheduledEvents'); - Route::get('/empty-spots', 'OAuth2SummitEventsApiController@getScheduleEmptySpots'); - }); - - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@addEvent']); - Route::group(['prefix' => '{event_id}'], function () { - - Route::post('/clone', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@cloneEvent']); - Route::get('', 'OAuth2SummitEventsApiController@getEvent'); - - Route::group(['prefix' => 'published'], function () { - Route::get('', ['middleware' => 'cache:' . Config::get('cache_api_response.get_published_event_response_lifetime', 300), 'uses' => 'OAuth2SummitEventsApiController@getScheduledEvent']); - Route::post('mail', 'OAuth2SummitEventsApiController@shareScheduledEventByEmail'); - }); - - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@updateEvent' ]); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@deleteEvent' ]); - Route::put('/publish', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@publishEvent']); - Route::delete('/publish', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@unPublishEvent']); - - Route::post('/attachment', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@addEventAttachment']); - - Route::group(['prefix' => 'feedback'], function () { - Route::get('', ['middleware' => 'cache:'.Config::get('cache_api_response.get_event_feedback_response_lifetime', 300), 'uses' => 'OAuth2SummitEventsApiController@getEventFeedback']); - }); - - Route::group(['prefix' => 'image'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@addEventImage']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitEventsApiController@deleteEventImage']); - }); - }); - }); - - // presentations - Route::group(['prefix' => 'presentations'], function () { - // opened without role CFP - valid selection plan on CFP status - Route::post('', 'OAuth2PresentationApiController@submitPresentation'); - // import from mux - Route::post('all/import/mux', 'OAuth2PresentationApiController@importAssetsFromMUX'); - - Route::group(['prefix' => '{presentation_id}'], function () { - - // opened without role CFP - valid selection plan on CFP status - Route::put('', 'OAuth2PresentationApiController@updatePresentationSubmission'); - - Route::put('completed', 'OAuth2PresentationApiController@completePresentationSubmission'); - - Route::delete('', 'OAuth2PresentationApiController@deletePresentation'); - - // videos - Route::group(['prefix' => 'videos'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationVideos'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationApiController@addVideo' ]); - Route::group(['prefix' => '{video_id}'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationVideo'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationApiController@updateVideo' ]); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationApiController@deleteVideo' ]); - }); - }); - - // slides - Route::group(['prefix' => 'slides'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationSlides'); - Route::post('', 'OAuth2PresentationApiController@addPresentationSlide' ); - Route::group(['prefix' => '{slide_id}'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationSlide'); - Route::put('', 'OAuth2PresentationApiController@updatePresentationSlide' ); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationApiController@deletePresentationSlide' ]); - }); - }); - - // links - Route::group(['prefix' => 'links'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationLinks'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationApiController@addPresentationLink' ]); - Route::group(['prefix' => '{link_id}'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationLink'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationApiController@updatePresentationLink' ]); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationApiController@deletePresentationLink' ]); - }); - }); - - // media uploads - - Route::group(['prefix' => 'media-uploads'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationMediaUploads'); - Route::post('', 'OAuth2PresentationApiController@addPresentationMediaUpload' ); - Route::group(['prefix' => '{media_upload_id}'], function () { - Route::get('', 'OAuth2PresentationApiController@getPresentationMediaUpload'); - Route::put('','OAuth2PresentationApiController@updatePresentationMediaUpload' ); - Route::delete('', 'OAuth2PresentationApiController@deletePresentationMediaUpload' ); - }); - }); - }); - }); - - // locations - Route::group(['prefix' => 'locations'], function () { - - Route::get('', 'OAuth2SummitLocationsApiController@getLocations'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addLocation']); - - Route::get('metadata', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@getMetadata']); - - // bookable-rooms - Route::group(['prefix' => 'bookable-rooms'], function () { - // GET /api/v1/summits/{id}/locations/bookable-rooms - Route::get('', 'OAuth2SummitLocationsApiController@getBookableVenueRooms'); - - Route::group(['prefix' => 'all'], function () { - Route::group(['prefix' => 'reservations'], function () { - // GET /api/v1/summits/{id}/locations/bookable-rooms/all/reservations - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@getAllReservationsBySummit']); - // GET /api/v1/summits/{id}/locations/bookable-rooms/all/reservations/csv - Route::get('csv', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@getAllReservationsBySummitCSV']); - // GET /api/v1/summits/{id}/locations/bookable-rooms/all/reservations/me - Route::get('me', 'OAuth2SummitLocationsApiController@getMyBookableVenueRoomReservations'); - Route::group(['prefix' => '{reservation_id}'], function () { - // DELETE /api/v1/summits/{id}/locations/bookable-rooms/all/reservations/{reservation_id} - Route::delete('', 'OAuth2SummitLocationsApiController@cancelMyBookableVenueRoomReservation'); - }); - }); - }); - - Route::group(['prefix' => '{room_id}'], function () { - // GET /api/v1/summits/{id}/locations/bookable-rooms/{room_id} - Route::get('', 'OAuth2SummitLocationsApiController@getBookableVenueRoom'); - // GET /api/v1/summits/{id}/locations/bookable-rooms/{room_id}/availability/{day} - Route::get('availability/{day}', 'OAuth2SummitLocationsApiController@getBookableVenueRoomAvailability'); - - Route::group(['prefix' => 'reservations'], function () { - // POST /api/v1/summits/{id}/locations/bookable-rooms/{room_id}/reservations - Route::post('', 'OAuth2SummitLocationsApiController@createBookableVenueRoomReservation'); - - Route::group(['prefix' => '{reservation_id}'], function () { - // GET /api/v1/summits/{id}/bookable-rooms/{room_id}/reservations/{reservation_id} - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@getBookableVenueRoomReservation']); - // DELETE /api/v1/summits/{id}/bookable-rooms/{room_id}/reservations/{reservation_id}/refund - Route::delete('refund', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@refundBookableVenueRoomReservation']); - }); - }); - - }); - }); - - // venues - - Route::group(['prefix' => 'venues'], function () { - - Route::get('', 'OAuth2SummitLocationsApiController@getVenues'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenue']); - - Route::group(['prefix' => '{venue_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateVenue']); - - Route::group(['prefix' => 'rooms'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueRoom']); - Route::group(['prefix' => '{room_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getVenueRoom'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateVenueRoom']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteVenueRoom']); - Route::group(['prefix' => 'image'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueRoomImage']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@removeVenueRoomImage']); - }); - }); - }); - - // bookable-rooms - Route::group(['prefix' => 'bookable-rooms'], function () { - // POST /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueBookableRoom']); - Route::group(['prefix' => '{room_id}'], function () { - // GET /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id} - Route::get('', 'OAuth2SummitLocationsApiController@getBookableVenueRoomByVenue'); - // PUT /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id} - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateVenueBookableRoom']); - // DELETE /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id} - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteVenueBookableRoom']); - // attributes - - Route::group(['prefix' => 'attributes'], function () { - Route::group(['prefix' => '{attribute_id}'], function () { - // PUT /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}/attributes/{attribute_id} - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueBookableRoomAttribute']); - // DELETE /api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}/attributes/{attribute_id} - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteVenueBookableRoomAttribute']); - }); - - }); - }); - }); - - Route::group(['prefix' => 'floors'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueFloor']); - Route::group(['prefix' => '{floor_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getVenueFloor'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateVenueFloor']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteVenueFloor']); - Route::group(['prefix' => 'image'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueFloorImage']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@removeVenueFloorImage']); - }); - Route::group(['prefix' => 'rooms'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueFloorRoom']); - Route::group(['prefix' => '{room_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getVenueFloorRoom'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateVenueFloorRoom']); - }); - }); - Route::group(['prefix' => 'bookable-rooms'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addVenueFloorBookableRoom']); - Route::group(['prefix' => '{room_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getVenueFloorBookableRoom'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateVenueFloorBookableRoom']); - }); - }); - }); - }); - }); - }); - - Route::group(['prefix' => 'airports'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getAirports'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addAirport']); - Route::group(['prefix' => '{airport_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateAirport']); - }); - }); - - Route::group(['prefix' => 'hotels'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getHotels'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addExternalLocation']); - Route::group(['prefix' => '{hotel_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateExternalLocation']); - }); - }); - - Route::group(['prefix' => 'external-locations'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getExternalLocations'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addHotel']); - Route::group(['prefix' => '{external_location_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateHotel']); - }); - }); - - Route::group(['prefix' => '{location_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getLocation'); - - // locations maps - Route::group(['prefix' => 'maps'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addLocationMap']); - Route::group(['prefix' => '{map_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getLocationMap'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateLocationMap']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteLocationMap']); - }); - }); - - // locations images - Route::group(['prefix' => 'images'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addLocationImage']); - Route::group(['prefix' => '{image_id}'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getLocationImage'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateLocationImage']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteLocationImage']); - }); - }); - - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateLocation']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteLocation']); - Route::get('/events/published','OAuth2SummitLocationsApiController@getLocationPublishedEvents')->where('location_id', 'tbd|[0-9]+'); - Route::get('/events','OAuth2SummitLocationsApiController@getLocationEvents')->where('location_id', 'tbd|[0-9]+'); - // location banners - Route::group(['prefix' => 'banners'], function () { - Route::get('', 'OAuth2SummitLocationsApiController@getLocationBanners'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@addLocationBanner']); - Route::group(['prefix' => '{banner_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@updateLocationBanner']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitLocationsApiController@deleteLocationBanner']); - }); - }); - }); - }); - - // bookable rooms attributes - Route::group(['prefix' => 'bookable-room-attribute-types'], function () { - Route::get('', 'OAuth2SummitBookableRoomsAttributeTypeApiController@getAllBookableRoomAttributeTypes'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBookableRoomsAttributeTypeApiController@addBookableRoomAttributeType']); - Route::group(['prefix' => '{type_id}'], function () { - Route::get('', 'OAuth2SummitBookableRoomsAttributeTypeApiController@getBookableRoomAttributeType'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBookableRoomsAttributeTypeApiController@updateBookableRoomAttributeType']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBookableRoomsAttributeTypeApiController@deleteBookableRoomAttributeType']); - Route::group(['prefix' => 'values'], function () { - Route::get('', 'OAuth2SummitBookableRoomsAttributeTypeApiController@getAllBookableRoomAttributeValues'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBookableRoomsAttributeTypeApiController@addBookableRoomAttributeValue']); - Route::group(['prefix' => '{value_id}'], function () { - Route::get('', 'OAuth2SummitBookableRoomsAttributeTypeApiController@getBookableRoomAttributeValue'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBookableRoomsAttributeTypeApiController@updateBookableRoomAttributeValue']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBookableRoomsAttributeTypeApiController@deleteBookableRoomAttributeValue']); - }); - }); - }); - }); - - // event types - Route::group(['prefix' => 'event-types'], function () { - Route::get('', 'OAuth2SummitsEventTypesApiController@getAllBySummit'); - Route::get('csv', 'OAuth2SummitsEventTypesApiController@getAllBySummitCSV'); - Route::post('seed-defaults', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsEventTypesApiController@seedDefaultEventTypesBySummit']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsEventTypesApiController@addEventTypeBySummit']); - Route::group(['prefix' => '{event_type_id}'], function () { - Route::get('', 'OAuth2SummitsEventTypesApiController@getEventTypeBySummit'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsEventTypesApiController@updateEventTypeBySummit']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsEventTypesApiController@deleteEventTypeBySummit']); - - Route::group(['prefix' => 'summit-documents'], function () { - Route::group(['prefix' => '{document_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsEventTypesApiController@addSummitDocument']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsEventTypesApiController@removeSummitDocument']); - }); - }); - }); - }); - - // documents - Route::group(['prefix' => 'summit-documents'], function () { - Route::get('', 'OAuth2SummitDocumentsApiController@getAllBySummit'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitDocumentsApiController@add']); - Route::group(['prefix' => '{document_id}'], function () { - Route::get('', 'OAuth2SummitDocumentsApiController@get'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitDocumentsApiController@update']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitDocumentsApiController@delete']); - Route::group(['prefix' => 'event-types'], function () { - Route::group(['prefix' => '{event_type_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitDocumentsApiController@addEventType']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitDocumentsApiController@removeEventType']); - }); - }); - }); - }); - - // ticket types - Route::group(['prefix' => 'ticket-types'], function () { - Route::get('', 'OAuth2SummitsTicketTypesApiController@getAllBySummit'); - Route::get('csv', 'OAuth2SummitsTicketTypesApiController@getAllBySummitCSV'); - Route::post('seed-defaults', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsTicketTypesApiController@seedDefaultTicketTypesBySummit']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsTicketTypesApiController@addTicketTypeBySummit']); - Route::group(['prefix' => '{ticket_type_id}'], function () { - Route::get('', 'OAuth2SummitsTicketTypesApiController@getTicketTypeBySummit'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsTicketTypesApiController@updateTicketTypeBySummit']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitsTicketTypesApiController@deleteTicketTypeBySummit']); - }); - }); - - // begin registration endpoints - - // tax-types - Route::group(['prefix' => 'tax-types'], function () { - Route::get('', [ 'uses' => 'OAuth2SummitTaxTypeApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitTaxTypeApiController@add']); - Route::group(['prefix' => '{tax_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitTaxTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitTaxTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitTaxTypeApiController@delete']); - - Route::group(['prefix' => 'ticket-types'], function () { - Route::group(['prefix' => '{ticket_type_id}'], function () { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitTaxTypeApiController@addTaxToTicketType']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitTaxTypeApiController@removeTaxFromTicketType']); - }); - }); - }); - }); - - // payment-gateway-profiles - Route::group(['prefix' => 'payment-gateway-profiles'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2PaymentGatewayProfileApiController@getAllBySummit']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PaymentGatewayProfileApiController@add']); - Route::group(['prefix' => '{payment_profile_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PaymentGatewayProfileApiController@get']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PaymentGatewayProfileApiController@update']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PaymentGatewayProfileApiController@delete']); - }); - }); - - // refund-policies - Route::group(['prefix' => 'refund-policies'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitRefundPolicyTypeApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitRefundPolicyTypeApiController@add']); - Route::group(['prefix' => '{policy_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitRefundPolicyTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitRefundPolicyTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitRefundPolicyTypeApiController@delete']); - }); - }); - - // sponsors - Route::group(['prefix' => 'sponsors'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSponsorApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSponsorApiController@add']); - Route::group(['prefix' => '{sponsor_id}'], function () { - Route::group(['prefix' => 'user-info-grants'], function () { - Route::post('me', ['uses' => 'OAuth2SummitBadgeScanApiController@addGrant']); - }); - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSponsorApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSponsorApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSponsorApiController@delete']); - Route::group(['prefix' => 'users'], function () { - Route::group(['prefix' => '{member_id}'], function () { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSponsorApiController@addSponsorUser']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitSponsorApiController@removeSponsorUser']); - }); - }); - }); - }); - - // order-extra-questions - Route::group(['prefix' => 'order-extra-questions'], function () { - Route::get('metadata', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@getMetadata']); - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@add']); - Route::group(['prefix' => '{question_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@delete']); - Route::group(['prefix' => 'values'], function () { - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@addQuestionValue']); - Route::group(['prefix' => '{value_id}'], function () { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@updateQuestionValue']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitOrderExtraQuestionTypeApiController@deleteQuestionValue']); - }); - }); - }); - }); - - // access-levels - Route::group(['prefix' => 'access-level-types'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAccessLevelTypeApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAccessLevelTypeApiController@add']); - Route::group(['prefix' => '{level_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAccessLevelTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAccessLevelTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAccessLevelTypeApiController@delete']); - }); - }); - - // badge-feature-types - Route::group(['prefix' => 'badge-feature-types'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeFeatureTypeApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeFeatureTypeApiController@add']); - Route::group(['prefix' => '{feature_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeFeatureTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeFeatureTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeFeatureTypeApiController@delete']); - Route::group(['prefix' => 'image'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeFeatureTypeApiController@addFeatureImage']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeFeatureTypeApiController@deleteFeatureImage']); - }); - }); - }); - - // badge-scans - Route::group(['prefix' => 'badge-scans'], function () { - Route::get('me','OAuth2SummitBadgeScanApiController@getAllMyBadgeScans' ); - Route::get('', 'OAuth2SummitBadgeScanApiController@getAllBySummit'); - Route::get('csv','OAuth2SummitBadgeScanApiController@getAllBySummitCSV'); - Route::post('', "OAuth2SummitBadgeScanApiController@add"); - }); - - // badge-types - Route::group(['prefix' => 'badge-types'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@add']); - Route::group(['prefix' => '{badge_type_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@delete']); - Route::group(['prefix' => 'access-levels'], function () { - Route::group(['prefix' => '{access_level_id}'], function () { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@addAccessLevelToBadgeType']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@removeAccessLevelFromBadgeType']); - }); - }); - Route::group(['prefix' => 'features'], function () { - Route::group(['prefix' => '{feature_id}'], function () { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@addFeatureToBadgeType']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgeTypeApiController@removeFeatureFromBadgeType']); - }); - }); - - }); - }); - - // orders - Route::group(['prefix' => 'orders'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@getAllBySummit']); - Route::get('csv', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@getAllBySummitCSV']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@add']); - Route::group(['prefix' => '{order_id}', 'where' => [ - 'order_id' => '[0-9]+' - ]], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@get']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@update']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@delete']); - Route::delete('refund', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@refundOrder']); - - Route::group(['prefix' => 'tickets'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@addTicket']); - Route::group(['prefix' => '{ticket_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@updateTicket']); - Route::group(['prefix' => 'activate'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@activateTicket']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@deActivateTicket']); - }); - Route::get('pdf', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitOrdersApiController@getTicketPDFBySummit']); - }); - }); - }); - Route::post('reserve', 'OAuth2SummitOrdersApiController@reserve'); - Route::group(['prefix' => '{hash}', 'where' => [ - 'hash' => '[a-zA-Z0-9]+' - ]], function () { - Route::put('checkout', 'OAuth2SummitOrdersApiController@checkout'); - Route::group(['prefix' => 'tickets'], function () { - Route::get('mine', 'OAuth2SummitOrdersApiController@getMyTicketByOrderHash'); - }); - Route::delete('', 'OAuth2SummitOrdersApiController@cancel'); - }); - }); - - // tickets - Route::group(['prefix' => 'tickets'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@getAllBySummit']); - Route::group(['prefix' => 'csv'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@getAllBySummitCSV']); - Route::get('template', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@getImportTicketDataTemplate']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@importTicketData']); - }); - - Route::post('ingest', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@ingestExternalTicketData']); - - Route::group(['prefix' => '{ticket_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@get']); - // badge endpoints - Route::group(['prefix' => 'badge'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@createAttendeeBadge']); - Route::get('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@getAttendeeBadge']); - Route::group(['prefix' => 'current'], function () { - Route::delete('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@deleteAttendeeBadge']); - Route::put('print', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@printAttendeeBadge']); - Route::group(['prefix' => 'features'], function () { - Route::group(['prefix' => '{feature_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@addAttendeeBadgeFeature']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@removeAttendeeBadgeFeature']); - }); - }); - Route::group(['prefix' => 'type'], function () { - Route::group(['prefix' => '{type_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@updateAttendeeBadgeType']); - }); - }); - }); - }); - // badge endpoints - Route::delete('refund', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitTicketApiController@refundTicket']); - }); - }); - - // attendees - Route::group(array('prefix' => 'attendees'), function () { - - Route::group(['prefix' => 'all'], function (){ - Route::put('send', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@send']); - }); - - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@getAttendeesBySummit']); - Route::get('csv', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@getAttendeesBySummitCSV']); - Route::get('me', 'OAuth2SummitAttendeesApiController@getOwnAttendee'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@addAttendee']); - - Route::group(array('prefix' => '{attendee_id}'), function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@getAttendee']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@updateAttendee']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@deleteAttendee']); - // attendee schedule - Route::group(array('prefix' => 'schedule'), function () - { - Route::get('', 'OAuth2SummitAttendeesApiController@getAttendeeSchedule')->where('attendee_id', 'me'); - - Route::group(array('prefix' => '{event_id}'), function (){ - Route::post('', 'OAuth2SummitAttendeesApiController@addEventToAttendeeSchedule')->where('attendee_id', 'me|[0-9]+'); - Route::delete('', 'OAuth2SummitAttendeesApiController@removeEventFromAttendeeSchedule')->where('attendee_id', 'me|[0-9]+'); - Route::delete('/rsvp', 'OAuth2SummitAttendeesApiController@deleteEventRSVP')->where('attendee_id', 'me|[0-9]+'); - Route::put('/check-in', 'OAuth2SummitAttendeesApiController@checkingAttendeeOnEvent')->where('attendee_id', 'me|[0-9]+'); - }); - }); - - // attendee tickets - Route::group(array('prefix' => 'tickets'), function () - { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@addAttendeeTicket']); - Route::group(array('prefix' => '{ticket_id}'), function (){ - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@deleteAttendeeTicket']); - Route::group(array('prefix' => 'reassign'), function (){ - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@reassignAttendeeTicket']); - Route::put('{other_member_id}', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAttendeesApiController@reassignAttendeeTicketByMember']); - }); - }); - }); - }); - }); - - // invitations - Route::group(array('prefix' => 'registration-invitations'), function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@getAllBySummit']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@add']); - Route::group(['prefix' => 'csv'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@ingestInvitations']); - Route::get('', [ 'middleware' => 'auth.user', 'uses' =>'OAuth2SummitRegistrationInvitationApiController@getAllBySummitCSV']); - }); - - Route::group(['prefix' => 'all'], function () { - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@deleteAll']); - Route::put('send', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@send']); - }); - - Route::group(['prefix' => '{invitation_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@update'])->where('invitation_id', '[0-9]+');; - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@get'])->where('invitation_id', '[0-9]+');; - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitRegistrationInvitationApiController@delete'])->where('invitation_id', '[0-9]+');; - }); - - - }); - - // badges - Route::group(['prefix' => 'badges'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgesApiController@getAllBySummit']); - Route::get('csv', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitBadgesApiController@getAllBySummitCSV']); - }); - - // external orders @todo to deprecate - Route::group(['prefix' => 'external-orders'], function () { - Route::get('{external_order_id}', 'OAuth2SummitApiController@getExternalOrder'); - Route::post('{external_order_id}/external-attendees/{external_attendee_id}/confirm', 'OAuth2SummitApiController@confirmExternalOrderAttendee'); - }); - - // members - Route::group(array('prefix' => 'members'), function () { - Route::get("", [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitMembersApiController@getAllBySummit']); - Route::get("csv", [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitMembersApiController@getAllBySummitCSV']); - Route::group(array('prefix' => '{member_id}'), function () { - - Route::get('', 'OAuth2SummitMembersApiController@getMyMember')->where('member_id', 'me'); - - - // favorites - Route::group(['prefix' => 'favorites'], function () - { - Route::get('', 'OAuth2SummitMembersApiController@getMemberFavoritesSummitEvents')->where('member_id', 'me'); - - Route::group(array('prefix' => '{event_id}'), function (){ - Route::post('', 'OAuth2SummitMembersApiController@addEventToMemberFavorites')->where('member_id', 'me'); - Route::delete('', 'OAuth2SummitMembersApiController@removeEventFromMemberFavorites')->where('member_id', 'me'); - }); - }); - - // schedule - Route::group(array('prefix' => 'schedule'), function () - { - Route::get('', 'OAuth2SummitMembersApiController@getMemberScheduleSummitEvents')->where('member_id', 'me'); - - Route::group(['prefix' => 'shareable-link'], function(){ - Route::post('', 'OAuth2SummitMembersApiController@createScheduleShareableLink')->where('member_id', 'me'); - Route::delete('', 'OAuth2SummitMembersApiController@revokeScheduleShareableLink')->where('member_id', 'me'); - }); - - Route::group(array('prefix' => '{event_id}'), function (){ - - Route::group(['prefix' => 'rsvp'], function (){ - Route::post('', 'OAuth2SummitMembersApiController@addEventRSVP')->where('member_id', 'me'); - Route::put('', 'OAuth2SummitMembersApiController@updateEventRSVP')->where('member_id', 'me'); - Route::delete('', 'OAuth2SummitMembersApiController@deleteEventRSVP')->where('member_id', 'me'); - }); - - Route::group(['prefix' => 'feedback'], function (){ - Route::get('','OAuth2SummitMembersApiController@getMyEventFeedback')->where('member_id', 'me'); - Route::post('', 'OAuth2SummitMembersApiController@addMyEventFeedback')->where('member_id', 'me'); - Route::put('', 'OAuth2SummitMembersApiController@updateMyEventFeedback')->where('member_id', 'me'); - Route::delete('', 'OAuth2SummitMembersApiController@deleteMyEventFeedback')->where('member_id', 'me'); - }); - - Route::post('', 'OAuth2SummitMembersApiController@addEventToMemberSchedule')->where('member_id', 'me'); - Route::delete('', 'OAuth2SummitMembersApiController@removeEventFromMemberSchedule')->where('member_id', 'me'); - - - Route::put('enter', 'OAuth2SummitMetricsApiController@enterToEvent')->where('member_id', 'me'); - Route::post('leave', 'OAuth2SummitMetricsApiController@leaveFromEvent')->where('member_id', 'me'); - }); - }); - }); - - }); - - // tracks - Route::group(['prefix' => 'tracks'], function () { - Route::get('', 'OAuth2SummitTracksApiController@getAllBySummit'); - Route::get('csv', 'OAuth2SummitTracksApiController@getAllBySummitCSV'); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTracksApiController@addTrackBySummit']); - Route::post('copy/{to_summit_id}', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTracksApiController@copyTracksToSummit']); - Route::group(['prefix' => '{track_id}'], function () { - Route::get('', 'OAuth2SummitTracksApiController@getTrackBySummit'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTracksApiController@updateTrackBySummit']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTracksApiController@deleteTrackBySummit']); - - Route::group(['prefix' => 'allowed-tags'], function () { - Route::get('', 'OAuth2SummitTracksApiController@getTrackAllowedTagsBySummit'); - }); - - Route::group(['prefix' => 'icon'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTracksApiController@addTrackIcon']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTracksApiController@deleteTrackIcon']); - }); - - Route::group(['prefix' => 'extra-questions'], function () { - Route::get('', 'OAuth2SummitTracksApiController@getTrackExtraQuestionsBySummit'); - Route::group(['prefix' => '{question_id}'], function () { - - Route::put('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTracksApiController@addTrackExtraQuestion'] - ); - - Route::delete('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTracksApiController@removeTrackExtraQuestion' - ]); - }); - }); - - // selection lists ( track chairs ) - - Route::group(['prefix' => 'selection-lists'], function () { - - Route::group(['prefix' => 'team'], function () { - Route::get('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitSelectedPresentationListApiController@getTeamSelectionList' - ]); - - Route::post('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitSelectedPresentationListApiController@createTeamSelectionList' - ]); - }); - - Route::group(['prefix' => 'individual'], function () { - Route::group(['prefix' => 'owner'], function () { - - Route::group(['prefix' => 'me'], function () { - Route::post('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitSelectedPresentationListApiController@createIndividualSelectionList' - ]); - }); - - Route::group(['prefix' => '{owner_id}'], function () { - Route::get('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitSelectedPresentationListApiController@getIndividualSelectionList' - ]); - }); - - }); - }); - - Route::group(['prefix' => 'individual'], function () { - - Route::group(['prefix' => 'presentation-selections'], function () { - - Route::group(['prefix' => '{collection}'], function () { - - Route::group(['prefix' => 'presentations'], function () { - - Route::group(['prefix' => '{presentation_id}'], function () { - - Route::post('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitSelectedPresentationListApiController@assignPresentationToMyIndividualList' - ]); - - Route::delete('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitSelectedPresentationListApiController@removePresentationFromMyIndividualList' - ]); - - }); - - }); - - }); - - }); - - }); - - Route::group(['prefix' => '{list_id}'], function () { - Route::put('reorder', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitSelectedPresentationListApiController@reorderSelectionList' - ]); - }); - }); - - }); - }); - - // track chairs - Route::group(['prefix' => 'track-chairs'], function () { - Route::get('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackChairsApiController@getAllBySummit' - ]); - - Route::get('csv', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackChairsApiController@getAllBySummitCSV' - ]); - - Route::post('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackChairsApiController@add' - ]); - - Route::group(['prefix' => '{track_chair_id}'], function () { - - Route::get('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackChairsApiController@get' - ]); - - Route::put('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackChairsApiController@update' - ]); - Route::delete('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackChairsApiController@delete' - ]); - - Route::group(['prefix' => 'categories'], function () { - Route::group(['prefix' => '{track_id}'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTrackChairsApiController@addTrack2TrackChair']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitTrackChairsApiController@removeFromTrackChair']); - }); - }); - }); - }); - - // track groups - Route::group(['prefix' => 'track-groups'], function () { - Route::get('', 'OAuth2PresentationCategoryGroupController@getAllBySummit'); - Route::get('csv', 'OAuth2PresentationCategoryGroupController@getAllBySummitCSV'); - Route::get('metadata', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@getMetadata']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@addTrackGroupBySummit']); - - Route::group(['prefix' => '{track_group_id}'], function () { - Route::get('', 'OAuth2PresentationCategoryGroupController@getTrackGroupBySummit'); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@updateTrackGroupBySummit']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@deleteTrackGroupBySummit']); - - Route::group(['prefix' => 'tracks'], function () { - - Route::group(['prefix' => '{track_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@associateTrack2TrackGroup']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@disassociateTrack2TrackGroup']); - }); - }); - Route::group(['prefix' => 'allowed-groups'], function () { - - Route::group(['prefix' => '{group_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@associateAllowedGroup2TrackGroup']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2PresentationCategoryGroupController@disassociateAllowedGroup2TrackGroup']); - }); - }); - }); - }); - - // promo codes - Route::group(['prefix' => 'promo-codes'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@getAllBySummit']); - Route::get('csv', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@getAllBySummitCSV']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@addPromoCodeBySummit']); - Route::get('metadata', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@getMetadata']); - Route::group(['prefix' => '{promo_code_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@getPromoCodeBySummit']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@updatePromoCodeBySummit']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@deletePromoCodeBySummit']); - Route::post('mail', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@sendPromoCodeMail']); - Route::group(['prefix' => 'badge-features'], function () { - Route::group(['prefix' => '{badge_feature_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@addBadgeFeatureToPromoCode']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@removeBadgeFeatureFromPromoCode']); - }); - }); - - Route::group(['prefix' => 'ticket-types'], function () { - Route::group(['prefix' => '{ticket_type_id}'], function () { - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@addTicketTypeToPromoCode']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitPromoCodesApiController@removeTicketTypeFromPromoCode']); - }); - }); - }); - }); - - // track tag groups - Route::group(['prefix' => 'track-tag-groups'], function(){ - - Route::get('', ['uses' => 'OAuth2SummitTrackTagGroupsApiController@getTrackTagGroupsBySummit']); - - Route::post('', [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@addTrackTagGroup']); - - Route::post('seed-defaults', [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@seedDefaultTrackTagGroups']); - - Route::group(['prefix' => '{track_tag_group_id}'], function(){ - Route::get('', [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@getTrackTagGroup']); - Route::put('', [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@updateTrackTagGroup']); - Route::delete('', [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@deleteTrackTagGroup']); - - Route::group(['prefix' => 'allowed-tags'], function(){ - - Route::group(['prefix' => 'all'], function(){ - Route::post('copy/tracks/{track_id}', - [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@seedTagTrackGroupOnTrack']); - }); - }); - - }); - - Route::group(['prefix' => 'all'], function(){ - Route::group(['prefix' => 'allowed-tags'], function(){ - - Route::get('', [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@getAllowedTags']); - - - Route::group(['prefix' => '{tag_id}'], function(){ - Route::post('seed-on-tracks', - [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2SummitTrackTagGroupsApiController@seedTagOnAllTracks']); - }); - }); - }); - }); - - // email-flows-events - Route::group(['prefix' => 'email-flows-events'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitEmailEventFlowApiController@getAllBySummit']); - Route::group(['prefix' => '{event_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitEmailEventFlowApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitEmailEventFlowApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitEmailEventFlowApiController@delete']); - }); - }); - - // media-upload-types - - Route::group(['prefix' => 'media-upload-types'], function(){ - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@getAllBySummit']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@add']); - Route::group(['prefix' => '{media_upload_type_id}'], function () { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@delete']); - Route::group(['prefix' => 'presentation-types'] , function(){ - Route::group(['prefix' => '{event_type_id}'] , function(){ - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@addToPresentationType']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@deleteFromPresentationType']); - }); - }); - }); - - Route::group(['prefix' => 'all'], function () { - Route::post('clone/{to_summit_id}', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitMediaUploadTypeApiController@cloneMediaUploadTypes']); - }); - }); - - // featured speakers - - Route::group(['prefix' => 'featured-speakers'], function(){ - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@getAllFeatureSpeaker']); - Route::group(['prefix' => '{speaker_id}'], function() { - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@addFeatureSpeaker']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitApiController@removeFeatureSpeaker']); - }); - }); - - // presentation action types - - Route::group(['prefix' => 'presentation-action-types'], function(){ - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionTypeApiController@getAllBySummit']); - Route::get('csv', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionTypeApiController@getAllBySummitCSV']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionTypeApiController@add']); - Route::group(['prefix' => '{action_id}'], function() { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitPresentationActionTypeApiController@delete']); - }); - }); - }); - }); - - // sponsorship-types - Route::group(['prefix' => 'sponsorship-types'], function () { - Route::get('', ['uses' => 'OAuth2SponsorshipTypeApiController@getAll']); - Route::post('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SponsorshipTypeApiController@add']); - Route::group(['prefix' => '{id}'], function () { - Route::get('', ['uses' => 'OAuth2SponsorshipTypeApiController@get']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SponsorshipTypeApiController@update']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SponsorshipTypeApiController@delete']); - }); - }); - - // speakers - Route::group(['prefix' => 'speakers'], function () { - - Route::get('', 'OAuth2SummitSpeakersApiController@getAll'); - Route::post('', 'OAuth2SummitSpeakersApiController@addSpeaker'); - Route::put('merge/{speaker_from_id}/{speaker_to_id}', 'OAuth2SummitSpeakersApiController@merge'); - - Route::group(['prefix' => 'active-involvements'], function(){ - Route::get('', 'OAuth2SpeakerActiveInvolvementApiController@getAll'); - }); - - Route::group(['prefix' => 'organizational-roles'], function(){ - Route::get('', 'OAuth2SpeakerOrganizationalRoleApiController@getAll'); - }); - - Route::group(['prefix' => 'me'], function(){ - Route::get('', 'OAuth2SummitSpeakersApiController@getMySpeaker'); - Route::post('', 'OAuth2SummitSpeakersApiController@createMySpeaker'); - Route::put('', 'OAuth2SummitSpeakersApiController@updateMySpeaker'); - Route::post('/photo', 'OAuth2SummitSpeakersApiController@addMySpeakerPhoto'); - - Route::group(['prefix' => 'presentations'], function(){ - - Route::group(['prefix' => '{presentation_id}'], function(){ - - Route::group(['prefix' => 'speakers'], function(){ - Route::put('{speaker_id}', 'OAuth2SummitSpeakersApiController@addSpeakerToMyPresentation'); - Route::delete('{speaker_id}', 'OAuth2SummitSpeakersApiController@removeSpeakerFromMyPresentation'); - }); - Route::group(['prefix' => 'moderators'], function(){ - Route::put('{speaker_id}', 'OAuth2SummitSpeakersApiController@addModeratorToMyPresentation'); - Route::delete('{speaker_id}', 'OAuth2SummitSpeakersApiController@removeModeratorFromMyPresentation'); - }); - }); - Route::group(['prefix' => '{role}'], function(){ - Route::group(['prefix' => 'selection-plans'], function(){ - Route::group(['prefix' => '{selection_plan_id}'], function(){ - Route::get("", "OAuth2SummitSpeakersApiController@getMySpeakerPresentationsByRoleAndBySelectionPlan") - ->where('role', 'creator|speaker|moderator'); - }); - }); - - Route::group(['prefix' => 'summits'], function(){ - Route::group(['prefix' => '{summit_id}'], function(){ - Route::get("", "OAuth2SummitSpeakersApiController@getMySpeakerPresentationsByRoleAndBySummit") - ->where('role', 'creator|speaker|moderator'); - }); - }); - }); - }); - }); - - Route::group(['prefix' => '{speaker_id}'], function () { - Route::put('/edit-permission', 'OAuth2SummitSpeakersApiController@requestSpeakerEditPermission')->where('speaker_id', '[0-9]+'); - Route::get('/edit-permission', 'OAuth2SummitSpeakersApiController@getSpeakerEditPermission')->where('speaker_id', '[0-9]+'); - Route::put('','OAuth2SummitSpeakersApiController@updateSpeaker')->where('speaker_id', 'me|[0-9]+'); - Route::delete('',[ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitSpeakersApiController@deleteSpeaker'])->where('speaker_id', 'me|[0-9]+'); - Route::get('', 'OAuth2SummitSpeakersApiController@getSpeaker'); - // speaker photos - Route::group(['prefix' => 'photo'], function () { - Route::post('', [ 'uses' => 'OAuth2SummitSpeakersApiController@addSpeakerPhoto']); - Route::delete('', ['uses' => 'OAuth2SummitSpeakersApiController@deleteSpeakerPhoto']); - }); - - Route::group(['prefix' => 'big-photo'], function () { - Route::post('', [ 'uses' => 'OAuth2SummitSpeakersApiController@addSpeakerBigPhoto']); - Route::delete('', [ 'uses' => 'OAuth2SummitSpeakersApiController@deleteSpeakerBigPhoto']); - }); - - }); - }); - - // track question templates - Route::group(['prefix' => 'track-question-templates'], function () { - - Route::get('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2TrackQuestionsTemplateApiController@getTrackQuestionTemplates']); - Route::get('metadata', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2TrackQuestionsTemplateApiController@getTrackQuestionTemplateMetadata' - ]); - - Route::post('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2TrackQuestionsTemplateApiController@addTrackQuestionTemplate']); - - Route::group(['prefix' => '{track_question_template_id}'], function () { - - Route::get('', [ 'middleware' => 'auth.user', - 'uses' => 'OAuth2TrackQuestionsTemplateApiController@getTrackQuestionTemplate']); - - Route::put('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2TrackQuestionsTemplateApiController@updateTrackQuestionTemplate']); - - Route::delete('', [ - 'middleware' => 'auth.user', - 'uses' => 'OAuth2TrackQuestionsTemplateApiController@deleteTrackQuestionTemplate']); - - // multi values questions - Route::group(['prefix' => 'values'], function () { - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2TrackQuestionsTemplateApiController@addTrackQuestionTemplateValue']); - Route::group(['prefix' => '{track_question_template_value_id}'], function () { - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2TrackQuestionsTemplateApiController@getTrackQuestionTemplateValue']); - Route::put('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2TrackQuestionsTemplateApiController@updateTrackQuestionTemplateValue']); - Route::delete('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2TrackQuestionsTemplateApiController@deleteTrackQuestionTemplateValue']); - }); - }); - }); - }); - - // summit-administrator-groups - Route::group(['prefix'=>'summit-administrator-groups'], function(){ - Route::get('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@getAll']); - Route::post('', [ 'middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@add']); - Route::group(['prefix'=>'{group_id}'], function() { - Route::get('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@get']); - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@delete']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@update']); - - Route::group(['prefix'=>'members'], function() { - Route::group(['prefix'=>'{member_id}'], function() { - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@addMember']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@removeMember']); - }); - }); - - Route::group(['prefix'=>'summits'], function() { - Route::group(['prefix'=>'{summit_id}'], function() { - Route::delete('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@addSummit']); - Route::put('', ['middleware' => 'auth.user', 'uses' => 'OAuth2SummitAdministratorPermissionGroupApiController@removeSummit']); - }); - }); - }); - }); - -}); - -//OAuth2 Protected API V2 -Route::group([ - 'namespace' => 'App\Http\Controllers', - 'prefix' => 'api/v2', - 'before' => [], - 'after' => [], - 'middleware' => ['ssl', 'oauth2.protected', 'rate.limit','etags'] -], function () { - - // summits - Route::group(['prefix' => 'summits'], function () { - - Route::group(['prefix' => '{id}'], function () { - - Route::get('', ['uses' => 'OAuth2SummitApiController@getSummit'])->where('id', 'current|[0-9]+'); - // events - Route::group(['prefix' => 'events'], function () { - - Route::group(['prefix' => '{event_id}'], function () { - Route::group(['prefix' => 'feedback'], function () { - Route::post('', 'OAuth2SummitEventsApiController@addMyEventFeedbackReturnId'); - Route::put('', 'OAuth2SummitEventsApiController@updateMyEventFeedbackReturnId'); - }); - }); - }); - }); - }); -}); \ No newline at end of file diff --git a/app/Jobs/CompensatePromoCodes.php b/app/Jobs/CompensatePromoCodes.php deleted file mode 100644 index d69a8ca0..00000000 --- a/app/Jobs/CompensatePromoCodes.php +++ /dev/null @@ -1,90 +0,0 @@ -summit_id = $summit->getId(); - $this->code = $code; - $this->qty_to_return = $qty_to_return; - } - - /** - * @param ISummitRepository $summit_repository - * @param ISummitRegistrationPromoCodeRepository $repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle - ( - ISummitRepository $summit_repository, - ISummitRegistrationPromoCodeRepository $repository, - ITransactionService $tx_service - ) - { - $tx_service->transaction(function() use($summit_repository, $repository){ - $summit = $summit_repository->getById($this->summit_id); - if(is_null($summit) || ! $summit instanceof Summit) return; - $promo_code = $repository->getByValueExclusiveLock($summit, $this->code); - if(is_null($promo_code) || !$promo_code instanceof SummitRegistrationPromoCode) return; - Log::debug(sprintf("CompensatePromoCodes::handle: compensating promo code %s on %s usages", $this->code, $this->qty_to_return)); - try { - $promo_code->removeUsage($this->qty_to_return); - } - catch (ValidationException $ex){ - Log::error($ex); - } - }); - } -} diff --git a/app/Jobs/CompensateTickets.php b/app/Jobs/CompensateTickets.php deleted file mode 100644 index 75f070bf..00000000 --- a/app/Jobs/CompensateTickets.php +++ /dev/null @@ -1,76 +0,0 @@ -ticket_type_id = $ticket_type_id; - $this->qty_to_return = $qty_to_return; - } - - - /** - * @param ISummitTicketTypeRepository $repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle(ISummitTicketTypeRepository $repository, ITransactionService $tx_service) - { - $tx_service->transaction(function () use ($repository) { - - $ticket_type = $repository->getByIdExclusiveLock($this->ticket_type_id); - if(is_null($ticket_type) || !$ticket_type instanceof SummitTicketType) return; - Log::debug(sprintf("CompensateTickets::handle: compensating ticket type %s on %s usages", $this->ticket_type_id, $this->qty_to_return)); - try { - $ticket_type->restore($this->qty_to_return); - } - catch(ValidationException $ex){ - Log::error($ex); - } - }); - } -} diff --git a/app/Jobs/CreateVideosFromMUXAssetsForSummitJob.php b/app/Jobs/CreateVideosFromMUXAssetsForSummitJob.php deleted file mode 100644 index 8a2bf764..00000000 --- a/app/Jobs/CreateVideosFromMUXAssetsForSummitJob.php +++ /dev/null @@ -1,110 +0,0 @@ -summit_id = $summit_id; - $this->mux_token_id = $mux_token_id; - $this->mux_token_secret = $mux_token_secret; - $this->email_to = $email_to; - } - - /** - * @param IPresentationVideoMediaUploadProcessor $service - */ - public function handle(IPresentationVideoMediaUploadProcessor $service){ - - Log::debug - ( - sprintf - ( - "CreateVideosFromMUXAssetsForSummit::handle summit %s token id %s token secret %s mail_to %s", - $this->summit_id, - $this->mux_token_id, - $this->mux_token_secret, - $this->email_to - ) - ); - - try { - $service->createVideosFromMUXAssets - ( - $this->summit_id, - new MuxCredentials( - $this->mux_token_id, - $this->mux_token_secret - ), - $this->email_to - ); - } - catch (\Exception $ex){ - Log::error($ex); - } - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/AbstractEmailJob.php b/app/Jobs/Emails/AbstractEmailJob.php deleted file mode 100644 index 2c51fb18..00000000 --- a/app/Jobs/Emails/AbstractEmailJob.php +++ /dev/null @@ -1,101 +0,0 @@ -template_identifier = $template_identifier; - Log::debug(sprintf("AbstractEmailJob::__construct template_identifier %s", $template_identifier)); - if(empty($this->template_identifier)){ - throw new \InvalidArgumentException("missing template_identifier value"); - } - $this->payload = $payload; - $this->to_email = $to_email; - $this->subject = $subject; - } - - /** - * @param IMailApi $api - * @return array - * @throws \Exception - */ - public function handle - ( - IMailApi $api - ) - { - try { - Log::debug(sprintf("AbstractEmailJob::handle template_identifier %s to_email %s", $this->template_identifier, $this->to_email)); - return $api->sendEmail($this->payload, $this->template_identifier, $this->to_email, $this->subject); - } - catch (\Exception $ex){ - Log::error(sprintf("AbstractEmailJob::sendEmail template_identifier %s to_email %s", $this->template_identifier, $this->to_email)); - Log::error($ex); - throw $ex; - } - } - - abstract protected function getEmailEventSlug():string; - - /** - * @param Summit $summit - * @return string|null - */ - protected function getEmailTemplateIdentifierFromEmailEvent(Summit $summit):?string{ - return $summit->getEmailIdentifierPerEmailEventFlowSlug($this->getEmailEventSlug()); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/BookableRooms/AbstractBookableRoomReservationEmail.php b/app/Jobs/Emails/BookableRooms/AbstractBookableRoomReservationEmail.php deleted file mode 100644 index d923f0bd..00000000 --- a/app/Jobs/Emails/BookableRooms/AbstractBookableRoomReservationEmail.php +++ /dev/null @@ -1,56 +0,0 @@ -getOwner()->getEmail(); - } - - /** - * AbstractBookableRoomReservationEmail constructor. - * @param string $to - * @param SummitRoomReservation $reservation - */ - public function __construct(SummitRoomReservation $reservation) - { - $payload = []; - $room = $reservation->getRoom(); - $summit = $room->getSummit(); - $payload['owner_fullname'] = $reservation->getOwner()->getFullName(); - $payload['owner_email'] = $reservation->getOwner()->getEmail(); - $payload['room_complete_name'] = $room->getCompleteName(); - $payload['reservation_start_datetime'] = $reservation->getLocalStartDatetime()->format("Y-m-d H:i:s"); - $payload['reservation_end_datetime'] = $reservation->getLocalEndDatetime()->format("Y-m-d H:i:s"); - $payload['reservation_created_datetime'] = $reservation->getCreated()->format("Y-m-d H:i:s"); - $payload['reservation_amount'] = $reservation->getAmount(); - $payload['reservation_currency'] = $reservation->getCurrency(); - $payload['reservation_id'] = $reservation->getId(); - $payload['room_capacity'] = $room->getCapacity(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['reservation_refunded_amount'] = $reservation->getRefundedAmount(); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - parent::__construct($payload, $template_identifier, $this->getTo($reservation)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/BookableRooms/BookableRoomReservationCanceledEmail.php b/app/Jobs/Emails/BookableRooms/BookableRoomReservationCanceledEmail.php deleted file mode 100644 index 038da89b..00000000 --- a/app/Jobs/Emails/BookableRooms/BookableRoomReservationCanceledEmail.php +++ /dev/null @@ -1,31 +0,0 @@ -getPresentation(); - $requester = $request->getRequester(); - $old_category = $request->getOldCategory(); - $new_category = $request->getNewCategory(); - - foreach($new_category->getTrackChairs() as $chair){ - $to_emails[] = $chair->getMember()->getEmail(); - } - - $summit = $presentation->getSummit(); - - $payload = []; - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_date'] = $summit->getMonthYear(); - $payload['requester_fullname'] = $requester->getFullName(); - $payload['requester_email'] = $requester->getEmail(); - $payload['old_category'] = $old_category->getTitle(); - $payload['new_category'] = $new_category->getTitle(); - $payload['status'] = $request->getNiceStatus(); - $payload['presentation_title'] = $presentation->getTitle(); - $payload['presentation_id'] = $presentation->getId(); - $payload['review_link'] = sprintf(Config::get("track_chairs.review_link"), $summit->getRawSlug()); - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, implode(",", $to_emails)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSelections/PresentationCategoryChangeRequestResolvedEmail.php b/app/Jobs/Emails/PresentationSelections/PresentationCategoryChangeRequestResolvedEmail.php deleted file mode 100644 index a6aaa092..00000000 --- a/app/Jobs/Emails/PresentationSelections/PresentationCategoryChangeRequestResolvedEmail.php +++ /dev/null @@ -1,70 +0,0 @@ -getPresentation(); - $aprover = $request->getAprover(); - $requester = $request->getRequester(); - $old_category = $request->getOldCategory(); - $new_category = $request->getNewCategory(); - - foreach($old_category->getTrackChairs() as $chair){ - $to_emails[] = $chair->getMember()->getEmail(); - } - foreach($new_category->getTrackChairs() as $chair){ - $to_emails[] = $chair->getMember()->getEmail(); - } - - $summit = $presentation->getSummit(); - $payload = []; - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_date'] = $summit->getMonthYear(); - $payload['aprover_fullname'] = $aprover->getFullName(); - $payload['aprover_email'] = $aprover->getEmail(); - $payload['requester_fullname'] = $requester->getFullName(); - $payload['requester_email'] = $requester->getEmail(); - $payload['old_category'] = $old_category->getTitle(); - $payload['new_category'] = $new_category->getTitle(); - $payload['status'] = $request->getNiceStatus(); - $payload['presentation_title'] = $presentation->getTitle(); - $payload['presentation_id'] = $presentation->getId(); - $payload['reason'] = $request->getReason(); - $payload['approval_date'] = $request->getApprovalDate()->format('d F, Y'); - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, implode(",", $to_emails)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSelections/SpeakerEmail.php b/app/Jobs/Emails/PresentationSelections/SpeakerEmail.php deleted file mode 100644 index 272fea40..00000000 --- a/app/Jobs/Emails/PresentationSelections/SpeakerEmail.php +++ /dev/null @@ -1,32 +0,0 @@ -getSummit(); - $creator = $presentation->getCreator(); - $selection_plan = $presentation->getSelectionPlan(); - - $speaker_management_base_url = Config::get('cfp.base_url'); - $idp_base_url = Config::get('idp.base_url'); - $support_email = $summit->getSupportEmail(); - $support_email = !empty($support_email) ? $support_email: Config::get("cfp.support_email", null); - - if(empty($speaker_management_base_url)) - throw new \InvalidArgumentException('cfp.base_url is null.'); - - if(empty($idp_base_url)) - throw new \InvalidArgumentException('idp.base_url is null.'); - - if(empty($support_email)) - throw new \InvalidArgumentException('cfp.support_email is null.'); - - $payload = []; - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['creator_full_name'] = is_null($creator) ? '' : $creator->getFullName(); - $payload['creator_email'] = is_null($creator) ? '': $creator->getEmail(); - $payload['presentation_name'] = $presentation->getTitle(); - $payload['presentation_start_date'] = $presentation->getStartDateNice(); - $payload['presentation_end_date'] = $presentation->getEndDateNice(); - $payload['presentation_location'] = $presentation->getLocationName(); - - $payload['selection_plan_name'] = is_null($selection_plan) ? '': $selection_plan->getName(); - $payload['presentation_edit_link'] = $presentation->getEditLink(); - $payload['summit_date'] = $summit->getMonthYear(); - $payload['until_date'] =is_null($selection_plan) ? '' : $selection_plan->getSubmissionEndDate()->format('d F, Y'); - $payload['selection_process_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['speaker_management_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['bio_edit_link'] = sprintf("%s/app/%s/profile", $speaker_management_base_url, $summit->getRawSlug()); - if(!empty($setPasswordLink)){ - $payload['bio_edit_link'] = $setPasswordLink; - } - $payload['reset_password_link'] = sprintf("%s/auth/password/reset", $idp_base_url); - $payload['support_email'] = $support_email; - $payload['speaker_full_name'] = $speaker->getFullName(' '); - if(empty($payload['speaker_full_name'])){ - $payload['speaker_full_name'] = $speaker->getEmail(); - } - $payload['speaker_email'] = $speaker->getEmail(); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['speaker_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/PresentationCreatorNotificationEmail.php b/app/Jobs/Emails/PresentationSubmissions/PresentationCreatorNotificationEmail.php deleted file mode 100644 index 72dfc768..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/PresentationCreatorNotificationEmail.php +++ /dev/null @@ -1,80 +0,0 @@ -getSummit(); - $creator = $presentation->getCreator(); - $selection_plan = $presentation->getSelectionPlan(); - - if(is_null($selection_plan)) - throw new \InvalidArgumentException('Presentation selection plan is null.'); - - $speaker_management_base_url = Config::get('cfp.base_url'); - $idp_base_url = Config::get('idp.base_url'); - $support_email = $summit->getSupportEmail(); - $support_email = !empty($support_email) ? $support_email: Config::get("cfp.support_email", null); - - if(empty($speaker_management_base_url)) - throw new \InvalidArgumentException('cfp.base_url is null.'); - - if(empty($idp_base_url)) - throw new \InvalidArgumentException('idp.base_url is null.'); - - if(empty($support_email)) - throw new \InvalidArgumentException('cfp.support_email is null.'); - - $payload = []; - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['creator_full_name'] = $creator->getFullName(); - $payload['creator_email'] = $creator->getEmail(); - $payload['selection_plan_name'] = $selection_plan->getName(); - $payload['presentation_edit_link'] = $presentation->getEditLink(); - - $summitBeginDate = $summit->getLocalBeginDate(); - $payload['summit_date'] = !is_null($summitBeginDate)? $summitBeginDate->format("F d, Y") : ""; - $submissionEndDateLocal = $selection_plan->getSubmissionEndDateLocal(); - $payload['until_date'] = !is_null($submissionEndDateLocal) ? $submissionEndDateLocal->format('F d, Y') : ""; - - $payload['selection_process_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['speaker_management_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['bio_edit_link'] = sprintf("%s/app/%s/profile", $speaker_management_base_url, $summit->getRawSlug()); - $payload['reset_password_link'] = sprintf("%s/auth/password/reset", $idp_base_url); - $payload['support_email'] = $support_email; - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['creator_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/PresentationModeratorNotificationEmail.php b/app/Jobs/Emails/PresentationSubmissions/PresentationModeratorNotificationEmail.php deleted file mode 100644 index 26190ffa..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/PresentationModeratorNotificationEmail.php +++ /dev/null @@ -1,90 +0,0 @@ -getSummit(); - $creator = $presentation->getCreator(); - $selection_plan = $presentation->getSelectionPlan(); - - if(is_null($selection_plan)) - throw new \InvalidArgumentException('Presentation selection plan is null.'); - - $speaker_management_base_url = Config::get('cfp.base_url'); - $idp_base_url = Config::get('idp.base_url'); - $support_email = $summit->getSupportEmail(); - $support_email = !empty($support_email) ? $support_email: Config::get("cfp.support_email", null); - - - if(empty($speaker_management_base_url)) - throw new \InvalidArgumentException('cfp.base_url is null.'); - - if(empty($idp_base_url)) - throw new \InvalidArgumentException('idp.base_url is null.'); - - if(empty($support_email)) - throw new \InvalidArgumentException('cfp.support_email is null.'); - - $payload = []; - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['speaker_full_name'] = $moderator->getFullName(" "); - $payload['speaker_email'] = $moderator->getEmail(); - $payload['creator_full_name'] = $creator->getFullName(); - $payload['creator_email'] = $creator->getEmail(); - $payload['selection_plan_name'] = $selection_plan->getName(); - $payload['presentation_edit_link'] = $presentation->getEditLink(); - - $summitBeginDate = $summit->getLocalBeginDate(); - $payload['summit_date'] = !is_null($summitBeginDate)? $summitBeginDate->format("F d, Y") : ""; - $submissionEndDateLocal = $selection_plan->getSubmissionEndDateLocal(); - $payload['until_date'] = !is_null($submissionEndDateLocal) ? $submissionEndDateLocal->format('F d, Y') : ""; - - $payload['selection_process_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['speaker_management_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['bio_edit_link'] = sprintf("%s/app/%s/profile", $speaker_management_base_url, $summit->getRawSlug()); - $payload['reset_password_link'] = sprintf("%s/auth/password/reset", $idp_base_url); - $payload['support_email'] = $support_email; - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['speaker_email']); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/PresentationSpeakerNotificationEmail.php b/app/Jobs/Emails/PresentationSubmissions/PresentationSpeakerNotificationEmail.php deleted file mode 100644 index 205ffc97..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/PresentationSpeakerNotificationEmail.php +++ /dev/null @@ -1,89 +0,0 @@ -getSummit(); - $creator = $presentation->getCreator(); - $selection_plan = $presentation->getSelectionPlan(); - - if(is_null($selection_plan)) - throw new \InvalidArgumentException('Presentation selection plan is null.'); - - $speaker_management_base_url = Config::get('cfp.base_url'); - $idp_base_url = Config::get('idp.base_url'); - $support_email = $summit->getSupportEmail(); - $support_email = !empty($support_email) ? $support_email: Config::get("cfp.support_email", null); - - - if(empty($speaker_management_base_url)) - throw new \InvalidArgumentException('cfp.base_url is null.'); - - if(empty($idp_base_url)) - throw new \InvalidArgumentException('idp.base_url is null.'); - - if(empty($support_email)) - throw new \InvalidArgumentException('cfp.support_email is null.'); - - $payload = []; - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['speaker_full_name'] = $speaker->getFullName(" "); - $payload['speaker_email'] = $speaker->getEmail(); - $payload['creator_full_name'] = $creator->getFullName(); - $payload['creator_email'] = $creator->getEmail(); - $payload['selection_plan_name'] = $selection_plan->getName(); - $payload['presentation_edit_link'] = $presentation->getEditLink(); - - $summitBeginDate = $summit->getLocalBeginDate(); - $payload['summit_date'] = !is_null($summitBeginDate)? $summitBeginDate->format("F d, Y") : ""; - $submissionEndDateLocal = $selection_plan->getSubmissionEndDateLocal(); - $payload['until_date'] = !is_null($submissionEndDateLocal) ? $submissionEndDateLocal->format('F d, Y') : ""; - - $payload['selection_process_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['speaker_management_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug()); - $payload['bio_edit_link'] = sprintf("%s/app/%s/profile", $speaker_management_base_url, $summit->getRawSlug()); - $payload['reset_password_link'] = sprintf("%s/auth/password/reset", $idp_base_url); - $payload['support_email'] = $support_email; - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['speaker_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedAlternateEmail.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedAlternateEmail.php deleted file mode 100644 index 53403c4c..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedAlternateEmail.php +++ /dev/null @@ -1,63 +0,0 @@ -getSummit(); - $this->payload['accepted_presentations'] = []; - foreach($speaker->getPublishedRegularPresentations($summit, $speaker_role) as $p){ - $this->payload['accepted_presentations'][] = ['title' => $p->getTitle()]; - } - $this->payload['alternate_presentations'] = []; - foreach($speaker->getAlternatePresentations($summit, $speaker_role) as $p){ - $this->payload['alternate_presentations'][] = ['title' => $p->getTitle()]; - } - - $payload['speaker_confirmation_link'] = sprintf("%s?t=%s", $this->payload['speaker_confirmation_link'], base64_encode($confirmation_token)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedOnlyEmail.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedOnlyEmail.php deleted file mode 100644 index 5680bb2c..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedOnlyEmail.php +++ /dev/null @@ -1,59 +0,0 @@ -getSummit(); - $this->payload['accepted_presentations'] = []; - foreach($speaker->getPublishedRegularPresentations($summit, $speaker_role) as $p){ - $this->payload['accepted_presentations'][] = ['title' => $p->getTitle()]; - } - - $payload['speaker_confirmation_link'] = sprintf("%s?t=%s", $this->payload['speaker_confirmation_link'], base64_encode($confirmation_token)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedRejectedEmail.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedRejectedEmail.php deleted file mode 100644 index be91fdcb..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAcceptedRejectedEmail.php +++ /dev/null @@ -1,64 +0,0 @@ -getSummit(); - $this->payload['accepted_presentations'] = []; - foreach($speaker->getPublishedRegularPresentations($summit, $speaker_role) as $p){ - $this->payload['accepted_presentations'][] = ['title' => $p->getTitle()]; - } - $this->payload['rejected_presentations'] = []; - foreach($speaker->getRejectedPresentations($summit, $speaker_role) as $p){ - $this->payload['rejected_presentations'][] = ['title' => $p->getTitle()]; - } - - $payload['speaker_confirmation_link'] = sprintf("%s?t=%s", $this->payload['speaker_confirmation_link'], base64_encode($confirmation_token)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAlternateOnlyEmail.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAlternateOnlyEmail.php deleted file mode 100644 index e365992f..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAlternateOnlyEmail.php +++ /dev/null @@ -1,60 +0,0 @@ -getSummit(); - $this->payload['alternate_presentations'] = []; - foreach($speaker->getAlternatePresentations($summit, $speaker_role) as $p){ - $this->payload['alternate_presentations'][] = ['title' => $p->getTitle()]; - } - - $payload['speaker_confirmation_link'] = sprintf("%s?t=%s", $this->payload['speaker_confirmation_link'], base64_encode($confirmation_token)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAlternateRejectedEmail.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAlternateRejectedEmail.php deleted file mode 100644 index 43516af9..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessAlternateRejectedEmail.php +++ /dev/null @@ -1,64 +0,0 @@ -getSummit(); - $this->payload['alternate_presentations'] = []; - foreach($speaker->getAlternatePresentations($summit, $speaker_role) as $p){ - $this->payload['alternate_presentations'][] = ['title' => $p->getTitle()]; - } - $this->payload['rejected_presentations'] = []; - foreach($speaker->getRejectedPresentations($summit, $speaker_role) as $p){ - $this->payload['rejected_presentations'][] = ['title' => $p->getTitle()]; - } - - $payload['speaker_confirmation_link'] = sprintf("%s?t=%s", $this->payload['speaker_confirmation_link'], base64_encode($confirmation_token)); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessEmail.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessEmail.php deleted file mode 100644 index 971596b5..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessEmail.php +++ /dev/null @@ -1,68 +0,0 @@ -getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_schedule_url'] = $summit->getScheduleDefaultPageUrl(); - $payload['summit_site_url'] = $summit->getDefaultPageUrl(); - $payload['speaker_full_name'] = $speaker->getFullName(); - $payload['speaker_email'] = $speaker->getEmail(); - $speaker_management_base_url = Config::get('cfp.base_url'); - if(empty($speaker_management_base_url)) - throw new \InvalidArgumentException('cfp.base_url is null.'); - - $payload['promo_code'] = ''; - $payload['promo_code_until_date'] = ''; - $payload['ticket_type'] = ''; - - if(!is_null($promo_code)){ - $payload['promo_code'] = $promo_code->getCode(); - if(!is_null($promo_code->getValidUntilDate())) - $payload['promo_code_until_date'] = $promo_code->getValidUntilDate()->format("Y-m-d H:i:s"); - $allowed_ticket_types = $promo_code->getAllowedTicketTypes(); - if(count($allowed_ticket_types) > 0) - $payload['ticket_type'] = $allowed_ticket_types[0]->getName(); - } - - $payload['bio_edit_link'] = sprintf("%s/app/profile", $speaker_management_base_url); - $payload['speaker_confirmation_link'] = $summit->getSpeakerConfirmationDefaultPageUrl(); - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['speaker_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessEmailFactory.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessEmailFactory.php deleted file mode 100644 index 29392c92..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessEmailFactory.php +++ /dev/null @@ -1,123 +0,0 @@ -getToken() - ); - break; - case SpeakerAnnouncementSummitEmail::TypeRejected: - PresentationSpeakerSelectionProcessRejectedEmail::dispatch - ( - $summit, - $speaker, - $speaker_role - ); - break; - case SpeakerAnnouncementSummitEmail::TypeAcceptedAlternate: - PresentationSpeakerSelectionProcessAcceptedAlternateEmail::dispatch - ( - $summit, - $promo_code, - $speaker, - $speaker_role, - $speaker_assistance->getToken() - ); - break; - case SpeakerAnnouncementSummitEmail::TypeAcceptedRejected: - PresentationSpeakerSelectionProcessAcceptedRejectedEmail::dispatch - ( - $summit, - $promo_code, - $speaker, - $speaker_role, - $speaker_assistance->getToken() - ); - break; - case SpeakerAnnouncementSummitEmail::TypeAlternate: - PresentationSpeakerSelectionProcessAlternateOnlyEmail::dispatch - ( - $summit, - $promo_code, - $speaker, - $speaker_role, - $speaker_assistance->getToken() - ); - break; - case SpeakerAnnouncementSummitEmail::TypeAlternateRejected: - PresentationSpeakerSelectionProcessAlternateRejectedEmail::dispatch - ( - $summit, - $promo_code, - $speaker, - $speaker_role, - $speaker_assistance->getToken() - ); - break; - } - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessRejectedEmail.php b/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessRejectedEmail.php deleted file mode 100644 index 7748fd8d..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SelectionProcess/PresentationSpeakerSelectionProcessRejectedEmail.php +++ /dev/null @@ -1,52 +0,0 @@ -payload['rejected_presentations'] = []; - foreach($speaker->getRejectedPresentations($summit, $speaker_role) as $p){ - $this->payload['rejected_presentations'][] = ['title' => $p->getTitle()]; - } - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SpeakerCreationEmail.php b/app/Jobs/Emails/PresentationSubmissions/SpeakerCreationEmail.php deleted file mode 100644 index d2d1d940..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SpeakerCreationEmail.php +++ /dev/null @@ -1,75 +0,0 @@ -getFullName(); - $payload['speaker_email'] = $speaker->getEmail(); - $payload['speaker_management_link'] = $speaker_management_base_url; - $bio_edit_link = sprintf("%s/app/profile", $speaker_management_base_url); - $registrationRequest = $speaker->getRegistrationRequest(); - /** - * - @todo need 2 update CFP to support registration request retrieval - if(is_null($registrationRequest)){ - $token = $registrationRequest->getToken(); - if(!is_null($token)) - $bio_edit_link = $bio_edit_link.'/'.$token; - } - */ - $payload['bio_edit_link'] = $bio_edit_link; - $payload['reset_password_link'] = sprintf("%s/auth/password/reset", $idp_base_url); - $payload['support_email'] = $support_email; - $payload['tenant_name'] = Config::get("app.tenant_name"); - - parent::__construct($payload, self::DEFAULT_TEMPLATE, $payload['speaker_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionApprovedEmail.php b/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionApprovedEmail.php deleted file mode 100644 index 0e8bad09..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionApprovedEmail.php +++ /dev/null @@ -1,49 +0,0 @@ -getRequestedBy()->getFullName(); - $payload['speaker_full_name'] = $request->getSpeaker()->getFullName(); - $payload['speaker_management_link'] = - $payload['tenant_name'] = Config::get("app.tenant_name"); - $payload['requested_by_email'] = $request->getRequestedBy()->getEmail(); - parent::__construct($payload, self::DEFAULT_TEMPLATE, $payload['requested_by_email']); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionRejectedEmail.php b/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionRejectedEmail.php deleted file mode 100644 index 63029b4f..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionRejectedEmail.php +++ /dev/null @@ -1,49 +0,0 @@ -getRequestedBy()->getFullName(); - $payload['speaker_full_name'] = $request->getSpeaker()->getFullName(); - $payload['speaker_management_link'] = - $payload['tenant_name'] = Config::get("app.tenant_name"); - $payload['requested_by_email'] = $request->getRequestedBy()->getEmail(); - parent::__construct($payload, self::DEFAULT_TEMPLATE, $payload['requested_by_email']); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionRequestedEmail.php b/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionRequestedEmail.php deleted file mode 100644 index 582e6f74..00000000 --- a/app/Jobs/Emails/PresentationSubmissions/SpeakerEditPermissionRequestedEmail.php +++ /dev/null @@ -1,54 +0,0 @@ -getRequestedBy()->getFullName(); - $payload['speaker_full_name'] = $request->getSpeaker()->getFullName(); - $payload['token'] = $token; - $payload['link'] = $request->getConfirmationLink($request->getSpeaker()->getId(), $token); - $payload['tenant_name'] = Config::get("app.tenant_name"); - $payload['requested_by_email'] = $request->getRequestedBy()->getEmail(); - $payload['speaker_email'] = $request->getSpeaker()->getEmail(); - parent::__construct($payload, self::DEFAULT_TEMPLATE, $payload['speaker_email']); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Attendees/AbstractSummitAttendeeTicketEmail.php b/app/Jobs/Emails/Registration/Attendees/AbstractSummitAttendeeTicketEmail.php deleted file mode 100644 index 9cb628ed..00000000 --- a/app/Jobs/Emails/Registration/Attendees/AbstractSummitAttendeeTicketEmail.php +++ /dev/null @@ -1,78 +0,0 @@ -payload['owner_email']; - // check if exist at idp - $user = $memberService->checkExternalUser($email); - - if(is_null($user)){ - - // user does not exist at idp so we need to generate a registration request - // and create the magic links to complete the registration request - - $userRegistrationRequest = $memberService->emitRegistrationRequest - ( - $email, - $this->payload['owner_first_name'], - $this->payload['owner_last_name'] - ); - - $setPasswordLink = $userRegistrationRequest['set_password_link']; - - if(isset($this->payload['summit_virtual_site_url']) && - !empty($this->payload['summit_virtual_site_url']) && - isset($this->payload['summit_virtual_site_oauth2_client_id']) && - !empty($this->payload['summit_virtual_site_oauth2_client_id'])){ - $this->payload['summit_virtual_site_url'] = sprintf( - "%s?client_id=%s&redirect_uri=%s", - $setPasswordLink, - $this->payload['summit_virtual_site_oauth2_client_id'], - urlencode($this->payload['summit_virtual_site_url']) - ); - } - - if(isset($this->payload['summit_marketing_site_url']) && - !empty($this->payload['summit_marketing_site_url']) && - isset($this->payload['summit_marketing_site_oauth2_client_id']) && - !empty($this->payload['summit_marketing_site_oauth2_client_id'])){ - $this->payload['summit_marketing_site_url'] = sprintf( - "%s?client_id=%s&redirect_uri=%s", - $setPasswordLink, - $this->payload['summit_marketing_site_oauth2_client_id'], - urlencode($this->payload['summit_marketing_site_url']) - ); - } - } - } - return parent::handle($api); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Attendees/InviteAttendeeTicketEditionMail.php b/app/Jobs/Emails/Registration/Attendees/InviteAttendeeTicketEditionMail.php deleted file mode 100644 index 3f2bdfc6..00000000 --- a/app/Jobs/Emails/Registration/Attendees/InviteAttendeeTicketEditionMail.php +++ /dev/null @@ -1,124 +0,0 @@ -getOwner(); - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - $payload = []; - - $payload['order_owner_full_name'] = $order->getOwnerFullName(); - $payload['order_owner_company'] = $order->getOwnerCompany(); - $payload['order_owner_email'] = $order->getOwnerEmail(); - - $payload['owner_full_name'] = $owner->getFullName(); - $payload['owner_company'] = $owner->getCompanyName(); - $payload['owner_email'] = $owner->getEmail(); - $payload['owner_first_name'] = $owner->getFirstName(); - $payload['owner_last_name'] = $owner->getSurname(); - $payload['summit_reassign_ticket_till_date'] = ''; - $summit_reassign_ticket_till_date = $summit->getReassignTicketTillDateLocal(); - if(!is_null($summit_reassign_ticket_till_date)) { - $payload['summit_reassign_ticket_till_date'] = $summit_reassign_ticket_till_date->format("l j F Y h:i A T"); - } - - if(empty($payload['owner_full_name'])){ - Log::warning(sprintf("InviteAttendeeTicketEditionMail owner_full_name is empty setting email")); - $payload['owner_full_name'] = $payload['owner_email']; - } - - if(empty($payload['owner_first_name'])){ - Log::warning(sprintf("InviteAttendeeTicketEditionMail owner_first_name is empty setting email")); - $payload['owner_first_name'] = $payload['owner_email']; - } - - if(empty($payload['owner_last_name'])){ - Log::warning(sprintf("InviteAttendeeTicketEditionMail owner_last_name is empty setting email")); - $payload['owner_last_name'] = $payload['owner_email']; - } - - $payload['hash'] = $ticket->getHash(); - - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - $payload['summit_virtual_site_oauth2_client_id'] = $summit->getVirtualSiteOAuth2ClientId(); - $payload['summit_marketing_site_oauth2_client_id'] = $summit->getMarketingSiteOAuth2ClientId(); - - $base_url = Config::get('registration.dashboard_base_url', null); - $edit_ticket_link = Config::get('registration.dashboard_attendee_edit_form_url', null); - - if (empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - if (empty($edit_ticket_link)) - throw new \InvalidArgumentException("missing dashboard_attendee_edit_form_url value"); - - $payload['edit_ticket_link'] = sprintf($edit_ticket_link, $base_url, $payload['hash']); - $payload['ticket_number'] = $ticket->getNumber(); - $payload['ticket_type_name'] = $ticket->getTicketType()->getName(); - $payload['ticket_raw_amount'] = $ticket->getRawCost(); - $payload['ticket_currency'] = $ticket->getCurrency(); - $payload['ticket_currency_symbol'] = '$'; - $payload['ticket_discount'] = $ticket->getDiscount(); - $payload['ticket_taxes'] = $ticket->getTaxesAmount(); - $payload['ticket_amount'] = $ticket->getFinalAmount(); - $payload['need_details'] = $owner->needToFillDetails(); - - $promo_code = $ticket->hasPromoCode() ? $ticket->getPromoCode() : null; - $payload['promo_code'] = ''; - if (!is_null($promo_code)) { - $payload['promo_code'] = $promo_code->getCode(); - - if ($promo_code instanceof SummitRegistrationDiscountCode) { - $payload['promo_code_discount_rate'] = $promo_code->getRate(); - $payload['promo_code_discount_amount'] = $promo_code->getAmount(); - } - } - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['owner_email'] ); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - - // metadata - const EVENT_SLUG = 'SUMMIT_REGISTRATION_INVITE_ATTENDEE_TICKET_EDITION'; - const EVENT_NAME = 'SUMMIT_REGISTRATION_INVITE_ATTENDEE_TICKET_EDITION'; - const DEFAULT_TEMPLATE = 'REGISTRATION_INVITE_ATTENDEE_TICKET_EDITION'; -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Attendees/ProcessAttendeesEmailRequestJob.php b/app/Jobs/Emails/Registration/Attendees/ProcessAttendeesEmailRequestJob.php deleted file mode 100644 index 3231c57d..00000000 --- a/app/Jobs/Emails/Registration/Attendees/ProcessAttendeesEmailRequestJob.php +++ /dev/null @@ -1,72 +0,0 @@ -summit_id = $summit->getId(); - $this->payload = $payload; - $this->filter = $filter; - } - - public function handle(IAttendeeService $service){ - Log::debug(sprintf("ProcessAttendeesEmailRequestJob::handle summit id %s", $this->summit_id)); - - $filter = !is_null($this->filter) ? FilterParser::parse($this->filter, [ - 'first_name' => ['=@', '=='], - 'last_name' => ['=@', '=='], - 'full_name' => ['=@', '=='], - 'company' => ['=@', '=='], - 'email' => ['=@', '=='], - 'external_order_id' => ['=@', '=='], - 'external_attendee_id' => ['=@', '=='], - 'member_id' => ['==', '>'], - 'ticket_type' => ['=@', '=='], - 'badge_type' => ['=@', '=='], - 'status' => ['=@', '=='], - ]) : null; - - $service->send($this->summit_id, $this->payload, $filter); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Attendees/RevocationTicketEmail.php b/app/Jobs/Emails/Registration/Attendees/RevocationTicketEmail.php deleted file mode 100644 index f848d362..00000000 --- a/app/Jobs/Emails/Registration/Attendees/RevocationTicketEmail.php +++ /dev/null @@ -1,70 +0,0 @@ -getEmail(); - $summit = $attendee->getSummit(); - $order = $ticket->getOrder(); - $payload = []; - - $payload['owner_full_name'] = $attendee->getFullName(); - $payload['owner_email'] = $attendee->getEmail(); - $payload['owner_first_name'] = $attendee->getFirstName(); - $payload['owner_last_name'] = $attendee->getSurname(); - $payload['owner_company'] = $attendee->getCompanyName(); - $payload['order_owner_full_name'] = $order->getOwnerFullName(); - $payload['order_owner_email'] = $order->getOwnerEmail(); - $payload['order_owner_company'] = $order->getOwnerCompany(); - $payload['ticket_number'] = $ticket->getNumber(); - - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $owner_email); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Attendees/SummitAttendeeTicketEmail.php b/app/Jobs/Emails/Registration/Attendees/SummitAttendeeTicketEmail.php deleted file mode 100644 index 34eb21da..00000000 --- a/app/Jobs/Emails/Registration/Attendees/SummitAttendeeTicketEmail.php +++ /dev/null @@ -1,127 +0,0 @@ -getOwner(); - $summit = $attendee->getSummit(); - $order = $ticket->getOrder(); - $payload['order_owner_full_name'] = $order->getOwnerFullName(); - $payload['order_owner_company'] = $order->getOwnerCompany(); - $payload['order_owner_email'] = $order->getOwnerEmail(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - - $summit_reassign_ticket_till_date = $summit->getReassignTicketTillDateLocal(); - if(!is_null($summit_reassign_ticket_till_date)) { - $payload['summit_reassign_ticket_till_date'] = $summit_reassign_ticket_till_date->format("l j F Y h:i A T"); - } - - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - $payload['summit_virtual_site_oauth2_client_id'] = $summit->getVirtualSiteOAuth2ClientId(); - $payload['summit_marketing_site_oauth2_client_id'] = $summit->getMarketingSiteOAuth2ClientId(); - - $payload['ticket_number'] = $ticket->getNumber(); - $payload['ticket_type_name'] = $ticket->getTicketType()->getName(); - $payload['ticket_amount'] = $ticket->getFinalAmount(); - $payload['ticket_currency'] = $ticket->getCurrency(); - $payload['ticket_currency_symbol'] = '$'; - $owner_email = $attendee->getEmail(); - $payload['owner_email'] = $owner_email; - $payload['owner_first_name'] = $attendee->getFirstName(); - $payload['owner_last_name'] = $attendee->getSurname(); - $payload['owner_full_name'] = $attendee->getFullName(); - $payload['owner_company'] = $attendee->getCompanyName(); - - if(empty($payload['owner_full_name'])){ - Log::warning(sprintf("SummitAttendeeTicketEmail owner_full_name is empty setting email")); - $payload['owner_full_name'] = $payload['owner_email']; - } - - if(empty($payload['owner_first_name'])){ - Log::warning(sprintf("SummitAttendeeTicketEmail owner_first_name is empty setting email")); - $payload['owner_first_name'] = $payload['owner_email']; - } - - if(empty($payload['owner_last_name'])){ - Log::warning(sprintf("SummitAttendeeTicketEmail owner_last_name is empty setting email")); - $payload['owner_last_name'] = $payload['owner_email']; - } - - $payload['promo_code'] = ($ticket->hasPromoCode()) ? $ticket->getPromoCode()->getCode() : ''; - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $sendTicketAttachments = Config::get("registration.send_ticket_attachments", false); - - // @todo attachments are only meant for in person events - // we need on a future a way to determine if current summit is virtual or in person - // to included this attachments, for now , will be managed by managed by a environmental - // variable - // attachments - if($sendTicketAttachments) { - $renderer = new SummitAttendeeTicketPDFRenderer($ticket); - $attachments = []; - $attachments[] = [ - 'name' => 'qr.png', - 'content' => base64_encode(QrCode::format('png')->size(250, 250)->generate($ticket->getQRCode())), - 'type' => 'application/octet-stream', - 'disposition' => 'inline', - 'content_id' => 'qrcid', - ]; - - $attachments[] = [ - 'name' => 'ticket_' . $ticket->getNumber() . '.pdf', - 'content' => base64_encode($renderer->render()), - 'type' => 'application/pdf', - 'disposition' => 'attachment', - ]; - - $payload['attachments'] = $attachments; - } - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - parent::__construct($payload, $template_identifier, $owner_email); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Attendees/SummitAttendeeTicketRegenerateHashEmail.php b/app/Jobs/Emails/Registration/Attendees/SummitAttendeeTicketRegenerateHashEmail.php deleted file mode 100644 index 8e998516..00000000 --- a/app/Jobs/Emails/Registration/Attendees/SummitAttendeeTicketRegenerateHashEmail.php +++ /dev/null @@ -1,31 +0,0 @@ -getId(); - $payload['summit_name'] = $summit->getName(); - $payload['feed_type'] = $summit->getExternalRegistrationFeedType(); - $payload['external_id'] = $summit->getExternalSummitId(); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $email_to); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/ExternalIngestion/UnsuccessfulIIngestionEmail.php b/app/Jobs/Emails/Registration/ExternalIngestion/UnsuccessfulIIngestionEmail.php deleted file mode 100644 index f6f61d5b..00000000 --- a/app/Jobs/Emails/Registration/ExternalIngestion/UnsuccessfulIIngestionEmail.php +++ /dev/null @@ -1,55 +0,0 @@ -getId(); - $payload['summit_name'] = $summit->getName(); - $payload['feed_type'] = $summit->getExternalRegistrationFeedType(); - $payload['external_id'] = $summit->getExternalSummitId(); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $email_to); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Invitations/InviteSummitRegistrationEmail.php b/app/Jobs/Emails/Registration/Invitations/InviteSummitRegistrationEmail.php deleted file mode 100644 index 9f96c60b..00000000 --- a/app/Jobs/Emails/Registration/Invitations/InviteSummitRegistrationEmail.php +++ /dev/null @@ -1,79 +0,0 @@ -getSummit(); - $owner_email = $invitation->getEmail(); - $payload = []; - $payload['owner_email'] = $owner_email; - $payload['first_name'] = $invitation->getFirstName(); - $payload['last_name'] = $invitation->getLastName(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $base_url = Config::get('registration.dashboard_base_url', null); - $invitation_form_url = Config::get('registration.dashboard_invitation_form_url', null); - - if (empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - if (empty($invitation_form_url)) - throw new \InvalidArgumentException("missing dashboard_invitation_form_url value"); - - $payload['invitation_form_url'] = sprintf($invitation_form_url, $base_url, $invitation->getToken()); - - if(!empty($invitation->getSetPasswordLink())){ - $payload['invitation_form_url'] = sprintf( - "%s?client_id=%s&redirect_uri=%s", - $invitation->getSetPasswordLink(), - Config::get("registration.dashboard_client_id"), - urlencode($payload['invitation_form_url']) - ); - } - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $owner_email); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - - // metadata - const EVENT_SLUG = 'SUMMIT_REGISTRATION_INVITE_REGISTRATION'; - const EVENT_NAME = 'SUMMIT_REGISTRATION_INVITE_REGISTRATION'; - const DEFAULT_TEMPLATE = 'SUMMIT_REGISTRATION_INVITE_REGISTRATION'; -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Invitations/ProcessRegistrationInvitationsJob.php b/app/Jobs/Emails/Registration/Invitations/ProcessRegistrationInvitationsJob.php deleted file mode 100644 index cd7acc80..00000000 --- a/app/Jobs/Emails/Registration/Invitations/ProcessRegistrationInvitationsJob.php +++ /dev/null @@ -1,66 +0,0 @@ -summit_id = $summit->getId(); - $this->payload = $payload; - $this->filter = $filter; - } - - /** - * @param ISummitRegistrationInvitationService $service - * @throws \utils\FilterParserException - */ - public function handle(ISummitRegistrationInvitationService $service){ - - Log::debug(sprintf("ProcessRegistrationInvitationsJob::handle summit id %s", $this->summit_id)); - $filter = !is_null($this->filter) ? FilterParser::parse($this->filter, [ - 'is_accepted' => ['=='], - 'is_sent' => ['=='], - ]) : null; - - $service->send($this->summit_id, $this->payload, $filter); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Invitations/ReInviteSummitRegistrationEmail.php b/app/Jobs/Emails/Registration/Invitations/ReInviteSummitRegistrationEmail.php deleted file mode 100644 index ef1703db..00000000 --- a/app/Jobs/Emails/Registration/Invitations/ReInviteSummitRegistrationEmail.php +++ /dev/null @@ -1,79 +0,0 @@ -getSummit(); - $owner_email = $invitation->getEmail(); - $payload = []; - $payload['owner_email'] = $owner_email; - $payload['first_name'] = $invitation->getFirstName(); - $payload['last_name'] = $invitation->getLastName(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $base_url = Config::get('registration.dashboard_base_url', null); - $invitation_form_url = Config::get('registration.dashboard_invitation_form_url', null); - - if (empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - if (empty($invitation_form_url)) - throw new \InvalidArgumentException("missing dashboard_invitation_form_url value"); - - $payload['invitation_form_url'] = sprintf($invitation_form_url, $base_url, $invitation->getToken()); - - if(!empty($invitation->getSetPasswordLink())){ - $payload['invitation_form_url'] = sprintf( - "%s?client_id=%s&redirect_uri=%s", - $invitation->getSetPasswordLink(), - Config::get("registration.dashboard_client_id"), - urlencode($payload['invitation_form_url']) - ); - } - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $owner_email); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - - // metadata - const EVENT_SLUG = 'SUMMIT_REGISTRATION_REINVITE_REGISTRATION'; - const EVENT_NAME = 'SUMMIT_REGISTRATION_REINVITE_REGISTRATION'; - const DEFAULT_TEMPLATE = 'SUMMIT_REGISTRATION_REINVITE_REGISTRATION'; -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/MemberPromoCodeEmail.php b/app/Jobs/Emails/Registration/MemberPromoCodeEmail.php deleted file mode 100644 index e54df3b5..00000000 --- a/app/Jobs/Emails/Registration/MemberPromoCodeEmail.php +++ /dev/null @@ -1,31 +0,0 @@ -getSummit(); - $payload = []; - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - $payload['promo_code'] = $promo_code->getCode(); - $payload['owner_email'] = $promo_code->getOwnerEmail(); - $payload['owner_fullname'] = $promo_code->getOwnerFullname(); - $payload['registration_url'] = Config::get("registration.dashboard_base_url", null); - if(empty($payload['registration_url'])) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - parent::__construct($payload, $template_identifier, $payload['owner_email']); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/PromoCodeEmailFactory.php b/app/Jobs/Emails/Registration/PromoCodeEmailFactory.php deleted file mode 100644 index 58754881..00000000 --- a/app/Jobs/Emails/Registration/PromoCodeEmailFactory.php +++ /dev/null @@ -1,34 +0,0 @@ -getOwnerType() == 'MEMBER'){ - MemberPromoCodeEmail::dispatch($promo_code); - } - if($promo_code->getOwnerType() == 'SPEAKER'){ - SpeakerPromoCodeEMail::dispatch($promo_code); - } - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Refunds/SummitOrderRefundAccepted.php b/app/Jobs/Emails/Registration/Refunds/SummitOrderRefundAccepted.php deleted file mode 100644 index 5121238a..00000000 --- a/app/Jobs/Emails/Registration/Refunds/SummitOrderRefundAccepted.php +++ /dev/null @@ -1,30 +0,0 @@ -getSummit(); - $payload['owner_full_name'] = $order->getOwnerFullName(); - $payload['owner_email'] = $order->getOwnerEmail(); - $payload['owner_company'] = $order->getOwnerCompany(); - $payload['order_number'] = $order->getNumber(); - $payload['summit_name'] = $order->getSummit()->getName(); - $payload['summit_logo'] = $order->getSummit()->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - $to = Config::get("registration.admin_email"); - if(empty($to)){ - throw new \InvalidArgumentException("registration.admin_email is not set"); - } - - parent::__construct($payload, $template_identifier, $to); - } - - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Refunds/SummitOrderRefundRequestOwner.php b/app/Jobs/Emails/Registration/Refunds/SummitOrderRefundRequestOwner.php deleted file mode 100644 index 35836967..00000000 --- a/app/Jobs/Emails/Registration/Refunds/SummitOrderRefundRequestOwner.php +++ /dev/null @@ -1,106 +0,0 @@ -getSummit(); - $payload['owner_full_name'] = $order->getOwnerFullName(); - $payload['owner_first_name'] = $order->getOwnerFirstName(); - $payload['owner_full_name'] = $order->getOwnerFullName(); - $payload['owner_company'] = $order->getOwnerCompany(); - $payload['owner_email'] = $order->getOwnerEmail(); - $payload['order_number'] = $order->getNumber(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - $payload['order_amount'] = $order->getFinalAmount(); - $payload['order_currency'] = $order->getCurrency(); - $payload['order_currency_symbol'] = "$"; - $payload['tickets'] = []; - - $tickets = []; - foreach ($order->getTickets() as $ticket) { - $ticket_dto = [ - 'number' => $ticket->getNumber(), - 'ticket_type_name' => $ticket->getTicketType()->getName(), - 'has_owner' => false, - 'price' => $ticket->getFinalAmount(), - 'currency' => $ticket->getCurrency(), - 'currency_symbol' => '$', - 'need_details' => false, - ]; - if ($ticket->hasPromoCode()) { - $promo_code = $ticket->getPromoCode(); - $promo_code_dto = [ - 'code' => $promo_code->getCode(), - 'is_discount' => false, - ]; - - if ($promo_code instanceof SummitRegistrationDiscountCode) { - $promo_code_dto['is_discount'] = true; - $promo_code_dto['discount_amount'] = $promo_code->getAmount(); - $promo_code_dto['discount_rate'] = $promo_code->getRate(); - } - - $ticket_dto['promo_code'] = $promo_code_dto; - } - if ($ticket->hasOwner()) { - $ticket_dto['has_owner'] = true; - $ticket_owner = $ticket->getOwner(); - $ticket_dto['owner_email'] = $ticket_owner->getEmail(); - $ticket_dto['owner_full_name'] = $ticket_owner->getFullName(); - $ticket_dto['owner_company'] = $ticket_owner->getCompanyName(); - $ticket_dto['owner_first_name'] = $ticket_owner->getFirstName(); - $ticket_dto['owner_last_name'] = $ticket_owner->getSurname(); - $ticket_dto['need_details'] = $ticket_owner->needToFillDetails(); - } - $tickets[] = $ticket_dto; - } - - $payload['tickets'] = $tickets; - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['owner_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Refunds/SummitTicketRefundAccepted.php b/app/Jobs/Emails/Registration/Refunds/SummitTicketRefundAccepted.php deleted file mode 100644 index e6c3b554..00000000 --- a/app/Jobs/Emails/Registration/Refunds/SummitTicketRefundAccepted.php +++ /dev/null @@ -1,30 +0,0 @@ -getOrder(); - $summit = $order->getSummit(); - $payload = []; - $payload['owner_full_name'] = $order->getOwnerFullName(); - $payload['owner_email'] = $order->getOwnerEmail(); - $payload['owner_company'] = $order->getOwnerCompany(); - $payload['ticket_number'] = $ticket->getNumber(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - $to = Config::get("registration.admin_email"); - if(empty($to)){ - throw new \InvalidArgumentException("registration.admin_email is not set"); - } - - parent::__construct($payload, $template_identifier, $to); - } - -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Refunds/SummitTicketRefundRequestOwner.php b/app/Jobs/Emails/Registration/Refunds/SummitTicketRefundRequestOwner.php deleted file mode 100644 index c994ddb9..00000000 --- a/app/Jobs/Emails/Registration/Refunds/SummitTicketRefundRequestOwner.php +++ /dev/null @@ -1,78 +0,0 @@ -getOrder(); - $summit = $order->getSummit(); - $payload['order_number'] = $order->getNumber(); - $payload['owner_full_name'] = $order->getOwnerFullName(); - $payload['owner_email'] = $order->getOwnerEmail(); - $payload['owner_company'] = $order->getOwnerCompany(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - $payload['ticket_number'] = $ticket->getNumber(); - $payload['ticket_type_name'] = $ticket->getTicketType()->getName(); - $payload['ticket_currency'] = $ticket->getCurrency(); - $payload['ticket_amount'] = $ticket->getFinalAmount(); - $payload['ticket_currency_symbol'] = '$'; - - $payload['ticket_promo_code'] = ''; - if ($ticket->hasPromoCode()) { - $payload['ticket_promo_code'] = $ticket->getPromoCode()->getCode(); - } - - $payload['ticket_owner'] = ''; - if ($ticket->hasOwner()) { - $payload['ticket_owner'] = $ticket->getOwner()->getFullName(); - } - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['owner_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/RegisteredMemberOrderPaidMail.php b/app/Jobs/Emails/Registration/RegisteredMemberOrderPaidMail.php deleted file mode 100644 index 56625f25..00000000 --- a/app/Jobs/Emails/Registration/RegisteredMemberOrderPaidMail.php +++ /dev/null @@ -1,127 +0,0 @@ -getOwnerFullName(); - $payload['owner_company'] = $order->getOwnerCompany(); - $owner_email = $order->getOwnerEmail(); - $payload['owner_email'] = $owner_email; - $summit = $order->getSummit(); - $payload['order_raw_amount'] = $order->getRawAmount(); - $payload['order_amount'] = $order->getFinalAmount(); - $payload['order_currency'] = $order->getCurrency(); - $payload['order_currency_symbol'] = '$'; - $payload['order_taxes'] = $order->getTaxesAmount(); - $payload['order_discount'] = $order->getDiscountAmount(); - $payload['order_number'] = $order->getNumber(); - $payload['order_qr_value'] = $order->getQRCode(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $summit_reassign_ticket_till_date = $summit->getReassignTicketTillDateLocal(); - if(!is_null($summit_reassign_ticket_till_date)) { - $payload['summit_reassign_ticket_till_date'] = $summit_reassign_ticket_till_date->format("l j F Y h:i A T"); - } - - $base_url = Config::get("registration.dashboard_base_url", null); - if (empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - - $back_url = Config::get("registration.dashboard_back_url", null); - if (empty($back_url)) - throw new \InvalidArgumentException("missing dashboard_back_url value"); - - $payload['manage_orders_url'] = sprintf($back_url, $base_url); - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - foreach ($order->getTickets() as $ticket) { - $ticket_dto = [ - 'number' => $ticket->getNumber(), - 'ticket_type_name' => $ticket->getTicketType()->getName(), - 'has_owner' => false, - 'price' => $ticket->getFinalAmount(), - 'currency' => $ticket->getCurrency(), - 'currency_symbol' => '$', - 'need_details' => false, - ]; - - if ($ticket->hasPromoCode()) { - $promo_code = $ticket->getPromoCode(); - $promo_code_dto = [ - 'code' => $promo_code->getCode(), - 'is_discount' => false, - ]; - - if ($promo_code instanceof SummitRegistrationDiscountCode) { - $promo_code_dto['is_discount'] = true; - $promo_code_dto['discount_amount'] = $promo_code->getAmount(); - $promo_code_dto['discount_rate'] = $promo_code->getRate(); - } - - $ticket_dto['promo_code'] = $promo_code_dto; - } - - if ($ticket->hasOwner()) { - $ticket_dto['has_owner'] = true; - $ticket_owner = $ticket->getOwner(); - $ticket_dto['owner_email'] = $ticket_owner->getEmail(); - $ticket_dto['owner_full_name'] = $ticket_owner->getFullName(); - $ticket_dto['owner_first_name'] = $ticket_owner->getFirstName(); - $ticket_dto['owner_company'] = $ticket_owner->getCompanyName(); - $ticket_dto['owner_last_name'] = $ticket_owner->getSurname(); - $ticket_dto['need_details'] = $ticket_owner->needToFillDetails(); - } - $tickets[] = $ticket_dto; - } - $payload['tickets'] = $tickets; - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - Log::debug(sprintf("RegisteredMemberOrderPaidMail::__construct template_identifier %s", $template_identifier)); - parent::__construct($payload, $template_identifier, $owner_email); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - - // metadata - const EVENT_SLUG = 'SUMMIT_REGISTRATION_REGISTERED_MEMBER_ORDER_PAID'; - const EVENT_NAME = 'SUMMIT_REGISTRATION_REGISTERED_MEMBER_ORDER_PAID'; - const DEFAULT_TEMPLATE = 'REGISTRATION_REGISTERED_MEMBER_ORDER_PAID'; -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Reminders/SummitOrderReminderEmail.php b/app/Jobs/Emails/Registration/Reminders/SummitOrderReminderEmail.php deleted file mode 100644 index 60632b80..00000000 --- a/app/Jobs/Emails/Registration/Reminders/SummitOrderReminderEmail.php +++ /dev/null @@ -1,128 +0,0 @@ -getSummit(); - $payload['owner_full_name'] = $order->getOwnerFullName(); - $payload['owner_email'] = $order->getOwnerEmail(); - $payload['owner_company'] = $order->getOwnerCompany(); - $summit_reassign_ticket_till_date = $summit->getReassignTicketTillDateLocal(); - $payload['summit_reassign_ticket_till_date'] = ''; - if(!is_null($summit_reassign_ticket_till_date)) { - $payload['summit_reassign_ticket_till_date'] = $summit_reassign_ticket_till_date->format("l j F Y h:i A T"); - } - $owner_email = $payload['owner_email']; - - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - - $payload['summit_name'] = $order->getSummit()->getName(); - $payload['summit_logo'] = $order->getSummit()->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $base_url = Config::get("registration.dashboard_base_url", null); - if (empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - - $back_url = Config::get("registration.dashboard_back_url", null); - if (empty($back_url)) - throw new \InvalidArgumentException("missing dashboard_back_url value"); - - $payload['manage_orders_url'] = sprintf($back_url, $base_url); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $tickets = []; - - foreach ($order->getTickets() as $ticket) { - if (!$ticket->hasTicketType()) continue; - - $ticket_dto = [ - 'number' => $ticket->getNumber(), - 'ticket_type_name' => $ticket->getTicketType()->getName(), - 'has_owner' => false, - 'price' => $ticket->getFinalAmount(), - 'currency' => $ticket->getCurrency(), - 'currency_symbol' => '$', - 'need_details' => false, - ]; - - if ($ticket->hasPromoCode()) { - $promo_code = $ticket->getPromoCode(); - $promo_code_dto = [ - 'code' => $promo_code->getCode(), - 'is_discount' => false, - ]; - - if ($promo_code instanceof SummitRegistrationDiscountCode) { - $promo_code_dto['is_discount'] = true; - $promo_code_dto['discount_amount'] = $promo_code->getAmount(); - $promo_code_dto['discount_rate'] = $promo_code->getRate(); - } - - $ticket_dto['promo_code'] = $promo_code_dto; - } - - if ($ticket->hasOwner()) { - $ticket_dto['has_owner'] = true; - $ticket_owner = $ticket->getOwner(); - $ticket_dto['owner_full_name'] = $ticket_owner->getFullName(); - $ticket_dto['owner_company'] = $ticket_owner->getCompanyName(); - $ticket_dto['owner_email'] = $ticket_owner->getEmail(); - $ticket_dto['owner_first_name'] = $ticket_owner->getFirstName(); - $ticket_dto['owner_last_name'] = $ticket_owner->getSurname(); - $ticket_dto['need_details'] = $ticket_owner->needToFillDetails(); - } - - $tickets[] = $ticket_dto; - } - - $payload['tickets'] = $tickets; - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $owner_email); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - - // metadata - const EVENT_SLUG = 'SUMMIT_REGISTRATION_ORDER_REMINDER'; - const EVENT_NAME = 'SUMMIT_REGISTRATION_ORDER_REMINDER'; - const DEFAULT_TEMPLATE = 'REGISTRATION_ORDER_REMINDER_EMAIL'; -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/Reminders/SummitTicketReminderEmail.php b/app/Jobs/Emails/Registration/Reminders/SummitTicketReminderEmail.php deleted file mode 100644 index 802a0070..00000000 --- a/app/Jobs/Emails/Registration/Reminders/SummitTicketReminderEmail.php +++ /dev/null @@ -1,80 +0,0 @@ -getOwner(); - $summit = $attendee->getSummit(); - $order = $ticket->getOrder(); - $payload = []; - $summit_reassign_ticket_till_date = $summit->getReassignTicketTillDateLocal(); - if(!is_null($summit_reassign_ticket_till_date)) { - $payload['summit_reassign_ticket_till_date'] = $summit_reassign_ticket_till_date->format("l j F Y h:i A T"); - } - $payload['order_owner_full_name'] = $order->getOwnerFullName(); - $payload['order_owner_company'] = $order->getOwnerCompany(); - $payload['order_owner_email'] = $order->getOwnerEmail(); - $payload['owner_full_name'] = $attendee->getFullName(); - $payload['owner_email'] = $attendee->getEmail(); - $payload['owner_company'] = $attendee->getCompanyName(); - $support_email = $summit->getSupportEmail(); - $payload['support_email'] = !empty($support_email) ? $support_email: Config::get("registration.support_email", null); - $payload['summit_name'] = $summit->getName(); - $payload['summit_logo'] = $summit->getLogoUrl(); - $payload['summit_virtual_site_url'] = $summit->getVirtualSiteUrl(); - $payload['summit_marketing_site_url'] = $summit->getMarketingSiteUrl(); - - $base_url = Config::get('registration.dashboard_base_url', null); - $edit_ticket_link = Config::get('registration.dashboard_attendee_edit_form_url', null); - - if (empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - if (empty($edit_ticket_link)) - throw new \InvalidArgumentException("missing dashboard_attendee_edit_form_url value"); - - $payload['edit_ticket_link'] = sprintf($edit_ticket_link, $base_url, $ticket->getHash()); - - if (empty($payload['support_email'])) - throw new \InvalidArgumentException("missing support_email value"); - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['owner_email']); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - - // metadata - const EVENT_SLUG = 'SUMMIT_REGISTRATION_TICKET_REMINDER'; - const EVENT_NAME = 'SUMMIT_REGISTRATION_TICKET_REMINDER'; - const DEFAULT_TEMPLATE = 'REGISTRATION_TICKET_REMINDER_EMAIL'; -} \ No newline at end of file diff --git a/app/Jobs/Emails/Registration/SpeakerPromoCodeEMail.php b/app/Jobs/Emails/Registration/SpeakerPromoCodeEMail.php deleted file mode 100644 index e064968f..00000000 --- a/app/Jobs/Emails/Registration/SpeakerPromoCodeEMail.php +++ /dev/null @@ -1,32 +0,0 @@ -template_identifier)); - // need to add the dashboard client id and return url - $base_url = Config::get("registration.dashboard_base_url", null); - if(empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - - $back_url = Config::get("registration.dashboard_back_url", null); - if(empty($back_url)) - throw new \InvalidArgumentException("missing dashboard_back_url value"); - - $this->payload['set_password_link'] = $set_password_link; - - $this->payload['set_password_link_to_registration'] = sprintf( - "%s?client_id=%s&redirect_uri=%s", - $set_password_link, - Config::get("registration.dashboard_client_id"), - urlencode(sprintf($back_url, $base_url)) - ); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Schedule/RSVPMail.php b/app/Jobs/Emails/Schedule/RSVPMail.php deleted file mode 100644 index 91fed982..00000000 --- a/app/Jobs/Emails/Schedule/RSVPMail.php +++ /dev/null @@ -1,59 +0,0 @@ -getEvent(); - $summit = $event->getSummit(); - $owner = $rsvp->getOwner(); - $payload['owner_fullname'] = $owner->getFullName(); - $payload['owner_email'] = $owner->getEmail(); - $payload['event_title'] = $event->getTitle(); - $payload['event_date'] = $event->getDateNice(); - $payload['confirmation_number'] = $rsvp->getConfirmationNumber(); - $payload['summit_name'] = $summit->getName(); - $payload['summit_schedule_default_event_detail_url'] = $summit->getScheduleDefaultEventDetailUrl(); - $event_uri = $rsvp->getEventUri(); - - $payload['event_uri'] = ''; - - if (!empty($event_uri)) { - // we got a valid origin - $payload['event_uri'] = $event_uri; - } - // if we dont have a custom event uri, try to get default one - if (empty($payload['event_uri']) && !empty($payload['summit_schedule_default_event_detail_url'])) { - $payload['event_uri'] = str_replace(":event_id", $event->getId(), $payload['summit_schedule_default_event_detail_url']); - } - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['owner_email']); - } -} \ No newline at end of file diff --git a/app/Jobs/Emails/Schedule/RSVPRegularSeatMail.php b/app/Jobs/Emails/Schedule/RSVPRegularSeatMail.php deleted file mode 100644 index dfa80be7..00000000 --- a/app/Jobs/Emails/Schedule/RSVPRegularSeatMail.php +++ /dev/null @@ -1,30 +0,0 @@ -getSummit(); - $payload = []; - $payload['from_email'] = $from_email; - $payload['to_email '] = $to_email; - $payload['summit_name'] = $summit->getName(); - $payload['event_title'] = $event->getTitle(); - $payload['event_description'] = $event->getAbstract(); - $payload['event_url'] = $event_url; - - $template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit); - - parent::__construct($payload, $template_identifier, $payload['to_email']); - } - - protected function getEmailEventSlug(): string - { - return self::EVENT_SLUG; - } - - // metadata - const EVENT_SLUG = 'SUMMIT_SCHEDULE_SHARE_EVENT'; - const EVENT_NAME = 'SUMMIT_SCHEDULE_SHARE_EVENT'; - const DEFAULT_TEMPLATE = 'SUMMIT_SCHEDULE_SHARE_EVENT'; - -} \ No newline at end of file diff --git a/app/Jobs/IngestSummitExternalRegistrationData.php b/app/Jobs/IngestSummitExternalRegistrationData.php deleted file mode 100644 index 92880674..00000000 --- a/app/Jobs/IngestSummitExternalRegistrationData.php +++ /dev/null @@ -1,101 +0,0 @@ -summit_id = $summit_id; - $this->email_to = $email_to; - } - - /** - * @param ISummitRepository $summit_repository - * @param IRegistrationIngestionService $service - * @param ITransactionService $tx_service - */ - public function handle - ( - ISummitRepository $summit_repository, - IRegistrationIngestionService $service, - ITransactionService $tx_service - ) - { - try { - Log::debug("IngestSummitExternalRegistrationData::handle"); - - $tx_service->transaction(function () use ($summit_repository, $service) { - - $summit = $summit_repository->getById($this->summit_id); - if (is_null($summit) || !$summit instanceof Summit) return; - $service->ingestSummit($summit); - if(!empty($this->email_to)) { - Log::debug(sprintf("IngestSummitExternalRegistrationData::handle - sending result email to %s", $this->email_to)); - SuccessfulIIngestionEmail::dispatch($this->email_to, $summit); - } - }); - } - catch (ValidationException $ex){ - Log::warning($ex); - if(!empty($this->email_to)) { - $summit = $summit_repository->getById($this->summit_id); - if (is_null($summit) || !$summit instanceof Summit) return; - UnsuccessfulIIngestionEmail::dispatch($ex->getMessage(), $this->email_to, $summit); - } - } - catch (\Exception $ex){ - Log::error($ex); - if(!empty($this->email_to)) { - $summit = $summit_repository->getById($this->summit_id); - if (is_null($summit) || !$summit instanceof Summit) return; - UnsuccessfulIIngestionEmail::dispatch($ex->getMessage(), $this->email_to, $summit); - } - } - } - -} \ No newline at end of file diff --git a/app/Jobs/Job.php b/app/Jobs/Job.php deleted file mode 100644 index 55ece29a..00000000 --- a/app/Jobs/Job.php +++ /dev/null @@ -1,21 +0,0 @@ -member_id = $member_id; - } - - /** - * @param ISummitOrderRepository $order_repository - * @param IMemberRepository $member_repository - * @param ISummitAttendeeRepository $attendee_repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle - ( - ISummitOrderRepository $order_repository, - IMemberRepository $member_repository, - ISummitAttendeeRepository $attendee_repository, - ITransactionService $tx_service - ) - { - $tx_service->transaction(function() use($order_repository, $member_repository, $attendee_repository){ - - Log::debug(sprintf("NewMemberAssocSummitOrders::handle trying to get member id %s", $this->member_id)); - $member = $member_repository->getById($this->member_id); - if(is_null($member) || !$member instanceof Member) return; - - // associate orders - $orders = $order_repository->getAllByOwnerEmail($member->getEmail()); - if(!is_null($orders)) { - foreach ($orders as $order) { - if (!$order instanceof SummitOrder) continue; - Log::debug(sprintf("NewMemberAssocSummitOrders::handle got order %s for member %s", $order->getNumber(), $this->member_id)); - $member->addSummitRegistrationOrder($order); - } - } - - // associate attendees/tickets - $attendees = $attendee_repository->getByEmail($member->getEmail()); - if(!is_null($attendees)) { - foreach ($attendees as $attendee) { - if (!$attendee instanceof SummitAttendee) continue; - Log::debug(sprintf("NewMemberAssocSummitOrders::handle got attendee %s for member", $attendee->getId(), $this->member_id)); - $attendee->setMember($member); - } - } - - }); - } -} diff --git a/app/Jobs/ProcessEventDataImport.php b/app/Jobs/ProcessEventDataImport.php deleted file mode 100644 index a5f19d09..00000000 --- a/app/Jobs/ProcessEventDataImport.php +++ /dev/null @@ -1,80 +0,0 @@ -summit_id = $summit_id; - $this->filename = $filename; - $this->send_speaker_email = boolval($payload['send_speaker_email']); - } - - /** - * @param ISummitService $service - */ - public function handle - ( - ISummitService $service - ) - { - try { - Log::debug(sprintf("ProcessEventDataImport::handle summit %s filename %s send_speaker_email %s", $this->summit_id, $this->filename, $this->send_speaker_email)); - $service->processEventData($this->summit_id, $this->filename, $this->send_speaker_email); - } catch (ValidationException $ex) { - Log::warning($ex); - } catch (\Exception $ex) { - Log::error($ex); - } - } -} \ No newline at end of file diff --git a/app/Jobs/ProcessOrderRefundRequest.php b/app/Jobs/ProcessOrderRefundRequest.php deleted file mode 100644 index 9edaa616..00000000 --- a/app/Jobs/ProcessOrderRefundRequest.php +++ /dev/null @@ -1,159 +0,0 @@ -order_id = $order_id; - $this->requested_n_days_before_summit = $requested_n_days_before_summit; - } - - - /** - * @param IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy - * @param ISummitOrderRepository $repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle( - IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy, - ISummitOrderRepository $repository, - ITransactionService $tx_service - ) - { - $tx_service->transaction(function() use($default_payment_gateway_strategy, $repository){ - - Log::debug(sprintf("ProcessOrderRefundRequest::handle: processing for order id %s", $this->order_id)); - - $order = $repository->getByIdExclusiveLock($this->order_id); - - if(is_null($order) || !$order instanceof SummitOrder || !$order->isRefundRequested()){ - Log::debug(sprintf("ProcessOrderRefundRequest::handle: order id %s not found", $this->order_id)); - } - - $summit = $order->getSummit(); - - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $default_payment_gateway_strategy - ); - if(is_null($payment_gateway)){ - Log::warning(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - return; - } - - $policy = $summit->getRefundPolicyForRefundRequest($this->requested_n_days_before_summit); - - if(is_null($policy)){ - - Log::debug - ( - sprintf - ( - "ProcessOrderRefundRequest::handle: policy not found for order id %s - requested_n_days_before_summit %s summit id %s", - $this->order_id, - $this->requested_n_days_before_summit, - $summit->getId()) - ); - return; - } - $rate = $policy->getRefundRate(); - if($rate <= 0){ - Log::debug - ( - sprintf - ( - "ProcessOrderRefundRequest::handle: policy id %s has not a valid refund rate %s", - $policy->getId(), - $rate - ) - ); - return; - } - - $amount_2_refund = ($rate/100.00) * $order->getFinalAmount(); - - Log::debug - ( - sprintf - ( - "ProcessOrderRefundRequest::handle: requesting refund to payment gateway with following data amount_2_refund %s - cart id %s - currency %s ", - $amount_2_refund, - $order->getPaymentGatewayCartId(), - $order->getCurrency()) - ); - - if(!$order->hasPaymentInfo()) - { - Log::warning(sprintf("order %s has not payment info ", $order->getId())); - return; - } - - try { - $payment_gateway->refundPayment( - $order->getPaymentGatewayCartId(), - $amount_2_refund, - $order->getCurrency() - ); - } - catch(\Exception $ex){ - log::error($ex); - return; - } - - $order->refund($amount_2_refund); - - }); - } -} diff --git a/app/Jobs/ProcessSummitOrderPaymentConfirmation.php b/app/Jobs/ProcessSummitOrderPaymentConfirmation.php deleted file mode 100644 index 8044eaab..00000000 --- a/app/Jobs/ProcessSummitOrderPaymentConfirmation.php +++ /dev/null @@ -1,66 +0,0 @@ -order_id = $order_id; - } - - /** - * @param ISummitOrderService $orderService - * @throws \Exception - */ - public function handle - ( - ISummitOrderService $orderService - ) - { - try{ - Log::debug(sprintf("ProcessSummitOrderPaymentConfirmation::handle order %s", $this->order_id)); - $orderService->processOrderPaymentConfirmation($this->order_id); - } - catch (\Exception $ex){ - Log::error($ex); - throw $ex; - } - } -} diff --git a/app/Jobs/ProcessTicketDataImport.php b/app/Jobs/ProcessTicketDataImport.php deleted file mode 100644 index 37ba58f4..00000000 --- a/app/Jobs/ProcessTicketDataImport.php +++ /dev/null @@ -1,75 +0,0 @@ -summit_id = $summit_id; - $this->filename = $filename; - } - - /** - * @param ISummitOrderService $service - */ - public function handle - ( - ISummitOrderService $service - ) - { - try { - Log::debug(sprintf("ProcessTicketDataImport::handle summit %s filename %s", $this->summit_id, $this->filename)); - $service->processTicketData($this->summit_id, $this->filename); - } catch (ValidationException $ex) { - Log::warning($ex); - } catch (\Exception $ex) { - Log::error($ex); - } - } -} \ No newline at end of file diff --git a/app/Jobs/ProcessTicketRefundRequest.php b/app/Jobs/ProcessTicketRefundRequest.php deleted file mode 100644 index 3e645096..00000000 --- a/app/Jobs/ProcessTicketRefundRequest.php +++ /dev/null @@ -1,116 +0,0 @@ -ticket_id = $ticket_id; - $this->requested_n_days_before_summit = $requested_n_days_before_summit; - } - - /** - * @param IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy - * @param ISummitAttendeeTicketRepository $repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle( - IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy, - ISummitAttendeeTicketRepository $repository, - ITransactionService $tx_service - ) - { - $tx_service->transaction(function () use ($default_payment_gateway_strategy, $repository) { - - $ticket = $repository->getByIdExclusiveLock($this->ticket_id); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket || !$ticket->isRefundRequested()) return; - - - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $default_payment_gateway_strategy - ); - - if (is_null($payment_gateway)) { - Log::warning(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - return; - } - - $policy = $summit->getRefundPolicyForRefundRequest($this->requested_n_days_before_summit); - if (is_null($policy)) return; - $rate = $policy->getRefundRate(); - if ($rate <= 0) return; - $amount_2_refund = ($rate / 100.00) * $ticket->getFinalAmount(); - - if (!$order->hasPaymentInfo()) { - Log::warning(sprintf("order %s has not payment info ", $order->getId())); - return; - } - - try { - $payment_gateway->refundPayment( - $order->getPaymentGatewayCartId(), - $amount_2_refund, - $ticket->getCurrency() - ); - } catch (\Exception $ex) { - Log::warning($ex); - return; - } - - $ticket->refund($amount_2_refund); - - }); - } -} diff --git a/app/Jobs/PublishUserCreated.php b/app/Jobs/PublishUserCreated.php deleted file mode 100644 index 145a04c2..00000000 --- a/app/Jobs/PublishUserCreated.php +++ /dev/null @@ -1,52 +0,0 @@ -user_id, $this->user_email)); - - try { - $service->registerExternalUserById($this->user_id); - } - catch (\Exception $ex){ - Log::error($ex); - } - } -} diff --git a/app/Jobs/PublishUserDeleted.php b/app/Jobs/PublishUserDeleted.php deleted file mode 100644 index a38bfb11..00000000 --- a/app/Jobs/PublishUserDeleted.php +++ /dev/null @@ -1,57 +0,0 @@ -user_id, $this->user_email)); - - try { - $service->deleteExternalUserById($this->user_id); - } - catch (EntityNotFoundException $ex){ - Log::warning($ex); - } - catch (Exception $ex){ - Log::error($ex); - } - } -} diff --git a/app/Jobs/PublishUserUpdated.php b/app/Jobs/PublishUserUpdated.php deleted file mode 100644 index 61e39b1a..00000000 --- a/app/Jobs/PublishUserUpdated.php +++ /dev/null @@ -1,52 +0,0 @@ -user_id, $this->user_email)); - - try { - $service->registerExternalUserById($this->user_id); - } - catch (\Exception $ex){ - Log::error($ex); - } - } -} diff --git a/app/Jobs/SynchAllAttendeesStatus.php b/app/Jobs/SynchAllAttendeesStatus.php deleted file mode 100644 index a45ddcba..00000000 --- a/app/Jobs/SynchAllAttendeesStatus.php +++ /dev/null @@ -1,70 +0,0 @@ -summit_id = $summit_id; - } - - /** - * @param ISummitRepository $repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle( - ISummitRepository $repository, - ITransactionService $tx_service - ) - { - Log::debug(sprintf("SynchAllAttendeesStatus::handle summit %s", $this->summit_id)); - $tx_service->transaction(function() use($repository){ - $summit = $repository->getById($this->summit_id); - if(is_null($summit)) - throw new EntityNotFoundException(sprintf("Summit %s not found", $this->summit_id)); - - $summit->synchAllAttendeesStatus(); - }); - } -} - diff --git a/app/Jobs/SynchAllPresentationActions.php b/app/Jobs/SynchAllPresentationActions.php deleted file mode 100644 index a82dca2e..00000000 --- a/app/Jobs/SynchAllPresentationActions.php +++ /dev/null @@ -1,68 +0,0 @@ -summit_id = $summit_id; - } - - /** - * @param ISummitRepository $repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle( - ISummitRepository $repository, - ITransactionService $tx_service - ) - { - Log::debug(sprintf("SynchAllPresentationActions::handle summit %s", $this->summit_id)); - $tx_service->transaction(function() use($repository){ - $summit = $repository->getById($this->summit_id); - if(is_null($summit)) - throw new EntityNotFoundException(sprintf("Summit %s not found", $this->summit_id)); - - $summit->synchAllPresentationActions(); - }); - } -} \ No newline at end of file diff --git a/app/Jobs/SynchPresentationActions.php b/app/Jobs/SynchPresentationActions.php deleted file mode 100644 index 6f0b77c6..00000000 --- a/app/Jobs/SynchPresentationActions.php +++ /dev/null @@ -1,75 +0,0 @@ -event_id = $event_id; - } - - /** - * @param ISummitRepository $repository - * @param ITransactionService $tx_service - * @throws \Exception - */ - public function handle( - ISummitEventRepository $repository, - ITransactionService $tx_service - ) - { - Log::debug(sprintf("SynchPresentationActions::handle event id %s", $this->event_id)); - $tx_service->transaction(function() use($repository){ - $event = $repository->getById($this->event_id); - - if(is_null($event)) - throw new EntityNotFoundException(sprintf("Event %s ", $this->event_id)); - - if(!$event instanceof Presentation){ - return; - } - - $event->getSummit()->synchAllPresentationActions(); - }); - } -} \ No newline at end of file diff --git a/app/Jobs/VideoStreamUrlMUXProcessingForSummitJob.php b/app/Jobs/VideoStreamUrlMUXProcessingForSummitJob.php deleted file mode 100644 index 1c707a5e..00000000 --- a/app/Jobs/VideoStreamUrlMUXProcessingForSummitJob.php +++ /dev/null @@ -1,106 +0,0 @@ -summit_id = $summit_id; - $this->email_to = $email_to; - $this->mux_token_id = $mux_token_id; - $this->mux_token_secret = $mux_token_secret; - } - - /** - * @param IPresentationVideoMediaUploadProcessor $service - */ - public function handle(IPresentationVideoMediaUploadProcessor $service){ - - Log::debug - ( - sprintf - ( - "VideoStreamUrlMUXProcessingForSummitJob::handle summit %s token id %s token secret %s mail_to %s", - $this->summit_id, - $this->mux_token_id, - $this->mux_token_secret, - $this->email_to - ) - ); - - try { - $service->processSummitEventsStreamURLs - ( - $this->summit_id, - new MuxCredentials( - $this->mux_token_id, - $this->mux_token_secret - ), - $this->email_to - ); - } - catch (\Exception $ex){ - Log::error($ex); - } - } -} \ No newline at end of file diff --git a/app/Listeners/.gitkeep b/app/Listeners/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/app/Listeners/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/app/Listeners/QueryExecutedListener.php b/app/Listeners/QueryExecutedListener.php deleted file mode 100644 index e26af542..00000000 --- a/app/Listeners/QueryExecutedListener.php +++ /dev/null @@ -1,65 +0,0 @@ -sql; - $bindings = $event->bindings; - - // Format binding data for sql insertion - foreach ($bindings as $i => $binding) { - if ($binding instanceof DateTime) { - $bindings[$i] = $binding->format('\'Y-m-d H:i:s\''); - } else { - if (is_string($binding)) { - $bindings[$i] = "'$binding'"; - } - } - } - - $time = $event->time; - $connection = $event->connectionName; - $data = compact('bindings', 'time', 'connection'); - // Insert bindings into query - $query = str_replace(array('%', '?'), array('%%', '%s'), $query); - $query = vsprintf($query, $bindings); - Log::info($query, $data); - - //trace - if (Config::get("server.db_log_trace_enabled", false)){ - $trace = ''; - $entries = debug_backtrace(); - unset($entries[0]); - foreach ($entries as $entry) { - if (!isset($entry['file']) || !isset($entry['line'])) continue; - $trace .= $entry['file'] . ' ' . $entry['line'] . PHP_EOL; - } - Log::debug($trace); - } - } - } -} diff --git a/app/Mail/MUXExportExcerptMail.php b/app/Mail/MUXExportExcerptMail.php deleted file mode 100644 index 29b1de30..00000000 --- a/app/Mail/MUXExportExcerptMail.php +++ /dev/null @@ -1,64 +0,0 @@ -mail_to = $mail_to; - $this->step = $step; - $this->excerpt = nl2br($excerpt); - } - - public function build() - { - $subject = sprintf("[%s] Mux Export Process - %s", Config::get('app.tenant_name'), $this->step); - Log::warning(sprintf("MUXExportExcerptMail::build to %s", $this->mail_to)); - return $this->from(Config::get("mail.from")) - ->to($this->mail_to) - ->subject($subject) - ->view('emails.mux_export_excerpt'); - } -} diff --git a/app/ModelSerializers/AbstractMemberSerializer.php b/app/ModelSerializers/AbstractMemberSerializer.php deleted file mode 100644 index 34290485..00000000 --- a/app/ModelSerializers/AbstractMemberSerializer.php +++ /dev/null @@ -1,120 +0,0 @@ - 'first_name:json_string', - 'LastName' => 'last_name:json_string', - 'Gender' => 'gender:json_string', - 'GitHubUser' => 'github_user:json_string', - 'Bio' => 'bio:json_string', - 'LinkedInProfile' => 'linked_in:json_string', - 'IrcHandle' => 'irc:json_string', - 'TwitterHandle' => 'twitter:json_string', - 'State' => 'state:json_string', - 'Country' => 'country:json_string', - 'Active' => 'active:json_boolean', - 'EmailVerified' => 'email_verified:json_boolean', - 'ProfilePhotoUrl' => 'pic:json_url', - 'MembershipType' => 'membership_type:json_string', - ]; - - protected static $allowed_relations = [ - 'groups', - 'affiliations', - 'ccla_teams', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $member = $this->object; - if(!$member instanceof Member) return []; - - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('groups', $relations)) - $values['groups'] = $member->getGroupsIds(); - - if(in_array('ccla_teams', $relations)) - $values['ccla_teams'] = $member->getCCLATeamsIds(); - - if(in_array('affiliations', $relations)){ - $res = []; - foreach ($member->getCurrentAffiliations() as $affiliation){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($affiliation) - ->serialize('organization'); - } - $values['affiliations'] = $res; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'groups': { - if(!in_array('groups', $relations)) break; - $groups = []; - unset($values['groups']); - foreach ($member->getGroups() as $g) { - $groups[] = SerializerRegistry::getInstance()->getSerializer($g)->serialize(null, [], ['none']); - } - $values['groups'] = $groups; - } - break; - case 'ccla_teams': { - if(!in_array('ccla_teams', $relations)) break; - $teams = []; - unset($values['ccla_teams']); - foreach ($member->getCCLATeams() as $t) { - $teams[] = SerializerRegistry::getInstance()->getSerializer($t)->serialize('company', [], ['none']); - } - $values['ccla_teams'] = $teams; - } - break; - case 'all_affiliations': - { - $res = []; - foreach ($member->getAllAffiliations() as $affiliation){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($affiliation) - ->serialize('organization'); - } - $values['affiliations'] = $res; - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/AdminMemberSerializer.php b/app/ModelSerializers/AdminMemberSerializer.php deleted file mode 100644 index 21d6aa47..00000000 --- a/app/ModelSerializers/AdminMemberSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'email:json_string', - 'UserExternalId' => 'user_external_id:json_int' - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/AffiliationSerializer.php b/app/ModelSerializers/AffiliationSerializer.php deleted file mode 100644 index 0c30d061..00000000 --- a/app/ModelSerializers/AffiliationSerializer.php +++ /dev/null @@ -1,55 +0,0 @@ - 'start_date:datetime_epoch', - 'EndDate' => 'end_date:datetime_epoch', - 'JobTitle' => 'job_title:json_string', - 'OwnerId' => 'owner_id:json_int', - 'IsCurrent' => 'is_current:json_boolean', - 'OrganizationId' => 'organization_id:json_int' - ]; - - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $affiliation = $this->object; - if (!$affiliation instanceof Affiliation) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'organization': - { - if($affiliation->hasOrganization()) { - unset($values['organization_id']); - $values['organization'] = SerializerRegistry::getInstance()->getSerializer($affiliation->getOrganization())->serialize($expand, [], ['none']); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/BaseSerializerTypeSelector.php b/app/ModelSerializers/BaseSerializerTypeSelector.php deleted file mode 100644 index b59f60c1..00000000 --- a/app/ModelSerializers/BaseSerializerTypeSelector.php +++ /dev/null @@ -1,64 +0,0 @@ -resource_server_context = $resource_server_context; - $this->member_repository = $member_repository; - } - - /** - * @return string - */ - public function getSerializerType() - { - $serializer_type = SerializerRegistry::SerializerType_Public; - $current_member = $this->resource_server_context->getCurrentUser(); - if(!is_null($current_member)){ - if($current_member->isAdmin()){ - $serializer_type = SerializerRegistry::SerializerType_Private; - } - } - return $serializer_type; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/CCLA/TeamSerializer.php b/app/ModelSerializers/CCLA/TeamSerializer.php deleted file mode 100644 index 595ff74c..00000000 --- a/app/ModelSerializers/CCLA/TeamSerializer.php +++ /dev/null @@ -1,81 +0,0 @@ - 'name:json_string', - 'CompanyId' => 'company_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(), array $relations = array(), array $params = array() ) - { - $team = $this->object; - - if(!$team instanceof Team) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - $members = []; - - foreach($team->getMembers() as $member){ - $members[] = $member->getId(); - } - - $values['members'] = $members; - - if (!empty($expand)) { - $expand_to = explode(',', $expand); - foreach ($expand_to as $relation) { - switch (trim($relation)) { - case 'company':{ - if(isset($values['company_id'])) - { - unset($values['company_id']); - $values['company'] = SerializerRegistry::getInstance()->getSerializer($team->getCompany())->serialize($expand); - } - } - break; - case 'members':{ - unset( $values['members']); - $members = []; - foreach($team->getMembers() as $member){ - $members[] = SerializerRegistry::getInstance()->getSerializer($member)->serialize($expand); - } - - $values['members'] = $members; - - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/ChatTeams/ChatTeamInvitationSerializer.php b/app/ModelSerializers/ChatTeams/ChatTeamInvitationSerializer.php deleted file mode 100644 index d25dc536..00000000 --- a/app/ModelSerializers/ChatTeams/ChatTeamInvitationSerializer.php +++ /dev/null @@ -1,81 +0,0 @@ - 'team_id:json_int', - 'InviteeId' => 'invitee_id:json_int', - 'InviterId' => 'inviter_id:json_int', - 'Permission' => 'permission:json_string', - 'IsAccepted' => 'is_accepted:json_boolean', - 'CreatedUTC' => 'created_at:datetime_epoch', - 'LastEditedUTC' => 'updated_at:datetime_epoch', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $invitation = $this->object; - if(! $invitation instanceof ChatTeamInvitation) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!empty($expand)) { - $expand = explode(',', $expand); - foreach ($expand as $relation) { - switch (trim($relation)) { - case 'inviter':{ - if(isset($values['inviter_id'])) - { - unset($values['inviter_id']); - $values['inviter'] = SerializerRegistry::getInstance()->getSerializer($invitation->getInviter())->serialize('groups'); - } - } - break; - case 'invitee':{ - if(isset($values['invitee_id'])) - { - unset($values['invitee_id']); - $values['invitee'] = SerializerRegistry::getInstance()->getSerializer($invitation->getInvitee())->serialize('groups'); - } - } - break; - case 'team':{ - if(isset($values['team_id'])) - { - unset($values['team_id']); - $values['team'] = SerializerRegistry::getInstance()->getSerializer($invitation->getTeam())->serialize($expand = 'owner,members,member, groups'); - } - } - break; - } - } - } - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/ChatTeams/ChatTeamMemberSerializer.php b/app/ModelSerializers/ChatTeams/ChatTeamMemberSerializer.php deleted file mode 100644 index a3a5e036..00000000 --- a/app/ModelSerializers/ChatTeams/ChatTeamMemberSerializer.php +++ /dev/null @@ -1,71 +0,0 @@ - 'team_id:json_int', - 'MemberId' => 'member_id:json_int', - 'Permission' => 'permission:json_string', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $team_member = $this->object; - if(! $team_member instanceof ChatTeamMember) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $expand_to = explode(',', $expand); - foreach ($expand_to as $relation) { - switch (trim($relation)) { - case 'member':{ - if(isset($values['member_id'])) - { - unset($values['member_id']); - $values['member'] = SerializerRegistry::getInstance()->getSerializer($team_member->getMember())->serialize($expand); - } - } - break; - case 'team': { - if (isset($values['team_id'])) { - unset($values['team_id']); - - $values['team'] = SerializerRegistry::getInstance()->getSerializer($team_member->getTeam())->serialize(self::filterExpandByPrefix($expand, 'team.')); - } - } - break; - } - } - } - - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/ChatTeams/ChatTeamPushNotificationMessageSerializer.php b/app/ModelSerializers/ChatTeams/ChatTeamPushNotificationMessageSerializer.php deleted file mode 100644 index da8f8666..00000000 --- a/app/ModelSerializers/ChatTeams/ChatTeamPushNotificationMessageSerializer.php +++ /dev/null @@ -1,75 +0,0 @@ - 'team_id:json_int', - 'OwnerId' => 'owner_id:json_int', - 'Priority' => 'priority:json_string', - 'Message' => 'body:json_string', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $message = $this->object; - if(! $message instanceof ChatTeamPushNotificationMessage) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if($message->isSent()){ - $values['sent_date'] = $message->getSentDate()->getTimestamp(); - } - - if (!empty($expand)) { - $expand = explode(',', $expand); - foreach ($expand as $relation) { - switch (trim($relation)) { - case 'owner':{ - if(isset($values['owner_id'])) - { - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($message->getOwner())->serialize(); - } - } - break; - case 'team':{ - if(isset($values['team_id'])) - { - unset($values['team_id']); - $values['team'] = SerializerRegistry::getInstance()->getSerializer($message->getTeam())->serialize(); - } - } - break; - } - } - } - - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/ChatTeams/ChatTeamSerializer.php b/app/ModelSerializers/ChatTeams/ChatTeamSerializer.php deleted file mode 100644 index cf9dbc98..00000000 --- a/app/ModelSerializers/ChatTeams/ChatTeamSerializer.php +++ /dev/null @@ -1,87 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'OwnerId' => 'owner_id:json_int', - 'CreatedUTC' => 'created_at:datetime_epoch', - 'LastEditedUTC' => 'updated_at:datetime_epoch', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $team = $this->object; - - if(!$team instanceof ChatTeam) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - $members = []; - $current_member = null; - - if(isset($params['current_member'])) - $current_member = $params['current_member']; - - foreach($team->getMembers() as $member){ - $members[] = SerializerRegistry::getInstance()->getSerializer($member)->serialize($expand); - } - - $values['members'] = $members; - - if (!empty($expand)) { - $expand_to = explode(',', $expand); - foreach ($expand_to as $relation) { - switch (trim($relation)) { - case 'owner':{ - if(isset($values['owner_id'])) - { - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($team->getOwner())->serialize($expand); - } - } - break; - } - } - } - - if(!is_null($current_member) && $team->isAdmin($current_member)){ - // add pending invitations - $invitations = []; - foreach($team->getInvitations() as $invitation){ - $invitations[] = SerializerRegistry::getInstance()->getSerializer($invitation)->serialize('inviter,invitee'); - } - $values['invitations'] = $invitations; - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Companies/CompanySerializer.php b/app/ModelSerializers/Companies/CompanySerializer.php deleted file mode 100644 index 027a5f8f..00000000 --- a/app/ModelSerializers/Companies/CompanySerializer.php +++ /dev/null @@ -1,58 +0,0 @@ - 'name:json_string', - 'Url' => 'url:json_string', - 'DisplayOnSite' => 'display_on_site:json_boolean', - 'Featured' => 'featured:json_boolean', - 'City' => 'city:json_string', - 'State' => 'state:json_string', - 'Country' => 'country:json_string', - 'Description' => 'description:json_string', - 'Industry' => 'industry:json_string', - 'Contributions' => 'contributions:json_string', - 'ContactEmail' => 'contact_email:json_string', - 'MemberLevel' => 'member_level:json_string', - 'AdminEmail' => 'admin_email:json_string', - 'Overview' => 'overview:json_string', - 'Products' => 'products:json_string', - 'Commitment' => 'commitment:json_string', - 'CommitmentAuthor' => 'commitment_author:json_string', - 'LogoUrl' => 'logo:json_url', - 'BigLogoUrl' => 'big_logo:json_url', - 'Color' => 'color:json_color', - ]; - - /** - * @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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $company = $this->object; - if(!$company instanceof Company) return $values; - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Companies/ProjectSponsorshipTypeSerializer.php b/app/ModelSerializers/Companies/ProjectSponsorshipTypeSerializer.php deleted file mode 100644 index 2d7f2281..00000000 --- a/app/ModelSerializers/Companies/ProjectSponsorshipTypeSerializer.php +++ /dev/null @@ -1,46 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'Active' => 'is_active:json_boolean', - 'Order' => 'order:json_int', - 'SponsoredProjectId' => 'sponsored_project_id:json_int', - 'SupportingCompaniesIds' => 'supporting_companies', - ]; - - public function __construct($object, IResourceServerContext $resource_server_context) - { - parent::__construct($object, $resource_server_context); - $this->expand_mappings = [ - 'sponsored_project' => new One2ManyExpandSerializer('sponsored_project', function () use ($object) { - return $object->getSponsoredProject(); - }, "sponsored_project_id"), - 'supporting_companies' => new Many2OneExpandSerializer('supporting_companies', function () use ($object) { - return $object->getSupportingCompanies(); - }, "supporting_companies"), - ]; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Companies/SponsoredProjectSerializer.php b/app/ModelSerializers/Companies/SponsoredProjectSerializer.php deleted file mode 100644 index 0d141436..00000000 --- a/app/ModelSerializers/Companies/SponsoredProjectSerializer.php +++ /dev/null @@ -1,40 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'Slug' => 'slug:json_string', - 'Active' => 'is_active:json_boolean', - 'SponsorshipTypesIds' => 'sponsorship_types', - ]; - - public function __construct($object, IResourceServerContext $resource_server_context) - { - parent::__construct($object, $resource_server_context); - - $this->expand_mappings = [ - 'sponsorship_types' => new Many2OneExpandSerializer('sponsorship_types', function () use ($object) { - return $object->getSponsorshipTypes(); - }, "sponsorship_types"), - ]; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Companies/SupportingCompanySerializer.php b/app/ModelSerializers/Companies/SupportingCompanySerializer.php deleted file mode 100644 index 0ee9ba9d..00000000 --- a/app/ModelSerializers/Companies/SupportingCompanySerializer.php +++ /dev/null @@ -1,47 +0,0 @@ - 'company_id:json_int', - 'SponsorshipId' => 'sponsorship_type_id:json_int', - 'Order' => 'order:json_int', - ]; - - /*** - * SupportingCompanySerializer constructor. - * @param $object - * @param IResourceServerContext $resource_server_context - */ - public function __construct($object, IResourceServerContext $resource_server_context) - { - parent::__construct($object, $resource_server_context); - - $this->expand_mappings = [ - 'company' => new One2ManyExpandSerializer('company', function () use ($object) { - return $object->getCompany(); - }, "company_id"), - 'sponsorship_type' => new One2ManyExpandSerializer('sponsorship_type', function () use ($object) { - return $object->getSponsorshipType(); - }, "sponsorship_type_id"), - ]; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/ExtraQuestionAnswerSerializer.php b/app/ModelSerializers/ExtraQuestionAnswerSerializer.php deleted file mode 100644 index 97684714..00000000 --- a/app/ModelSerializers/ExtraQuestionAnswerSerializer.php +++ /dev/null @@ -1,65 +0,0 @@ - 'value:json_string', - 'QuestionId' => 'question_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(), array $relations = array(), array $params = array()) - { - $answer = $this->object; - if (!$answer instanceof ExtraQuestionAnswer) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!count($relations)) $relations = $this->getAllowedRelations(); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'question': - { - - if ($answer->hasQuestion()) { - unset($values['question_id']); - $values['question'] = SerializerRegistry::getInstance()->getSerializer($answer->getQuestion()) - ->serialize(AbstractSerializer::getExpandForPrefix('question', $expand)); - } - } - break; - - - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/ExtraQuestionTypeSerializer.php b/app/ModelSerializers/ExtraQuestionTypeSerializer.php deleted file mode 100644 index 2a78a691..00000000 --- a/app/ModelSerializers/ExtraQuestionTypeSerializer.php +++ /dev/null @@ -1,79 +0,0 @@ - 'name:json_string', - 'Type' => 'type:json_string', - 'Label' => 'label:json_string', - 'Placeholder' => 'placeholder:json_string', - 'Order' => 'order:json_int', - 'Mandatory' => 'mandatory:json_boolean', - ]; - - protected static $allowed_relations = [ - 'values', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $question = $this->object; - if (!$question instanceof ExtraQuestionType) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('values', $relations) && $question->allowsValues()) { - $question_values = []; - foreach ($question->getValues() as $value) { - $question_values[] = $value->getId(); - } - $values['values'] = $question_values; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'values': - { - if (!$question->allowsValues()) - break; - unset($values['values']); - $question_values = []; - foreach ($question->getValues() as $value) { - $question_values[] = SerializerRegistry::getInstance()->getSerializer($value)->serialize(); - } - $values['values'] = $question_values; - } - break; - - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/ExtraQuestionTypeValueSerializer.php b/app/ModelSerializers/ExtraQuestionTypeValueSerializer.php deleted file mode 100644 index 2591b8c8..00000000 --- a/app/ModelSerializers/ExtraQuestionTypeValueSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'label:json_string', - 'Value' => 'value:json_string', - 'Order' => 'order:json_int', - 'QuestionId' => 'question_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/FileSerializer.php b/app/ModelSerializers/FileSerializer.php deleted file mode 100644 index 7d1b454f..00000000 --- a/app/ModelSerializers/FileSerializer.php +++ /dev/null @@ -1,26 +0,0 @@ - 'title:json_string', - 'Name' => 'name:json_string', - 'Url' => 'url:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/GroupSerializer.php b/app/ModelSerializers/GroupSerializer.php deleted file mode 100644 index d06d1f17..00000000 --- a/app/ModelSerializers/GroupSerializer.php +++ /dev/null @@ -1,60 +0,0 @@ - 'title:json_string', - 'Description' => 'description:json_string', - 'Code' => 'code:json_string', - ); - - protected static $allowed_relations = array - ( - 'members', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $group = $this->object; - if(! $group instanceof Group) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if(!count($relations)) $relations = $this->getAllowedRelations(); - - if(in_array('members', $relations)) { - $members = []; - - foreach ($group->getMembers() as $member) { - $members[] = SerializerRegistry::getInstance()->getSerializer($member)->serialize(); - } - $values['members'] = $members; - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/ISerializerTypeSelector.php b/app/ModelSerializers/ISerializerTypeSelector.php deleted file mode 100644 index 10f32dc8..00000000 --- a/app/ModelSerializers/ISerializerTypeSelector.php +++ /dev/null @@ -1,21 +0,0 @@ - 'name:json_string', - 'IsoCode' => 'iso_code:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/LegalAgreementSerializer.php b/app/ModelSerializers/LegalAgreementSerializer.php deleted file mode 100644 index cae332b2..00000000 --- a/app/ModelSerializers/LegalAgreementSerializer.php +++ /dev/null @@ -1,49 +0,0 @@ - 'owner_id:json_int', - 'DocumentId' => 'document_id:json_int', - ]; - - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $legal_agreement = $this->object; - if (!$legal_agreement instanceof LegalAgreement) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'document': - { - $document = App::make(ILegalDocumentRepository::class)->getById($values['document_id']); - unset($values['document_id']); - $values['document'] = SerializerRegistry::getInstance()->getSerializer($document)->serialize($expand, [], ['none']); - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/LegalDocumentSerializer.php b/app/ModelSerializers/LegalDocumentSerializer.php deleted file mode 100644 index 07c66648..00000000 --- a/app/ModelSerializers/LegalDocumentSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'id:json_int', - 'Title' => 'title:json_string', - 'Slug' => 'slug:json_string', - 'Content' => 'content:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitAbstractLocationSerializer.php b/app/ModelSerializers/Locations/SummitAbstractLocationSerializer.php deleted file mode 100644 index c13feda1..00000000 --- a/app/ModelSerializers/Locations/SummitAbstractLocationSerializer.php +++ /dev/null @@ -1,31 +0,0 @@ - 'name:json_string', - 'ShortName' => 'short_name:json_string', - 'Description' => 'description:json_string', - 'LocationType' => 'location_type', - 'Order' => 'order:json_int', - 'ClassName' => 'class_name:json_string', - ); -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitAirportSerializer.php b/app/ModelSerializers/Locations/SummitAirportSerializer.php deleted file mode 100644 index cc60ea47..00000000 --- a/app/ModelSerializers/Locations/SummitAirportSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'airport_type:json_string', - ); -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitBookableVenueRoomAttributeTypeSerializer.php b/app/ModelSerializers/Locations/SummitBookableVenueRoomAttributeTypeSerializer.php deleted file mode 100644 index 4b8f2055..00000000 --- a/app/ModelSerializers/Locations/SummitBookableVenueRoomAttributeTypeSerializer.php +++ /dev/null @@ -1,62 +0,0 @@ - 'type:json_string', - 'SummitId' => 'summit_id:json_int', - ]; - - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $attr_type = $this->object; - if(!$attr_type instanceof SummitBookableVenueRoomAttributeType) - return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - $attr_values = []; - foreach ($attr_type->getValues() as $attr_val){ - $attr_values[] = $attr_val->getId(); - } - $values['values'] = $attr_values; - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'values': { - unset($values['values']); - $attr_values = []; - foreach ($attr_type->getValues() as $attr_val){ - $attr_values[] = SerializerRegistry::getInstance()->getSerializer($attr_val)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['values'] = $attr_values; - } - break; - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitBookableVenueRoomAttributeValueSerializer.php b/app/ModelSerializers/Locations/SummitBookableVenueRoomAttributeValueSerializer.php deleted file mode 100644 index 6194a79d..00000000 --- a/app/ModelSerializers/Locations/SummitBookableVenueRoomAttributeValueSerializer.php +++ /dev/null @@ -1,57 +0,0 @@ - 'value:json_string', - 'TypeId' => 'type_id:json_int', - ]; - - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $attr_value = $this->object; - if(!$attr_value instanceof SummitBookableVenueRoomAttributeValue) - return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'type': { - unset($values['type_id']); - $values['type'] = SerializerRegistry::getInstance()->getSerializer - ( - $attr_value->getType() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitBookableVenueRoomAvailableSlotSerializer.php b/app/ModelSerializers/Locations/SummitBookableVenueRoomAvailableSlotSerializer.php deleted file mode 100644 index 1d1fd31b..00000000 --- a/app/ModelSerializers/Locations/SummitBookableVenueRoomAvailableSlotSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'start_date:datetime_epoch', - 'EndDate' => 'end_date:datetime_epoch', - 'Free' => 'is_free:json_boolean', - 'Status' => 'status:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitBookableVenueRoomSerializer.php b/app/ModelSerializers/Locations/SummitBookableVenueRoomSerializer.php deleted file mode 100644 index 4ff1965c..00000000 --- a/app/ModelSerializers/Locations/SummitBookableVenueRoomSerializer.php +++ /dev/null @@ -1,48 +0,0 @@ - 'time_slot_cost:json_int', - 'Currency' => 'currency:json_string', - ]; - - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $room = $this->object; - if(!$room instanceof SummitBookableVenueRoom) - return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - $attributes = []; - foreach ($room->getAttributes() as $attribute){ - $attributes[] = SerializerRegistry::getInstance()->getSerializer($attribute)->serialize - ( - AbstractSerializer::filterExpandByPrefix($expand, 'attributes') - ); - } - $values['attributes'] = $attributes; - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitExternalLocationSerializer.php b/app/ModelSerializers/Locations/SummitExternalLocationSerializer.php deleted file mode 100644 index 97072156..00000000 --- a/app/ModelSerializers/Locations/SummitExternalLocationSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'capacity:json_int', - ); -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitGeoLocatedLocationSerializer.php b/app/ModelSerializers/Locations/SummitGeoLocatedLocationSerializer.php deleted file mode 100644 index b64b3882..00000000 --- a/app/ModelSerializers/Locations/SummitGeoLocatedLocationSerializer.php +++ /dev/null @@ -1,70 +0,0 @@ - 'address_1:json_string', - 'Address2' => 'address_2:json_string', - 'ZipCode' => 'zip_code', - 'City' => 'city:json_string', - 'State' => 'state:json_string', - 'Country' => 'country:json_string', - 'Lng' => 'lng', - 'Lat' => 'lat', - 'WebsiteUrl' => 'website_url:json_string', - 'DisplayOnSite' => 'display_on_site:json_boolean', - 'DetailsPage' => 'details_page:json_boolean', - 'LocationMessage' => 'location_message:json_string', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations); - $location = $this->object; - if(!$location instanceof SummitGeoLocatedLocation) return []; - // maps - $maps = []; - foreach($location->getMaps() as $image) - { - if(!$image->hasPicture()) continue; - $maps[] = SerializerRegistry::getInstance()->getSerializer($image)->serialize(); - } - $values['maps'] = $maps; - // images - $images = []; - foreach($location->getImages() as $image) - { - if(!$image->hasPicture()) continue; - $images[] = SerializerRegistry::getInstance()->getSerializer($image)->serialize(); - } - $values['images'] = $images; - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitHotelSerializer.php b/app/ModelSerializers/Locations/SummitHotelSerializer.php deleted file mode 100644 index ea22e946..00000000 --- a/app/ModelSerializers/Locations/SummitHotelSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'booking_link:json_string', - 'HotelType' => 'hotel_type:json_string', - 'SoldOut' => 'sold_out:json_boolean', - ); - -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitLocationImageSerializer.php b/app/ModelSerializers/Locations/SummitLocationImageSerializer.php deleted file mode 100644 index bedd926e..00000000 --- a/app/ModelSerializers/Locations/SummitLocationImageSerializer.php +++ /dev/null @@ -1,54 +0,0 @@ - 'name:json_text', - 'Description' => 'description:json_text', - 'ClassName' => 'class_name:json_text', - 'LocationId' => 'location_id:json_int', - 'Order' => 'order:json_int', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - - if($this->object->hasPicture()) - { - $picture = $this->object->getPicture(); - $values['image_url'] = $picture->getUrl(); - } - else - { - $values['image_url'] = null; - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitRoomReservationSerializer.php b/app/ModelSerializers/Locations/SummitRoomReservationSerializer.php deleted file mode 100644 index b2723df1..00000000 --- a/app/ModelSerializers/Locations/SummitRoomReservationSerializer.php +++ /dev/null @@ -1,75 +0,0 @@ - 'room_id:json_int', - 'OwnerId' => 'owner_id:json_int', - 'Amount' => 'amount:json_int', - 'RefundedAmount' => 'refunded_amount:json_int', - 'Currency' => 'currency:json_string', - 'Status' => 'status:json_string', - 'StartDatetime' => 'start_datetime:datetime_epoch', - 'EndDatetime' => 'end_datetime:datetime_epoch', - 'ApprovedPaymentDate' => 'approved_payment_date:datetime_epoch', - 'LastError' => 'last_error:json_string', - 'PaymentGatewayClientToken' => 'payment_gateway_client_token: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 = []) - { - $reservation = $this->object; - if(!$reservation instanceof SummitRoomReservation) - return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'room': { - unset($values['room_id']); - $values['room'] = SerializerRegistry::getInstance()->getSerializer($reservation->getRoom())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'owner': { - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($reservation->getOwner())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitVenueFloorSerializer.php b/app/ModelSerializers/Locations/SummitVenueFloorSerializer.php deleted file mode 100644 index 7c693d7e..00000000 --- a/app/ModelSerializers/Locations/SummitVenueFloorSerializer.php +++ /dev/null @@ -1,67 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'Number' => 'number:json_int', - 'VenueId' => 'venue_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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $floor = $this->object; - - if(!$floor instanceof SummitVenueFloor) return []; - - // floor image - $values['image']= ($floor->getImage() !== null) ? - $floor->getImage()->getUrl() - : null; - // rooms - $rooms = []; - $expand_rooms = !empty($expand) && strstr('rooms',$expand) !== false; - - foreach($floor->getRooms() as $room) - { - - $rooms[] = $expand_rooms ? SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand, $fields, $relations, $params) : - intval($room->getId()); - - } - - if(count($rooms) > 0) - $values['rooms'] = $rooms; - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitVenueRoomSerializer.php b/app/ModelSerializers/Locations/SummitVenueRoomSerializer.php deleted file mode 100644 index 0baa1ae6..00000000 --- a/app/ModelSerializers/Locations/SummitVenueRoomSerializer.php +++ /dev/null @@ -1,66 +0,0 @@ - '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() ) - { - $room = $this->object; - if(!$room instanceof SummitVenueRoom) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if($room->hasImage()){ - $values['image'] = SerializerRegistry::getInstance()->getSerializer($room->getImage())->serialize(); - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'floor': { - if($room->hasFloor()) { - unset($values['floor_id']); - $values['floor'] = SerializerRegistry::getInstance()->getSerializer($room->getFloor())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'venue': { - if($room->hasVenue()) { - unset($values['venue_id']); - $values['venue'] = SerializerRegistry::getInstance()->getSerializer($room->getVenue())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Locations/SummitVenueSerializer.php b/app/ModelSerializers/Locations/SummitVenueSerializer.php deleted file mode 100644 index ffb0171b..00000000 --- a/app/ModelSerializers/Locations/SummitVenueSerializer.php +++ /dev/null @@ -1,97 +0,0 @@ - 'is_main::json_boolean', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $venue = $this->object; - if(!$venue instanceof SummitVenue) return []; - // rooms - $rooms = []; - foreach($venue->getRooms() as $room) - { - $rooms[] = $room->getId(); - } - - if(count($rooms) > 0) - $values['rooms'] = $rooms; - - // floors - $floors = []; - foreach($venue->getFloors() as $floor) - { - $floors[] = $floor->getId(); - } - - if(count($floors) > 0) - $values['floors'] = $floors; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'rooms': - { - if($venue->hasRooms()) { - $rooms = []; - foreach ($venue->getRooms() as $room) { - $rooms[] = SerializerRegistry::getInstance()->getSerializer($room)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['rooms'] = $rooms; - } - } - break; - case 'floors': - { - if($venue->hasFloors()) { - $floors = []; - foreach ($venue->getFloors() as $floor) { - $floors[] = SerializerRegistry::getInstance()->getSerializer($floor)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['floors'] = $floors; - } - } - break; - - } - } - } - - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/ApplianceSerializer.php b/app/ModelSerializers/Marketplace/ApplianceSerializer.php deleted file mode 100644 index 51a35290..00000000 --- a/app/ModelSerializers/Marketplace/ApplianceSerializer.php +++ /dev/null @@ -1,22 +0,0 @@ -object; - if(!$service instanceof CloudServiceOffered) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('pricing_schemas', $relations)){ - $res = []; - foreach ($service->getPricingSchemas() as $schema){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($schema) - ->serialize($expand); - } - $values['pricing_schemas'] = $res; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/CloudServiceSerializer.php b/app/ModelSerializers/Marketplace/CloudServiceSerializer.php deleted file mode 100644 index 2762e2d0..00000000 --- a/app/ModelSerializers/Marketplace/CloudServiceSerializer.php +++ /dev/null @@ -1,70 +0,0 @@ -object; - if(!$cloud_service instanceof CloudService) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('data_centers', $relations)){ - $res = []; - foreach ($cloud_service->getDataCenters() as $dataCenter){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($dataCenter) - ->serialize($expand); - } - $values['data_centers'] = $res; - } - - if(in_array('data_center_regions', $relations)){ - $res = []; - foreach ($cloud_service->getDataCenterRegions() as $region){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($region) - ->serialize($expand); - } - $values['data_center_regions'] = $res; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/CompanyServiceSerializer.php b/app/ModelSerializers/Marketplace/CompanyServiceSerializer.php deleted file mode 100644 index 72f5152e..00000000 --- a/app/ModelSerializers/Marketplace/CompanyServiceSerializer.php +++ /dev/null @@ -1,81 +0,0 @@ - 'name:json_string', - 'Overview' => 'overview:json_string', - 'Call2ActionUrl' => 'call_2_action_url:json_string', - 'CompanyId' => 'company_id:json_int', - 'TypeId' => 'type_id:json_int', - ]; - - protected static $allowed_relations = [ - 'reviews', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $company_service = $this->object; - if(!$company_service instanceof CompanyService) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'company': { - unset($values['company_id']); - $values['company'] = SerializerRegistry::getInstance()->getSerializer($company_service->getCompany())->serialize(null, [], ['none']);; - } - break; - case 'type': { - unset($values['type_id']); - $values['type'] = SerializerRegistry::getInstance()->getSerializer($company_service->getType())->serialize(null, [], ['none']);; - } - break; - case 'reviews': - { - if(in_array('reviews', $relations)){ - $reviews = []; - foreach ($company_service->getApprovedReviews() as $r) { - $reviews[] = SerializerRegistry::getInstance()->getSerializer($r)->serialize(); - } - $values['reviews'] = $reviews; - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/ConfigurationManagementTypeSerializer.php b/app/ModelSerializers/Marketplace/ConfigurationManagementTypeSerializer.php deleted file mode 100644 index e192f22f..00000000 --- a/app/ModelSerializers/Marketplace/ConfigurationManagementTypeSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'type:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/ConsultantClientSerializer.php b/app/ModelSerializers/Marketplace/ConsultantClientSerializer.php deleted file mode 100644 index 6068e7d6..00000000 --- a/app/ModelSerializers/Marketplace/ConsultantClientSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'name:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/ConsultantSerializer.php b/app/ModelSerializers/Marketplace/ConsultantSerializer.php deleted file mode 100644 index 611ffd78..00000000 --- a/app/ModelSerializers/Marketplace/ConsultantSerializer.php +++ /dev/null @@ -1,116 +0,0 @@ -object; - if(!$consultant instanceof Consultant) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('offices', $relations)){ - $res = []; - foreach ($consultant->getOffices() as $office){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($office) - ->serialize($expand); - } - $values['offices'] = $res; - } - - if(in_array('clients', $relations)){ - $res = []; - foreach ($consultant->getClients() as $client){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($client) - ->serialize($expand); - } - $values['clients'] = $res; - } - - if(in_array('spoken_languages', $relations)){ - $res = []; - foreach ($consultant->getSpokenLanguages() as $lang){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($lang) - ->serialize($expand); - } - $values['spoken_languages'] = $res; - } - - if(in_array('configuration_management_expertise', $relations)){ - $res = []; - foreach ($consultant->getConfigurationManagementExpertise() as $exp){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($exp) - ->serialize($expand); - } - $values['configuration_management_expertise'] = $res; - } - - if(in_array('expertise_areas', $relations)){ - $res = []; - foreach ($consultant->getExpertiseAreas() as $area){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($area) - ->serialize($expand); - } - $values['expertise_areas'] = $res; - } - - if(in_array('services_offered', $relations)){ - $res = []; - foreach ($consultant->getServicesOffered() as $service){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($service) - ->serialize($expand); - } - $values['services_offered'] = $res; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/ConsultantServiceOfferedTypeSerializer.php b/app/ModelSerializers/Marketplace/ConsultantServiceOfferedTypeSerializer.php deleted file mode 100644 index 5736007f..00000000 --- a/app/ModelSerializers/Marketplace/ConsultantServiceOfferedTypeSerializer.php +++ /dev/null @@ -1,72 +0,0 @@ -object; - if(!$service instanceof ConsultantServiceOfferedType) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('service_offered_type', $relations)){ - $values['service_offered_type'] = SerializerRegistry::getInstance() - ->getSerializer($service->getServiceOffered()) - ->serialize($expand); - } - - if(in_array('region', $relations)){ - $values['region'] = SerializerRegistry::getInstance() - ->getSerializer($service->getRegion()) - ->serialize($expand); - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/DataCenterLocationSerializer.php b/app/ModelSerializers/Marketplace/DataCenterLocationSerializer.php deleted file mode 100644 index ccc79590..00000000 --- a/app/ModelSerializers/Marketplace/DataCenterLocationSerializer.php +++ /dev/null @@ -1,65 +0,0 @@ - 'city:json_string', - 'State' => 'state:json_string', - 'Country' => 'country:json_string', - 'Lat' => 'lat:json_float', - 'Lng' => 'lng:json_float', - 'RegionId' => 'region_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(), array $relations = array(), array $params = array()) - { - - $location = $this->object; - if(!$location instanceof DataCenterLocation) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'region': - unset($values['region_id']); - $values['region'] = SerializerRegistry ::getInstance() - ->getSerializer($location->getRegion()) - ->serialize($expand); - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/DataCenterRegionSerializer.php b/app/ModelSerializers/Marketplace/DataCenterRegionSerializer.php deleted file mode 100644 index 8f0142ba..00000000 --- a/app/ModelSerializers/Marketplace/DataCenterRegionSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'name:json_string', - 'Endpoint' => 'endpoint:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/DistributionSerializer.php b/app/ModelSerializers/Marketplace/DistributionSerializer.php deleted file mode 100644 index 444a29f8..00000000 --- a/app/ModelSerializers/Marketplace/DistributionSerializer.php +++ /dev/null @@ -1,23 +0,0 @@ - 'type:json_string', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/HyperVisorTypeSerializer.php b/app/ModelSerializers/Marketplace/HyperVisorTypeSerializer.php deleted file mode 100644 index 530479b5..00000000 --- a/app/ModelSerializers/Marketplace/HyperVisorTypeSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'type:json_string', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/MarketPlaceReviewSerializer.php b/app/ModelSerializers/Marketplace/MarketPlaceReviewSerializer.php deleted file mode 100644 index 44ef6b19..00000000 --- a/app/ModelSerializers/Marketplace/MarketPlaceReviewSerializer.php +++ /dev/null @@ -1,29 +0,0 @@ - 'title:json_string', - 'Comment' => 'comment:json_string', - 'Rating' => 'rating:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/OfficeSerializer.php b/app/ModelSerializers/Marketplace/OfficeSerializer.php deleted file mode 100644 index e615dd1f..00000000 --- a/app/ModelSerializers/Marketplace/OfficeSerializer.php +++ /dev/null @@ -1,36 +0,0 @@ - 'address:json_string', - 'Address2' => 'address2:json_string', - 'State' => 'state:json_string', - 'ZipCode' => 'zip_code:json_string', - 'City' => 'city:json_string', - 'Country' => 'country:json_string', - 'Lat' => 'lat:json_float', - 'Lng' => 'lng:json_float', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/OpenStackImplementationApiCoverageSerializer.php b/app/ModelSerializers/Marketplace/OpenStackImplementationApiCoverageSerializer.php deleted file mode 100644 index ac45ff2b..00000000 --- a/app/ModelSerializers/Marketplace/OpenStackImplementationApiCoverageSerializer.php +++ /dev/null @@ -1,72 +0,0 @@ - 'api_coverage:json_int', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $api_coverage = $this->object; - if(!$api_coverage instanceof OpenStackImplementationApiCoverage) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if(!$api_coverage->hasReleaseSupportedApiVersion()) return $values; - - $release_api_version = $api_coverage->getReleaseSupportedApiVersion(); - if($release_api_version->hasApiVersion() && $release_api_version->getApiVersion()->hasComponent()){ - $values["component"] = SerializerRegistry::getInstance() - ->getSerializer($release_api_version->getApiVersion()->getComponent()) - ->serialize(); - } - else if($release_api_version->hasComponent()){ - $values["component"] = SerializerRegistry::getInstance() - ->getSerializer($release_api_version->getComponent()) - ->serialize(); - } - - if($release_api_version->hasRelease()){ - $values["release"] = SerializerRegistry::getInstance() - ->getSerializer($release_api_version->getRelease()) - ->serialize(); - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/OpenStackImplementationSerializer.php b/app/ModelSerializers/Marketplace/OpenStackImplementationSerializer.php deleted file mode 100644 index 318e97e1..00000000 --- a/app/ModelSerializers/Marketplace/OpenStackImplementationSerializer.php +++ /dev/null @@ -1,99 +0,0 @@ - 'is_compatible_with_storage:json_boolean', - 'CompatibleWithCompute' => 'is_compatible_with_compute:json_boolean', - 'CompatibleWithFederatedIdentity' => 'is_compatible_with_federated_identity:json_boolean', - 'CompatibleWithPlatform' => 'is_compatible_with_platform:json_boolean', - 'OpenStackPowered' => 'is_openstack_powered:json_boolean', - 'OpenStackTested' => 'is_openstack_tested:json_boolean', - 'OpenStackTestedLabel' => 'openstack_tested_info:json_string', - ]; - - protected static $allowed_relations = [ - 'capabilities', - 'guests', - 'hypervisors', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - - $implementation = $this->object; - if(!$implementation instanceof OpenStackImplementation) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('capabilities', $relations)){ - $res = []; - foreach ($implementation->getCapabilities() as $capability){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($capability) - ->serialize($expand); - } - $values['capabilities'] = $res; - } - - if(in_array('hypervisors', $relations)){ - $res = []; - foreach ($implementation->getHypervisors() as $hypervisor){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($hypervisor) - ->serialize($expand); - } - $values['hypervisors'] = $res; - } - - if(in_array('guests', $relations)){ - $res = []; - foreach ($implementation->getGuests() as $guest){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($guest) - ->serialize($expand); - } - $values['guests'] = $res; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/PricingSchemaTypeSerializer.php b/app/ModelSerializers/Marketplace/PricingSchemaTypeSerializer.php deleted file mode 100644 index bc9fc683..00000000 --- a/app/ModelSerializers/Marketplace/PricingSchemaTypeSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'type:json_string', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/PrivateCloudServiceSerializer.php b/app/ModelSerializers/Marketplace/PrivateCloudServiceSerializer.php deleted file mode 100644 index 6b754079..00000000 --- a/app/ModelSerializers/Marketplace/PrivateCloudServiceSerializer.php +++ /dev/null @@ -1,21 +0,0 @@ - 'name:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/RegionalSupportSerializer.php b/app/ModelSerializers/Marketplace/RegionalSupportSerializer.php deleted file mode 100644 index 32eb9f43..00000000 --- a/app/ModelSerializers/Marketplace/RegionalSupportSerializer.php +++ /dev/null @@ -1,71 +0,0 @@ -object; - if(!$regional_support instanceof RegionalSupport) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('supported_channel_types', $relations)){ - $res = []; - foreach ($regional_support->getSupportedChannelTypes() as $channel_type){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($channel_type) - ->serialize(); - } - $values['supported_channel_types'] = $res; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'region': - unset($values['region_id']); - $values['region'] = SerializerRegistry::getInstance() - ->getSerializer($regional_support->getRegion()) - ->serialize(); - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/RegionalSupportedCompanyServiceSerializer.php b/app/ModelSerializers/Marketplace/RegionalSupportedCompanyServiceSerializer.php deleted file mode 100644 index 5bd54205..00000000 --- a/app/ModelSerializers/Marketplace/RegionalSupportedCompanyServiceSerializer.php +++ /dev/null @@ -1,62 +0,0 @@ -object; - if(!$regional_service instanceof RegionalSupportedCompanyService) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('supported_regions', $relations)){ - $res = []; - foreach ($regional_service->getRegionalSupports() as $region){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($region) - ->serialize($expand = 'region'); - } - $values['supported_regions'] = $res; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/RemoteCloudServiceSerializer.php b/app/ModelSerializers/Marketplace/RemoteCloudServiceSerializer.php deleted file mode 100644 index cf7eaf50..00000000 --- a/app/ModelSerializers/Marketplace/RemoteCloudServiceSerializer.php +++ /dev/null @@ -1,30 +0,0 @@ - 'hardware_spec:json_string', - 'PricingModels' => 'pricing_models:json_string', - 'PublishedSla' => 'published_sla:json_string', - 'VendorManagedUpgrades' => 'is_vendor_managed_upgrades:json_boolean', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/ServiceOfferedTypeSerializer.php b/app/ModelSerializers/Marketplace/ServiceOfferedTypeSerializer.php deleted file mode 100644 index d444aa7a..00000000 --- a/app/ModelSerializers/Marketplace/ServiceOfferedTypeSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'type:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/SpokenLanguageSerializer.php b/app/ModelSerializers/Marketplace/SpokenLanguageSerializer.php deleted file mode 100644 index 30660d59..00000000 --- a/app/ModelSerializers/Marketplace/SpokenLanguageSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'name:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Marketplace/SupportChannelTypeSerializer.php b/app/ModelSerializers/Marketplace/SupportChannelTypeSerializer.php deleted file mode 100644 index 980f9f0e..00000000 --- a/app/ModelSerializers/Marketplace/SupportChannelTypeSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'type:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/OrganizationSerializer.php b/app/ModelSerializers/OrganizationSerializer.php deleted file mode 100644 index 13df3c15..00000000 --- a/app/ModelSerializers/OrganizationSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'name:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/OwnMemberSerializer.php b/app/ModelSerializers/OwnMemberSerializer.php deleted file mode 100644 index 07ad9a53..00000000 --- a/app/ModelSerializers/OwnMemberSerializer.php +++ /dev/null @@ -1,280 +0,0 @@ - 'first_name:json_string', - 'LastName' => 'last_name:json_string', - 'Gender' => 'gender:json_string', - 'GitHubUser' => 'github_user:json_string', - 'Bio' => 'bio:json_string', - 'LinkedInProfile' => 'linked_in:json_string', - 'IrcHandle' => 'irc:json_string', - 'TwitterHandle' => 'twitter:json_string', - 'State' => 'state:json_string', - 'Country' => 'country:json_string', - 'Active' => 'active:json_boolean', - 'EmailVerified' => 'email_verified:json_boolean', - 'Email' => 'email:json_string', - ]; - - protected static $allowed_relations = [ - 'team_memberships', - 'groups_events', - 'favorite_summit_events', - 'feedback', - 'schedule_summit_events', - 'summit_tickets', - 'rsvp', - 'sponsor_memberships', - 'legal_agreements', - 'track_chairs', - 'schedule_shareable_link', - ]; - - private static $expand_group_events = [ - 'type', - 'location', - 'sponsors', - 'track', - 'track_groups', - 'groups', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $member = $this->object; - if(!$member instanceof Member) return []; - - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $values = parent::serialize($expand, $fields, $relations, $params); - $summit = isset($params['summit'])? $params['summit'] :null; - $speaker = !is_null($summit)? $summit->getSpeakerByMember($member): null; - $attendee = !is_null($summit)? $summit->getAttendeeByMember($member): null; - $groups_events = !is_null($summit)? $summit->getGroupEventsFor($member): null; - - if(!is_null($speaker)) - $values['speaker_id'] = $speaker->getId(); - - if(!is_null($attendee)) - $values['attendee_id'] = $attendee->getId(); - - if(!is_null($groups_events) && in_array('groups_events', $relations)){ - $res = []; - foreach ($groups_events as $group_event){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($group_event) - ->serialize(implode(',', self::$expand_group_events)); - } - $values['groups_events'] = $res; - } - - if(in_array('team_memberships', $relations)){ - $res = []; - foreach ($member->getTeamMemberships() as $team_membership){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($team_membership) - ->serialize('team,team.member'); - } - $values['team_memberships'] = $res; - } - - if(in_array('sponsor_memberships', $relations)){ - $res = []; - foreach ($member->getSponsorMemberships() as $sponsor_membership){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($sponsor_membership) - ->serialize('summit,company,sponsorship'); - } - $values['sponsor_memberships'] = $res; - } - - if(in_array('favorite_summit_events', $relations) && !is_null($summit)){ - $res = []; - foreach ($member->getFavoritesEventsIds($summit) as $event_id){ - $res[] = intval($event_id); - } - $values['favorite_summit_events'] = $res; - } - - if(in_array('schedule_summit_events', $relations) && !is_null($summit)){ - $schedule = []; - - foreach ($member->getScheduledEventsIds($summit) as $event_id){ - $schedule[] = intval($event_id); - } - - $values['schedule_summit_events'] = $schedule; - } - - if(in_array('summit_tickets', $relations) && !is_null($summit)){ - $res = []; - foreach ($member->getPaidSummitTicketsIds($summit) as $ticket_id){ - $res[] = intval($ticket_id); - } - $values['summit_tickets'] = $res; - } - - if(in_array('schedule_shareable_link', $relations) && !is_null($summit)){ - $link = $member->getScheduleShareableLinkBy($summit); - if(!is_null($link)) { - $values['schedule_shareable_link'] = SerializerRegistry::getInstance() - ->getSerializer($link)->serialize(); - } - } - - if(in_array('legal_agreements', $relations)){ - $res = []; - foreach ($member->getLegalAgreements() as $agreement) - $res[] = intval($agreement->getId()); - $values['legal_agreements'] = $res; - } - - if(in_array('track_chairs', $relations)){ - $res = []; - foreach ($member->getTrackChairs() as $track_chair){ - $res[] = intval($track_chair->getId()); - } - $values['track_chairs'] = $res; - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'attendee': { - if (!is_null($attendee)) - { - unset($values['attendee_id']); - $values['attendee'] = SerializerRegistry::getInstance()->getSerializer($attendee)->serialize - ( - AbstractSerializer::filterExpandByPrefix($expand, $relation),[],['none'] - ); - } - } - break; - case 'speaker': { - if (!is_null($speaker)) - { - unset($values['speaker_id']); - $values['speaker'] = SerializerRegistry::getInstance()->getSerializer($speaker)->serialize - ( - AbstractSerializer::filterExpandByPrefix($expand, $relation),[],['none'] - ); - } - } - break; - case 'feedback': { - if(!in_array('feedback', $relations)) break; - if(is_null($summit)) break; - $feedback = array(); - foreach ($member->getFeedbackBySummit($summit) as $f) { - $feedback[] = SerializerRegistry::getInstance()->getSerializer($f)->serialize( - AbstractSerializer::filterExpandByPrefix($expand, $relation) - ); - } - $values['feedback'] = $feedback; - } - break; - case 'favorite_summit_events':{ - if(!in_array('favorite_summit_events', $relations)) break; - if(is_null($summit)) break; - $favorites = []; - foreach ($member->getFavoritesSummitEventsBySummit($summit) as $events){ - $favorites[] = SerializerRegistry::getInstance() - ->getSerializer($events) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['favorite_summit_events'] = $favorites; - } - case 'schedule_summit_events':{ - if(!in_array('schedule_summit_events', $relations)) break; - if(is_null($summit)) break; - $schedule = []; - foreach ($member->getScheduleBySummit($summit) as $events){ - $schedule[] = SerializerRegistry::getInstance() - ->getSerializer($events) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['schedule_summit_events'] = $schedule; - } - break; - case 'summit_tickets':{ - if(!in_array('summit_tickets', $relations)) break; - if(is_null($summit)) break; - $summit_tickets = []; - foreach ($member->getPaidSummitTickets($summit) as $ticket){ - $summit_tickets[] = SerializerRegistry::getInstance() - ->getSerializer($ticket) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['summit_tickets'] = $summit_tickets; - } - break; - case 'rsvp':{ - if(!in_array('rsvp', $relations)) break; - if(is_null($summit)) break; - $rsvps = []; - foreach ($member->getRsvpBySummit($summit) as $rsvp){ - $rsvps[] = SerializerRegistry::getInstance() - ->getSerializer($rsvp) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['rsvp'] = $rsvps; - } - break; - case 'legal_agreements':{ - if(!in_array('legal_agreements', $relations)) break; - if(is_null($summit)) break; - $res = []; - foreach ($member->getLegalAgreements() as $agreement){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($agreement) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['legal_agreements'] = $res; - } - break; - case 'track_chairs':{ - if(!in_array('track_chairs', $relations)) break; - $res = []; - foreach ($member->getTrackChairs() as $trackChair){ - $res[] = SerializerRegistry::getInstance() - ->getSerializer($trackChair) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['track_chairs'] = $res; - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/PublicMemberSerializer.php b/app/ModelSerializers/PublicMemberSerializer.php deleted file mode 100644 index 56fee439..00000000 --- a/app/ModelSerializers/PublicMemberSerializer.php +++ /dev/null @@ -1,22 +0,0 @@ - 'message:json_string', - 'Priority' => 'priority:json_string', - 'Platform' => 'platform:json_string', - 'Created' => 'created:datetime_epoch', - 'SentDate' => 'sent_date:datetime_epoch', - 'IsSent' => 'is_sent:json_boolean', - 'Approved' => 'approved:json_boolean', - 'OwnerId' => 'owner_id:json_int', - 'ApprovedById' => 'approved_by_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 = []) - { - $notification = $this->object; - if(! $notification instanceof PushNotificationMessage) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - - case 'owner': { - if(!$notification->hasOwner()) continue; - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($notification->getOwner())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'approved_by': { - if(!$notification->hasApprovedBy()) continue; - unset($values['approved_by_id']); - $values['approved_by'] = SerializerRegistry::getInstance()->getSerializer($notification->getApprovedBy())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/ResourceServer/ApiEndpointAuthzGroupSerializer.php b/app/ModelSerializers/ResourceServer/ApiEndpointAuthzGroupSerializer.php deleted file mode 100644 index 4530b9bf..00000000 --- a/app/ModelSerializers/ResourceServer/ApiEndpointAuthzGroupSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'id:json_int', - 'Slug' => 'slug:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/ResourceServer/ApiEndpointSerializer.php b/app/ModelSerializers/ResourceServer/ApiEndpointSerializer.php deleted file mode 100644 index b4fdb7cc..00000000 --- a/app/ModelSerializers/ResourceServer/ApiEndpointSerializer.php +++ /dev/null @@ -1,92 +0,0 @@ - 'id:json_int', - 'Name' => 'name:json_string', - 'Description' => 'description:json_string', - 'Active' => 'active:json_boolean', - 'HttpMethod' => 'http_method:json_string', - 'Route' => 'route:json_string', - ]; - - protected static $allowed_relations = [ - 'scopes', - 'authz_groups', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $endpoint = $this->object; - if(!$endpoint instanceof ApiEndpoint) return []; - - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('scopes', $relations)) - $values['scopes'] = $endpoint->getScopeIds(); - - if(in_array('authz_groups', $relations)) - $values['authz_groups'] = $endpoint->getAuthGroupIds(); - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch (trim($relation)) { - - case 'scopes': { - if(!in_array('scopes', $relations)) break; - $scopes = []; - unset($values['scopes']); - foreach ($endpoint->getScopes() as $e) { - $scopes[] = SerializerRegistry::getInstance()->getSerializer($e)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['scopes'] = $scopes; - } - break; - case 'authz_groups': { - if(!in_array('authz_groups', $relations)) break; - $authz_groups = []; - unset($values['authz_groups']); - foreach ($endpoint->getAuthzGroups() as $e) { - $authz_groups[] = SerializerRegistry::getInstance()->getSerializer($e)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['authz_groups'] = $authz_groups; - } - break; - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/ResourceServer/ApiScopeSerializer.php b/app/ModelSerializers/ResourceServer/ApiScopeSerializer.php deleted file mode 100644 index 6c9eb261..00000000 --- a/app/ModelSerializers/ResourceServer/ApiScopeSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'id:json_int', - 'Name' => 'name:json_string', - 'Description' => 'description:json_string', - 'Active' => 'active:json_boolean', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/ResourceServer/ApiSerializer.php b/app/ModelSerializers/ResourceServer/ApiSerializer.php deleted file mode 100644 index 36f91e6a..00000000 --- a/app/ModelSerializers/ResourceServer/ApiSerializer.php +++ /dev/null @@ -1,90 +0,0 @@ - 'id:json_int', - 'Name' => 'name:json_string', - 'Description' => 'description:json_string', - 'Active' => 'active:json_boolean', - ]; - - protected static $allowed_relations = [ - 'scopes', - 'endpoints', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $api = $this->object; - if(!$api instanceof Api) return []; - - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('scopes', $relations)) - $values['scopes'] = $api->getScopeIds(); - - if(in_array('endpoints', $relations)) - $values['endpoints'] = $api->getEndpointsIds(); - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch (trim($relation)) { - case 'scopes': { - if(!in_array('scopes', $relations)) break; - $scopes = []; - unset($values['scopes']); - foreach ($api->getScopes() as $s) { - $scopes[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['scopes'] = $scopes; - } - break; - case 'endpoints': { - if(!in_array('endpoints', $relations)) break; - $endpoints = []; - unset($values['endpoints']); - foreach ($api->getEndpoints() as $e) { - $endpoints[] = SerializerRegistry::getInstance()->getSerializer($e)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['endpoints'] = $endpoints; - } - break; - - } - } - } - return $values; - } -} - diff --git a/app/ModelSerializers/SerializerRegistry.php b/app/ModelSerializers/SerializerRegistry.php deleted file mode 100644 index 1c4a4ce2..00000000 --- a/app/ModelSerializers/SerializerRegistry.php +++ /dev/null @@ -1,460 +0,0 @@ -resource_server_context = App::make(IResourceServerContext::class); - // resource server config - $this->registry['Api'] = ApiSerializer::class; - $this->registry['ApiEndpoint'] = ApiEndpointSerializer::class; - $this->registry['ApiScope'] = ApiScopeSerializer::class; - $this->registry['ApiEndpointAuthzGroup'] = ApiEndpointAuthzGroupSerializer::class; - - // extra questions base - $this->registry['ExtraQuestionTypeValue'] = ExtraQuestionTypeValueSerializer::class; - // metrics - - $this->registry['SummitMetric'] = SummitMetricSerializer::class; - $this->registry['SummitSponsorMetric'] = SummitSponsorMetricSerializer::class; - $this->registry['SummitEventAttendanceMetric'] = SummitEventAttendanceMetricSerializer::class; - - // stripe - $this->registry['StripePaymentProfile'] = [ - self::SerializerType_Public => StripePaymentProfileSerializer::class, - self::SerializerType_Private => AdminStripePaymentProfileSerializer::class, - ]; - - $this->registry['SummitAdministratorPermissionGroup'] = SummitAdministratorPermissionGroupSerializer::class; - - $this->registry['Summit'] = - [ - self::SerializerType_Public => SummitSerializer::class, - self::SerializerType_Private => AdminSummitSerializer::class - ]; - - $this->registry['SummitDocument'] = SummitDocumentSerializer::class; - $this->registry['SummitEmailEventFlow'] = SummitEmailEventFlowSerializer::class; - $this->registry['SelectionPlan'] = SelectionPlanSerializer::class; - $this->registry['SummitSelectionPlanExtraQuestionType'] = SummitSelectionPlanExtraQuestionTypeSerializer::class; - $this->registry['SummitWIFIConnection'] = SummitWIFIConnectionSerializer::class; - $this->registry['SummitType'] = SummitTypeSerializer::class; - $this->registry['SummitEventType'] = SummitEventTypeSerializer::class; - $this->registry['PresentationType'] = PresentationTypeSerializer::class; - $this->registry['SummitTicketType'] = SummitTicketTypeSerializer::class; - $this->registry['PresentationCategory'] = PresentationCategorySerializer::class; - $this->registry['PresentationCategoryGroup'] = PresentationCategoryGroupSerializer::class; - $this->registry['PrivatePresentationCategoryGroup'] = PrivatePresentationCategoryGroupSerializer::class; - $this->registry['Tag'] = TagSerializer::class; - $this->registry['Language'] = LanguageSerializer::class; - $this->registry['PresentationExtraQuestionAnswer'] = PresentationExtraQuestionAnswerSerializer::class; - // track questions - $this->registry['TrackAnswer'] = TrackAnswerSerializer::class; - $this->registry['TrackQuestionValueTemplate'] = TrackQuestionValueTemplateSerializer::class; - $this->registry['TrackTextBoxQuestionTemplate'] = TrackSingleValueTemplateQuestionSerializer::class; - $this->registry['TrackCheckBoxQuestionTemplate'] = TrackSingleValueTemplateQuestionSerializer::class; - $this->registry['TrackDropDownQuestionTemplate'] = TrackDropDownQuestionTemplateSerializer::class; - $this->registry['TrackCheckBoxListQuestionTemplate'] = TrackMultiValueQuestionTemplateSerializer::class; - $this->registry['TrackRadioButtonListQuestionTemplate'] = TrackMultiValueQuestionTemplateSerializer::class; - $this->registry['TrackLiteralContentQuestionTemplate'] = TrackLiteralContentQuestionTemplateSerializer::class; - // events - - $this->registry['SummitEvent'] = [ - self::SerializerType_Public => SummitEventSerializer::class, - self::SerializerType_Private => SummitEventSerializer::class, - self::SerializerType_CSV => AdminSummitEventCSVSerializer::class - ]; - - $this->registry['SummitGroupEvent'] = SummitGroupEventSerializer::class; - $this->registry['TrackTagGroup'] = TrackTagGroupSerializer::class; - $this->registry['Presentation'] = - [ - self::SerializerType_Public => PresentationSerializer::class, - self::SerializerType_Private => AdminPresentationSerializer::class, - self::SerializerType_CSV => AdminPresentationCSVSerializer::class, - IPresentationSerializerTypes::TrackChairs => TrackChairPresentationSerializer::class, - IPresentationSerializerTypes::TrackChairs_CSV => TrackChairPresentationCSVSerializer::class - ]; - - $this->registry['SummitCategoryChange'] = SummitCategoryChangeSerializer::class; - - $this->registry['PresentationActionType'] = PresentationActionTypeSerializer::class; - $this->registry['PresentationAction'] = PresentationActionSerializer::class; - - // track chairs - $this->registry['PresentationTrackChairView'] = PresentationTrackChairViewSerializer::class; - $this->registry['SummitSelectedPresentationList'] = SummitSelectedPresentationListSerializer::class; - $this->registry['SummitSelectedPresentation'] = SummitSelectedPresentationSerializer::class; - - $this->registry['SummitTrackChair'] = [ - self::SerializerType_Public => SummitTrackChairSerializer::class, - self::SerializerType_Private => AdminSummitTrackChairSerializer::class, - self::SerializerType_CSV => SummitTrackChairCSVSerializer::class - ]; - - $this->registry['SummitPresentationComment'] = SummitPresentationCommentSerializer::class; - $this->registry['SummitMediaFileType'] = SummitMediaFileTypeSerializer::class; - $this->registry['SummitMediaUploadType'] = SummitMediaUploadTypeSerializer::class; - $this->registry['PresentationVideo'] = PresentationVideoSerializer::class; - $this->registry['PresentationSlide'] = PresentationSlideSerializer::class; - $this->registry['PresentationLink'] = PresentationLinkSerializer::class; - - $this->registry['PresentationMediaUpload'] = [ - self::SerializerType_Public => PresentationMediaUploadSerializer::class, - self::SerializerType_Private => AdminPresentationMediaUploadSerializer::class - ]; - // Company - - $this->registry['Company'] = CompanySerializer::class; - $this->registry['SponsoredProject'] = SponsoredProjectSerializer::class; - $this->registry['ProjectSponsorshipType'] = ProjectSponsorshipTypeSerializer::class; - $this->registry['SupportingCompany'] = SupportingCompanySerializer::class; - - $this->registry['PresentationSpeaker'] = - [ - self::SerializerType_Public => PresentationSpeakerSerializer::class, - self::SerializerType_Private => AdminPresentationSpeakerSerializer::class - ]; - - $this->registry['SpeakerEditPermissionRequest'] = SpeakerEditPermissionRequestSerializer::class; - - // RSVP - $this->registry['RSVP'] = RSVPSerializer::class; - $this->registry['RSVPAnswer'] = RSVPAnswerSerializer::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['RSVPLiteralContentQuestionTemplate'] = RSVPLiteralContentQuestionTemplateSerializer::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['RSVPDropDownQuestionTemplate'] = RSVPDropDownQuestionTemplateSerializer::class; - - $this->registry['SpeakerExpertise'] = SpeakerExpertiseSerializer::class; - $this->registry['SpeakerTravelPreference'] = SpeakerTravelPreferenceSerializer::class; - $this->registry['SpeakerPresentationLink'] = SpeakerPresentationLinkSerializer::class; - $this->registry['SpeakerActiveInvolvement'] = SpeakerActiveInvolvementSerializer::class; - $this->registry['SpeakerOrganizationalRole'] = SpeakerOrganizationalRoleSerializer::class; - - $this->registry['SummitEventFeedback'] = SummitEventFeedbackSerializer::class; - $this->registry['SummitMemberSchedule'] = SummitMemberScheduleSerializer::class; - $this->registry['SummitMemberFavorite'] = SummitMemberFavoriteSerializer::class; - $this->registry['SummitEntityEvent'] = SummitEntityEventSerializer::class; - $this->registry['SummitEventWithFile'] = SummitEventWithFileSerializer::class; - $this->registry['SummitScheduleEmptySpot'] = SummitScheduleEmptySpotSerializer::class; - - // promo codes - $this->registry['SummitRegistrationPromoCode'] = SummitRegistrationPromoCodeSerializer::class; - $this->registry['MemberSummitRegistrationPromoCode'] = MemberSummitRegistrationPromoCodeSerializer::class; - $this->registry['SpeakerSummitRegistrationPromoCode'] = SpeakerSummitRegistrationPromoCodeSerializer::class; - $this->registry['SponsorSummitRegistrationPromoCode'] = SponsorSummitRegistrationPromoCodeSerializer::class; - $this->registry['PresentationSpeakerSummitAssistanceConfirmationRequest'] = PresentationSpeakerSummitAssistanceConfirmationRequestSerializer::class; - $this->registry['SummitRegistrationDiscountCodeTicketTypeRule'] = SummitRegistrationDiscountCodeTicketTypeRuleSerializer::class; - $this->registry['SummitRegistrationDiscountCode'] = SummitRegistrationDiscountCodeSerializer::class; - $this->registry['MemberSummitRegistrationDiscountCode'] = MemberSummitRegistrationDiscountCodeSerializer::class; - $this->registry['SpeakerSummitRegistrationDiscountCode'] = SpeakerSummitRegistrationDiscountCodeSerializer::class; - $this->registry['SponsorSummitRegistrationDiscountCode'] = SponsorSummitRegistrationDiscountCodeSerializer::class; - - // registration - $this->registry['SummitRegistrationInvitation'] = - [ - self::SerializerType_Public => SummitRegistrationInvitationSerializer::class, - self::SerializerType_CSV => SummitRegistrationInvitationCSVSerializer::class, - ]; - - $this->registry['SummitAccessLevelType'] = SummitAccessLevelTypeSerializer::class; - $this->registry['SummitTaxType'] = SummitTaxTypeSerializer::class; - $this->registry['SummitBadgeType'] = SummitBadgeTypeSerializer::class; - $this->registry['SummitBadgeFeatureType'] = SummitBadgeFeatureTypeSerializer::class; - $this->registry['SummitRefundPolicyType'] = SummitRefundPolicyTypeSerializer::class; - $this->registry['SummitOrderExtraQuestionType'] = SummitOrderExtraQuestionTypeSerializer::class; - - - // orders - - $this->registry['SummitOrder'] = [ - self::SerializerType_Public => SummitOrderBaseSerializer::class, - ISummitOrderSerializerTypes::CheckOutType => SummitOrderBaseSerializer::class, - ISummitOrderSerializerTypes::ReservationType => SummitOrderReservationSerializer::class, - ISummitOrderSerializerTypes::AdminType => SummitOrderAdminSerializer::class, - ]; - - $this->registry['SummitOrderExtraQuestionAnswer'] = SummitOrderExtraQuestionAnswerSerializer::class; - - $this->registry['SummitAttendee'] = [ - self::SerializerType_Public => SummitAttendeeSerializer::class, - self::SerializerType_Private => SummitAttendeeAdminSerializer::class, - self::SerializerType_CSV => SummitAttendeeCSVSerializer::class, - ]; - - $this->registry['SummitAttendeeTicket'] = [ - self::SerializerType_Public => BaseSummitAttendeeTicketSerializer::class, - ISummitAttendeeTicketSerializerTypes::AdminType => SummitAttendeeTicketSerializer::class, - ISummitAttendeeTicketSerializerTypes::PublicEdition => PublicEditionSummitAttendeeTicketSerializer::class, - ISummitAttendeeTicketSerializerTypes::GuestEdition => GuestEditionSummitAttendeeTicketSerializer::class, - self::SerializerType_CSV => SummitAttendeeTicketCSVSerializer::class, - ]; - - $this->registry['SummitAttendeeBadge'] = SummitAttendeeBadgeSerializer::class; - - $this->registry['SponsorBadgeScan'] = [ - self::SerializerType_Public => SponsorBadgeScanSerializer::class, - self::SerializerType_CSV => SponsorBadgeScanCSVSerializer::class, - ]; - - $this->registry['SponsorUserInfoGrant'] = [ - self::SerializerType_Public => SponsorUserInfoGrantSerializer::class, - self::SerializerType_CSV => SponsorUserInfoGrantSerializer::class, - ]; - - $this->registry['SummitAttendeeTicketTax'] = SummitAttendeeTicketTaxSerializer::class; - - // summit sponsors - - $this->registry['SponsorshipType'] = SponsorshipTypeSerializer::class; - $this->registry['Sponsor'] = SponsorSerializer::class; - - // locations - $this->registry['SummitVenue'] = SummitVenueSerializer::class; - $this->registry['SummitVenueRoom'] = SummitVenueRoomSerializer::class; - $this->registry['SummitVenueFloor'] = SummitVenueFloorSerializer::class; - $this->registry['SummitExternalLocation'] = SummitExternalLocationSerializer::class; - $this->registry['SummitHotel'] = SummitHotelSerializer::class; - $this->registry['SummitAirport'] = SummitAirportSerializer::class; - $this->registry['SummitLocationImage'] = SummitLocationImageSerializer::class; - $this->registry['SummitLocationBanner'] = SummitLocationBannerSerializer::class; - $this->registry['ScheduledSummitLocationBanner'] = ScheduledSummitLocationBannerSerializer::class; - $this->registry['SummitBookableVenueRoom'] = SummitBookableVenueRoomSerializer::class; - $this->registry['SummitBookableVenueRoomAttributeType'] = SummitBookableVenueRoomAttributeTypeSerializer::class; - $this->registry['SummitBookableVenueRoomAttributeValue'] = SummitBookableVenueRoomAttributeValueSerializer::class; - $this->registry['SummitBookableVenueRoomAvailableSlot'] = SummitBookableVenueRoomAvailableSlotSerializer::class; - $this->registry['SummitRoomReservation'] = SummitRoomReservationSerializer::class; - - // track tag groups - $this->registry['TrackTagGroup'] = TrackTagGroupSerializer::class; - $this->registry['TrackTagGroupAllowedTag'] = TrackTagGroupAllowedTagSerializer::class; - - $this->registry['PersonalCalendarShareInfo'] = PersonalCalendarShareInfoSerializer::class; - - // member - $this->registry['Member'] = [ - self::SerializerType_Public => PublicMemberSerializer::class, - self::SerializerType_Private => OwnMemberSerializer::class, - self::SerializerType_Admin => AdminMemberSerializer::class - ]; - - $this->registry['LegalAgreement'] = LegalAgreementSerializer::class; - $this->registry['LegalDocument'] = LegalDocumentSerializer::class; - - $this->registry['Group'] = GroupSerializer::class; - $this->registry['Affiliation'] = AffiliationSerializer::class; - $this->registry['Organization'] = OrganizationSerializer::class; - // push notification - $this->registry['PushNotificationMessage'] = PushNotificationMessageSerializer::class; - $this->registry['SummitPushNotification'] = SummitPushNotificationSerializer::class; - - // teams - $this->registry['ChatTeam'] = ChatTeamSerializer::class; - $this->registry['ChatTeamMember'] = ChatTeamMemberSerializer::class; - $this->registry['ChatTeamInvitation'] = ChatTeamInvitationSerializer::class; - $this->registry['ChatTeamPushNotificationMessage'] = ChatTeamPushNotificationMessageSerializer::class; - - // marketplace - - $this->registry['Appliance'] = ApplianceSerializer::class; - $this->registry["Distribution"] = DistributionSerializer::class; - $this->registry['MarketPlaceReview'] = MarketPlaceReviewSerializer::class; - $this->registry['OpenStackImplementationApiCoverage'] = OpenStackImplementationApiCoverageSerializer::class; - $this->registry['GuestOSType'] = GuestOSTypeSerializer::class; - $this->registry['HyperVisorType'] = HyperVisorTypeSerializer::class; - $this->registry['Region'] = RegionSerializer::class; - $this->registry['RegionalSupport'] = RegionalSupportSerializer::class; - $this->registry['SupportChannelType'] = SupportChannelTypeSerializer::class; - $this->registry['Office'] = OfficeSerializer::class; - $this->registry['Consultant'] = ConsultantSerializer::class; - $this->registry['ConsultantClient'] = ConsultantClientSerializer::class; - $this->registry['SpokenLanguage'] = SpokenLanguageSerializer::class; - $this->registry['ConfigurationManagementType'] = ConfigurationManagementTypeSerializer::class; - $this->registry['ServiceOfferedType'] = ServiceOfferedTypeSerializer::class; - $this->registry['ConsultantServiceOfferedType'] = ConsultantServiceOfferedTypeSerializer::class; - $this->registry['DataCenterLocation'] = DataCenterLocationSerializer::class; - $this->registry['DataCenterRegion'] = DataCenterRegionSerializer::class; - $this->registry['PricingSchemaType'] = PricingSchemaTypeSerializer::class; - $this->registry['PrivateCloudService'] = PrivateCloudServiceSerializer::class; - $this->registry['PublicCloudService'] = PublicCloudServiceSerializer::class; - $this->registry['RemoteCloudService'] = RemoteCloudServiceSerializer::class; - $this->registry['CloudServiceOffered'] = CloudServiceOfferedSerializer::class; - // software - - $this->registry['OpenStackComponent'] = OpenStackComponentSerializer::class; - $this->registry['OpenStackRelease'] = OpenStackReleaseSerializer::class; - - // ccla - - $this->registry['Team'] = TeamSerializer::class; - - $this->registry['File'] = FileSerializer::class; - } - - /** - * @param object $object - * @param string $type - * @return IModelSerializer - */ - public function getSerializer($object, $type = self::SerializerType_Public) - { - if (is_null($object)) return null; - $reflect = new \ReflectionClass($object); - $class = $reflect->getShortName(); - if (!isset($this->registry[$class])) - throw new \InvalidArgumentException('Serializer not found for ' . $class); - - $serializer_class = $this->registry[$class]; - - if (is_array($serializer_class)) { - if (!isset($serializer_class[$type])) - throw new \InvalidArgumentException(sprintf('Serializer not found for %s , type %s', $class, $type)); - $serializer_class = $serializer_class[$type]; - } - - return new $serializer_class($object, $this->resource_server_context); - } -} \ No newline at end of file diff --git a/app/ModelSerializers/SerializerUtils.php b/app/ModelSerializers/SerializerUtils.php deleted file mode 100644 index a1ffb532..00000000 --- a/app/ModelSerializers/SerializerUtils.php +++ /dev/null @@ -1,38 +0,0 @@ - 'id:json_int', - 'CreatedUTC' => 'created:datetime_epoch', - 'LastEditedUTC' => 'last_edited:datetime_epoch', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Software/OpenStackComponentSerializer.php b/app/ModelSerializers/Software/OpenStackComponentSerializer.php deleted file mode 100644 index 26a7e835..00000000 --- a/app/ModelSerializers/Software/OpenStackComponentSerializer.php +++ /dev/null @@ -1,29 +0,0 @@ - 'name:json_string', - 'CodeName' => 'code_name:json_string', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Software/OpenStackReleaseSerializer.php b/app/ModelSerializers/Software/OpenStackReleaseSerializer.php deleted file mode 100644 index 2a5eb4f5..00000000 --- a/app/ModelSerializers/Software/OpenStackReleaseSerializer.php +++ /dev/null @@ -1,29 +0,0 @@ - 'name:json_string', - 'ReleaseNumber' => 'release_number:json_string', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/AdminStripePaymentProfileSerializer.php b/app/ModelSerializers/Summit/AdminStripePaymentProfileSerializer.php deleted file mode 100644 index 0cb17e9d..00000000 --- a/app/ModelSerializers/Summit/AdminStripePaymentProfileSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'live_secret_key:json_string', - 'TestSecretKey' => 'test_secret_key:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/AdminSummitSerializer.php b/app/ModelSerializers/Summit/AdminSummitSerializer.php deleted file mode 100644 index 809ce2be..00000000 --- a/app/ModelSerializers/Summit/AdminSummitSerializer.php +++ /dev/null @@ -1,59 +0,0 @@ - 'available_on_api:json_boolean', - 'MaxSubmissionAllowedPerUser' => 'max_submission_allowed_per_user:json_int', - 'RegistrationLink' => 'registration_link:json_string', - 'Link' => 'link:json_string', - 'ExternalSummitId' => 'external_summit_id:json_string', - 'CalendarSyncName' => 'calendar_sync_name:json_string', - 'CalendarSyncDesc' => 'calendar_sync_desc:json_string', - // External Feeds - 'ApiFeedType' => 'api_feed_type:json_string', - 'ApiFeedUrl' => 'api_feed_url:json_string', - 'ApiFeedKey' => 'api_feed_key:json_string', - // registration - 'OrderQRPrefix' => 'order_qr_prefix:json_string', - 'TicketQRPrefix' => 'ticket_qr_prefix:json_string', - 'BadgeQRPrefix' => 'badge_qr_prefix:json_string', - 'QRRegistryFieldDelimiter' => 'qr_registry_field_delimiter:json_string', - 'ReassignTicketTillDate' => 'reassign_ticket_till_date:datetime_epoch', - 'RegistrationDisclaimerContent' => 'registration_disclaimer_content:json_string', - 'RegistrationDisclaimerMandatory' => 'registration_disclaimer_mandatory:json_boolean', - // registration external feed - 'ExternalRegistrationFeedType' => 'external_registration_feed_type:json_string', - 'ExternalRegistrationFeedApiKey' => 'external_registration_feed_api_key:json_string', - // oauth2 clients - 'VirtualSiteOAuth2ClientId' => 'virtual_site_oauth2_client_id:json_string', - 'MarketingSiteOAuth2ClientId' => 'marketing_site_oauth2_client_id:json_string', - ]; - - /** - * @return string - */ - protected function getSerializerType(): string - { - return SerializerRegistry::SerializerType_Private; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Metrics/SummitEventAttendanceMetricSerializer.php b/app/ModelSerializers/Summit/Metrics/SummitEventAttendanceMetricSerializer.php deleted file mode 100644 index 710f42ee..00000000 --- a/app/ModelSerializers/Summit/Metrics/SummitEventAttendanceMetricSerializer.php +++ /dev/null @@ -1,23 +0,0 @@ - 'event_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Metrics/SummitMetricSerializer.php b/app/ModelSerializers/Summit/Metrics/SummitMetricSerializer.php deleted file mode 100644 index ae370f50..00000000 --- a/app/ModelSerializers/Summit/Metrics/SummitMetricSerializer.php +++ /dev/null @@ -1,32 +0,0 @@ - 'member_first_name:json_string', - 'MemberLastName' => 'member_last_name:json_string', - 'MemberProfilePhotoUrl' => 'member_pic:json_url', - 'Type' => 'type:json_string', - 'Ip' => 'ip:json_string', - 'Origin' => 'origin:json_string', - 'Browser' => 'browser:json_string', - 'OutgressDate' => 'outgress_date:datetime_epoch', - 'IngressDate' => 'ingress_date:datetime_epoch' - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Metrics/SummitSponsorMetricSerializer.php b/app/ModelSerializers/Summit/Metrics/SummitSponsorMetricSerializer.php deleted file mode 100644 index aa7ec4da..00000000 --- a/app/ModelSerializers/Summit/Metrics/SummitSponsorMetricSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'sponsor_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/PaymentGatewayProfileSerializer.php b/app/ModelSerializers/Summit/PaymentGatewayProfileSerializer.php deleted file mode 100644 index 5be12f9a..00000000 --- a/app/ModelSerializers/Summit/PaymentGatewayProfileSerializer.php +++ /dev/null @@ -1,26 +0,0 @@ - 'active:json_boolean', - 'Provider' => 'provider:json_string', - 'ApplicationType' => 'application_type:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/PersonalCalendarShareInfoSerializer.php b/app/ModelSerializers/Summit/PersonalCalendarShareInfoSerializer.php deleted file mode 100644 index b0fc2a01..00000000 --- a/app/ModelSerializers/Summit/PersonalCalendarShareInfoSerializer.php +++ /dev/null @@ -1,44 +0,0 @@ - 'link:json_url', - 'SummitId' => 'summit_id:json_int', - 'OwnerId' => 'owner_id:json_int', - 'Cid' => 'cid: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 = []) - { - $link = $this->object; - if (!$link instanceof PersonalCalendarShareInfo) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/AdminPresentationCSVSerializer.php b/app/ModelSerializers/Summit/Presentation/AdminPresentationCSVSerializer.php deleted file mode 100644 index f17ed17e..00000000 --- a/app/ModelSerializers/Summit/Presentation/AdminPresentationCSVSerializer.php +++ /dev/null @@ -1,159 +0,0 @@ -object; - if(!$presentation instanceof Presentation) return $values; - - $serializerType = SerializerRegistry::SerializerType_Public; - - if(isset($params['current_user']) && $params['current_user'] instanceof Member && $params['current_user']->isAdmin()){ - $serializerType = SerializerRegistry::SerializerType_Private; - } - - // moderator data - - $values['moderator_id'] = ""; - $values['moderator_full_name'] = ""; - $values['moderator_email'] = ""; - $values['moderator_title'] = ""; - $values['moderator_company'] = ""; - - if(isset($values['moderator_speaker_id'])) - unset($values['moderator_speaker_id']); - - if($presentation->hasModerator()){ - $values['moderator_id'] = $presentation->getModerator()->getId(); - $values['moderator_full_name'] = $presentation->getModerator()->getFullName(); - $values['moderator_email'] = $presentation->getModerator()->getEmail(); - $values['moderator_title'] = trim($presentation->getModerator()->getTitle()); - $values['moderator_company'] = trim($presentation->getModerator()->getCompany()); - } - - // speaker data - - $values['speaker_ids'] = ""; - $values['speaker_fullnames'] = ""; - $values['speaker_emails'] = ""; - $values['speaker_titles'] = ""; - $values['speaker_companies'] = ""; - - - if($presentation->getSpeakers()->count() > 0){ - - $speaker_ids = []; - $speaker_fullnames = []; - $speaker_emails = []; - $speaker_titles = []; - $speaker_companies = []; - - foreach ($presentation->getSpeakers() as $speaker) { - $speaker_ids[] = $speaker->getId(); - $speaker_fullnames[] = $speaker->getFullName(); - $speaker_emails[] = $speaker->getEmail(); - $speaker_titles[] = trim($speaker->getTitle()); - $speaker_companies[] = trim($speaker->getCompany()); - } - - $values['speaker_ids'] = implode("|", $speaker_ids); - $values['speaker_fullnames'] = implode("|", $speaker_fullnames); - $values['speaker_emails'] = implode("|", $speaker_emails); - $values['speaker_titles'] = implode("|", $speaker_titles); - $values['speaker_companies'] = implode("|", $speaker_companies); - } - - // submitter - - $values['submitter_id'] = ""; - $values['submitter_full_name'] = ""; - $values['submitter_email'] = ""; - $values['submitter_title'] = ""; - $values['submitter_company'] = ""; - - if($presentation->hasCreatedBy()){ - $creator = $presentation->getCreatedBy(); - if($creator->hasSpeaker()){ - $submitter = $creator->getSpeaker(); - $values['submitter_id'] = $submitter->getId(); - $values['submitter_full_name'] = $submitter->getFullName(); - $values['submitter_email'] = $submitter->getEmail(); - $values['submitter_title'] = $submitter->getTitle(); - $values['submitter_company'] = $submitter->getCompany(); - } - } - - - if(isset($values['description'])){ - $values['description'] = strip_tags($values['description']); - } - if(isset($values['attendees_expected_learnt'])){ - $values['attendees_expected_learnt'] = strip_tags($values['attendees_expected_learnt']); - } - - // add video column - - $values['video'] = ''; - $values['public_video'] = ''; - - foreach ($presentation->getMediaUploads() as $mediaUpload) { - if($mediaUpload->getMediaUploadType()->isVideo()) { - $media_upload_csv = SerializerRegistry::getInstance()->getSerializer($mediaUpload, $serializerType)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'media_uploads'));; - if(!isset($media_upload_csv['private_url']) || !isset($media_upload_csv['filename'])){ - Log::warning(sprintf("AdminPresentationCSVSerializer::serialize can not process media upload %s", json_encode($media_upload_csv))); - continue; - } - $values['video'] = sprintf('=HYPERLINK("%s";"%s")', $media_upload_csv['private_url'], $media_upload_csv['filename']); - - if(!isset($media_upload_csv['public_url']) || !isset($media_upload_csv['filename'])){ - Log::warning(sprintf("AdminPresentationCSVSerializer::serialize can not process media upload %s", json_encode($media_upload_csv))); - continue; - } - $values['public_video'] = sprintf('=HYPERLINK("%s";"%s")', $media_upload_csv['public_url'], $media_upload_csv['filename']); - } - } - - // extra questions - - $values['extra_questions'] = ''; - foreach ($presentation->getExtraQuestionAnswers() as $answer){ - if(!empty($values['extra_questions'])) - $values['extra_questions'] = $values['extra_questions'] . '|'; - $values['extra_questions'] = $values['extra_questions'] . str_replace(",", "", (string)$answer); - } - - if($presentation->hasCategory()){ - $values['track'] = $presentation->getCategory()->getTitle(); - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/AdminPresentationMediaUploadSerializer.php b/app/ModelSerializers/Summit/Presentation/AdminPresentationMediaUploadSerializer.php deleted file mode 100644 index 854e1ed3..00000000 --- a/app/ModelSerializers/Summit/Presentation/AdminPresentationMediaUploadSerializer.php +++ /dev/null @@ -1,55 +0,0 @@ -object; - if(!$mediaUpload instanceof PresentationMediaUpload) return []; - - $mediaUploadType = $mediaUpload->getMediaUploadType(); - if(!is_null($mediaUploadType)) { - try{ - $strategy = FileDownloadStrategyFactory::build($mediaUploadType->getPrivateStorageType()); - if (!is_null($strategy)) { - - $values['private_url'] = $strategy->getUrl($mediaUpload->getRelativePath(IStorageTypesConstants::PrivateType)); - } - } - catch (\Exception $ex){ - Log::warning($ex); - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/AdminPresentationSerializer.php b/app/ModelSerializers/Summit/Presentation/AdminPresentationSerializer.php deleted file mode 100644 index 02908037..00000000 --- a/app/ModelSerializers/Summit/Presentation/AdminPresentationSerializer.php +++ /dev/null @@ -1,37 +0,0 @@ - 'rank:json_int', - 'SelectionStatus' => 'selection_status:json_string', - ]; - - protected static $allowed_fields = [ - 'rank', - 'selection_status', - ]; - - /** - * @return string - */ - protected function getSpeakersSerializerType():string{ - return SerializerRegistry::SerializerType_Private; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/AdminSummitEventCSVSerializer.php b/app/ModelSerializers/Summit/Presentation/AdminSummitEventCSVSerializer.php deleted file mode 100644 index 39a4bdcf..00000000 --- a/app/ModelSerializers/Summit/Presentation/AdminSummitEventCSVSerializer.php +++ /dev/null @@ -1,43 +0,0 @@ -object; - if(!$summit_event instanceof SummitEvent) return $values; - if(isset($values['description'])){ - $values['description'] = strip_tags($values['description']); - } - - if($summit_event->hasCategory()){ - $values['track'] = $summit_event->getCategory()->getTitle(); - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/AdminSummitTrackChairSerializer.php b/app/ModelSerializers/Summit/Presentation/AdminSummitTrackChairSerializer.php deleted file mode 100644 index 863beaaa..00000000 --- a/app/ModelSerializers/Summit/Presentation/AdminSummitTrackChairSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'is_completed:json_boolean', - 'PresentationId' => 'presentation_id:json_int', - 'TypeId' => 'type_id:json_int', - 'CreatedById' => 'created_by_id:json_int', - 'UpdatedById' => 'updated_by_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(), array $relations = array(), array $params = array()) - { - $action = $this->object; - if (!$action instanceof PresentationAction) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'presentation': - { - unset($values['presentation_id']); - $values['presentation'] = SerializerRegistry::getInstance()->getSerializer - ( - $action->getPresentation() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'type': - { - unset($values['type_id']); - $values['type'] = SerializerRegistry::getInstance()->getSerializer - ( - $action->getType() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'created_by': - { - if($action->hasCreatedBy()) { - unset($values['created_by_id']); - $values['created_by'] = SerializerRegistry::getInstance()->getSerializer - ( - $action->getCreatedBy() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'updated_by': - { - if($action->hasUpdatedBy()) { - unset($values['updated_by_id']); - $values['updated_by'] = SerializerRegistry::getInstance()->getSerializer - ( - $action->getUpdatedBy() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationActionTypeSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationActionTypeSerializer.php deleted file mode 100644 index 121a54be..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationActionTypeSerializer.php +++ /dev/null @@ -1,58 +0,0 @@ - 'label:json_string', - 'SummitId' => 'summit_id:json_int', - 'Order' => 'order:json_int', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $action = $this->object; - if (!$action instanceof PresentationActionType) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'summit': - { - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer - ( - $action->getSummit() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationCategoryGroupSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationCategoryGroupSerializer.php deleted file mode 100644 index 22704fcf..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationCategoryGroupSerializer.php +++ /dev/null @@ -1,56 +0,0 @@ - 'name:json_string', - 'Color' => 'color:json_color', - 'Description' => 'description:json_string', - 'ClassName' => 'class_name:json_string', - '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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $track_group = $this->object; - if(!$track_group instanceof PresentationCategoryGroup) return $values; - - $categories = []; - - foreach($track_group->getCategories() as $c) - { - if(!is_null($expand) && in_array('tracks', explode(',',$expand))){ - $categories[] = SerializerRegistry::getInstance()->getSerializer($c)->serialize(); - } - else - $categories[] = intval($c->getId()); - } - - $values['tracks'] = $categories; - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationCategorySerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationCategorySerializer.php deleted file mode 100644 index e013a845..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationCategorySerializer.php +++ /dev/null @@ -1,141 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'Code' => 'code:json_string', - 'Slug' => 'slug:json_string', - 'SessionCount' => 'session_count:json_int', - 'AlternateCount' => 'alternate_count:json_int', - 'LightningCount' => 'lightning_count:json_int', - 'LightningAlternateCount' => 'lightning_alternate_count:json_int', - 'VotingVisible' => 'voting_visible:json_boolean', - 'ChairVisible' => 'chair_visible:json_boolean', - 'SummitId' => 'summit_id:json_int', - 'Color' => 'color:json_color', - 'IconUrl' => 'icon_url:json_url', - ]; - - /** - * @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 = []) - { - $category = $this->object; - if (!$category instanceof PresentationCategory) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $groups = []; - $allowed_tag = []; - $extra_questions = []; - $selection_lists = []; - $summit = $category->getSummit(); - - foreach ($category->getGroups() as $group) { - $groups[] = intval($group->getId()); - } - - foreach ($category->getAllowedTags() as $tag) { - $allowed_tag[] = $tag->getId(); - } - - foreach ($category->getExtraQuestions() as $question) { - $extra_questions[] = intval($question->getId()); - } - - foreach ($category->getSelectionLists() as $list) { - $selection_lists[] = intval($list->getId()); - } - - - $values['track_groups'] = $groups; - $values['allowed_tags'] = $allowed_tag; - $values['extra_questions'] = $extra_questions; - $values['selection_lists'] = $selection_lists; - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'track_groups': - { - $groups = []; - unset($values['track_groups']); - foreach ($category->getGroups() as $g) { - $groups[] = SerializerRegistry::getInstance()->getSerializer($g)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['track_groups'] = $groups; - } - break; - - case 'allowed_tags': - { - $allowed_tags = []; - unset($values['allowed_tags']); - foreach ($category->getAllowedTags() as $tag) { - $allowed_tag = SerializerRegistry::getInstance()->getSerializer($tag)->serialize(null, [], ['none']); - $track_tag_group = $summit->getTrackTagGroupForTag($tag); - if (!is_null($track_tag_group)) { - $allowed_tag['track_tag_group'] = SerializerRegistry::getInstance()->getSerializer($track_tag_group)->serialize(null, [], ['none']); - } - $allowed_tags[] = $allowed_tag; - } - $values['allowed_tags'] = $allowed_tags; - } - break; - - case 'extra_questions': - { - $extra_questions = []; - unset($values['extra_questions']); - foreach ($category->getExtraQuestions() as $question) { - $extra_questions[] = SerializerRegistry::getInstance()->getSerializer($question)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['extra_questions'] = $extra_questions; - } - break; - - case 'selection_lists': - { - $selection_lists = []; - unset($values['selection_lists']); - foreach ($category->getSelectionLists() as $list) { - $selection_lists[] = SerializerRegistry::getInstance()->getSerializer($list)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['selection_lists'] = $selection_lists; - } - break; - } - - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationExtraQuestionAnswerSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationExtraQuestionAnswerSerializer.php deleted file mode 100644 index 59b8c045..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationExtraQuestionAnswerSerializer.php +++ /dev/null @@ -1,63 +0,0 @@ - 'presentation_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(), array $relations = array(), array $params = array()) - { - $answer = $this->object; - if (!$answer instanceof PresentationExtraQuestionAnswer) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!count($relations)) $relations = $this->getAllowedRelations(); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - $relation = trim($relation); - switch ($relation) { - - case 'presentation': - { - - unset($values['presentation_id']); - $values['presentation'] = SerializerRegistry::getInstance()->getSerializer($answer->getPresentation()) - ->serialize(AbstractSerializer::getExpandForPrefix($relation, $expand)); - } - break; - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationLinkSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationLinkSerializer.php deleted file mode 100644 index 5c684157..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationLinkSerializer.php +++ /dev/null @@ -1,26 +0,0 @@ - 'link:json_text', - ); - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationMaterialSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationMaterialSerializer.php deleted file mode 100644 index a5d92c1c..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationMaterialSerializer.php +++ /dev/null @@ -1,32 +0,0 @@ - 'name:json_text', - 'Description' => 'description:json_text', - 'DisplayOnSite' => 'display_on_site:json_boolean', - 'Featured' => 'featured:json_boolean', - 'Order' => 'order:json_int', - 'PresentationId' => 'presentation_id:json_int', - 'ClassName' => 'class_name:json_text', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationMediaUploadSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationMediaUploadSerializer.php deleted file mode 100644 index 4e86aee7..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationMediaUploadSerializer.php +++ /dev/null @@ -1,79 +0,0 @@ - 'filename:json_text', - 'MediaUploadTypeId' => 'media_upload_type_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(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $mediaUpload = $this->object; - if(!$mediaUpload instanceof PresentationMediaUpload) return []; - // these values are calculated - unset($values['name']); - unset($values['description']); - unset($values['featured']); - - $mediaUploadType = $mediaUpload->getMediaUploadType(); - if(!is_null($mediaUploadType)){ - try { - $values['name'] = $mediaUploadType->getName(); - $values['description'] = $mediaUploadType->getDescription(); - $strategy = FileDownloadStrategyFactory::build($mediaUploadType->getPublicStorageType()); - if (!is_null($strategy)) { - $values['public_url'] = $strategy->getUrl($mediaUpload->getRelativePath()); - } - } - catch (\Exception $ex){ - Log::warning($ex); - } - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'media_upload_type': { - unset($values['media_upload_type_id']); - $type = $mediaUpload->getMediaUploadType(); - if(!is_null($type)) - $values['media_upload_type'] = SerializerRegistry::getInstance()->getSerializer($type)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationSerializer.php deleted file mode 100644 index 665e507f..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationSerializer.php +++ /dev/null @@ -1,294 +0,0 @@ - 'creator_id:json_int', - 'ModeratorId' => 'moderator_speaker_id:json_int', - 'SelectionPlanId' => 'selection_plan_id:json_int', - 'ProblemAddressed' => 'problem_addressed:json_string', - 'AttendeesExpectedLearnt' => 'attendees_expected_learnt:json_string', - 'ToRecord' => 'to_record:json_boolean', - 'AttendingMedia' => 'attending_media:json_boolean', - 'StatusNice' => 'status:json_string', - 'ProgressNice' => 'progress:json_string', - 'Slug' => 'slug:json_string', - 'SelectionStatus' => 'selection_status:string', - 'WillAllSpeakersAttend' => 'will_all_speakers_attend:json_boolean', - 'DisclaimerAcceptedDate' => 'disclaimer_accepted_date:datetime_epoch', - 'DisclaimerAccepted' => 'disclaimer_accepted:json_boolean', - ]; - - protected static $allowed_fields = [ - 'track_id', - 'creator_id', - 'moderator_speaker_id', - 'selection_plan_id', - 'problem_addressed', - 'attendees_expected_learnt', - 'to_record', - 'attending_media', - 'status', - 'progress', - 'selection_status', - 'disclaimer_accepted_date', - 'disclaimer_accepted' - ]; - - protected static $allowed_relations = [ - 'slides', - 'media_uploads', - 'videos', - 'speakers', - 'links', - 'extra_questions', - 'public_comments', - 'actions', - ]; - - /** - * @return string - */ - protected function getMediaUploadsSerializerType():string{ - $serializerType = SerializerRegistry::SerializerType_Public; - $currentUser = $this->resource_server_context->getCurrentUser(); - if(!is_null($currentUser) && $currentUser->isAdmin()){ - $serializerType = SerializerRegistry::SerializerType_Private; - } - return $serializerType; - } - - /** - * @return string - */ - protected function getSpeakersSerializerType():string{ - return SerializerRegistry::SerializerType_Public; - } - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $presentation = $this->object; - - if(!$presentation instanceof Presentation) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('speakers', $relations)) { - $values['speakers'] = $presentation->getSpeakerIds(); - } - - if(in_array('slides', $relations)) - { - $slides = []; - foreach ($presentation->getSlides() as $slide) { - $slides[] = $slide->getId(); - } - $values['slides'] = $slides; - } - - if(in_array('public_comments', $relations)) - { - $public_comments = []; - foreach ($presentation->getPublicComments() as $comment) { - $public_comments[] = $comment->getId(); - } - $values['public_comments'] = $public_comments; - } - - if(in_array('links', $relations)) - { - $links = []; - foreach ($presentation->getLinks() as $link) { - $links[] = $link->getId(); - } - $values['links'] = $links; - } - - if(in_array('videos', $relations)) - { - $videos = []; - foreach ($presentation->getVideos() as $video) { - $videos[] = $video->getId(); - } - $values['videos'] = $videos; - } - - if(in_array('media_uploads', $relations)) - { - $media_uploads = []; - foreach ($presentation->getMediaUploads() as $mediaUpload) { - $media_uploads[] = $mediaUpload->getId(); - } - - $values['media_uploads'] = $media_uploads; - } - - if(in_array('extra_questions', $relations)) - { - $answers = []; - foreach ($presentation->getExtraQuestionAnswers() as $answer) { - $answers[] = $answer->getId(); - } - $values['extra_questions'] = $answers; - } - - if(in_array('actions', $relations)) - { - $actions = []; - foreach ($presentation->getPresentationActions() as $action) { - $actions[] = $action->getId(); - } - $values['actions'] = $actions; - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'speakers': { - $speakers = []; - foreach ($presentation->getSpeakers() as $s) { - $speakers[] = SerializerRegistry::getInstance()->getSerializer - ( - $s, $this->getSpeakersSerializerType() - )->serialize - ( - AbstractSerializer::filterExpandByPrefix($expand, $relation), - [], - [], - $params - ); - } - $values['speakers'] = $speakers; - if(isset($values['moderator_speaker_id']) && intval($values['moderator_speaker_id']) > 0 ){ - $values['moderator'] = SerializerRegistry::getInstance()->getSerializer - ( - $presentation->getModerator(), - $this->getSpeakersSerializerType() - )->serialize - ( - AbstractSerializer::filterExpandByPrefix($expand, $relation), - [], - [], - $params - ); - } - } - break; - case 'creator':{ - if($presentation->getCreatorId() > 0) { - $member = $this->resource_server_context->getCurrentUser(); - $type = SerializerRegistry::SerializerType_Public; - if(!is_null($member) && $member->isAdmin()){ - $type = SerializerRegistry::SerializerType_Admin; - } - unset($values['creator_id']); - $values['creator'] = SerializerRegistry::getInstance()->getSerializer($presentation->getCreator(), $type)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'selection_plan':{ - if($presentation->getSelectionPlanId() > 0) { - unset($values['selection_plan_id']); - $values['selection_plan'] = SerializerRegistry::getInstance()->getSerializer($presentation->getSelectionPlan())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'slides':{ - $slides = []; - foreach ($presentation->getSlides() as $slide) { - $slide_values = SerializerRegistry::getInstance()->getSerializer($slide)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - if(empty($slide_values['link'])) continue; - $slides[] = $slide_values; - } - $values['slides'] = $slides; - } - break; - case 'public_comments':{ - $public_comments = []; - foreach ($presentation->getPublicComments() as $comment) { - $public_comments[] = SerializerRegistry::getInstance()->getSerializer($comment)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['public_comments'] = $public_comments; - } - break; - case 'links':{ - $links = []; - foreach ($presentation->getLinks() as $link) { - $link_values = SerializerRegistry::getInstance()->getSerializer($link)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - if(empty($link_values['link'])) continue; - $links[] = $link_values; - } - $values['links'] = $links; - } - break; - case 'videos':{ - $videos = []; - foreach ($presentation->getVideos() as $video) { - $video_values = SerializerRegistry::getInstance()->getSerializer($video)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - $videos[] = $video_values; - } - $values['videos'] = $videos; - } - break; - case 'media_uploads':{ - $media_uploads = []; - - foreach ($presentation->getMediaUploads() as $mediaUpload) { - $media_uploads[] = SerializerRegistry::getInstance()->getSerializer - ( - $mediaUpload, $this->getMediaUploadsSerializerType() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - - $values['media_uploads'] = $media_uploads; - } - break; - case 'extra_questions':{ - $answers = []; - foreach ($presentation->getExtraQuestionAnswers() as $answer) { - $answers[]= SerializerRegistry::getInstance()->getSerializer($answer)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['extra_questions'] = $answers; - } - break; - case 'actions':{ - $actions = []; - foreach ($presentation->getPresentationActions() as $action) { - $actions[]= SerializerRegistry::getInstance()->getSerializer($action)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['actions'] = $actions; - } - break; - } - } - } - return $values; - } -} diff --git a/app/ModelSerializers/Summit/Presentation/PresentationSlideSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationSlideSerializer.php deleted file mode 100644 index 0ca7cf3e..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationSlideSerializer.php +++ /dev/null @@ -1,45 +0,0 @@ - 'link:json_text', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $slide = $this->object; - if(!$slide instanceof PresentationSlide) return []; - $values['has_file'] = false; - if(empty($values['link'])){ - $values['link'] = $slide->hasSlide() ? $slide->getSlide()->getUrl(): null; - $values['has_file'] = !empty($values['link']); - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationSpeakerSummitAssistanceConfirmationRequestSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationSpeakerSummitAssistanceConfirmationRequestSerializer.php deleted file mode 100644 index 1a83cea4..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationSpeakerSummitAssistanceConfirmationRequestSerializer.php +++ /dev/null @@ -1,69 +0,0 @@ - 'on_site_phone:json_string', - 'Registered' => 'registered:json_boolean', - 'Confirmed' => 'is_confirmed:json_boolean', - 'CheckedIn' => 'checked_in:json_boolean', - 'SummitId' => 'summit_id:json_int', - 'SpeakerId' => 'speaker_id:json_int', - 'ConfirmationDate' => 'confirmation_date:datetime_epoch', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $request = $this->object; - - if(!$request instanceof PresentationSpeakerSummitAssistanceConfirmationRequest) return []; - - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'speaker': { - if(isset($values['speaker_id']) && intval($values['speaker_id']) > 0 ){ - unset($values['speaker_id']); - $values['speaker'] = SerializerRegistry::getInstance()->getSerializer($request->getSpeaker(), $serializer_type)->serialize(); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationTrackChairViewSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationTrackChairViewSerializer.php deleted file mode 100644 index 89e1eebd..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationTrackChairViewSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'viewer_id:json_int', - 'PresentationId' => 'presentation_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationTypeSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationTypeSerializer.php deleted file mode 100644 index ffd307b4..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationTypeSerializer.php +++ /dev/null @@ -1,77 +0,0 @@ - 'max_speakers:json_int', - 'MinSpeakers' => 'min_speakers:json_int', - 'MaxModerators' => 'max_moderators:json_int', - 'MinModerators' => 'min_moderators:json_int', - 'UseSpeakers' => 'use_speakers:json_boolean', - 'AreSpeakersMandatory' => 'are_speakers_mandatory:json_boolean', - 'UseModerator' => 'use_moderator:json_boolean', - 'ModeratorMandatory' => 'is_moderator_mandatory:json_boolean', - 'ModeratorLabel' => 'moderator_label:json_string', - 'ShouldBeAvailableOnCfp' => 'should_be_available_on_cfp:json_boolean', - ]; - - /** - * @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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $type = $this->object; - if (!$type instanceof PresentationType) return []; - - $allowed_media_upload_types = []; - - foreach ($type->getAllowedMediaUploadTypes() as $media_type){ - $allowed_media_upload_types[] = $media_type->getId(); - } - - $values['allowed_media_upload_types'] = $allowed_media_upload_types; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - - case 'allowed_media_upload_types': { - unset($values['allowed_media_upload_types']); - $allowed_media_upload_types = []; - - foreach ($type->getAllowedMediaUploadTypes() as $media_type){ - $allowed_media_upload_types[] = SerializerRegistry::getInstance()->getSerializer($media_type)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - - $values['allowed_media_upload_types'] = $allowed_media_upload_types; - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PresentationVideoSerializer.php b/app/ModelSerializers/Summit/Presentation/PresentationVideoSerializer.php deleted file mode 100644 index e0c03f0e..00000000 --- a/app/ModelSerializers/Summit/Presentation/PresentationVideoSerializer.php +++ /dev/null @@ -1,30 +0,0 @@ - 'youtube_id:json_text', - 'ExternalUrl' => 'external_url:json_url', - 'DateUploaded' => 'data_uploaded:datetime_epoch', - 'Highlighted' => 'highlighted:json_boolean', - 'Views' => 'views:json_int', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/PrivatePresentationCategoryGroupSerializer.php b/app/ModelSerializers/Summit/Presentation/PrivatePresentationCategoryGroupSerializer.php deleted file mode 100644 index 62cf7f47..00000000 --- a/app/ModelSerializers/Summit/Presentation/PrivatePresentationCategoryGroupSerializer.php +++ /dev/null @@ -1,58 +0,0 @@ - 'submission_begin_date:datetime_epoch', - 'SubmissionEndDate' => 'submission_end_date:datetime_epoch', - 'MaxSubmissionAllowedPerUser' => 'max_submission_allowed_per_user: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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - - $track_group = $this->object; - if(!$track_group instanceof PrivatePresentationCategoryGroup) return $values; - - $allowed_groups= []; - - foreach($track_group->getAllowedGroups() as $g) - { - if(!is_null($expand) && in_array('allowed_groups', explode(',',$expand))){ - $allowed_groups[] = SerializerRegistry::getInstance()->getSerializer($g)->serialize(); - } - else - $allowed_groups[] = intval($g->getId()); - } - - $values['allowed_groups'] = $allowed_groups; - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/SummitCategoryChangeSerializer.php b/app/ModelSerializers/Summit/Presentation/SummitCategoryChangeSerializer.php deleted file mode 100644 index 7f3351d2..00000000 --- a/app/ModelSerializers/Summit/Presentation/SummitCategoryChangeSerializer.php +++ /dev/null @@ -1,93 +0,0 @@ - 'reason:json_string', - 'ApprovalDate' => 'approval_date:datetime_epoch', - 'NiceStatus' => 'status:json_string', - 'PresentationId' => 'presentation_id:json_int', - 'NewCategoryId' => 'new_category_id:json_int', - 'OldCategoryId' => 'old_category_id:json_int', - 'RequesterId' => 'requester_id:json_int', - 'AproverId' => 'aprover_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(), array $relations = array(), array $params = array()) - { - $request = $this->object; - if (!$request instanceof SummitCategoryChange) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'presentation': - { - unset($values['presentation_id']); - $values['presentation'] = SerializerRegistry::getInstance()->getSerializer - ( - $request->getPresentation(), - IPresentationSerializerTypes::TrackChairs - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'new_category': - { - unset($values['new_category_id']); - $values['new_category'] = SerializerRegistry::getInstance()->getSerializer($request->getNewCategory())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'old_category': - { - unset($values['old_category_id']); - $values['old_category'] = SerializerRegistry::getInstance()->getSerializer($request->getOldCategory())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'requester': - { - unset($values['requester_id']); - $values['requester'] = SerializerRegistry::getInstance()->getSerializer($request->getRequester())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'aprover': - { - if($request->hasAprover()) { - unset($values['aprover_id']); - $values['aprover'] = SerializerRegistry::getInstance()->getSerializer($request->getAprover())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/SummitPresentationCommentSerializer.php b/app/ModelSerializers/Summit/Presentation/SummitPresentationCommentSerializer.php deleted file mode 100644 index 1cee99dd..00000000 --- a/app/ModelSerializers/Summit/Presentation/SummitPresentationCommentSerializer.php +++ /dev/null @@ -1,62 +0,0 @@ - 'body:json_string', - 'Activity' => 'is_activity:json_boolean', - 'Public' => 'is_public:json_boolean', - 'CreatorId' => 'creator_id:json_int', - 'PresentationId' => 'presentation_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(), array $relations = array(), array $params = array()) - { - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $comment = $this->object; - - if (!$comment instanceof SummitPresentationComment) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'creator':{ - if($comment->getCreatorId() > 0) { - unset($values['creator_id']); - $values['creator'] = SerializerRegistry::getInstance()->getSerializer($comment->getCreator())->serialize(); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/SummitSelectedPresentationListSerializer.php b/app/ModelSerializers/Summit/Presentation/SummitSelectedPresentationListSerializer.php deleted file mode 100644 index 5c6b0737..00000000 --- a/app/ModelSerializers/Summit/Presentation/SummitSelectedPresentationListSerializer.php +++ /dev/null @@ -1,116 +0,0 @@ - 'name:json_string', - 'ListType' => 'type:json_string', - 'Hash' => 'hash:json_string', - 'CategoryId' => 'category_id:json_int', - 'OwnerId' => 'owner_id:json_int', - ]; - - protected static $allowed_relations = [ - 'selected_presentations', - 'interested_presentations', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $presentation_list = $this->object; - - if (!$presentation_list instanceof SummitSelectedPresentationList) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - if (in_array('selected_presentations', $relations)) { - $selected_presentations = []; - foreach ($presentation_list->getSelectedPresentationsByCollection(SummitSelectedPresentation::CollectionSelected) as $p) { - $selected_presentations[] = $p->getId(); - } - $values['selected_presentations'] = $selected_presentations; - } - - if (in_array('interested_presentations', $relations) && $presentation_list->getListType() == SummitSelectedPresentationList::Individual) { - $interested_presentations = []; - foreach ($presentation_list->getSelectedPresentationsByCollection(SummitSelectedPresentation::CollectionMaybe) as $p) { - $interested_presentations[] = $p->getId(); - } - $values['interested_presentations'] = $interested_presentations; - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'owner': - { - if ($presentation_list->getMemberId() > 0) { - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($presentation_list->getMember())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'category': - { - if ($presentation_list->getCategoryId() > 0) { - unset($values['category_id']); - $values['category'] = SerializerRegistry::getInstance()->getSerializer($presentation_list->getCategory())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'selected_presentations': - { - $selected_presentations = []; - foreach ($presentation_list->getSelectedPresentationsByCollection(SummitSelectedPresentation::CollectionSelected) as $p) { - $selected_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['selected_presentations'] = $selected_presentations; - } - break; - case 'interested_presentations': - { - if ($presentation_list->getListType() == SummitSelectedPresentationList::Individual) { - $interested_presentations = []; - foreach ($presentation_list->getSelectedPresentationsByCollection(SummitSelectedPresentation::CollectionMaybe) as $p) { - $interested_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['interested_presentations'] = $interested_presentations; - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/SummitSelectedPresentationSerializer.php b/app/ModelSerializers/Summit/Presentation/SummitSelectedPresentationSerializer.php deleted file mode 100644 index 22007fae..00000000 --- a/app/ModelSerializers/Summit/Presentation/SummitSelectedPresentationSerializer.php +++ /dev/null @@ -1,83 +0,0 @@ - 'type:json_string', - 'Order' => 'order:json_int', - 'ListId' => 'list_id:json_int', - 'PresentationId' => 'presentation_id:json_int', - ]; - - protected static $allowed_fields = [ - 'type', - 'category_id', - 'presentation_id', - 'order', - 'list_id', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $selected_presentation = $this->object; - - if (!$selected_presentation instanceof SummitSelectedPresentation) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'presentation': - { - if ($selected_presentation->getPresentationId() > 0) { - unset($values['presentation_id']); - $values['presentation'] = SerializerRegistry::getInstance()->getSerializer - ( - $selected_presentation->getPresentation(), - IPresentationSerializerTypes::TrackChairs - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'list': - { - if ($selected_presentation->getListId() > 0) { - unset($values['list_id']); - $values['list'] = SerializerRegistry::getInstance()->getSerializer($selected_presentation->getList())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/SummitTrackChairCSVSerializer.php b/app/ModelSerializers/Summit/Presentation/SummitTrackChairCSVSerializer.php deleted file mode 100644 index 3471c58e..00000000 --- a/app/ModelSerializers/Summit/Presentation/SummitTrackChairCSVSerializer.php +++ /dev/null @@ -1,67 +0,0 @@ - 'summit_id:json_int', - 'MemberId' => 'member_id:json_int', - ]; - - protected static $allowed_fields = [ - 'summit_id', - 'member_id', - ]; - - protected static $allowed_relations = [ - 'categories', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $track_chair = $this->object; - - if (!$track_chair instanceof SummitTrackChair) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - $values['member_first_name'] = $track_chair->getMember()->getFirstName(); - $values['member_last_name'] = $track_chair->getMember()->getLastName(); - $values['member_email'] = $track_chair->getMember()->getEmail(); - - if (in_array('categories', $relations)) { - $categories = []; - foreach ($track_chair->getCategories() as $t) { - $categories[] = $t->getTitle(); - } - $values['categories'] = implode("|", $categories); - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/SummitTrackChairSerializer.php b/app/ModelSerializers/Summit/Presentation/SummitTrackChairSerializer.php deleted file mode 100644 index fc20738f..00000000 --- a/app/ModelSerializers/Summit/Presentation/SummitTrackChairSerializer.php +++ /dev/null @@ -1,101 +0,0 @@ - 'summit_id:json_int', - 'MemberId' => 'member_id:json_int', - ]; - - protected static $allowed_relations = [ - 'categories', - ]; - - protected function getMemberSerializerType():string{ - return SerializerRegistry::SerializerType_Public; - } - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $track_chair = $this->object; - - if (!$track_chair instanceof SummitTrackChair) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - if (in_array('categories', $relations)) { - $categories = []; - foreach ($track_chair->getCategories() as $t) { - $categories[] = $t->getId(); - } - $values['categories'] = $categories; - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'categories': - { - $categories = []; - foreach ($track_chair->getCategories() as $t) { - $categories[] = SerializerRegistry::getInstance()->getSerializer($t)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['categories'] = $categories; - } - break; - case 'member': - { - - if ($track_chair->getMemberId() > 0) { - unset($values['member_id']); - $values['member'] = SerializerRegistry::getInstance()->getSerializer - ( - $track_chair->getMember(), - $this->getMemberSerializerType() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'summit': - { - if ($track_chair->getSummitId() > 0) { - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer($track_chair->getSummit())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackChairPresentationCSVSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackChairPresentationCSVSerializer.php deleted file mode 100644 index 68b1fae9..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackChairPresentationCSVSerializer.php +++ /dev/null @@ -1,44 +0,0 @@ -object; - if(!$presentation instanceof Presentation) return $values; - - if(isset($values['description'])){ - $values['description'] = strip_tags($values['description']); - } - if(isset($values['attendees_expected_learnt'])){ - $values['attendees_expected_learnt'] = strip_tags($values['attendees_expected_learnt']); - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackChairPresentationSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackChairPresentationSerializer.php deleted file mode 100644 index 570f5c7c..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackChairPresentationSerializer.php +++ /dev/null @@ -1,198 +0,0 @@ - 'is_group_selected:json_bool', - 'ViewsCount' => 'views_count:json_int', - 'CommentsCount' => 'comments_count:json_int', - 'PopularityScore' => 'popularity_score:json_float', - 'VotesCount' => 'votes_count:json_int', - 'VotesAverage' => 'votes_average:json_float', - 'VotesTotalPoints' => 'votes_total_points:json_int', - ]; - - protected static $allowed_fields = [ - 'is_group_selected', - 'views_count', - 'comments_count', - 'popularity_score', - 'votes_count', - 'votes_average', - 'votes_total_points', - 'remaining_selections', - ]; - - protected static $allowed_relations = [ - 'slides', - 'media_uploads', - 'videos', - 'speakers', - 'links', - 'extra_questions', - 'public_comments', - 'selectors', - 'likers', - 'passers', - 'comments', - 'viewers', - 'category_changes_requests', - ]; - - /** - * @return string - */ - protected function getMediaUploadsSerializerType():string{ - return SerializerRegistry::SerializerType_Private; - } - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $presentation = $this->object; - - if(!$presentation instanceof Presentation) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - $values['remaining_selections'] = $presentation->getRemainingSelectionsForMember($this->resource_server_context->getCurrentUser(false)); - - if(in_array('selectors', $relations)) - { - $selectors = []; - foreach ($presentation->getSelectors() as $m) { - $selectors[] = $m->getId(); - } - $values['selectors'] = $selectors; - } - - if(in_array('likers', $relations)) - { - $likers = []; - foreach ($presentation->getLikers() as $m) { - $likers[] = $m->getId(); - } - $values['likers'] = $likers; - } - - if(in_array('viewers', $relations)) - { - $viewers = []; - foreach ($presentation->getMemberViewers() as $m) { - $viewers[] = $m->getId(); - } - $values['viewers'] = $viewers; - } - - if(in_array('passers', $relations)) - { - $passers = []; - foreach ($presentation->getPassers() as $m) { - $passers[] = $m->getId(); - } - $values['passers'] = $passers; - } - - if(in_array('comments', $relations)) - { - $comments = []; - foreach ($presentation->getComments() as $comment) { - $comments[] = $comment->getId(); - } - $values['comments'] = $comments; - } - - if(in_array('category_changes_requests', $relations)) - { - $category_changes_requests = []; - foreach ($presentation->getCategoryChangeRequests() as $request) { - $category_changes_requests[] = $request->getId(); - } - $values['category_changes_requests'] = $category_changes_requests; - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'selectors': { - $selectors = []; - foreach ($presentation->getSelectors() as $m) { - $selectors[] = SerializerRegistry::getInstance()->getSerializer($m)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['selectors'] = $selectors; - } - break; - case 'likers': { - $likers = []; - foreach ($presentation->getLikers() as $m) { - $likers[] = SerializerRegistry::getInstance()->getSerializer($m)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['likers'] = $likers; - } - break; - case 'passers': { - $passers = []; - foreach ($presentation->getPassers() as $m) { - $passers[] = SerializerRegistry::getInstance()->getSerializer($m)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['passers'] = $passers; - } - break; - case 'viewers': { - $viewers = []; - foreach ($presentation->getMemberViewers() as $m) { - $viewers[] = SerializerRegistry::getInstance()->getSerializer($m)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['viewers'] = $viewers; - } - break; - case 'comments':{ - $comments = []; - foreach ($presentation->getComments() as $comment) { - $comments[] = SerializerRegistry::getInstance()->getSerializer($comment)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['comments'] = $comments; - } - break; - case 'category_changes_requests':{ - $category_changes_requests = []; - foreach ($presentation->getCategoryChangeRequests() as $request) { - $category_changes_requests[] = SerializerRegistry::getInstance()->getSerializer($request)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['category_changes_requests'] = $category_changes_requests; - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackAnswerSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackAnswerSerializer.php deleted file mode 100644 index c50d16f8..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackAnswerSerializer.php +++ /dev/null @@ -1,26 +0,0 @@ - 'value:json_string', - 'QuestionName' => 'question_name:json_string', - 'QuestionId' => 'question_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackDropDownQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackDropDownQuestionTemplateSerializer.php deleted file mode 100644 index e7d88227..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackDropDownQuestionTemplateSerializer.php +++ /dev/null @@ -1,26 +0,0 @@ - 'is_country_selector:json_boolean', - 'isMultiSelect' => 'is_multi_select:json_boolean', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackLiteralContentQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackLiteralContentQuestionTemplateSerializer.php deleted file mode 100644 index eaa6ba7a..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackLiteralContentQuestionTemplateSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'content:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackMultiValueQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackMultiValueQuestionTemplateSerializer.php deleted file mode 100644 index 94339e8c..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackMultiValueQuestionTemplateSerializer.php +++ /dev/null @@ -1,50 +0,0 @@ - 'empty_string:json_string', - 'DefaultValueId' => 'default_value_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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $question_template = $this->object; - if(!$question_template instanceof TrackMultiValueQuestionTemplate) return $values; - - $list = []; - - foreach($question_template->getValues() as $v) - { - $list[] = SerializerRegistry::getInstance()->getSerializer($v)->serialize(); - } - - $values['values'] = $list; - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackQuestionTemplateSerializer.php deleted file mode 100644 index 2b8ed74a..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackQuestionTemplateSerializer.php +++ /dev/null @@ -1,59 +0,0 @@ - 'name:json_string', - 'Label' => 'label:json_string', - 'Mandatory' => 'is_mandatory:json_boolean', - 'ReadOnly' => 'is_read_only:json_boolean', - 'AfterQuestion' => 'after_question:json_string', - 'ClassName' => 'class_name: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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $question_template = $this->object; - if(!$question_template instanceof TrackQuestionTemplate) return $values; - - $tracks = []; - - foreach($question_template->getTracks() as $t) - { - if(!is_null($expand) && in_array('tracks', explode(',',$expand))){ - $tracks[] = SerializerRegistry::getInstance()->getSerializer($t)->serialize(); - } - else - $tracks[] = intval($t->getId()); - } - - $values['tracks'] = $tracks; - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackQuestionValueTemplateSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackQuestionValueTemplateSerializer.php deleted file mode 100644 index 6f201936..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackQuestionValueTemplateSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'value:json_string', - 'Label' => 'label:json_string', - 'Order' => 'order:json_int', - 'OwnerId' => 'owner_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackSingleValueTemplateQuestionSerializer.php b/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackSingleValueTemplateQuestionSerializer.php deleted file mode 100644 index 2d432054..00000000 --- a/app/ModelSerializers/Summit/Presentation/TrackQuestions/TrackSingleValueTemplateQuestionSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'initial_value:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/RSVPAnswerSerializer.php b/app/ModelSerializers/Summit/RSVP/RSVPAnswerSerializer.php deleted file mode 100644 index 2b8b6e80..00000000 --- a/app/ModelSerializers/Summit/RSVP/RSVPAnswerSerializer.php +++ /dev/null @@ -1,63 +0,0 @@ - 'value:json_string', - 'RSVPId' => 'rsvp_id:json_int', - 'QuestionId' => 'question_id:json_string', - 'Created' => 'created:datetime_epoch', - ]; - - /** - * @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 = []) - { - $answer = $this->object; - if(! $answer instanceof RSVPAnswer) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'rsvp': { - unset($values['rsvp_id']); - $values['rsvp_id'] = SerializerRegistry::getInstance()->getSerializer($answer->getRsvp())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'question': { - unset($values['question_id']); - $values['question'] = SerializerRegistry::getInstance()->getSerializer($answer->getQuestion())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/RSVPSerializer.php b/app/ModelSerializers/Summit/RSVP/RSVPSerializer.php deleted file mode 100644 index 79b0e0ee..00000000 --- a/app/ModelSerializers/Summit/RSVP/RSVPSerializer.php +++ /dev/null @@ -1,82 +0,0 @@ - 'owner_id:json_int', - 'EventId' => 'event_id:json_int', - 'SeatType' => 'seat_type:json_string', - 'Created' => 'created:datetime_epoch', - 'ConfirmationNumber' => 'confirmation_number:json_string', - 'EventUri' => 'event_uri: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 = []) - { - $rsvp = $this->object; - if(! $rsvp instanceof RSVP) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - $answers = []; - foreach ($rsvp->getAnswers() as $answer){ - $answers[] = $answer->getId(); - } - - $values['answers'] = $answers; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'owner': { - if(!$rsvp->hasOwner()) continue; - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($rsvp->getOwner())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'event': { - if(!$rsvp->hasEvent()) continue; - unset($values['event_id']); - $values['event'] = SerializerRegistry::getInstance()->getSerializer($rsvp->getEvent())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'answers':{ - $answers = []; - foreach ($rsvp->getAnswers() as $answer){ - $answers[] = SerializerRegistry::getInstance()->getSerializer($answer)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['answers'] = $answers; - } - break; - } - } - } - - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/Templates/RSVPDropDownQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/RSVP/Templates/RSVPDropDownQuestionTemplateSerializer.php deleted file mode 100644 index a11dc0bd..00000000 --- a/app/ModelSerializers/Summit/RSVP/Templates/RSVPDropDownQuestionTemplateSerializer.php +++ /dev/null @@ -1,62 +0,0 @@ - 'is_country_selector:json_boolean', - 'UseChosenPlugin' => 'use_chosen_plugin:json_boolean', - 'Multiselect' => 'is_multiselect:json_boolean', - ]; - - /** - * @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 RSVPDropDownQuestionTemplate) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if($question->isCountrySelector()) { - $question_values = []; - $extra_options = [ - - 'Worldwide' => 'Worldwide', - 'Prefer not to say' => 'Prefer not to say', - 'Too many to list' => 'Too many to list', - ]; - - $options = array_merge($extra_options, CountryCodes::$iso_3166_countryCodes); - foreach($options as $k => $v) - { - $question_values[] = [ - 'id' => $k, - 'value' => $v - ]; - } - $values['values'] = $question_values; - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/Templates/RSVPLiteralContentQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/RSVP/Templates/RSVPLiteralContentQuestionTemplateSerializer.php deleted file mode 100644 index b66e0462..00000000 --- a/app/ModelSerializers/Summit/RSVP/Templates/RSVPLiteralContentQuestionTemplateSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'content:json_string', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/Templates/RSVPMultiValueQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/RSVP/Templates/RSVPMultiValueQuestionTemplateSerializer.php deleted file mode 100644 index 6564d64a..00000000 --- a/app/ModelSerializers/Summit/RSVP/Templates/RSVPMultiValueQuestionTemplateSerializer.php +++ /dev/null @@ -1,52 +0,0 @@ - '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; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/Templates/RSVPQuestionTemplateSerializer.php b/app/ModelSerializers/Summit/RSVP/Templates/RSVPQuestionTemplateSerializer.php deleted file mode 100644 index f9ef5b52..00000000 --- a/app/ModelSerializers/Summit/RSVP/Templates/RSVPQuestionTemplateSerializer.php +++ /dev/null @@ -1,29 +0,0 @@ - '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', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/Templates/RSVPQuestionValueTemplateSerializer.php b/app/ModelSerializers/Summit/RSVP/Templates/RSVPQuestionValueTemplateSerializer.php deleted file mode 100644 index 3c80fb61..00000000 --- a/app/ModelSerializers/Summit/RSVP/Templates/RSVPQuestionValueTemplateSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'value:json_string', - 'Label' => 'label:json_string', - 'Order' => 'order:json_int', - 'OwnerId' => 'owner_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/Templates/RSVPSingleValueTemplateQuestionSerializer.php b/app/ModelSerializers/Summit/RSVP/Templates/RSVPSingleValueTemplateQuestionSerializer.php deleted file mode 100644 index b2ce3d6e..00000000 --- a/app/ModelSerializers/Summit/RSVP/Templates/RSVPSingleValueTemplateQuestionSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'initial_value:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/RSVP/Templates/RSVPTemplateSerializer.php b/app/ModelSerializers/Summit/RSVP/Templates/RSVPTemplateSerializer.php deleted file mode 100644 index dddcbf7e..00000000 --- a/app/ModelSerializers/Summit/RSVP/Templates/RSVPTemplateSerializer.php +++ /dev/null @@ -1,70 +0,0 @@ - 'title:json_string', - 'Enabled' => 'is_enabled: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; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/BaseSummitAttendeeTicketSerializer.php b/app/ModelSerializers/Summit/Registration/BaseSummitAttendeeTicketSerializer.php deleted file mode 100644 index 61155e5a..00000000 --- a/app/ModelSerializers/Summit/Registration/BaseSummitAttendeeTicketSerializer.php +++ /dev/null @@ -1,117 +0,0 @@ - 'number:json_string', - 'Status' => 'status:json_string', - 'ExternalOrderId' => 'external_order_id:json_string', - 'ExternalAttendeeId' => 'external_attendee_id:json_string', - 'BoughtDate' => 'bought_date:datetime_epoch', - 'TicketTypeId' => 'ticket_type_id:json_int', - 'OwnerId' => 'owner_id:json_int', - 'OrderId' => 'order_id:json_int', - 'BadgeId' => 'badge_id:json_int', - 'PromoCodeId' => 'promo_code_id:json_int', - 'RawCost' => 'raw_cost:json_float', - 'FinalAmount' => 'final_amount:json_float', - 'Discount' => 'discount:json_float', - 'RefundedAmount' => 'refunded_amount:json_float', - 'Currency' => 'currency:json_string', - 'Active' => 'is_active:json_bool', - ]; - - protected static $allowed_relations = [ - 'applied_taxes', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $ticket = $this->object; - if (!$ticket instanceof SummitAttendeeTicket) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!count($relations)) $relations = $this->getAllowedRelations(); - - Log::debug(sprintf("BaseSummitAttendeeTicketSerializer::serialize expand %s", $expand)); - - if (in_array('applied_taxes', $relations)) { - $applied_taxes = []; - foreach ($ticket->getAppliedTaxes() as $tax) { - $applied_taxes[] = $tax->getId(); - } - $values['applied_taxes'] = $applied_taxes; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'ticket_type': { - if(!$ticket->hasTicketType()) continue; - unset($values['ticket_type_id']); - $values['ticket_type'] = SerializerRegistry::getInstance()->getSerializer($ticket->getTicketType())->serialize(AbstractSerializer::getExpandForPrefix('ticket_type', $expand)); - } - break; - case 'badge': { - if(!$ticket->hasBadge()) continue; - unset($values['badge_id']); - $values['badge'] = SerializerRegistry::getInstance()->getSerializer($ticket->getBadge())->serialize(AbstractSerializer::getExpandForPrefix('badge', $expand)); - } - break; - case 'promo_code': { - if(!$ticket->hasPromoCode()) continue; - unset($values['promo_code_id']); - $values['promo_code'] = SerializerRegistry::getInstance()->getSerializer($ticket->getPromoCode())->serialize(AbstractSerializer::getExpandForPrefix('promo_code', $expand)); - } - break; - case 'applied_taxes': { - if (in_array('applied_taxes', $relations)) { - unset( $values['applied_taxes']); - $applied_taxes = []; - foreach ($ticket->getAppliedTaxes() as $tax) { - $applied_taxes[] = SerializerRegistry::getInstance()->getSerializer($tax)->serialize(AbstractSerializer::getExpandForPrefix('applied_taxes', $expand)); - } - $values['applied_taxes'] = $applied_taxes; - } - } - break; - case 'owner': { - if(!$ticket->hasOwner()) continue; - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($ticket->getOwner())->serialize(AbstractSerializer::getExpandForPrefix('owner', $expand)); - } - break; - } - - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/GuestEditionSummitAttendeeTicketSerializer.php b/app/ModelSerializers/Summit/Registration/GuestEditionSummitAttendeeTicketSerializer.php deleted file mode 100644 index 45243925..00000000 --- a/app/ModelSerializers/Summit/Registration/GuestEditionSummitAttendeeTicketSerializer.php +++ /dev/null @@ -1,47 +0,0 @@ -object; - if (!$ticket instanceof SummitAttendeeTicket) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - $base_url = Config::get('registration.dashboard_base_url', null); - $edit_ticket_link = Config::get('registration.dashboard_attendee_edit_form_url', null); - - if(empty($base_url)) - throw new \InvalidArgumentException("missing dashboard_base_url value"); - if(empty($edit_ticket_link)) - throw new \InvalidArgumentException("missing dashboard_attendee_edit_form_url value"); - - $values['edit_link'] = sprintf($edit_ticket_link, $base_url, $ticket->getHash()); - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/MemberSummitRegistrationDiscountCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/MemberSummitRegistrationDiscountCodeSerializer.php deleted file mode 100644 index 9ec77074..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/MemberSummitRegistrationDiscountCodeSerializer.php +++ /dev/null @@ -1,82 +0,0 @@ - 'first_name:json_string', - 'LastName' => 'last_name:json_string', - 'Email' => 'email:json_string', - 'Type' => 'type:json_string', - 'OwnerId' => 'owner_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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if(!$code instanceof MemberSummitRegistrationDiscountCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'owner': { - if($code->hasOwner()){ - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer - ( - $code->getOwner(), - $serializer_type - )->serialize($expand); - } - } - break; - case 'owner_name': { - if($code->hasOwner()){ - $values['owner_name'] = $code->getOwner()->getFullName(); - } - } - break; - case 'owner_email': { - if($code->hasOwner()){ - $values['owner_email'] = $code->getOwner()->getEmail(); - } - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/MemberSummitRegistrationPromoCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/MemberSummitRegistrationPromoCodeSerializer.php deleted file mode 100644 index 7a344abc..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/MemberSummitRegistrationPromoCodeSerializer.php +++ /dev/null @@ -1,81 +0,0 @@ - 'first_name:json_string', - 'LastName' => 'last_name:json_string', - 'Email' => 'email:json_string', - 'Type' => 'type:json_string', - 'OwnerId' => 'owner_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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if(!$code instanceof MemberSummitRegistrationPromoCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'owner': { - if($code->hasOwner()){ - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer - ( - $code->getOwner(), - $serializer_type - )->serialize($expand); - } - } - break; - case 'owner_name': { - if($code->hasOwner()){ - $values['owner_name'] = $code->getOwner()->getFullName(); - } - } - break; - case 'owner_email': { - if($code->hasOwner()){ - $values['owner_email'] = $code->getOwner()->getEmail(); - } - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/SpeakerSummitRegistrationDiscountCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/SpeakerSummitRegistrationDiscountCodeSerializer.php deleted file mode 100644 index ef206755..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/SpeakerSummitRegistrationDiscountCodeSerializer.php +++ /dev/null @@ -1,77 +0,0 @@ - 'type:json_string', - 'SpeakerId' => 'speaker_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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if(!$code instanceof SpeakerSummitRegistrationDiscountCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'speaker': { - if($code->hasSpeaker()){ - unset($values['speaker_id']); - $values['speaker'] = SerializerRegistry::getInstance()->getSerializer - ( - $code->getSpeaker(), - $serializer_type - )->serialize($expand); - } - } - case 'owner_name': { - if($code->hasSpeaker()){ - $values['owner_name'] = $code->getSpeaker()->getFullName(); - } - } - break; - case 'owner_email': { - if($code->hasSpeaker()){ - $values['owner_email'] = $code->getSpeaker()->getEmail(); - } - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/SpeakerSummitRegistrationPromoCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/SpeakerSummitRegistrationPromoCodeSerializer.php deleted file mode 100644 index 42505e85..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/SpeakerSummitRegistrationPromoCodeSerializer.php +++ /dev/null @@ -1,78 +0,0 @@ - 'type:json_string', - 'SpeakerId' => 'speaker_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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if(!$code instanceof SpeakerSummitRegistrationPromoCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'speaker': { - if($code->hasSpeaker()){ - unset($values['speaker_id']); - $values['speaker'] = SerializerRegistry::getInstance()->getSerializer - ( - $code->getSpeaker(), - $serializer_type - )->serialize($expand); - } - } - case 'owner_name': { - if($code->hasSpeaker()){ - $values['owner_name'] = $code->getSpeaker()->getFullName(); - } - } - break; - case 'owner_email': { - if($code->hasSpeaker()){ - $values['owner_email'] = $code->getSpeaker()->getEmail(); - } - } - break; - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/SponsorSummitRegistrationDiscountCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/SponsorSummitRegistrationDiscountCodeSerializer.php deleted file mode 100644 index 9234394d..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/SponsorSummitRegistrationDiscountCodeSerializer.php +++ /dev/null @@ -1,69 +0,0 @@ - 'sponsor_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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if(!$code instanceof SponsorSummitRegistrationDiscountCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'sponsor': { - if($code->hasSponsor()){ - unset($values['sponsor_id']); - $values['sponsor'] = SerializerRegistry::getInstance()->getSerializer - ( - $code->getSponsor(), - $serializer_type - )->serialize($expand); - } - } - break; - case 'sponsor_name':{ - $values['sponsor_name'] = $code->getSponsor()->getName(); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/SponsorSummitRegistrationPromoCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/SponsorSummitRegistrationPromoCodeSerializer.php deleted file mode 100644 index d26cb788..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/SponsorSummitRegistrationPromoCodeSerializer.php +++ /dev/null @@ -1,71 +0,0 @@ - 'sponsor_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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if(!$code instanceof SponsorSummitRegistrationPromoCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'sponsor': { - if($code->hasSponsor()){ - unset($values['sponsor_id']); - $values['sponsor'] = SerializerRegistry::getInstance()->getSerializer - ( - $code->getSponsor(), - $serializer_type - )->serialize($expand); - } - } - break; - case 'sponsor_name':{ - $values['sponsor_name'] = $code->getSponsor()->getName(); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeSerializer.php deleted file mode 100644 index bada6edb..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeSerializer.php +++ /dev/null @@ -1,79 +0,0 @@ - 'rate:json_float', - 'Amount' => 'amount:json_float', - ]; - - protected static $allowed_relations = [ - 'ticket_types_rules', - ]; - - /** - * @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 = []) - { - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if (!$code instanceof SummitRegistrationDiscountCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - unset($values['allowed_ticket_types']); - - if (in_array('ticket_types_rules', $relations)) { - $ticket_types_rules = []; - foreach ($code->getTicketTypesRules() as $ticket_types_rule) { - $ticket_types_rules[] = $ticket_types_rule->getId(); - } - $values['ticket_types_rules'] = $ticket_types_rules; - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'ticket_types_rules': - { - unset($values['ticket_types_rules']); - $ticket_types_rules = []; - foreach ($code->getTicketTypesRules() as $ticket_types_rule) { - $ticket_types_rules[] = SerializerRegistry::getInstance()->getSerializer($ticket_types_rule)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['ticket_types_rules'] = $ticket_types_rules; - } - break; - - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeTicketTypeRuleSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeTicketTypeRuleSerializer.php deleted file mode 100644 index 7dc6d42c..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeTicketTypeRuleSerializer.php +++ /dev/null @@ -1,69 +0,0 @@ - 'id:json_int', - 'Rate' => 'rate:json_float', - 'Amount' => 'amount:json_float', - 'TicketTypeId' => 'ticket_type_id:json_int', - 'DiscountCodeId' => 'discount_code_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 = []) - { - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $rule = $this->object; - if (!$rule instanceof SummitRegistrationDiscountCodeTicketTypeRule) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'ticket_type': - { - unset($values['ticket_type_id']); - $values['ticket_type'] = SerializerRegistry::getInstance()->getSerializer($rule->getTicketType())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'discount_code': - { - unset($values['discount_code_id']); - $values['discount_code'] = SerializerRegistry::getInstance()->getSerializer($rule->getDiscountCode())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationPromoCodeSerializer.php b/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationPromoCodeSerializer.php deleted file mode 100644 index d617d207..00000000 --- a/app/ModelSerializers/Summit/Registration/PromoCodes/SummitRegistrationPromoCodeSerializer.php +++ /dev/null @@ -1,114 +0,0 @@ - 'code:json_string', - 'Redeemed' => 'redeemed:json_boolean', - 'EmailSent' => 'email_sent:json_boolean', - 'Source' => 'source:json_string', - 'SummitId' => 'summit_id:json_int', - 'CreatorId' => 'creator_id:json_int', - 'QuantityAvailable' => 'quantity_available:json_int', - 'QuantityUsed' => 'quantity_used:json_int', - 'ValidSinceDate' => 'valid_since_date:datetime_epoch', - 'ValidUntilDate' => 'valid_until_date:datetime_epoch', - 'ClassName' => 'class_name:json_string', - ]; - - protected static $allowed_relations = [ - 'badge_features', - 'allowed_ticket_types', - ]; - - /** - * @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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $code = $this->object; - if(!$code instanceof SummitRegistrationPromoCode) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(in_array('badge_features', $relations)) { - $features = []; - foreach ($code->getBadgeFeatures() as $feature) { - $features[] = $feature->getId(); - } - $values['badge_features'] = $features; - } - - if(in_array('allowed_ticket_types', $relations)) { - $ticket_types = []; - foreach ($code->getAllowedTicketTypes() as $ticket_type) { - $ticket_types[] = $ticket_type->getId(); - } - $values['allowed_ticket_types'] = $ticket_types; - } - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'creator': { - if($code->hasCreator()){ - unset($values['creator_id']); - $values['creator'] = SerializerRegistry::getInstance()->getSerializer - ( - $code->getCreator(), - $serializer_type - )->serialize($expand); - } - } - break; - case 'badge_features': { - unset($values['badge_features']); - $features = []; - foreach ($code->getBadgeFeatures() as $feature) { - $features[] = SerializerRegistry::getInstance()->getSerializer($feature)->serialize($expand); - } - $values['badge_features'] = $features; - } - break; - case 'allowed_ticket_types': { - unset($values['allowed_ticket_types']); - - $ticket_types = []; - foreach ($code->getAllowedTicketTypes() as $ticket_type) { - $ticket_types[] = SerializerRegistry::getInstance()->getSerializer($ticket_type)->serialize($expand); - } - $values['allowed_ticket_types'] = $ticket_types; - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/PublicEditionSummitAttendeeTicketSerializer.php b/app/ModelSerializers/Summit/Registration/PublicEditionSummitAttendeeTicketSerializer.php deleted file mode 100644 index 0f3b3c7a..00000000 --- a/app/ModelSerializers/Summit/Registration/PublicEditionSummitAttendeeTicketSerializer.php +++ /dev/null @@ -1,43 +0,0 @@ -object; - if (!$ticket instanceof SummitAttendeeTicket) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - $order_extra_questions = []; - $summit = $ticket->getOrder()->getSummit(); - foreach ($summit->getOrderExtraQuestions() as $question) { - $order_extra_questions[] = SerializerRegistry::getInstance()->getSerializer($question)->serialize(AbstractSerializer::filterExpandByPrefix($expand,"order_extra_questions")); - } - $values['order_extra_questions'] = $order_extra_questions; - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SponsorBadgeScanCSVSerializer.php b/app/ModelSerializers/Summit/Registration/SponsorBadgeScanCSVSerializer.php deleted file mode 100644 index e2dbd84f..00000000 --- a/app/ModelSerializers/Summit/Registration/SponsorBadgeScanCSVSerializer.php +++ /dev/null @@ -1,50 +0,0 @@ - 'scan_date:datetime_epoch', - 'QRCode' => 'qr_code:json_string', - 'SponsorId' => 'sponsor_id:json_int', - 'UserId' => 'scanned_by_id:json_int', - 'BadgeId' => 'badge_id:json_int', - 'AttendeeFirstName' => 'attendee_first_name:json_string', - 'AttendeeLastName' => 'attendee_last_name:json_string', - 'AttendeeEmail' => 'attendee_email:json_string', - 'AttendeeCompany' => 'attendee_company:json_string', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $scan = $this->object; - if (!$scan instanceof SponsorBadgeScan) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SponsorBadgeScanSerializer.php b/app/ModelSerializers/Summit/Registration/SponsorBadgeScanSerializer.php deleted file mode 100644 index c9874fdf..00000000 --- a/app/ModelSerializers/Summit/Registration/SponsorBadgeScanSerializer.php +++ /dev/null @@ -1,75 +0,0 @@ - 'scan_date:datetime_epoch', - 'QRCode' => 'qr_code:json_string', - 'SponsorId' => 'sponsor_id:json_int', - 'UserId' => 'scanned_by_id:json_int', - 'BadgeId' => 'badge_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(), array $relations = array(), array $params = array() ) - { - $scan = $this->object; - if (!$scan instanceof SponsorBadgeScan) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'sponsor': { - if(!$scan->hasSponsor()) continue; - unset($values['sponsor_id']); - $values['sponsor'] = SerializerRegistry::getInstance()->getSerializer($scan->getSponsor())->serialize(AbstractSerializer::filterExpandByPrefix($expand, "sponsor")); - } - break; - case 'scanned_by_id': { - if(!$scan->hasUser()) continue; - unset($values['scanned_by_id']); - $values['scanned_by'] = SerializerRegistry::getInstance()->getSerializer($scan->getUser())->serialize(AbstractSerializer::filterExpandByPrefix($expand, "user")); - } - break; - case 'badge': { - if(!$scan->hasBadge()) continue; - unset($values['badge_id']); - $values['badge'] = SerializerRegistry::getInstance()->getSerializer($scan->getBadge())->serialize(AbstractSerializer::filterExpandByPrefix($expand, "badge")); - } - break; - } - - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SponsorUserInfoGrantSerializer.php b/app/ModelSerializers/Summit/Registration/SponsorUserInfoGrantSerializer.php deleted file mode 100644 index fb968e4f..00000000 --- a/app/ModelSerializers/Summit/Registration/SponsorUserInfoGrantSerializer.php +++ /dev/null @@ -1,30 +0,0 @@ - 'scan_date:datetime_epoch', - 'SponsorId' => 'sponsor_id:json_int', - 'AllowedUserId' => 'allowed_user_id:json_int', - 'AttendeeFirstName' => 'attendee_first_name:json_string', - 'AttendeeLastName' => 'attendee_last_name:json_string', - 'AttendeeEmail' => 'attendee_email:json_string', - 'AttendeeCompany' => 'attendee_company:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAccessLevelTypeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAccessLevelTypeSerializer.php deleted file mode 100644 index 44c3ed69..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAccessLevelTypeSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'TemplateContent' => 'template_content:json_string', - 'Default' => 'is_default:json_boolean', - 'SummitId' => 'summit_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAttendeeAdminSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAttendeeAdminSerializer.php deleted file mode 100644 index 88736437..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAttendeeAdminSerializer.php +++ /dev/null @@ -1,23 +0,0 @@ - 'admin_notes:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAttendeeBadgeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAttendeeBadgeSerializer.php deleted file mode 100644 index bd9db527..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAttendeeBadgeSerializer.php +++ /dev/null @@ -1,100 +0,0 @@ - 'print_date:datetime_epoch', - 'QRCode' => 'qr_code:json_string', - 'Void' => 'is_void:json_boolean', - 'TicketId' => 'ticket_id:json_int', - 'TypeId' => 'type_id:json_int', - 'PrintedTimes' => 'printed_times:json_int', - ]; - - protected static $allowed_relations = [ - 'features', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - $badge = $this->object; - if(!$badge instanceof SummitAttendeeBadge) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (in_array('features', $relations)) { - $features = []; - - foreach ($badge->getAllFeatures() as $feature) { - $features[] = $feature->getId(); - } - $values['features'] = $features; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - case 'ticket': { - if ($badge->hasTicket()) - { - unset($values['ticket_id']); - $values['ticket'] = SerializerRegistry::getInstance()->getSerializer($badge->getTicket())->serialize(AbstractSerializer::getExpandForPrefix('ticket', $expand)); - } - } - break; - case 'type': { - if ($badge->hasType()) - { - unset($values['type_id']); - $values['type'] = SerializerRegistry::getInstance()->getSerializer($badge->getType())->serialize(AbstractSerializer::getExpandForPrefix('type', $expand)); - } - } - break; - case 'features': { - if (in_array('features', $relations)) { - unset( $values['features']); - $features = []; - - foreach ($badge->getAllFeatures() as $feature) { - $features[] = SerializerRegistry::getInstance()->getSerializer($feature)->serialize(AbstractSerializer::getExpandForPrefix('features', $expand)); - } - $values['features'] = $features; - } - } - break; - - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAttendeeCSVSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAttendeeCSVSerializer.php deleted file mode 100644 index 81b4a28c..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAttendeeCSVSerializer.php +++ /dev/null @@ -1,32 +0,0 @@ - 'member_id:json_int', - 'SummitId' => 'summit_id:json_int', - 'FirstName' => 'first_name:json_string', - 'Surname' => 'last_name:json_string', - 'Email' => 'email:json_string', - 'CompanyName' => 'company:json_string', - 'DisclaimerAcceptedDate' => 'disclaimer_accepted_date:datetime_epoch', - 'Status' => 'status:json_string', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAttendeeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAttendeeSerializer.php deleted file mode 100644 index 09fc830d..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAttendeeSerializer.php +++ /dev/null @@ -1,151 +0,0 @@ - 'summit_hall_checked_in:json_boolean', - 'SummitHallCheckedInDate' => 'summit_hall_checked_in_date:datetime_epoch', - 'SharedContactInfo' => 'shared_contact_info:json_boolean', - 'MemberId' => 'member_id:json_int', - 'SummitId' => 'summit_id:json_int', - 'FirstName' => 'first_name:json_string', - 'Surname' => 'last_name:json_string', - 'Email' => 'email:json_string', - 'CompanyName' => 'company:json_string', - 'DisclaimerAcceptedDate' => 'disclaimer_accepted_date:datetime_epoch', - 'DisclaimerAccepted' => 'disclaimer_accepted:json_boolean', - 'Status' => 'status:json_string', - ]; - - protected static $allowed_relations = [ - 'extra_questions', - 'tickets', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - $attendee = $this->object; - if(!$attendee instanceof SummitAttendee) return []; - $serializer_type = SerializerRegistry::SerializerType_Public; - - if(isset($params['serializer_type'])) - $serializer_type = $params['serializer_type']; - $summit = $attendee->getSummit(); - - $attendee->updateStatus(); - - $values = parent::serialize($expand, $fields, $relations, $params); - $member = null; - $speaker = null; - - if (in_array('tickets', $relations)) { - $tickets = []; - foreach ($attendee->getTickets() as $t) { - if (!$t->hasTicketType()) continue; - if ($t->isCancelled()) continue; - $tickets[] = intval($t->getTicketType()->getId()); - } - $values['tickets'] = $tickets; - } - - if (in_array('extra_questions', $relations)) { - $extra_question_answers = []; - - foreach ($attendee->getExtraQuestionAnswers() as $answer) { - $extra_question_answers[] = $answer->getId(); - } - $values['extra_questions'] = $extra_question_answers; - } - - if($attendee->hasMember()) - { - $member = $attendee->getMember(); - $values['member_id'] = $member->getId(); - $speaker = $summit->getSpeakerByMember($member); - if (!is_null($speaker)) { - $values['speaker_id'] = intval($speaker->getId()); - } - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'tickets': { - if (!in_array('tickets', $relations)) break; - unset($values['tickets']); - $tickets = []; - foreach($attendee->getTickets() as $t) - { - if (!$t->hasTicketType()) continue; - if ($t->isCancelled()) continue; - $tickets[] = SerializerRegistry::getInstance()->getSerializer($t)->serialize(AbstractSerializer::getExpandForPrefix('tickets', $expand)); - } - $values['tickets'] = $tickets; - } - break; - case 'extra_questions': { - if (!in_array('extra_questions', $relations)) break; - unset($values['extra_questions']); - $extra_question_answers = []; - foreach($attendee->getExtraQuestionAnswers() as $answer) - { - $extra_question_answers[] = SerializerRegistry::getInstance()->getSerializer($answer)->serialize(AbstractSerializer::getExpandForPrefix('extra_questions', $expand)); - } - $values['extra_questions'] = $extra_question_answers; - } - break; - case 'speaker': { - if (!is_null($speaker)) - { - unset($values['speaker_id']); - $values['speaker'] = SerializerRegistry::getInstance()->getSerializer($speaker)->serialize(AbstractSerializer::getExpandForPrefix('speaker', $expand)); - } - } - break; - case 'member':{ - if($attendee->hasMember()) - { - unset($values['member_id']); - $values['member'] = SerializerRegistry::getInstance() - ->getSerializer($attendee->getMember(), $serializer_type) - ->serialize( - AbstractSerializer::getExpandForPrefix('member', $expand), - [], - [], - ['summit' => $attendee->getSummit()]); - } - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketCSVSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketCSVSerializer.php deleted file mode 100644 index c198edf7..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketCSVSerializer.php +++ /dev/null @@ -1,87 +0,0 @@ - 'number:json_string', - 'Status' => 'status:json_string', - 'OwnerId' => 'attendee_id:json_int', - 'OwnerFirstName' => 'attendee_first_name:json_string', - 'OwnerSurname' => 'attendee_last_name:json_string', - 'OwnerEmail' => 'attendee_email:json_string', - 'OwnerCompany' => 'owner_company:json_string', - 'ExternalOrderId' => 'attendee_company:json_string', - 'ExternalAttendeeId' => 'external_attendee_id:json_string', - 'BoughtDate' => 'bought_date:datetime_epoch', - 'TicketTypeId' => 'ticket_type_id:json_int', - 'TicketTypeName' => 'ticket_type_name:json_string', - 'OrderId' => 'order_id:json_int', - 'BadgeId' => 'badge_id:json_int', - 'PromoCodeId' => 'promo_code_id:json_int', - 'PromoCodeValue' => 'promo_code:json_string', - 'RawCost' => 'raw_cost:json_float', - 'FinalAmount' => 'final_amount:json_float', - 'Discount' => 'discount:json_float', - 'RefundedAmount' => 'refunded_amount:json_float', - 'Currency' => 'currency:json_string', - 'BadgeTypeId' => 'badge_type_id:json_int', - 'BadgeTypeName' => 'badge_type_name:json_string', - 'Active' => 'is_active:json_bool', - ]; - - /** - * @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 = []) - { - $ticket = $this->object; - if (!$ticket instanceof SummitAttendeeTicket) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (isset($params['features_types'])) { - $ticket_features = $ticket->getBadgeFeaturesNames(); - foreach ($params['features_types'] as $features_type) { - if (!$features_type instanceof SummitBadgeFeatureType) continue; - $values[$features_type->getName()] = in_array($features_type->getName(), $ticket_features) ? '1' : '0'; - } - } - - if (isset($params['ticket_questions'])) { - foreach ($params['ticket_questions'] as $question) { - if (!$question instanceof SummitOrderExtraQuestionType) continue; - $values[$question->getLabel()] = ''; - $ticket_owner = $ticket->getOwner(); - if (!is_null($ticket_owner)) { - $answers = $ticket_owner->getExtraQuestionAnswerByQuestion($question); - if(is_null($answers)) continue; - $values[$question->getLabel()] = $question->getNiceValue($answers->getValue()); - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketSerializer.php deleted file mode 100644 index 2c6719e3..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketSerializer.php +++ /dev/null @@ -1,50 +0,0 @@ -object; - if (!$ticket instanceof SummitAttendeeTicket) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'order': { - if(!$ticket->hasOrder()) continue; - unset($values['order_id']); - $values['order'] = SerializerRegistry::getInstance()->getSerializer($ticket->getOrder())->serialize(AbstractSerializer::getExpandForPrefix('order', $expand)); - } - break; - } - - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketTaxSerializer.php b/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketTaxSerializer.php deleted file mode 100644 index 625679d8..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitAttendeeTicketTaxSerializer.php +++ /dev/null @@ -1,69 +0,0 @@ - 'amount:json_float', - 'TaxId' => 'tax_id:json_int', - 'TicketId' => 'ticket_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(), array $relations = array(), array $params = array()) - { - $tax_applied = $this->object; - if (!$tax_applied instanceof SummitAttendeeTicketTax) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!count($relations)) $relations = $this->getAllowedRelations(); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'tax': - { - if ($tax_applied->hasTax()) { - unset($values['tax_id']); - $values['tax'] = SerializerRegistry::getInstance()->getSerializer($tax_applied->getTax())->serialize($expand); - } - } - break; - case 'ticket': - { - if ($tax_applied->hasTicket()) { - unset($values['ticket_id']); - $values['ticket'] = SerializerRegistry::getInstance()->getSerializer($tax_applied->getTicket())->serialize($expand); - } - } - break; - } - - } - } - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitBadgeFeatureTypeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitBadgeFeatureTypeSerializer.php deleted file mode 100644 index 906fbcde..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitBadgeFeatureTypeSerializer.php +++ /dev/null @@ -1,28 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'TemplateContent' => 'template_content:json_string', - 'SummitId' => 'summit_id:json_int', - 'ImageUrl' => 'image:json_url', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitBadgeTypeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitBadgeTypeSerializer.php deleted file mode 100644 index 2869f11f..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitBadgeTypeSerializer.php +++ /dev/null @@ -1,95 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'TemplateContent' => 'template_content:json_string', - 'Default' => 'is_default:json_boolean', - 'SummitId' => 'summit_id:json_int', - ]; - - protected static $allowed_relations = [ - 'access_levels', - 'badge_features', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $badge_type = $this->object; - if (!$badge_type instanceof SummitBadgeType) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if(!count($relations)) $relations = $this->getAllowedRelations(); - // access_levels - if(in_array('access_levels', $relations)) { - $access_levels = []; - foreach ($badge_type->getAccessLevels() as $access_level) { - $access_levels[] = $access_level->getId(); - } - $values['access_levels'] = $access_levels; - } - - // badge_features - if(in_array('badge_features', $relations)) { - $features = []; - foreach ($badge_type->getBadgeFeatures() as $feature) { - $features[] = $feature->getId(); - } - $values['badge_features'] = $features; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'access_levels': { - unset($values['access_levels']); - $access_levels = []; - foreach ($badge_type->getAccessLevels() as $access_level) { - $access_levels[] = SerializerRegistry::getInstance()->getSerializer($access_level)->serialize(AbstractSerializer::getExpandForPrefix('access_levels', $expand)); - } - $values['access_levels'] = $access_levels; - } - break; - case 'badge_features': { - unset($values['badge_features']); - $badge_features = []; - foreach ($badge_type->getBadgeFeatures() as $feature) { - $badge_features[] = SerializerRegistry::getInstance()->getSerializer($feature)->serialize(AbstractSerializer::getExpandForPrefix('badge_features', $expand)); - } - $values['badge_features'] = $badge_features; - } - break; - } - - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitOrderAdminSerializer.php b/app/ModelSerializers/Summit/Registration/SummitOrderAdminSerializer.php deleted file mode 100644 index 4e6f4c82..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitOrderAdminSerializer.php +++ /dev/null @@ -1,23 +0,0 @@ - 'number:json_string', - 'Status' => 'status:json_string', - 'PaymentMethod' => 'payment_method:json_string', - 'OwnerFirstName' => 'owner_first_name:json_string', - 'OwnerSurname' => 'owner_last_name:json_string', - 'OwnerEmail' => 'owner_email:json_string', - 'OwnerCompany' => 'owner_company:json_string', - 'OwnerId' => 'owner_id:json_string', - 'SummitId' => 'summit_id:json_int', - ]; - - protected static $allowed_relations = [ - 'extra_questions', - 'tickets', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $order = $this->object; - if (!$order instanceof SummitOrder) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!count($relations)) $relations = $this->getAllowedRelations(); - - if (in_array('tickets', $relations)) { - $tickets = []; - - foreach ($order->getTickets() as $ticket) { - $tickets[] = $ticket->getId(); - } - $values['tickets'] = $tickets; - } - - if (in_array('extra_questions', $relations)) { - $extra_question_answers = []; - - foreach ($order->getExtraQuestionAnswers() as $answer) { - $extra_question_answers[] = $answer->getId(); - } - $values['extra_questions'] = $extra_question_answers; - } - - if (!empty($expand)) { - Log::debug(sprintf("SummitOrderBaseSerializer::serialize expand %s", $expand)); - - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'tickets': - { - if (!in_array('tickets', $relations)) break; - $tickets = []; - unset($values['tickets']); - foreach ($order->getTickets() as $ticket) { - $tickets[] = SerializerRegistry::getInstance()->getSerializer($ticket)->serialize(AbstractSerializer::getExpandForPrefix('tickets', $expand)); - } - $values['tickets'] = $tickets; - } - break; - case 'owner': - { - - if ($order->hasOwner()) { - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($order->getOwner())->serialize(AbstractSerializer::getExpandForPrefix('owner', $expand)); - } - } - break; - /* - case 'summit':{ - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer($order->getSummit())->serialize(null, - [ - 'id', - 'start_date', - 'end_date', - 'registration_begin_date', - 'registration_end_date', - 'reassign_ticket_till_date' - ], [], []); - } - break; - */ - case 'owner_company': - { - - if ($order->hasCompany()) { - unset($values['owner_company_id']); - $values['owner_company'] = SerializerRegistry::getInstance()->getSerializer($order->getCompany())->serialize(AbstractSerializer::getExpandForPrefix('owner_company', $expand)); - } - } - break; - case 'extra_questions': - { - if (!in_array('extra_questions', $relations)) break; - $extra_question_answers = []; - unset($values['extra_questions']); - foreach ($order->getExtraQuestionAnswers() as $answer) { - $extra_question_answers[] = SerializerRegistry::getInstance()->getSerializer($answer)->serialize(AbstractSerializer::getExpandForPrefix('extra_questions', $expand)); - } - $values['extra_questions'] = $extra_question_answers; - } - break; - } - } - } - - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitOrderCheckoutSerializer.php b/app/ModelSerializers/Summit/Registration/SummitOrderCheckoutSerializer.php deleted file mode 100644 index 8200d301..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitOrderCheckoutSerializer.php +++ /dev/null @@ -1,30 +0,0 @@ - 'billing_address_1:json_string', - 'BillingAddress2' => 'billing_address_2:json_string', - 'BillingAddressZipCode' => 'billing_address_zip_code:json_string', - 'BillingAddressCity' => 'billing_address_city:json_string', - 'BillingAddressState' => 'billing_address_state:json_string', - 'BillingAddressCountryIsoCode' => 'billing_address_country_iso_code:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitOrderExtraQuestionAnswerSerializer.php b/app/ModelSerializers/Summit/Registration/SummitOrderExtraQuestionAnswerSerializer.php deleted file mode 100644 index 4e6625c2..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitOrderExtraQuestionAnswerSerializer.php +++ /dev/null @@ -1,76 +0,0 @@ - 'order_id:json_int', - 'AttendeeId' => 'attendee_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(), array $relations = array(), array $params = array()) - { - $answer = $this->object; - if (!$answer instanceof SummitOrderExtraQuestionAnswer) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!count($relations)) $relations = $this->getAllowedRelations(); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - - case 'order': - { - - if ($answer->hasOrder()) { - unset($values['order_id']); - $values['order'] = SerializerRegistry::getInstance()->getSerializer($answer->getOrder()) - ->serialize(AbstractSerializer::getExpandForPrefix('order', $expand)); - } - } - break; - - case 'attendee': - { - - if ($answer->hasAttendee()) { - unset($values['attendee_id']); - $values['attendee'] = SerializerRegistry::getInstance()->getSerializer($answer->getAttendee()) - ->serialize(AbstractSerializer::getExpandForPrefix('attendee', $expand)); - } - } - break; - - } - } - } - - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitOrderExtraQuestionTypeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitOrderExtraQuestionTypeSerializer.php deleted file mode 100644 index 6880f7e8..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitOrderExtraQuestionTypeSerializer.php +++ /dev/null @@ -1,42 +0,0 @@ - 'usage:json_string', - 'Printable' => 'printable:json_boolean', - '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(), array $relations = array(), array $params = array() ) - { - $question = $this->object; - if (!$question instanceof SummitOrderExtraQuestionType) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitOrderReservationSerializer.php b/app/ModelSerializers/Summit/Registration/SummitOrderReservationSerializer.php deleted file mode 100644 index 77de0e1f..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitOrderReservationSerializer.php +++ /dev/null @@ -1,32 +0,0 @@ - 'raw_amount:json_float', - 'FinalAmount' => 'amount:json_float', - 'TaxesAmount' => 'taxes_amount:json_float', - 'DiscountAmount' => 'discount_amount:json_float', - 'PaymentGatewayClientToken' => 'payment_gateway_client_token:json_string', - 'PaymentGatewayCartId' => 'payment_gateway_cart_id:json_string', - 'Hash' => 'hash:json_string', - 'HashCreationDate' => 'hash_creation_date:datetime_epoch', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitRefundPolicyTypeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitRefundPolicyTypeSerializer.php deleted file mode 100644 index 93d70ceb..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitRefundPolicyTypeSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'name:json_string', - 'UntilXDaysBeforeEventStarts' => 'until_x_days_before_event_starts:json_int', - 'RefundRate' => 'refund_rate:json_float', - 'SummitId' => 'summit_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitRegistrationInvitationCSVSerializer.php b/app/ModelSerializers/Summit/Registration/SummitRegistrationInvitationCSVSerializer.php deleted file mode 100644 index 574ff69a..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitRegistrationInvitationCSVSerializer.php +++ /dev/null @@ -1,32 +0,0 @@ - 'member_id:json_int', - 'OrderId' => 'order_id:json_int', - 'SummitId' => 'summit_id:json_int', - 'FirstName' => 'first_name:json_string', - 'LastName' => 'last_name:json_string', - 'Email' => 'email:json_string', - 'Accepted' => 'is_accepted:jon_boolean', - 'Sent' => 'is_sent:jon_boolean', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitRegistrationInvitationSerializer.php b/app/ModelSerializers/Summit/Registration/SummitRegistrationInvitationSerializer.php deleted file mode 100644 index 9533f753..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitRegistrationInvitationSerializer.php +++ /dev/null @@ -1,31 +0,0 @@ - 'email:json_string', - 'FirstName' => 'first_name:json_string', - 'LastName' => 'last_name:json_string', - 'SummitId' => 'summit_id:json_int', - 'Accepted' => 'is_accepted:json_boolean', - 'Sent' => 'is_sent:json_boolean', - 'AcceptedDate' => 'accepted_date:datetime_epoch', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitTaxTypeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitTaxTypeSerializer.php deleted file mode 100644 index 520adef1..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitTaxTypeSerializer.php +++ /dev/null @@ -1,73 +0,0 @@ - 'name:json_string', - 'TaxId' => 'tax_id:json_string', - 'Rate' => 'rate:json_float', - 'SummitId' => 'summit_id:json_int', - ]; - - protected static $allowed_relations = [ - 'ticket_types', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $tax = $this->object; - if (!$tax instanceof SummitTaxType) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if(!count($relations)) $relations = $this->getAllowedRelations(); - // applied_taxes - if(in_array('ticket_types', $relations)) { - $ticket_types = []; - foreach ($tax->getTicketTypes() as $ticket_type) { - $ticket_types[] = $ticket_type->getId(); - } - $values['ticket_types'] = $ticket_types; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'ticket_types': { - unset($values['ticket_types']); - $ticket_types = []; - foreach ($tax->getTicketTypes() as $ticket_type) { - $ticket_types[] = SerializerRegistry::getInstance()->getSerializer($ticket_type)->serialize($expand); - } - $values['ticket_types'] = $ticket_types; - } - break; - } - - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Registration/SummitTicketTypeSerializer.php b/app/ModelSerializers/Summit/Registration/SummitTicketTypeSerializer.php deleted file mode 100644 index 1ab6f0fc..00000000 --- a/app/ModelSerializers/Summit/Registration/SummitTicketTypeSerializer.php +++ /dev/null @@ -1,90 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'ExternalId' => 'external_id:json_string', - 'SummitId' => 'summit_id:json_int', - 'Cost' => 'cost:json_float', - 'Currency' => 'currency:json_string', - 'Quantity2Sell' => 'quantity_2_sell:json_int', - 'MaxQuantityPerOrder' => 'max_quantity_per_order:json_int', - 'SalesStartDate' => 'sales_start_date:datetime_epoch', - 'SalesEndDate' => 'sales_end_date:datetime_epoch', - 'BadgeTypeId' => 'badge_type_id:json_int', - 'QuantitySold' => 'quantity_sold:json_int', - ]; - - protected static $allowed_relations = [ - 'applied_taxes', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $ticket_type = $this->object; - if (!$ticket_type instanceof SummitTicketType) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - // applied_taxes - if(in_array('applied_taxes', $relations)) { - $applied_taxes = []; - foreach ($ticket_type->getAppliedTaxes() as $tax) { - $applied_taxes[] = $tax->getId(); - } - $values['applied_taxes'] = $applied_taxes; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'applied_taxes': { - unset($values['applied_taxes']); - $applied_taxes = []; - foreach ($ticket_type->getAppliedTaxes() as $tax) { - $applied_taxes[] = SerializerRegistry::getInstance()->getSerializer($tax)->serialize(AbstractSerializer::filterExpandByPrefix($expand, "applied_taxes")); - } - $values['applied_taxes'] = $applied_taxes; - } - break; - - case 'badge_type': { - if($ticket_type->hasBadgeType()) { - unset($values['badge_type_id']); - $values['badge_type'] = SerializerRegistry::getInstance()->getSerializer($ticket_type->getBadgeType())->serialize(AbstractSerializer::filterExpandByPrefix($expand, "badge_type")); - } - } - break; - } - - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/ScheduledSummitLocationBannerSerializer.php b/app/ModelSerializers/Summit/ScheduledSummitLocationBannerSerializer.php deleted file mode 100644 index 77601ec3..00000000 --- a/app/ModelSerializers/Summit/ScheduledSummitLocationBannerSerializer.php +++ /dev/null @@ -1,26 +0,0 @@ - 'start_date:datetime_epoch', - 'EndDate' => 'end_date:datetime_epoch', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SelectionPlanSerializer.php b/app/ModelSerializers/Summit/SelectionPlanSerializer.php deleted file mode 100644 index 1e19118e..00000000 --- a/app/ModelSerializers/Summit/SelectionPlanSerializer.php +++ /dev/null @@ -1,97 +0,0 @@ - 'name:json_string', - 'Enabled' => 'is_enabled:json_boolean', - 'SubmissionBeginDate' => 'submission_begin_date:datetime_epoch', - 'SubmissionEndDate' => 'submission_end_date:datetime_epoch', - 'MaxSubmissionAllowedPerUser' => 'max_submission_allowed_per_user:json_int', - 'VotingBeginDate' => 'voting_begin_date:datetime_epoch', - 'VotingEndDate' => 'voting_end_date:datetime_epoch', - 'SelectionBeginDate' => 'selection_begin_date:datetime_epoch', - 'SelectionEndDate' => 'selection_end_date:datetime_epoch', - 'SummitId' => 'summit_id:json_int', - 'AllowNewPresentations' => 'allow_new_presentations:json_boolean', - ]; - - /** - * @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 = []) - { - $selection_plan = $this->object; - if (!$selection_plan instanceof SelectionPlan) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - $category_groups = []; - foreach ($selection_plan->getCategoryGroups() as $group) { - $category_groups[] = $group->getId(); - } - - $values['track_groups'] = $category_groups; - - $extra_questions = []; - foreach ($selection_plan->getExtraQuestions() as $extraQuestion) { - $extra_questions[] = $extraQuestion->getId(); - } - - $values['extra_questions'] = $extra_questions; - - if (!empty($expand)) { - $relations = explode(',', $expand); - foreach ($relations as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'track_groups':{ - $category_groups = []; - foreach ($selection_plan->getCategoryGroups() as $group) { - $category_groups[] = SerializerRegistry::getInstance()->getSerializer($group)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['track_groups'] = $category_groups; - } - break; - case 'extra_questions':{ - $extra_questions = []; - foreach ($selection_plan->getExtraQuestions() as $extraQuestion) { - $extra_questions[] = SerializerRegistry::getInstance()->getSerializer($extraQuestion)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['extra_questions'] = $extra_questions; - } - break; - case 'summit':{ - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer($selection_plan->getSummit())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/AdminPresentationSpeakerSerializer.php b/app/ModelSerializers/Summit/Speakers/AdminPresentationSpeakerSerializer.php deleted file mode 100644 index 18b81e84..00000000 --- a/app/ModelSerializers/Summit/Speakers/AdminPresentationSpeakerSerializer.php +++ /dev/null @@ -1,118 +0,0 @@ - 'notes:json_string', - 'Email' => 'email: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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $speaker = $this->object; - if(!$speaker instanceof PresentationSpeaker) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - $summit = isset($params['summit'])? $params['summit']:null; - - if(!is_null($summit)){ - $summit_assistance = $speaker->getAssistanceFor($summit); - if($summit_assistance){ - $values['summit_assistance'] = SerializerRegistry::getInstance()->getSerializer($summit_assistance)->serialize(); - } - $registration_code = $speaker->getPromoCodeFor($summit); - if($registration_code){ - $values['registration_code'] = SerializerRegistry::getInstance()->getSerializer($registration_code)->serialize(); - } - - $values['all_presentations'] = $speaker->getPresentationIds($summit->getId() ,false); - $values['all_moderated_presentations'] = $speaker->getModeratedPresentationIds($summit->getId(), false); - } - else{ - // get all summits info - $summit_assistances = []; - foreach ($speaker->getSummitAssistances() as $assistance){ - $summit_assistances[] = SerializerRegistry::getInstance()->getSerializer($assistance)->serialize(); - } - $values['summit_assistances'] = $summit_assistances; - - $registration_codes = []; - foreach ($speaker->getPromoCodes() as $promo_code){ - $registration_codes[] = SerializerRegistry::getInstance()->getSerializer($promo_code)->serialize(); - } - $values['registration_codes'] = $registration_codes; - - $values['all_presentations'] = $speaker->getAllPresentationIds(false); - $values['all_moderated_presentations'] = $speaker->getAllModeratedPresentationIds( false); - } - - $affiliations = []; - if($speaker->hasMember()) { - $member = $speaker->getMember(); - foreach ($member->getAllAffiliations() as $affiliation) { - $affiliations[] = SerializerRegistry::getInstance()->getSerializer($affiliation)->serialize('organization'); - } - } - $values['affiliations'] = $affiliations; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'presentations': { - $presentations = []; - $moderated_presentations = []; - if(is_null($summit)){ - - foreach ($speaker->getAllPresentations( false) as $p) { - $presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(); - } - - foreach ($speaker->getAllModeratedPresentations(false) as $p) { - $moderated_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(); - } - } - else{ - foreach ($speaker->getPresentations($summit->getId(), false) as $p) { - $presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(); - } - - foreach ($speaker->getModeratedPresentations($summit->getId(), false) as $p) { - $moderated_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(); - } - } - - $values['all_presentations'] = $presentations; - $values['all_moderated_presentations'] = $moderated_presentations; - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/PresentationSpeakerSerializer.php b/app/ModelSerializers/Summit/Speakers/PresentationSpeakerSerializer.php deleted file mode 100644 index 2d6db526..00000000 --- a/app/ModelSerializers/Summit/Speakers/PresentationSpeakerSerializer.php +++ /dev/null @@ -1,185 +0,0 @@ - 'first_name:json_string', - 'LastName' => 'last_name:json_string', - 'Title' => 'title:json_string', - 'Bio' => 'bio:json_string', - 'IRCHandle' => 'irc:json_string', - 'TwitterName' => 'twitter:json_string', - 'OrgHasCloud' => 'org_has_cloud:json_boolean', - 'Country' => 'country:json_string', - 'AvailableForBureau' => 'available_for_bureau:json_boolean', - 'FundedTravel' => 'funded_travel:json_boolean', - 'WillingToTravel' => 'willing_to_travel:json_boolean', - 'WillingToPresentVideo' => 'willing_to_present_video:json_boolean', - 'Email' => 'email:json_obfuscated_email', - 'MemberID' => 'member_id:json_int', - 'RegistrationRequestId' => 'registration_request_id:json_int', - 'ProfilePhotoUrl' => 'pic:json_url', - 'BigProfilePhotoUrl' => 'big_pic:json_url', - 'Company' => 'company:json_string', - 'PhoneNumber' => 'phone_number:json_string', - ]; - - protected static $allowed_relations = [ - 'member', - ]; - - /** - * @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 = [] ) - { - if(!count($relations)) $relations = $this->getAllowedRelations(); - $speaker = $this->object; - - if(!$speaker instanceof PresentationSpeaker) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - $summit_id = isset($params['summit_id'])? intval($params['summit_id']):null; - $published = isset($params['published'])? intval($params['published']):true; - - if(!is_null($summit_id)) { - $values['presentations'] = $speaker->getPresentationIds($summit_id, $published); - $values['moderated_presentations'] = $speaker->getModeratedPresentationIds($summit_id, $published); - } - - if (in_array('member', $relations) && $speaker->hasMember()) - { - $member = $speaker->getMember(); - $values['gender'] = $member->getGender(); - $values['member_id'] = intval($member->getId()); - $values['member_external_id'] = intval($member->getUserExternalId()); - if(!is_null($summit_id)) { - // check badges if the speaker user has tickets - $badge_features = []; - $already_processed_features= []; - foreach($member->getPaidSummitTicketsBySummitId($summit_id) as $ticket){ - foreach($ticket->getBadgeFeatures() as $feature) { - if(in_array($feature->getId(), $already_processed_features)) continue; - $already_processed_features[] = $feature->getId(); - $badge_features[] = SerializerRegistry::getInstance()->getSerializer($feature)->serialize(); - } - } - $values['badge_features'] = $badge_features; - } - } - - if(empty($values['first_name']) || empty($values['last_name'])){ - - $first_name = ''; - $last_name = ''; - if ($speaker->hasMember()) - { - $member = $speaker->getMember(); - $first_name = $member->getFirstName(); - $last_name = $member->getLastName(); - } - $values['first_name'] = $first_name; - $values['last_name'] = $last_name; - } - - $affiliations = []; - if($speaker->hasMember()) { - $member = $speaker->getMember(); - foreach ($member->getCurrentAffiliations() as $affiliation) { - $affiliations[] = SerializerRegistry::getInstance()->getSerializer($affiliation)->serialize('organization'); - } - } - $values['affiliations'] = $affiliations; - - $languages = []; - foreach ($speaker->getLanguages() as $language){ - $languages[] = SerializerRegistry::getInstance()->getSerializer($language)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'languages')); - } - $values['languages'] = $languages; - - $other_presentation_links = []; - foreach ($speaker->getOtherPresentationLinks() as $link){ - $other_presentation_links[] = SerializerRegistry::getInstance()->getSerializer($link)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'other_presentation_links')); - } - $values['other_presentation_links'] = $other_presentation_links; - - $areas_of_expertise = []; - foreach ($speaker->getAreasOfExpertise() as $exp){ - $areas_of_expertise[] = SerializerRegistry::getInstance()->getSerializer($exp)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'areas_of_expertise')); - } - $values['areas_of_expertise'] = $areas_of_expertise; - - $travel_preferences = []; - foreach ($speaker->getTravelPreferences() as $tp){ - $travel_preferences[] = SerializerRegistry::getInstance()->getSerializer($tp)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'travel_preferences')); - } - $values['travel_preferences'] = $travel_preferences; - - $active_involvements = []; - foreach ($speaker->getActiveInvolvements() as $ai){ - $active_involvements[] = SerializerRegistry::getInstance()->getSerializer($ai)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'active_involvements')); - } - $values['active_involvements'] = $active_involvements; - - $organizational_roles = []; - foreach ($speaker->getOrganizationalRoles() as $or){ - $organizational_roles[] = SerializerRegistry::getInstance()->getSerializer($or)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'organizational_roles')); - } - $values['organizational_roles'] = $organizational_roles; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation =trim($relation); - switch ($relation) { - case 'presentations': { - // if summit_id is null then all presentations - $presentations = []; - foreach ($speaker->getPresentations($summit_id, $published) as $p) { - $presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['presentations'] = $presentations; - - $moderated_presentations = []; - foreach ($speaker->getModeratedPresentations($summit_id, $published) as $p) { - $moderated_presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['moderated_presentations'] = $moderated_presentations; - } - break; - case 'member': { - if($speaker->hasMember()){ - unset($values['member_id']); - $values['member'] = SerializerRegistry::getInstance()->getSerializer($speaker->getMember())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/SpeakerActiveInvolvementSerializer.php b/app/ModelSerializers/Summit/Speakers/SpeakerActiveInvolvementSerializer.php deleted file mode 100644 index 9768c8f2..00000000 --- a/app/ModelSerializers/Summit/Speakers/SpeakerActiveInvolvementSerializer.php +++ /dev/null @@ -1,21 +0,0 @@ - 'involvement:json_string', - 'IsDefault' => 'is_default:json_boolean', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/SpeakerEditPermissionRequestSerializer.php b/app/ModelSerializers/Summit/Speakers/SpeakerEditPermissionRequestSerializer.php deleted file mode 100644 index a2da54c9..00000000 --- a/app/ModelSerializers/Summit/Speakers/SpeakerEditPermissionRequestSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'approved:json_boolean', - 'ApprovedDate' => 'approved_date:datetime_epoch', - 'SpeakerId' => 'speaker_id:json_int', - 'RequestedById' => 'requested_by_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/SpeakerExpertiseSerializer.php b/app/ModelSerializers/Summit/Speakers/SpeakerExpertiseSerializer.php deleted file mode 100644 index 48f41317..00000000 --- a/app/ModelSerializers/Summit/Speakers/SpeakerExpertiseSerializer.php +++ /dev/null @@ -1,21 +0,0 @@ - 'expertise:json_string', - 'SpeakerId' => 'speaker_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/SpeakerOrganizationalRoleSerializer.php b/app/ModelSerializers/Summit/Speakers/SpeakerOrganizationalRoleSerializer.php deleted file mode 100644 index a6d2ad48..00000000 --- a/app/ModelSerializers/Summit/Speakers/SpeakerOrganizationalRoleSerializer.php +++ /dev/null @@ -1,21 +0,0 @@ - 'role:json_string', - 'Default' => 'is_default:json_boolean', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/SpeakerPresentationLinkSerializer.php b/app/ModelSerializers/Summit/Speakers/SpeakerPresentationLinkSerializer.php deleted file mode 100644 index 88a5ed5d..00000000 --- a/app/ModelSerializers/Summit/Speakers/SpeakerPresentationLinkSerializer.php +++ /dev/null @@ -1,22 +0,0 @@ - 'link:json_string', - 'Title' => 'title:json_string', - 'SpeakerId' => 'speaker_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/Speakers/SpeakerTravelPreferenceSerializer.php b/app/ModelSerializers/Summit/Speakers/SpeakerTravelPreferenceSerializer.php deleted file mode 100644 index b01f8356..00000000 --- a/app/ModelSerializers/Summit/Speakers/SpeakerTravelPreferenceSerializer.php +++ /dev/null @@ -1,22 +0,0 @@ - 'country_iso_code:json_string', - 'CountryName' => 'country:json_string', - 'SpeakerId' => 'speaker_id:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SponsorSerializer.php b/app/ModelSerializers/Summit/SponsorSerializer.php deleted file mode 100644 index 32b6582d..00000000 --- a/app/ModelSerializers/Summit/SponsorSerializer.php +++ /dev/null @@ -1,108 +0,0 @@ - 'order:json_int', - 'SummitId' => 'summit_id:json_int', - 'CompanyId' => 'company_id:json_int', - 'SponsorshipId' => 'sponsorship_id:json_int', - ]; - - protected static $allowed_relations = [ - 'members', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $sponsor = $this->object; - if (!$sponsor instanceof Sponsor) return []; - if(!count($relations)) $relations = $this->getAllowedRelations(); - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('members', $relations)) { - $members = []; - foreach ($sponsor->getMembers() as $member) { - $members[] = $member->getId(); - } - $values['members'] = $members; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'summit': - { - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer($sponsor->getSummit())->serialize(AbstractSerializer::filterExpandByPrefix($expand,'summit'),[ - 'id', - 'name', - 'start_date', - 'end_date', - 'time_zone_id', - 'order_qr_prefix', - 'ticket_qr_prefix', - 'badge_qr_prefix', - 'qr_registry_field_delimiter', - ],['none']); - } - break; - case 'members': - { - unset($values['members']); - $members = []; - foreach ($sponsor->getMembers() as $member) { - $members[] = SerializerRegistry::getInstance()->getSerializer($member)->serialize(AbstractSerializer::filterExpandByPrefix($expand,'members')); - } - $values['members'] = $members; - } - break; - case 'company': - { - if($sponsor->hasCompany()) { - unset($values['company_id']); - $values['company'] = SerializerRegistry::getInstance()->getSerializer($sponsor->getCompany())->serialize(AbstractSerializer::filterExpandByPrefix($expand,'company')); - } - } - break; - case 'sponsorship': - { - if($sponsor->hasSponsorship()) { - unset($values['sponsorship_id']); - $values['sponsorship'] = SerializerRegistry::getInstance()->getSerializer($sponsor->getSponsorship())->serialize(AbstractSerializer::filterExpandByPrefix($expand,'sponsorship')); - } - } - break; - - - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SponsorshipTypeSerializer.php b/app/ModelSerializers/Summit/SponsorshipTypeSerializer.php deleted file mode 100644 index 04591791..00000000 --- a/app/ModelSerializers/Summit/SponsorshipTypeSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'name:json_string', - 'Label' => 'label:json_string', - 'Order' => 'order:json_int', - 'Size' => 'size:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/StripePaymentProfileSerializer.php b/app/ModelSerializers/Summit/StripePaymentProfileSerializer.php deleted file mode 100644 index 33fe1873..00000000 --- a/app/ModelSerializers/Summit/StripePaymentProfileSerializer.php +++ /dev/null @@ -1,27 +0,0 @@ - 'test_mode_enabled:json_boolean', - 'SendEmailReceipt' => 'send_email_receipt:json_boolean', - 'LivePublishableKey' => 'live_publishable_key:json_string', - 'TestPublishableKey' => 'test_publishable_key:json_string', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitDocumentSerializer.php b/app/ModelSerializers/Summit/SummitDocumentSerializer.php deleted file mode 100644 index f8bf0519..00000000 --- a/app/ModelSerializers/Summit/SummitDocumentSerializer.php +++ /dev/null @@ -1,76 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'ShowAlways' => 'show_always:json_boolean', - 'Label' => 'label:json_string', - 'SummitId' => 'summit_id:json_int', - 'FileUrl' => 'file:json_url', - ]; - - /** - * @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 = []) - { - $summit_document = $this->object; - if (!$summit_document instanceof SummitDocument) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - $event_types = []; - foreach ($summit_document->getEventTypes() as $event_type) { - $event_types[] = $event_type->getId(); - } - - $values['event_types'] = $event_types; - - if (!empty($expand)) { - $relations = explode(',', $expand); - foreach ($relations as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'event_types':{ - $event_types = []; - foreach ($summit_document->getEventTypes() as $event_type) { - $event_types[] = SerializerRegistry::getInstance()->getSerializer($event_type)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['event_types'] = $event_types; - } - break; - case 'summit':{ - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer($summit_document->getSummit())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitEmailEventFlowSerializer.php b/app/ModelSerializers/Summit/SummitEmailEventFlowSerializer.php deleted file mode 100644 index 41240dda..00000000 --- a/app/ModelSerializers/Summit/SummitEmailEventFlowSerializer.php +++ /dev/null @@ -1,29 +0,0 @@ - 'summit_id:json_int', - 'EmailTemplateIdentifier' => 'email_template_identifier:json_string', - 'FlowName' => 'flow_name:json_string', - 'EventTypeName' => 'event_type_name:json_string', - ); -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitEntityEventSerializer.php b/app/ModelSerializers/Summit/SummitEntityEventSerializer.php deleted file mode 100644 index 32ebde7c..00000000 --- a/app/ModelSerializers/Summit/SummitEntityEventSerializer.php +++ /dev/null @@ -1,56 +0,0 @@ - 'entity_id:json_int', - 'EntityClassName' => 'class_name:json_string', - 'Type' => 'type', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $entity_event = $this->object; - $values = parent::serialize($expand, $fields, $relations, $params); - $entity = $entity_event->getEntity(); - - if(!is_null($entity)) - { - $values['entity'] = SerializerRegistry::getInstance()->getSerializer($entity)->serialize - ( - $expand, - $fields, - $relations, - $params - ); - } - - if($values['class_name'] == 'PresentationType') - $values['class_name'] = 'SummitEventType'; - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitEventFeedbackSerializer.php b/app/ModelSerializers/Summit/SummitEventFeedbackSerializer.php deleted file mode 100644 index c42f4ba7..00000000 --- a/app/ModelSerializers/Summit/SummitEventFeedbackSerializer.php +++ /dev/null @@ -1,62 +0,0 @@ - 'rate:json_int', - 'Note' => 'note:json_string', - 'CreatedUTC' => 'created_date:datetime_epoch', - 'EventId' => 'event_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(), array $relations = array(), array $params = array()) - { - $feedback = $this->object; - $values = parent::serialize($expand, $fields, $relations, $params); - $member = $feedback->hasOwner() ? $feedback->getOwner() : null; - - if (is_null($member)) return $values; - - $values['owner_id'] = intval($member->getId()); - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'owner': { - unset($values['owner_id']); - $values['owner'] = SerializerRegistry::getInstance()->getSerializer($member)->serialize('', [], ['none']); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitEventSerializer.php b/app/ModelSerializers/Summit/SummitEventSerializer.php deleted file mode 100644 index ef0699b0..00000000 --- a/app/ModelSerializers/Summit/SummitEventSerializer.php +++ /dev/null @@ -1,247 +0,0 @@ - 'title:json_string', - 'Abstract' => 'description:json_string', - 'SocialSummary' => 'social_description:json_string', - 'StartDate' => 'start_date:datetime_epoch', - 'EndDate' => 'end_date:datetime_epoch', - 'LocationId' => 'location_id:json_int', - 'SummitId' => 'summit_id:json_int', - 'TypeId' => 'type_id:json_int', - 'ClassName' => 'class_name', - 'AllowFeedBack' => 'allow_feedback:json_boolean', - 'AvgFeedbackRate' => 'avg_feedback_rate:json_float', - 'Published' => 'is_published:json_boolean', - 'HeadCount' => 'head_count:json_int', - 'RSVPLink' => 'rsvp_link:json_string', - 'RSVPTemplateId' => 'rsvp_template_id:json_int', - 'RSVPMaxUserNumber' => 'rsvp_max_user_number:json_int', - 'RSVPMaxUserWaitListNumber' => 'rsvp_max_user_wait_list_number:json_int', - 'RSVPRegularCount' => 'rsvp_regular_count:json_int', - 'RSVPWaitCount' => 'rsvp_wait_count:json_int', - 'ExternalRSVP' => 'rsvp_external:json_boolean', - 'CategoryId' => 'track_id:json_int', - 'MeetingUrl' => 'meeting_url:json_string', - 'TotalAttendanceCount' => 'attendance_count:json_int', - 'CurrentAttendanceCount' => 'current_attendance_count:json_int', - 'ImageUrl' => 'image:json_url', - "StreamThumbnailUrl" => "stream_thumbnail:json_url", - 'Level' => 'level', - 'CreatedById' => 'created_by_id:json_int', - 'UpdatedById' => 'updated_by_id:json_int', - ]; - - protected static $allowed_fields = [ - 'id', - 'title', - 'description', - 'social_description', - 'start_date', - 'end_date', - 'location_id', - 'summit_id', - 'type_id', - 'class_name', - 'allow_feedback', - 'avg_feedback_rate', - 'is_published', - 'head_count', - 'rsvp_link', - 'rsvp_external', - 'track_id', - 'rsvp_template_id', - 'rsvp_max_user_number', - 'rsvp_max_user_wait_list_number', - 'rsvp_regular_count', - 'rsvp_wait_count', - 'streaming_url', - 'etherpad_link', - 'meeting_url', - 'attendance_count', - 'current_attendance_count', - 'image', - 'stream_thumbnail', - 'level', - 'created_by_id', - 'updated_by_id', - ]; - - protected static $allowed_relations = [ - 'sponsors', - 'tags', - 'feedback', - 'current_attendance', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize( - $expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $event = $this->object; - if (!$event instanceof SummitEvent) return []; - - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $values = parent::serialize($expand, $fields, $relations, $params); - - if (in_array('sponsors', $relations)) - $values['sponsors'] = $event->getSponsorsIds(); - - if (in_array('tags', $relations)) { - $tags = []; - foreach ($event->getTags() as $tag) { - $tags[] = $tag->getId(); - } - $values['tags'] = $tags; - } - - if (in_array('feedback', $relations)) { - $feedback = []; - $count = 0; - foreach ($event->getFeedback() as $f) { - $feedback[] = $f->getId(); - $count++; - if (AbstractSerializer::MaxCollectionPage < $count) break; - } - $values['feedback'] = $feedback; - } - - if (in_array('current_attendance', $relations)) { - $attendance = []; - $count = 0; - foreach ($event->getCurrentAttendance() as $a) { - $attendance[] = $a->getId(); - $count++; - if (AbstractSerializer::MaxCollectionPage < $count) break; - } - $values['current_attendance'] = $attendance; - } - - if (isset($params['current_user']) && $params['current_user'] instanceof Member && $event->hasAccess($params['current_user'])) { - $values['streaming_url'] = $event->getStreamingUrl(); - $values['etherpad_link'] = $event->getEtherpadLink(); - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'current_attendance': - { - $attendance = []; - $count = 0; - foreach ($event->getCurrentAttendance() as $a) { - $attendance[] = SerializerRegistry::getInstance()->getSerializer($a)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - $count++; - if (AbstractSerializer::MaxCollectionPage < $count) break; - } - $values['current_attendance'] = $attendance; - } - case 'feedback': - { - $feedback = []; - foreach ($event->getFeedback() as $f) { - $feedback[] = SerializerRegistry::getInstance()->getSerializer($f)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['feedback'] = $feedback; - } - break; - case 'location': - { - if ($event->hasLocation()) { - unset($values['location_id']); - $values['location'] = SerializerRegistry::getInstance()->getSerializer($event->getLocation())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'rsvp_template': - { - if ($event->hasRSVPTemplate()) { - unset($values['rsvp_template_id']); - $values['rsvp_template'] = SerializerRegistry::getInstance()->getSerializer($event->getRSVPTemplate())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - } - break; - case 'sponsors': - { - $sponsors = []; - foreach ($event->getSponsors() as $s) { - $sponsors[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['sponsors'] = $sponsors; - } - break; - case 'track': - { - unset($values['track_id']); - $values['track'] = SerializerRegistry::getInstance()->getSerializer($event->getCategory())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - case 'type': - { - unset($values['type_id']); - $values['type'] = SerializerRegistry::getInstance()->getSerializer($event->getType())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'tags': - { - $tags = []; - foreach ($event->getTags() as $tag) { - $tags[] = SerializerRegistry::getInstance()->getSerializer($tag)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['tags'] = $tags; - } - break; - case 'created_by': - { - if(!$event->hasCreatedBy()) - break; - unset($values['created_by_id']); - $values['created_by'] = SerializerRegistry::getInstance()->getSerializer($event->getCreatedBy())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'updated_by': - { - if(!$event->hasUpdatedBy()) - break; - unset($values['updated_by_id']); - $values['updated_by'] = SerializerRegistry::getInstance()->getSerializer($event->getUpdatedBy())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitEventTypeSerializer.php b/app/ModelSerializers/Summit/SummitEventTypeSerializer.php deleted file mode 100644 index e09ff08f..00000000 --- a/app/ModelSerializers/Summit/SummitEventTypeSerializer.php +++ /dev/null @@ -1,81 +0,0 @@ - 'name:json_string', - 'ClassName' => 'class_name:json_string', - 'Color' => 'color:json_color', - 'BlackoutTimes' => 'black_out_times:json_boolean', - 'UseSponsors' => 'use_sponsors:json_boolean', - 'AreSponsorsMandatory' => 'are_sponsors_mandatory:json_boolean', - 'AllowsAttachment' => 'allows_attachment:json_boolean', - 'AllowsLevel' => 'allows_level:json_boolean', - 'Default' => 'is_default:json_boolean', - '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(), array $relations = array(), array $params = array() ) - { - $event_type = $this->object; - if (!$event_type instanceof SummitEventType) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - $summit_documents = []; - foreach ($event_type->getSummitDocuments() as $document) { - $summit_documents[] = $document->getId(); - } - - $values['summit_documents'] = $summit_documents; - - if (!empty($expand)) { - $relations = explode(',', $expand); - foreach ($relations as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'summit_documents':{ - $summit_documents = []; - foreach ($event_type->getSummitDocuments() as $document) { - $summit_documents[] = SerializerRegistry::getInstance()->getSerializer($document)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['summit_documents'] = $summit_documents; - } - break; - case 'summit':{ - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer($event_type->getSummit())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitEventWithFileSerializer.php b/app/ModelSerializers/Summit/SummitEventWithFileSerializer.php deleted file mode 100644 index e75c0481..00000000 --- a/app/ModelSerializers/Summit/SummitEventWithFileSerializer.php +++ /dev/null @@ -1,38 +0,0 @@ -object; - - if (!$event instanceof SummitEventWithFile) return []; - - $values = parent::serialize($expand, $fields, $relations, $params); - - $values['attachment'] = $event->hasAttachment()? $event->getAttachment()->getUrl() : null; - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitGroupEventSerializer.php b/app/ModelSerializers/Summit/SummitGroupEventSerializer.php deleted file mode 100644 index 0cca9762..00000000 --- a/app/ModelSerializers/Summit/SummitGroupEventSerializer.php +++ /dev/null @@ -1,58 +0,0 @@ -object; - if(!$event instanceof SummitGroupEvent) return []; - - $values['groups'] = $event->getGroupsIds(); - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'groups': { - $groups = array(); - unset($values['groups']); - foreach ($event->getGroups() as $g) { - $groups[] = SerializerRegistry::getInstance()->getSerializer($g)->serialize(null, [], ['none']); - } - $values['groups'] = $groups; - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitLocationBannerSerializer.php b/app/ModelSerializers/Summit/SummitLocationBannerSerializer.php deleted file mode 100644 index 69758b26..00000000 --- a/app/ModelSerializers/Summit/SummitLocationBannerSerializer.php +++ /dev/null @@ -1,61 +0,0 @@ - 'title:json_string', - 'Content' => 'content:json_string', - 'Type' => 'type:json_string', - 'Enabled' => 'enabled:json_boolean', - 'LocationId' => 'location_id:json_int', - 'ClassName' => 'class_name: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 = [] ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $banner = $this->object; - if(!$banner instanceof SummitLocationBanner) return []; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - switch (trim($relation)) { - case 'location': { - if($banner->hasLocation()){ - unset($values['location_id']); - $values['location'] = SerializerRegistry::getInstance()->getSerializer($banner->getLocation())->serialize(); - } - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitMediaFileTypeSerializer.php b/app/ModelSerializers/Summit/SummitMediaFileTypeSerializer.php deleted file mode 100644 index 54c1c773..00000000 --- a/app/ModelSerializers/Summit/SummitMediaFileTypeSerializer.php +++ /dev/null @@ -1,43 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'SystemDefined' => 'is_system_defined:json_boolean', - ]; - - /** - * @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 = []) - { - $type = $this->object; - if (!$type instanceof SummitMediaFileType) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - $allowed_extensions = $type->getAllowedExtensions(); - $values['allowed_extensions'] = !is_null($allowed_extensions) ? explode('|', $allowed_extensions): []; - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitMediaUploadTypeSerializer.php b/app/ModelSerializers/Summit/SummitMediaUploadTypeSerializer.php deleted file mode 100644 index 47ec563d..00000000 --- a/app/ModelSerializers/Summit/SummitMediaUploadTypeSerializer.php +++ /dev/null @@ -1,85 +0,0 @@ - 'name:json_string', - 'Description' => 'description:json_string', - 'MaxSize' => 'max_size:json_int', - 'Mandatory' => 'is_mandatory:json_boolean', - 'PrivateStorageType' => 'private_storage_type:json_string', - 'PublicStorageType' => 'public_storage_type:json_string', - 'SummitId' => 'summit_id:json_int', - 'TypeId' => 'type_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 = []) - { - $type = $this->object; - if (!$type instanceof SummitMediaUploadType) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - $presentation_types = []; - - foreach ($type->getPresentationTypes() as $presentation_type){ - $presentation_types[] = $presentation_type->getId(); - } - - $values['presentation_types'] = $presentation_types; - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'type': { - unset($values['type_id']); - $values['type'] = SerializerRegistry::getInstance()->getSerializer($type->getType())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'summit': { - unset($values['summit_id']); - $values['summit'] = SerializerRegistry::getInstance()->getSerializer($type->getSummit())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'presentation_types': { - unset($values['presentation_types']); - $presentation_types = []; - - foreach ($type->getPresentationTypes() as $presentation_type){ - $presentation_types[] = SerializerRegistry::getInstance()->getSerializer($presentation_type)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - - $values['presentation_types'] = $presentation_types; - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitMemberFavoriteSerializer.php b/app/ModelSerializers/Summit/SummitMemberFavoriteSerializer.php deleted file mode 100644 index c00911b3..00000000 --- a/app/ModelSerializers/Summit/SummitMemberFavoriteSerializer.php +++ /dev/null @@ -1,40 +0,0 @@ -object; - $values = SerializerRegistry::getInstance()->getSerializer($favorite->getEvent())->serialize - ( - $expand, - $fields, - $relations, - $params - ); - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitMemberScheduleSerializer.php b/app/ModelSerializers/Summit/SummitMemberScheduleSerializer.php deleted file mode 100644 index 3b791b18..00000000 --- a/app/ModelSerializers/Summit/SummitMemberScheduleSerializer.php +++ /dev/null @@ -1,41 +0,0 @@ -object; - - $values = SerializerRegistry::getInstance()->getSerializer($schedule->getEvent())->serialize - ( - $expand, - $fields, - $relations, - $params - ); - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitPushNotificationSerializer.php b/app/ModelSerializers/Summit/SummitPushNotificationSerializer.php deleted file mode 100644 index 47b43f85..00000000 --- a/app/ModelSerializers/Summit/SummitPushNotificationSerializer.php +++ /dev/null @@ -1,90 +0,0 @@ - 'channel:json_string', - '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 = [] ) - { - $notification = $this->object; - if(! $notification instanceof SummitPushNotification) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if($notification->getChannel() == SummitPushNotificationChannel::Event){ - $values['event_id'] = $notification->getSummitEvent()->getId(); - } - - if($notification->getChannel() == SummitPushNotificationChannel::Group){ - $values['group_id'] = $notification->getGroup()->getId(); - } - - if($notification->getChannel() == SummitPushNotificationChannel::Members){ - $values['recipients'] = []; - foreach ($notification->getRecipients() as $recipient) { - if (!$recipient instanceof Member) continue; - $values['recipients'][] = $recipient->getId(); - } - } - - if (!empty($expand)) { - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'event': { - if($notification->getChannel() != SummitPushNotificationChannel::Event) continue; - unset($values['event_id']); - $values['event'] = SerializerRegistry::getInstance()->getSerializer($notification->getSummitEvent())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'group': { - if($notification->getChannel() != SummitPushNotificationChannel::Group) continue; - unset($values['group_id']); - $values['group'] = SerializerRegistry::getInstance()->getSerializer($notification->getGroup())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'recipients': { - if($notification->getChannel() != SummitPushNotificationChannel::Members) continue; - $values['recipients'] = []; - foreach ($notification->getRecipients() as $recipient) - $values['recipients'][] = SerializerRegistry::getInstance()->getSerializer($recipient)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitScheduleEmptySpotSerializer.php b/app/ModelSerializers/Summit/SummitScheduleEmptySpotSerializer.php deleted file mode 100644 index 5788ff6f..00000000 --- a/app/ModelSerializers/Summit/SummitScheduleEmptySpotSerializer.php +++ /dev/null @@ -1,29 +0,0 @@ - 'location_id:json_int', - 'StartDateTime' => 'start_date:datetime_epoch', - 'EndDateTime' => 'end_date:datetime_epoch', - 'TotalMinutes' => 'total_minutes:json_int', - ]; -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitSelectionPlanExtraQuestionTypeSerializer.php b/app/ModelSerializers/Summit/SummitSelectionPlanExtraQuestionTypeSerializer.php deleted file mode 100644 index a42c6325..00000000 --- a/app/ModelSerializers/Summit/SummitSelectionPlanExtraQuestionTypeSerializer.php +++ /dev/null @@ -1,25 +0,0 @@ - 'selection_plan_id:json_int', - ]; - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitSerializer.php b/app/ModelSerializers/Summit/SummitSerializer.php deleted file mode 100644 index 73a79ecc..00000000 --- a/app/ModelSerializers/Summit/SummitSerializer.php +++ /dev/null @@ -1,480 +0,0 @@ - 'name:json_string', - 'BeginDate' => 'start_date:datetime_epoch', - 'EndDate' => 'end_date:datetime_epoch', - 'RegistrationBeginDate' => 'registration_begin_date:datetime_epoch', - 'RegistrationEndDate' => 'registration_end_date:datetime_epoch', - 'StartShowingVenuesDate' => 'start_showing_venues_date:datetime_epoch', - 'ScheduleDefaultStartDate' => 'schedule_start_date:datetime_epoch', - 'Active' => 'active:json_boolean', - 'TypeId' => 'type_id:json_int', - 'DatesLabel' => 'dates_label:json_string', - 'MaxSubmissionAllowedPerUser' => 'max_submission_allowed_per_user:json_int', - // calculated attributes - 'PresentationVotesCount' => 'presentation_votes_count:json_int', - 'PresentationVotersCount' => 'presentation_voters_count:json_int', - 'AttendeesCount' => 'attendees_count:json_int', - 'PaidTicketsCount' => 'paid_tickets_count:json_int', - 'SpeakersCount' => 'speakers_count:json_int', - 'PresentationsSubmittedCount' => 'presentations_submitted_count:json_int', - 'PublishedEventsCount' => 'published_events_count:json_int', - 'SpeakerAnnouncementEmailAcceptedCount' => 'speaker_announcement_email_accepted_count:json_int', - 'SpeakerAnnouncementEmailRejectedCount' => 'speaker_announcement_email_rejected_count:json_int', - 'SpeakerAnnouncementEmailAlternateCount' => 'speaker_announcement_email_alternate_count:json_int', - 'SpeakerAnnouncementEmailAcceptedAlternateCount' => 'speaker_announcement_email_accepted_alternate_count:json_int', - 'SpeakerAnnouncementEmailAcceptedRejectedCount' => 'speaker_announcement_email_accepted_rejected_count:json_int', - 'SpeakerAnnouncementEmailAlternateRejectedCount' => 'speaker_announcement_email_alternate_rejected_count:json_int', - 'TimeZoneId' => 'time_zone_id:json_string', - 'RawSlug' => 'slug:json_string', - // Bookable rooms attributes - 'MeetingRoomBookingStartTime' => 'meeting_room_booking_start_time:datetime_epoch', - 'MeetingRoomBookingEndTime' => 'meeting_room_booking_end_time:datetime_epoch', - 'MeetingRoomBookingSlotLength' => 'meeting_room_booking_slot_length:json_int', - 'MeetingRoomBookingMaxAllowed' => 'meeting_room_booking_max_allowed:json_int', - 'BeginAllowBookingDate' => 'begin_allow_booking_date:datetime_epoch', - 'EndAllowBookingDate' => 'end_allow_booking_date:datetime_epoch', - 'LogoUrl' => 'logo:json_url', - // External Feeds - 'ApiFeedType' => 'api_feed_type:json_string', - 'ApiFeedUrl' => 'api_feed_url:json_string', - 'ApiFeedKey' => 'api_feed_key:json_string', - // registration - 'OrderQRPrefix' => 'order_qr_prefix:json_string', - 'TicketQRPrefix' => 'ticket_qr_prefix:json_string', - 'BadgeQRPrefix' => 'badge_qr_prefix:json_string', - 'QRRegistryFieldDelimiter' => 'qr_registry_field_delimiter:json_string', - 'ReassignTicketTillDate' => 'reassign_ticket_till_date:datetime_epoch', - 'RegistrationDisclaimerContent' => 'registration_disclaimer_content:json_string', - 'RegistrationDisclaimerMandatory' => 'registration_disclaimer_mandatory:json_boolean', - 'RegistrationReminderEmailDaysInterval' => 'registration_reminder_email_days_interval:json_int', - 'RegistrationLink' => 'registration_link:json_url', - 'SecondaryRegistrationLink' => 'secondary_registration_link:json_url', - 'SecondaryRegistrationLabel' => 'secondary_registration_label:json_string', - // schedule app - 'ScheduleDefaultPageUrl' => 'schedule_default_page_url:json_url', - 'ScheduleDefaultEventDetailUrl' => 'schedule_default_event_detail_url:json_url', - 'ScheduleOgSiteName' => 'schedule_og_site_name:json_string', - 'ScheduleOgImageUrl' => 'schedule_og_image_url:json_string', - 'ScheduleOgImageSecureUrl' => 'schedule_og_image_secure_url:json_string', - 'ScheduleOgImageWidth' => 'schedule_og_image_width:json_int', - 'ScheduleOgImageHeight' => 'schedule_og_image_height:json_int', - 'ScheduleFacebookAppId' => 'schedule_facebook_app_id:json_string', - 'ScheduleIosAppName' => 'schedule_ios_app_name:json_string', - 'ScheduleIosAppStoreId' => 'schedule_ios_app_store_id:json_string', - 'ScheduleIosAppCustomSchema' => 'schedule_ios_app_custom_schema:json_string', - 'ScheduleAndroidAppName' => 'schedule_android_app_name:json_string', - 'ScheduleAndroidAppPackage' => 'schedule_android_app_package:json_string', - 'ScheduleAndroidCustomSchema' => 'schedule_android_custom_schema:json_string', - 'ScheduleTwitterAppName' => 'schedule_twitter_app_name:json_string', - 'ScheduleTwitterText' => 'schedule_twitter_text:json_string', - 'DefaultPageUrl' => 'default_page_url:json_string', - 'SpeakerConfirmationDefaultPageUrl' => 'speaker_confirmation_default_page_url:json_string', - 'InviteOnlyRegistration' => 'invite_only_registration:json_boolean', - 'VirtualSiteUrl' => 'virtual_site_url:json_string', - 'MarketingSiteUrl' => 'marketing_site_url:json_string', - 'SupportEmail' => 'support_email:json_string', - ]; - - protected static $allowed_relations = [ - 'ticket_types', - 'locations', - 'wifi_connections', - 'selection_plans', - 'meeting_booking_room_allowed_attributes', - 'summit_sponsors', - 'order_extra_questions', - 'tax_types', - 'payment_profiles', - 'email_flows_events', - 'summit_documents', - 'featured_speakers', - 'dates_with_events', - 'presentation_action_types', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - * @throws HTTP403ForbiddenException - */ - public function serialize($expand = null, array $fields = [], array $relations = [], array $params = []) - { - $summit = $this->object; - if (!$summit instanceof Summit) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - if (!count($relations)) $relations = $this->getAllowedRelations(); - - $values['dates_with_events'] = []; - foreach($summit->getSummitDaysWithEvents() as $day){ - $values['dates_with_events'][] = $day->format('Y-m-d'); - } - - $timezone = $summit->getTimeZone(); - $values['time_zone'] = null; - - if (!is_null($timezone)) { - $time_zone_info = $timezone->getLocation(); - $time_zone_info['name'] = $timezone->getName(); - $time_zone_info['offset'] = $timezone->getOffset(new DateTime("now", $timezone)); - $values['time_zone'] = $time_zone_info; - } - // pages info - $main_page = $summit->getMainPage(); - $schedule_page = $summit->getSchedulePage(); - $values['page_url'] = - empty($main_page) ? null : - sprintf("%s%s", Config::get("server.assets_base_url", 'https://www.openstack.org/'), $main_page); - $values['schedule_page_url'] = empty($schedule_page) ? null : - sprintf("%s%s", Config::get("server.assets_base_url", 'https://www.openstack.org/'), $schedule_page); - $values['schedule_event_detail_url'] = empty($schedule_page) ? null : sprintf("%s%s/%s", Config::get("server.assets_base_url", 'https://www.openstack.org/'), $schedule_page, 'events/:event_id/:event_title'); - - // tickets - if (in_array('ticket_types', $relations)) { - $ticket_types = []; - foreach ($summit->getTicketTypes() as $ticket) { - $ticket_types[] = SerializerRegistry::getInstance()->getSerializer($ticket)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'ticket_types')); - } - $values['ticket_types'] = $ticket_types; - } - - // payment_profiles - if (in_array('payment_profiles', $relations)) { - $payment_profiles = []; - foreach ($summit->getActivePaymentGateWayProfiles() as $profile) { - $payment_profiles[] = SerializerRegistry::getInstance()->getSerializer - ( - $profile, - $this->getSerializerType() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'payment_profiles')); - } - - $values['payment_profiles'] = $payment_profiles; - // if this serializer is public then we should show the default profiles - // if there is not set any - - $has_registration_profile = false; - $has_bookable_rooms_profile = false; - - foreach ($values['payment_profiles'] as $payment_profile) { - if ($payment_profile['application_type'] == IPaymentConstants::ApplicationTypeBookableRooms) { - $has_bookable_rooms_profile = true; - } - if ($payment_profile['application_type'] == IPaymentConstants::ApplicationTypeRegistration) { - $has_registration_profile = true; - } - } - - $build_default_payment_gateway_profile_strategy = $params['build_default_payment_gateway_profile_strategy'] ?? null; - - if (!$has_registration_profile && - !is_null($build_default_payment_gateway_profile_strategy) && - $this->getSerializerType() == SerializerRegistry::SerializerType_Public - ) { - - $values['payment_profiles'][] = - SerializerRegistry::getInstance()->getSerializer - ( - $build_default_payment_gateway_profile_strategy->build(IPaymentConstants::ApplicationTypeRegistration), - $this->getSerializerType() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'payment_profiles')); - - } - - if (!$has_bookable_rooms_profile && - !is_null($build_default_payment_gateway_profile_strategy) && - $this->getSerializerType() == SerializerRegistry::SerializerType_Public - ) { - $values['payment_profiles'][] = - SerializerRegistry::getInstance()->getSerializer - ( - $build_default_payment_gateway_profile_strategy->build(IPaymentConstants::ApplicationTypeBookableRooms), - $this->getSerializerType() - )->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'payment_profiles')); - } - } - - if (in_array('order_extra_questions', $relations)) { - $order_extra_questions = []; - foreach ($summit->getOrderExtraQuestions() as $question) { - $order_extra_questions[] = SerializerRegistry::getInstance()->getSerializer($question)->serialize(AbstractSerializer::filterExpandByPrefix($expand, "order_extra_questions")); - } - $values['order_extra_questions'] = $order_extra_questions; - } - - if (in_array('tax_types', $relations)) { - $tax_types = []; - foreach ($summit->getTaxTypes() as $tax_type) { - $tax_types[] = SerializerRegistry::getInstance()->getSerializer($tax_type)->serialize(AbstractSerializer::filterExpandByPrefix($expand, "tax_types")); - } - $values['tax_types'] = $tax_types; - } - - if (in_array('summit_documents', $relations)) { - $summit_documents = []; - foreach ($summit->getSummitDocuments() as $document) { - $summit_documents[] = SerializerRegistry::getInstance()->getSerializer($document)->serialize(AbstractSerializer::filterExpandByPrefix($expand, "summit_documents")); - } - $values['summit_documents'] = $summit_documents; - } - - // meeting_booking_room_allowed_attributes - if (in_array('meeting_booking_room_allowed_attributes', $relations)) { - $meeting_booking_room_allowed_attributes = []; - foreach ($summit->getMeetingBookingRoomAllowedAttributes() as $attr) { - $meeting_booking_room_allowed_attributes[] = SerializerRegistry::getInstance()->getSerializer($attr)->serialize($expand); - } - $values['meeting_booking_room_allowed_attributes'] = $meeting_booking_room_allowed_attributes; - } - - // summit sponsors - if (in_array('summit_sponsors', $relations)) { - $summit_sponsors = []; - foreach ($summit->getSummitSponsors() as $sponsor) { - $summit_sponsors[] = SerializerRegistry::getInstance()->getSerializer($sponsor)->serialize($expand); - } - $values['summit_sponsors'] = $summit_sponsors; - } - - // locations - if (in_array('locations', $relations)) { - $locations = []; - foreach ($summit->getLocations() as $location) { - $locations[] = SerializerRegistry::getInstance()->getSerializer($location)->serialize( - // is user is already expanding by schedule, its the total expand of the venues - !is_null($expand) && str_contains('schedule', $expand) ? - 'floors,rooms' : - AbstractSerializer::filterExpandByPrefix($expand, 'locations') - ); - } - $values['locations'] = $locations; - } - - // wifi connections - if (in_array('wifi_connections', $relations)) { - $wifi_connections = []; - foreach ($summit->getWifiConnections() as $wifi_connection) { - $wifi_connections[] = SerializerRegistry::getInstance()->getSerializer($wifi_connection)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'wifi_connections')); - } - $values['wifi_connections'] = $wifi_connections; - } - - // selection plans - if (in_array('selection_plans', $relations)) { - $selection_plans = []; - foreach ($summit->getSelectionPlans() as $selection_plan) { - $selection_plans[] = SerializerRegistry::getInstance()->getSerializer($selection_plan)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'selection_plans')); - } - $values['selection_plans'] = $selection_plans; - } - - if (in_array('email_flows_events', $relations)) { - $email_flows_events = []; - foreach ($summit->getAllEmailFlowsEvents() as $email_flow_event) { - $email_flows_events[] = SerializerRegistry::getInstance()->getSerializer($email_flow_event)->serialize(AbstractSerializer::filterExpandByPrefix($expand, "email_flows_events")); - } - $values['email_flows_events'] = $email_flows_events; - } - - // featured_speakers - if (in_array('featured_speakers', $relations)) { - $featured_speakers = []; - foreach ($summit->getFeaturesSpeakers() as $speaker) { - $featured_speakers[] = $speaker->getId(); - } - $values['featured_speakers'] = $featured_speakers; - } - - // presentation_action_types - if (in_array('presentation_action_types', $relations)) { - $presentation_action_types = []; - foreach ($summit->getPresentationActionTypes() as $action) { - $presentation_action_types[] = SerializerRegistry::getInstance()->getSerializer($action)->serialize(AbstractSerializer::filterExpandByPrefix($expand, 'presentation_action_types')); - } - $values['presentation_action_types'] = $presentation_action_types; - } - - if (!empty($expand)) { - - foreach (explode(',', $expand) as $relation) { - $relation = trim($relation); - switch ($relation) { - case 'event_types': - { - $event_types = []; - foreach ($summit->getEventTypes() as $event_type) { - $event_types[] = SerializerRegistry::getInstance()->getSerializer($event_type)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['event_types'] = $event_types; - } - break; - - case 'featured_speakers': - { - $featured_speakers = []; - foreach ($summit->getFeaturesSpeakers() as $speaker) { - $featured_speakers[] = SerializerRegistry::getInstance()->getSerializer($speaker)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['featured_speakers'] = $featured_speakers; - } - break; - case 'tracks': - { - $presentation_categories = []; - foreach ($summit->getPresentationCategories() as $cat) { - $presentation_categories[] = SerializerRegistry::getInstance()->getSerializer($cat)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['tracks'] = $presentation_categories; - } - break; - case 'track_groups': - { - // track_groups - $track_groups = []; - foreach ($summit->getCategoryGroups() as $group) { - $track_groups[] = SerializerRegistry::getInstance()->getSerializer($group)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['track_groups'] = $track_groups; - } - break; - case 'sponsors': - { - $sponsors = []; - foreach ($summit->getEventSponsors() as $company) { - $sponsors[] = SerializerRegistry::getInstance()->getSerializer($company)->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - $values['sponsors'] = $sponsors; - } - break; - case 'speakers': - { - $speakers = []; - foreach ($summit->getSpeakers() as $speaker) { - $speakers[] = - SerializerRegistry::getInstance()->getSerializer($speaker)->serialize - ( - AbstractSerializer::filterExpandByPrefix($expand, $relation), [], [], - [ - 'summit_id' => $summit->getId(), - 'published' => true - ] - ); - - } - $values['speakers'] = $speakers; - } - break; - case 'schedule': - { - // only could get schedule expanded if summit its available to public or - // we had proper scopes - if (!$summit->isAvailableOnApi()) { - $scopes = $this->resource_server_context->getCurrentScope(); - $current_realm = Config::get('app.url'); - $needed_scope = sprintf(SummitScopes::ReadAllSummitData, $current_realm); - if (!in_array($needed_scope, $scopes)) - throw new HTTP403ForbiddenException; - } - - $event_types = []; - foreach ($summit->getEventTypes() as $event_type) { - $event_types[] = SerializerRegistry::getInstance()->getSerializer($event_type)->serialize(); - } - $values['event_types'] = $event_types; - - $presentation_categories = []; - foreach ($summit->getPresentationCategories() as $cat) { - $presentation_categories[] = SerializerRegistry::getInstance()->getSerializer($cat)->serialize(); - } - $values['tracks'] = $presentation_categories; - - // track_groups - $track_groups = []; - foreach ($summit->getCategoryGroups() as $group) { - $track_groups[] = SerializerRegistry::getInstance()->getSerializer($group)->serialize(); - } - $values['track_groups'] = $track_groups; - - $schedule = []; - foreach ($summit->getScheduleEvents() as $event) { - $schedule[] = SerializerRegistry::getInstance()->getSerializer($event)->serialize(); - } - $values['schedule'] = $schedule; - - $sponsors = []; - foreach ($summit->getEventSponsors() as $company) { - $sponsors[] = SerializerRegistry::getInstance()->getSerializer($company)->serialize(); - } - $values['sponsors'] = $sponsors; - - $speakers = []; - foreach ($summit->getSpeakers() as $speaker) { - $speakers[] = - SerializerRegistry::getInstance()->getSerializer($speaker)->serialize - ( - null, [], [], - [ - 'summit_id' => $summit->getId(), - 'published' => true - ] - ); - - } - $values['speakers'] = $speakers; - } - break; - case 'type': - { - if (isset($values['type_id'])) { - unset($values['type_id']); - $values['type'] = $summit->hasType() ? - SerializerRegistry::getInstance()->getSerializer($summit->getType())->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)) : null; - } - } - break; - } - } - } - - $values['supported_currencies'] = $summit->getSupportedCurrencies(); - $values['timestamp'] = time(); - - return $values; - } - - /** - * @return string - */ - protected function getSerializerType(): string - { - return SerializerRegistry::SerializerType_Public; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitTypeSerializer.php b/app/ModelSerializers/Summit/SummitTypeSerializer.php deleted file mode 100644 index 7e092c59..00000000 --- a/app/ModelSerializers/Summit/SummitTypeSerializer.php +++ /dev/null @@ -1,40 +0,0 @@ - 'name:json_string', - 'Color' => 'color:json_color', - 'Type' => 'type:json_string', - ); - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/SummitWIFIConnectionSerializer.php b/app/ModelSerializers/Summit/SummitWIFIConnectionSerializer.php deleted file mode 100644 index b34c64d8..00000000 --- a/app/ModelSerializers/Summit/SummitWIFIConnectionSerializer.php +++ /dev/null @@ -1,44 +0,0 @@ - 'ssid:json_string', - 'Password' => 'password:json_string', - 'Description' => 'description:json_string', - '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(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $wifi_connection = $this->object; - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/TrackTagGroups/TrackTagGroupAllowedTagSerializer.php b/app/ModelSerializers/Summit/TrackTagGroups/TrackTagGroupAllowedTagSerializer.php deleted file mode 100644 index 3835ae03..00000000 --- a/app/ModelSerializers/Summit/TrackTagGroups/TrackTagGroupAllowedTagSerializer.php +++ /dev/null @@ -1,68 +0,0 @@ - 'is_default:json_boolean', - 'TrackTagGroupId' => 'track_tag_group_id:json_int', - 'TagId' => 'tag_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 = []) - { - $allowed_tag = $this->object; - if (!$allowed_tag instanceof TrackTagGroupAllowedTag) return []; - $values = parent::serialize($expand, $fields, $relations, $params); - - if (!empty($expand)) { - $relations = explode(',', $expand); - foreach ($relations as $relation) { - switch (trim($relation)) { - - case 'track_tag_group':{ - unset($values['track_tag_group_id']); - $values['track_tag_group'] = SerializerRegistry::getInstance() - ->getSerializer($allowed_tag->getTrackTagGroup()) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - case 'tag':{ - unset($values['tag_id']); - $values['tag'] = SerializerRegistry::getInstance() - ->getSerializer($allowed_tag->getTag()) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation)); - } - break; - } - } - } - - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/Summit/TrackTagGroups/TrackTagGroupSerializer.php b/app/ModelSerializers/Summit/TrackTagGroups/TrackTagGroupSerializer.php deleted file mode 100644 index 1becc91d..00000000 --- a/app/ModelSerializers/Summit/TrackTagGroups/TrackTagGroupSerializer.php +++ /dev/null @@ -1,74 +0,0 @@ - 'name:json_string', - 'Label' => 'label:json_string', - 'Order' => 'order:json_int', - 'Mandatory' => 'is_mandatory:json_boolean', - '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(), array $relations = array(), array $params = array() ) - { - $values = parent::serialize($expand, $fields, $relations, $params); - $track_tag_group = $this->object; - if (!$track_tag_group instanceof TrackTagGroup) return []; - $allowed_tags = []; - - foreach($track_tag_group->getAllowedTags() as $allowed_tag){ - $allowed_tags[] = $allowed_tag->getId(); - } - - $values['allowed_tags'] = $allowed_tags; - - if (!empty($expand)) { - $relations = explode(',', $expand); - foreach ($relations as $relation) { - switch (trim($relation)) { - - case 'allowed_tags':{ - unset($values['allowed_tags']); - $allowed_tags = []; - foreach($track_tag_group->getAllowedTags() as $allowed_tag){ - $allowed_tags[] = SerializerRegistry::getInstance() - ->getSerializer($allowed_tag) - ->serialize(AbstractSerializer::filterExpandByPrefix($expand, $relation));; - } - $values['allowed_tags'] = $allowed_tags; - } - break; - } - } - } - return $values; - } -} \ No newline at end of file diff --git a/app/ModelSerializers/SummitAdministratorPermissionGroupSerializer.php b/app/ModelSerializers/SummitAdministratorPermissionGroupSerializer.php deleted file mode 100644 index 7fbd57b4..00000000 --- a/app/ModelSerializers/SummitAdministratorPermissionGroupSerializer.php +++ /dev/null @@ -1,93 +0,0 @@ - 'title:json_string', - ]; - - protected static $allowed_relations = [ - 'members', - 'summits', - ]; - - /** - * @param null $expand - * @param array $fields - * @param array $relations - * @param array $params - * @return array - */ - public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array()) - { - $group = $this->object; - if(!$group instanceof SummitAdministratorPermissionGroup) return []; - - if(!count($relations)) $relations = $this->getAllowedRelations(); - - $values = parent::serialize($expand, $fields, $relations, $params); - - if(in_array('members', $relations)) { - $members = []; - foreach ($group->getMembersIds() as $member_id) - $members[] = intval($member_id) ; - $values['members'] = $members; - } - - if(in_array('summits', $relations)) { - $summits = []; - foreach ($group->getSummitsIds() as $summit_id){ - $summits[] = intval($summit_id); - } - $values['summits'] = $summits; - } - - if (!empty($expand)) { - $exp_expand = explode(',', $expand); - foreach ($exp_expand as $relation) { - switch (trim($relation)) { - case 'members': { - if(!in_array('members', $relations)) break; - $members = []; - unset($values['members']); - foreach ($group->getMembers() as $m) { - $members[] = SerializerRegistry::getInstance()->getSerializer($m)->serialize(AbstractSerializer::filterExpandByPrefix($expand,'members')); - } - $values['members'] = $members; - } - break; - case 'summits': { - if(!in_array('summits', $relations)) break; - $summits = []; - unset($values['summits']); - foreach ($group->getSummits() as $s) { - $summits[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize(AbstractSerializer::filterExpandByPrefix($expand,'summits')); - } - $values['summits'] = $summits; - } - break; - } - } - } - return $values; - } - -} \ No newline at end of file diff --git a/app/ModelSerializers/TagSerializer.php b/app/ModelSerializers/TagSerializer.php deleted file mode 100644 index 3b0f9b45..00000000 --- a/app/ModelSerializers/TagSerializer.php +++ /dev/null @@ -1,24 +0,0 @@ - 'tag:json_string', - ]; -} \ No newline at end of file diff --git a/app/Models/Exceptions/AuthzException.php b/app/Models/Exceptions/AuthzException.php deleted file mode 100644 index 765667d2..00000000 --- a/app/Models/Exceptions/AuthzException.php +++ /dev/null @@ -1,22 +0,0 @@ -messages = $message; - } - - /** - * @param array $messages - * @return $this - */ - public function setMessages(array $messages) - { - $this->messages = $messages; - return $this; - } - - public function getMessages():array - { - if(is_null($this->messages)) - { - $this->messages = [$this->getMessage()]; - } - return $this->messages; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Affiliation.php b/app/Models/Foundation/Main/Affiliation.php deleted file mode 100644 index 25c0a6f4..00000000 --- a/app/Models/Foundation/Main/Affiliation.php +++ /dev/null @@ -1,214 +0,0 @@ -start_date; - } - - /** - * @param \DateTime $start_date - */ - public function setStartDate($start_date) - { - $this->start_date = $start_date; - } - - /** - * @return \DateTime - */ - public function getEndDate() - { - return $this->end_date; - } - - /** - * @param \DateTime $end_date - */ - public function setEndDate($end_date) - { - $this->end_date = $end_date; - } - - /** - * @return bool - */ - public function isCurrent() - { - return $this->is_current; - } - - public function getIsCurrent(){ - return $this->isCurrent(); - } - - /** - * @param bool $is_current - */ - public function setIsCurrent($is_current) - { - $this->is_current = $is_current; - } - - /** - * @return Organization - */ - public function getOrganization() - { - return $this->organization; - } - - /** - * @param Organization $organization - */ - public function setOrganization($organization) - { - $this->organization = $organization; - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - public function clearOwner(){ - $this->owner = null; - } - - /** - * @param Member $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @return int - */ - public function getOwnerId(){ - try { - return $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getOrganizationId(){ - try { - return $this->organization->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasOrganization(){ - return $this->getOrganizationId() > 0; - } - - /** - * @return mixed - */ - public function getJobTitle() - { - return $this->job_title; - } - - /** - * @param mixed $job_title - */ - public function setJobTitle($job_title) - { - $this->job_title = $job_title; - } - - public function clearEndDate(){ - $this->end_date = null; - } - - public function clearStartDate(){ - $this->start_date = null; - } - - public function __construct() - { - parent::__construct(); - $this->is_current = false; - $this->start_date = null; - $this->end_date = null; - $this->organization = null; - $this->owner = null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/AssetsSyncRequest.php b/app/Models/Foundation/Main/AssetsSyncRequest.php deleted file mode 100644 index 08a04c12..00000000 --- a/app/Models/Foundation/Main/AssetsSyncRequest.php +++ /dev/null @@ -1,109 +0,0 @@ -from; - } - - /** - * @param string $from - */ - public function setFrom($from) - { - $this->from = $from; - } - - /** - * @return string - */ - public function getTo() - { - return $this->to; - } - - /** - * @param string $to - */ - public function setTo($to) - { - $this->to = $to; - } - - /** - * @return string - */ - public function getProcessed() - { - return $this->processed; - } - - /** - * @param string $processed - */ - public function setProcessed($processed) - { - $this->processed = $processed; - } - - /** - * @return DateTime - */ - public function getProcessedDate() - { - return $this->processed_date; - } - - /** - * @param DateTime $processed_date - */ - public function setProcessedDate($processed_date) - { - $this->processed_date = $processed_date; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/CCLA/Team.php b/app/Models/Foundation/Main/CCLA/Team.php deleted file mode 100644 index 61a453a4..00000000 --- a/app/Models/Foundation/Main/CCLA/Team.php +++ /dev/null @@ -1,77 +0,0 @@ -members = new ArrayCollection(); - } - - /** - * @ORM\ManyToMany(targetEntity="models\main\Member", mappedBy="ccla_teams") - */ - private $members; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Company") - * @ORM\JoinColumn(name="CompanyID", referencedColumnName="ID") - * @var Company - */ - private $company; - - /** - * @return Company - */ - public function getCompany(){ - return $this->company; - } - - /** - * @return Member[] - */ - public function getMembers(){ - return $this->members->toArray(); - } - - /** - * @return string - */ - public function getName(){ - return $this->name; - } - - /** - * @return int - */ - public function getCompanyId(){ - return $this->company->getId(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ChatTeams/ChatTeam.php b/app/Models/Foundation/Main/ChatTeams/ChatTeam.php deleted file mode 100644 index 53fd7eef..00000000 --- a/app/Models/Foundation/Main/ChatTeams/ChatTeam.php +++ /dev/null @@ -1,306 +0,0 @@ -members = new ArrayCollection(); - $this->messages = new ArrayCollection(); - $this->invitations = new ArrayCollection(); - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return ChatTeamMember[] - */ - public function getMembers() - { - return $this->members; - } - - /** - * @param ChatTeamMember[] $members - */ - public function setMembers($members) - { - $this->members = $members; - } - - /** - * @ORM\Column(name="Name", type="string") - * @var string - */ - private $name; - - /** - * @ORM\Column(name="Description", type="string") - * @var string - */ - private $description; - - - /** - * @ORM\OneToMany(targetEntity="ChatTeamMember", mappedBy="team", cascade={"persist"}, orphanRemoval=true) - * @var ChatTeamMember[] - */ - private $members; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID") - * @var Member - */ - private $owner; - - /** - * @ORM\OneToMany(targetEntity="ChatTeamPushNotificationMessage", mappedBy="team", cascade={"persist"}, orphanRemoval=true) - * @var ChatTeamPushNotificationMessage[] - */ - private $messages; - - /** - * @ORM\OneToMany(targetEntity="ChatTeamInvitation", mappedBy="team", cascade={"persist"}, orphanRemoval=true) - * @var ChatTeamInvitation[] - */ - private $invitations; - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @return int - */ - public function getOwnerId(){ - try{ - return $this->owner->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @param mixed $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @return ChatTeamPushNotificationMessage[] - */ - public function getMessages() - { - return $this->messages; - } - - /** - * @return ChatTeamInvitation[] - */ - public function getInvitations() - { - return $this->invitations; - } - - /** - * @param ChatTeamInvitation $invitation - */ - public function addInvitation(ChatTeamInvitation $invitation){ - $this->invitations->add($invitation); - $invitation->setTeam($this); - } - - /** - * @param ChatTeamPushNotificationMessage $message - */ - public function addMessage(ChatTeamPushNotificationMessage $message){ - $this->messages->add($message); - $message->setTeam($this); - } - - /** - * @param ChatTeamMember $team_member - */ - public function addMember(ChatTeamMember $team_member){ - $this->members->add($team_member); - $team_member->setTeam($this); - } - - /** - * @param Member $inviter - * @param Member $invitee - * @param string $permission - * @return ChatTeamInvitation - */ - public function createInvitation(Member $inviter, Member $invitee, $permission = ChatTeamPermission::Read){ - $invitation = new ChatTeamInvitation(); - $invitation->setTeam($this); - $invitation->setInviter($inviter); - $invitation->setInvitee($invitee); - $invitation->setPermission($permission); - return $invitation; - } - - public function createMember(Member $member, $permission = ChatTeamPermission::Read){ - $team_member = new ChatTeamMember(); - $team_member->setTeam($this); - $team_member->setPermission($permission); - $team_member->setMember($member); - return $team_member; - } - - /** - * @param Member $owner - * @param string $body - * @param string $priority - * @return ChatTeamPushNotificationMessage - */ - public function createMessage(Member $owner, $body, $priority = PushNotificationMessagePriority::Normal){ - $message = new ChatTeamPushNotificationMessage(); - $message->setTeam($this); - $message->setOwner($owner); - $message->setMessage($body); - $message->setPriority($priority); - return $message; - } - - /** - * @param Member $member - * @return bool - */ - public function isMember(Member $member){ - $res = $this->members->filter(function ($e) use($member){ - return $e->getMember()->getId() == $member->getId(); - }); - return $res->count() > 0; - } - - /** - * @param Member $member - * @return bool - */ - public function canPostMessages(Member $member){ - $res = $this->members->filter(function ($e) use($member){ - return $e->getMember()->getId() == $member->getId(); - }); - if($res->count() == 0) return false; - - $team_member = $res->first(); - - return $team_member->canPostMessages(); - } - - /** - * @param Member $member - * @return bool - */ - public function isOwner(Member $member){ - return $this->getOwnerId() == $member->getId(); - } - - /** - * @param Member $member - * @return bool - */ - public function isAlreadyInvited(Member $member){ - $res = $this->invitations->filter(function ($i) use($member){ - return $i->getInvitee()->getId() == $member->getId() && $i->isPending(); - }); - - return $res->count() > 0; - } - - /** - * @param Member $member - * @return bool - */ - public function isAdmin(Member $member){ - $res = $this->members->filter(function ($e) use($member){ - return $e->getMember()->getId() == $member->getId() && $e->isAdmin(); - }); - return $res->count() > 0; - } - - /** - * @param Member $member - */ - public function removeMember(Member $member){ - $res = $this->members->filter(function ($e) use($member){ - return $e->getMember()->getId() == $member->getId(); - }); - - if($res->count() == 0) return; - // remove member - $team_member = $res->first(); - $this->members->removeElement($team_member); - $res2 = $this->invitations->filter(function ($i) use($member){ - return $i->getInvitee()->getId() == $member->getId(); - }); - // remove invitation - if($res2->count() > 0) { - $this->invitations->removeElement($res2->first()); - } - - $team_member->setTeam(null); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ChatTeams/ChatTeamInvitation.php b/app/Models/Foundation/Main/ChatTeams/ChatTeamInvitation.php deleted file mode 100644 index deb92809..00000000 --- a/app/Models/Foundation/Main/ChatTeams/ChatTeamInvitation.php +++ /dev/null @@ -1,217 +0,0 @@ -is_accepted = false; - } - - /** - * @ORM\Column(name="Permission", type="string") - * @var string - */ - private $permission; - - /** - * @return string - */ - public function getPermission() - { - return $this->permission; - } - - /** - * @param string $permission - */ - public function setPermission($permission) - { - $this->permission = $permission; - } - - /** - * @return ChatTeam - */ - public function getTeam() - { - return $this->team; - } - - /** - * @return int - */ - public function getTeamId(){ - try{ - return $this->team->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @param ChatTeam $team - */ - public function setTeam($team) - { - $this->team = $team; - } - - /** - * @return Member - */ - public function getInvitee() - { - return $this->invitee; - } - - /** - * @return int - */ - public function getInviteeId(){ - try{ - return $this->invitee->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @param Member $invitee - */ - public function setInvitee($invitee) - { - $this->invitee = $invitee; - } - - /** - * @return Member - */ - public function getInviter() - { - return $this->inviter; - } - - /** - * @return int - */ - public function getInviterId(){ - try{ - return $this->inviter->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @param Member $inviter - */ - public function setInviter($inviter) - { - $this->inviter = $inviter; - } - - /** - * @ORM\Column(name="Accepted", type="boolean") - * @var bool - */ - private $is_accepted; - - /** - * @ORM\Column(name="AcceptedDate", type="datetime") - * @var \DateTime - */ - private $accepted_date; - - /** - * @return bool - */ - public function getIsAccepted() - { - return $this->is_accepted; - } - - /** - * @return bool - */ - public function isAccepted(){ - return $this->getIsAccepted(); - } - - /** - * @return bool - */ - public function isPending(){ - return !$this->getIsAccepted(); - } - - public function accept() - { - $this->is_accepted = true; - $now = new \DateTime('now', new \DateTimeZone(SilverstripeBaseModel::DefaultTimeZone)); - $this->accepted_date = $now; - } - - /** - * @return \DateTime - */ - public function getAcceptedDate() - { - return $this->accepted_date; - } - - /** - * @param \DateTime $accepted_date - */ - public function setAcceptedDate($accepted_date) - { - $this->accepted_date = $accepted_date; - } - - /** - * @ORM\ManyToOne(targetEntity="models\main\ChatTeam", inversedBy="invitations") - * @ORM\JoinColumn(name="TeamID", referencedColumnName="ID") - * @var ChatTeam - */ - private $team; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="InviteeID", referencedColumnName="ID") - * @var Member - */ - private $invitee; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="InviterID", referencedColumnName="ID") - * @var Member - */ - private $inviter; -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ChatTeams/ChatTeamMember.php b/app/Models/Foundation/Main/ChatTeams/ChatTeamMember.php deleted file mode 100644 index 1aadb6ec..00000000 --- a/app/Models/Foundation/Main/ChatTeams/ChatTeamMember.php +++ /dev/null @@ -1,145 +0,0 @@ -member; - } - - /** - * @param Member $member - */ - public function setMember($member) - { - $this->member = $member; - } - - /** - * @return ChatTeam - */ - public function getTeam() - { - return $this->team; - } - - /** - * @param ChatTeam $team - */ - public function setTeam($team) - { - $this->team = $team; - } - - /** - * @return string - */ - public function getPermission() - { - return $this->permission; - } - - /** - * @return bool - */ - public function isAdmin(){ - return $this->permission == ChatTeamPermission::Admin; - } - - /** - * @return bool - */ - public function canPostMessages(){ - return $this->isAdmin() || $this->permission == ChatTeamPermission::Write; - } - - /** - * @return bool - */ - public function canDeleteMembers(){ - return $this->isAdmin(); - } - - /** - * @param mixed $permission - */ - public function setPermission($permission) - { - $this->permission = $permission; - } - /** - * @ORM\Id - * @ORM\GeneratedValue - * @ORM\Column(name="ID", type="integer", unique=true, nullable=false) - */ - private $id; - - /** - * @return int - */ - public function getId() - { - return $this->id; - } - - public function getMemberId(){ - try{ - return $this->member->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - public function getTeamId(){ - try{ - return $this->team->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member", inversedBy="team_memberships") - * @ORM\JoinColumn(name="MemberID", referencedColumnName="ID") - * @var Member - */ - private $member; - - /** - * @ORM\ManyToOne(targetEntity="models\main\ChatTeam", inversedBy="members") - * @ORM\JoinColumn(name="ChatTeamID", referencedColumnName="ID") - * @var ChatTeam - */ - private $team; - - /** - * @ORM\Column(name="Permission", type="string") - * @var string - */ - private $permission; - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ChatTeams/ChatTeamPermission.php b/app/Models/Foundation/Main/ChatTeams/ChatTeamPermission.php deleted file mode 100644 index 779b24cc..00000000 --- a/app/Models/Foundation/Main/ChatTeams/ChatTeamPermission.php +++ /dev/null @@ -1,24 +0,0 @@ -team; - } - - /** - * @return int - */ - public function getTeamId(){ - try{ - return $this->team->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @param ChatTeam $team - */ - public function setTeam($team) - { - $this->team = $team; - } - /** - * @ORM\ManyToOne(targetEntity="models\main\ChatTeam", inversedBy="messages") - * @ORM\JoinColumn(name="ChatTeamID", referencedColumnName="ID") - * @var ChatTeam - */ - private $team; -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Companies/Company.php b/app/Models/Foundation/Main/Companies/Company.php deleted file mode 100644 index f08e3caa..00000000 --- a/app/Models/Foundation/Main/Companies/Company.php +++ /dev/null @@ -1,602 +0,0 @@ -sponsorships = new ArrayCollection(); - $this->featured = false; - $this->display_on_site = false; - $this->is_deleted = false; - } - - /** - * @return string|null - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name) - { - $this->name = $name; - } - - /** - * @return mixed - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description): void - { - $this->description = $description; - } - - /** - * @return string|null - */ - public function getIndustry(): ?string - { - return $this->industry; - } - - /** - * @param string $industry - */ - public function setIndustry(string $industry): void - { - $this->industry = $industry; - } - - /** - * @return string|null - */ - public function getCity(): ?string - { - return $this->city; - } - - /** - * @param string $city - */ - public function setCity(string $city): void - { - $this->city = $city; - } - - /** - * @return string|null - */ - public function getState(): ?string - { - return $this->state; - } - - /** - * @param string $state - */ - public function setState(string $state): void - { - $this->state = $state; - } - - /** - * @return string|null - */ - public function getCountry(): ?string - { - return $this->country; - } - - /** - * @param string $country - */ - public function setCountry(string $country): void - { - $this->country = $country; - } - - /** - * @return string|null - */ - public function getUrl(): ?string - { - return $this->url; - } - - /** - * @param string $url - */ - public function setUrl(string $url): void - { - $this->url = $url; - } - - /** - * @return File - */ - public function getLogo(): File - { - return $this->logo; - } - - /** - * @param File $logo - */ - public function setLogo(File $logo): void - { - $this->logo = $logo; - } - - public function clearLogo():void{ - $this->logo = null; - } - - /** - * @return File - */ - public function getBigLogo(): File - { - return $this->big_logo; - } - - /** - * @param File $big_logo - */ - public function setBigLogo(File $big_logo): void - { - $this->big_logo = $big_logo; - } - - public function clearBigLogo():void{ - $this->big_logo = null; - } - - /** - * @return bool - */ - public function hasLogo() - { - return $this->getLogoId() > 0; - } - - /** - * @return int - */ - public function getLogoId() - { - try { - if (is_null($this->logo)) return 0; - return $this->logo->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return bool - */ - public function hasBigLogo() - { - return $this->getBigLogoId() > 0; - } - - /** - * @return int - */ - public function getBigLogoId() - { - try { - if (is_null($this->big_logo)) return 0; - return $this->big_logo->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return string|null - */ - public function getLogoUrl(): ?string - { - - $logoUrl = null; - try { - if ($this->hasLogo() && $logo = $this->getLogo()) { - $logoUrl = $logo->getUrl(); - } - } - catch(\Exception $ex){ - Log::warning($ex); - } - return $logoUrl; - } - - /** - * @return string|null - */ - public function getBigLogoUrl(): ?string - { - $logoUrl = null; - try { - if ($this->hasBigLogo() && $logo = $this->getBigLogo()) { - $logoUrl = $logo->getUrl(); - } - } - catch(\Exception $ex){ - Log::warning($ex); - } - return $logoUrl; - } - - /** - * @return bool - */ - public function isDisplayOnSite(): bool - { - return $this->display_on_site; - } - - /** - * @param bool $display_on_site - */ - public function setDisplayOnSite(bool $display_on_site): void - { - $this->display_on_site = $display_on_site; - } - - /** - * @return bool - */ - public function isFeatured(): bool - { - return $this->featured; - } - - /** - * @param bool $featured - */ - public function setFeatured(bool $featured): void - { - $this->featured = $featured; - } - - /** - * @return string - */ - public function getProducts(): ?string - { - return $this->products; - } - - /** - * @param string $products - */ - public function setProducts(string $products): void - { - $this->products = $products; - } - - /** - * @return string - */ - public function getContributions(): ?string - { - return $this->contributions; - } - - /** - * @param string $contributions - */ - public function setContributions(string $contributions): void - { - $this->contributions = $contributions; - } - - /** - * @return string - */ - public function getContactEmail(): ?string - { - return $this->contact_email; - } - - /** - * @param string $contact_email - */ - public function setContactEmail(string $contact_email): void - { - $this->contact_email = $contact_email; - } - - /** - * @return string - */ - public function getMemberLevel(): ?string - { - return $this->member_level; - } - - /** - * @param string $member_level - * @throws ValidationException - */ - public function setMemberLevel(string $member_level): void - { - if(!in_array($member_level, ICompanyMemberLevel::ValidLevels)) - throw new ValidationException(sprintf("level %s is not valid", $member_level)); - - $this->member_level = $member_level; - } - - /** - * @return string - */ - public function getAdminEmail(): ?string - { - return $this->admin_email; - } - - /** - * @param string $admin_email - */ - public function setAdminEmail(string $admin_email): void - { - $this->admin_email = $admin_email; - } - - /** - * @return string - */ - public function getColor(): ?string - { - return $this->color; - } - - /** - * @param string $color - */ - public function setColor(string $color): void - { - $this->color = $color; - } - - /** - * @return string - */ - public function getOverview(): ?string - { - return $this->overview; - } - - /** - * @param string $overview - */ - public function setOverview(string $overview): void - { - $this->overview = $overview; - } - - /** - * @return string - */ - public function getCommitment(): ?string - { - return $this->commitment; - } - - /** - * @param string $commitment - */ - public function setCommitment(string $commitment): void - { - $this->commitment = $commitment; - } - - /** - * @return string - */ - public function getCommitmentAuthor(): ?string - { - return $this->commitment_author; - } - - /** - * @param string $commitment_author - */ - public function setCommitmentAuthor(string $commitment_author): void - { - $this->commitment_author = $commitment_author; - } - - /** - * @return bool - */ - public function isIsDeleted(): bool - { - return $this->is_deleted; - } - - /** - * @param bool $is_deleted - */ - public function setIsDeleted(bool $is_deleted): void - { - $this->is_deleted = $is_deleted; - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Companies/ProjectSponsorshipType.php b/app/Models/Foundation/Main/Companies/ProjectSponsorshipType.php deleted file mode 100644 index 5708304e..00000000 --- a/app/Models/Foundation/Main/Companies/ProjectSponsorshipType.php +++ /dev/null @@ -1,257 +0,0 @@ -order = $order; - } - - /** - * @inheritDoc - */ - public function getOrder() - { - return $this->order; - } - - public function __construct() - { - parent::__construct(); - $this->supporting_companies = new ArrayCollection(); - $this->is_active = false; - } - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - $slugify = new Slugify(); - $this->slug = $slugify->slugify($name); - } - - /** - * @return string - */ - public function getSlug(): string - { - return $this->slug; - } - - /** - * @return string - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return bool - */ - public function isActive(): bool - { - return $this->is_active; - } - - /** - * @param bool $is_active - */ - public function setIsActive(bool $is_active): void - { - $this->is_active = $is_active; - } - - /** - * @return SponsoredProject - */ - public function getSponsoredProject(): ?SponsoredProject - { - return $this->sponsored_project; - } - - /** - * @param SponsoredProject $sponsored_project - */ - public function setSponsoredProject(SponsoredProject $sponsored_project): void - { - $this->sponsored_project = $sponsored_project; - } - - public function clearSponsoredProject(){ - $this->sponsored_project = null; - } - - use OrderableChilds; - - /** - * @param SupportingCompany $value - * @param int $new_order - * @throws ValidationException - */ - public function recalculateSupportingCompanyOrder(SupportingCompany $value, $new_order){ - self::recalculateOrderForSelectable($this->supporting_companies, $value, $new_order); - } - - - /** - * @param Company $company - * @return SupportingCompany|null - */ - public function addSupportingCompany(Company $company):?SupportingCompany { - $supporting_company = new SupportingCompany(); - $supporting_company->setCompany($company); - $supporting_company->setSponsorshipType($this); - $this->supporting_companies->add($supporting_company); - $supporting_company->setOrder($this->supporting_companies->count()); - return $supporting_company; - } - - /** - * @param Company $company - * @return SupportingCompany|null - */ - public function getSupportingCompanyByCompany(Company $company):?SupportingCompany { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('company', $company)); - $supporting_company = $this->supporting_companies->matching($criteria)->first(); - return !$supporting_company ? null : $supporting_company; - } - - /** - * @param SupportingCompany $supporting_company - */ - public function removeSupportingCompany(SupportingCompany $supporting_company){ - if(!$this->supporting_companies->contains($supporting_company)) return; - $this->supporting_companies->removeElement($supporting_company); - } - - use One2ManyPropertyTrait; - - protected $getIdMappings = [ - 'getSponsoredProjectId' => 'sponsored_project', - ]; - - protected $hasPropertyMappings = [ - 'hasSponsoredProject' => 'sponsored_project', - ]; - - /** - * @return array - */ - public function getSupportingCompaniesIds():array { - $res = []; - foreach ($this->supporting_companies as $supporting_company){ - $res[] = $supporting_company->getCompany()->getId(); - } - return $res; - } - - public function getSupportingCompanies(){ - return $this->supporting_companies; - } - - /** - * @param int $id - * @return SupportingCompany|null - */ - public function getSupportingCompanyById(int $id):?SupportingCompany{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $res = $this->supporting_companies->matching($criteria)->first(); - return !$res ? null : $res; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Companies/SponsoredProject.php b/app/Models/Foundation/Main/Companies/SponsoredProject.php deleted file mode 100644 index 7caf697c..00000000 --- a/app/Models/Foundation/Main/Companies/SponsoredProject.php +++ /dev/null @@ -1,193 +0,0 @@ -name = $name; - $slugify = new Slugify(); - $this->slug = $slugify->slugify($name); - } - - /** - * @return string|null - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return bool - */ - public function isActive(): bool - { - return $this->is_active; - } - - /** - * @param bool $is_active - */ - public function setIsActive(bool $is_active): void - { - $this->is_active = $is_active; - } - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @return string - */ - public function getSlug(): string - { - return $this->slug; - } - - use OrderableChilds; - - /** - * @ORM\OneToMany(targetEntity="ProjectSponsorshipType", mappedBy="sponsored_project", cascade={"persist"}, orphanRemoval=true) - * @ORM\OrderBy({"order" = "ASC"}) - * @var ArrayCollection - */ - private $sponsorship_types; - - - /** - * SponsoredProject constructor. - */ - public function __construct() - { - parent::__construct(); - $this->sponsorship_types = new ArrayCollection; - $this->is_active = false; - } - - /** - * @param ProjectSponsorshipType $value - * @param int $new_order - * @throws ValidationException - */ - public function recalculateProjectSponsorshipTypeOrder(ProjectSponsorshipType $value, $new_order){ - self::recalculateOrderForSelectable($this->sponsorship_types, $value, $new_order); - } - - /** - * @return ArrayCollection - */ - public function getSponsorshipTypes() - { - return $this->sponsorship_types; - } - - /** - * @return array|int[] - */ - public function getSponsorshipTypesIds(): array { - $res = []; - foreach($this->sponsorship_types as $item){ - $res[] = $item->getId(); - } - return $res; - } - - /** - * @param string $name - * @return ProjectSponsorshipType|null - */ - public function getSponsorshipTypeByName(string $name):?ProjectSponsorshipType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $sponsorshipType = $this->sponsorship_types->matching($criteria)->first(); - return $sponsorshipType === false ? null : $sponsorshipType; - } - - /** - * @param int $id - * @return ProjectSponsorshipType|null - */ - public function getSponsorshipTypeById(int $id):?ProjectSponsorshipType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $sponsorshipType = $this->sponsorship_types->matching($criteria)->first(); - return $sponsorshipType === false ? null : $sponsorshipType; - } - - public function addSponsorshipType(ProjectSponsorshipType $sponsorshipType){ - if($this->sponsorship_types->contains($sponsorshipType)) return; - $this->sponsorship_types->add($sponsorshipType); - $sponsorshipType->setSponsoredProject($this); - $sponsorshipType->setOrder($this->sponsorship_types->count()); - } - - public function removeSponsorshipType(ProjectSponsorshipType $sponsorshipType){ - if(!$this->sponsorship_types->contains($sponsorshipType)) return; - $this->sponsorship_types->removeElement($sponsorshipType); - $sponsorshipType->clearSponsoredProject(); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Companies/SupportingCompany.php b/app/Models/Foundation/Main/Companies/SupportingCompany.php deleted file mode 100644 index 94408e82..00000000 --- a/app/Models/Foundation/Main/Companies/SupportingCompany.php +++ /dev/null @@ -1,114 +0,0 @@ - 'company', - 'getSponsorshipId' => 'sponsorship_type', - ]; - - protected $hasPropertyMappings = [ - 'hasCompany' => 'company', - 'hasSponsorshipType' => 'sponsorship_type', - ]; - - /** - * @ORM\ManyToOne(targetEntity="Company", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="CompanyID", referencedColumnName="ID", onDelete="CASCADE") - * @var Company - */ - private $company; - - /** - * @ORM\ManyToOne(targetEntity="ProjectSponsorshipType", fetch="EXTRA_LAZY", inversedBy="supporting_companies") - * @ORM\JoinColumn(name="ProjectSponsorshipTypeID", referencedColumnName="ID", onDelete="CASCADE") - * @var ProjectSponsorshipType - */ - private $sponsorship_type; - - /** - * @ORM\Column(name="`Order`", type="integer") - * @var int - */ - private $order; - - /** - * @inheritDoc - */ - public function setOrder($order) - { - $this->order = $order; - } - - /** - * @inheritDoc - */ - public function getOrder() - { - return $this->order; - } - - /** - * @return Company - */ - public function getCompany(): Company - { - return $this->company; - } - - /** - * @param Company $company - */ - public function setCompany(Company $company): void - { - $this->company = $company; - } - - /** - * @return ProjectSponsorshipType - */ - public function getSponsorshipType(): ProjectSponsorshipType - { - return $this->sponsorship_type; - } - - /** - * @param ProjectSponsorshipType $sponsorship_type - */ - public function setSponsorshipType(ProjectSponsorshipType $sponsorship_type): void - { - $this->sponsorship_type = $sponsorship_type; - } - - public function clearCompany(){ - $this->company = null; - } - - public function clearSponsorshipType(){ - $this->sponsorship_type = null; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/CountryCodes.php b/app/Models/Foundation/Main/CountryCodes.php deleted file mode 100644 index f51c1d2e..00000000 --- a/app/Models/Foundation/Main/CountryCodes.php +++ /dev/null @@ -1,274 +0,0 @@ - "Afghanistan", - 'AX' => "Aland Islands", - 'AL' => "Albania", - 'DZ' => "Algeria", - 'AS' => "American Samoa", - 'AD' => "Andorra", - 'AO' => "Angola", - 'AI' => "Anguilla", - 'AQ' => "Antarctica", - 'AG' => "Antigua and Barbuda", - 'AR' => "Argentina", - 'AM' => "Armenia", - 'AW' => "Aruba", - 'AU' => "Australia", - 'AT' => "Austria", - 'AZ' => "Azerbaijan", - 'BS' => "Bahamas", - 'BH' => "Bahrain", - 'BD' => "Bangladesh", - 'BB' => "Barbados", - 'BY' => "Belarus", - 'BE' => "Belgium", - 'BZ' => "Belize", - 'BJ' => "Benin", - 'BM' => "Bermuda", - 'BT' => "Bhutan", - 'BO' => "Bolivia, Plurinational State of", - 'BQ' => "Bonaire, Sint Eustatius and Saba", - 'BA' => "Bosnia and Herzegovina", - 'BW' => "Botswana", - 'BV' => "Bouvet Island", - 'BR' => "Brazil", - 'IO' => "British Indian Ocean Territory", - 'BN' => "Brunei Darussalam", - 'BG' => "Bulgaria", - 'BF' => "Burkina Faso", - 'BI' => "Burundi", - 'KH' => "Cambodia", - 'CM' => "Cameroon", - 'CA' => "Canada", - 'CV' => "Cape Verde", - 'KY' => "Cayman Islands", - 'CF' => "Central African Republic", - 'TD' => "Chad", - 'CL' => "Chile", - 'CN' => "China", - 'CX' => "Christmas Island", - 'CC' => "Cocos (Keeling) Islands", - 'CO' => "Colombia", - 'KM' => "Comoros", - 'CG' => "Congo", - 'CD' => "Congo, the Democratic Republic of the", - 'CK' => "Cook Islands", - 'CR' => "Costa Rica", - 'CI' => "Côte d'Ivoire", - 'HR' => "Croatia", - 'CU' => "Cuba", - 'CW' => "Curaçao", - 'CY' => "Cyprus", - 'CZ' => "Czech Republic", - 'DK' => "Denmark", - 'DJ' => "Djibouti", - 'DM' => "Dominica", - 'DO' => "Dominican Republic", - 'EC' => "Ecuador", - 'EG' => "Egypt", - 'SV' => "El Salvador", - 'GQ' => "Equatorial Guinea", - 'ER' => "Eritrea", - 'EE' => "Estonia", - 'ET' => "Ethiopia", - 'FK' => "Falkland Islands (Malvinas)", - 'FO' => "Faroe Islands", - 'FJ' => "Fiji", - 'FI' => "Finland", - 'FR' => "France", - 'FX' => "France, Metropolitan", - 'GF' => "French Guiana", - 'PF' => "French Polynesia", - 'TF' => "French Southern Territories", - 'GA' => "Gabon", - 'GM' => "Gambia", - 'GE' => "Georgia", - 'DE' => "Germany", - 'GH' => "Ghana", - 'GI' => "Gibraltar", - 'GR' => "Greece", - 'GL' => "Greenland", - 'GD' => "Grenada", - 'GP' => "Guadeloupe", - 'GU' => "Guam", - 'GT' => "Guatemala", - 'GG' => "Guernsey", - 'GN' => "Guinea", - 'GW' => "Guinea-Bissau", - 'GY' => "Guyana", - 'HT' => "Haiti", - 'HM' => "Heard Island and McDonald Islands", - 'VA' => "Holy See (Vatican City State)", - 'HN' => "Honduras", - 'HK' => "Hong Kong", - 'HU' => "Hungary", - 'IS' => "Iceland", - 'IN' => "India", - 'ID' => "Indonesia", - 'IR' => "Iran, Islamic Republic of", - 'IQ' => "Iraq", - 'IE' => "Ireland", - 'IM' => "Isle of Man", - 'IL' => "Israel", - 'IT' => "Italy", - 'JM' => "Jamaica", - 'JP' => "Japan", - 'JE' => "Jersey", - 'JO' => "Jordan", - 'KZ' => "Kazakhstan", - 'KE' => "Kenya", - 'KI' => "Kiribati", - 'KP' => "Korea, Democratic People's Republic of", - 'KR' => "Korea, Republic of", - 'KW' => "Kuwait", - 'KG' => "Kyrgyzstan", - 'LA' => "Lao People's Democratic Republic", - 'LV' => "Latvia", - 'LB' => "Lebanon", - 'LS' => "Lesotho", - 'LR' => "Liberia", - 'LY' => "Libya", - 'LI' => "Liechtenstein", - 'LT' => "Lithuania", - 'LU' => "Luxembourg", - 'MO' => "Macao", - 'MK' => "Macedonia, the former Yugoslav Republic of", - 'MG' => "Madagascar", - 'MW' => "Malawi", - 'MY' => "Malaysia", - 'MV' => "Maldives", - 'ML' => "Mali", - 'MT' => "Malta", - 'MH' => "Marshall Islands", - 'MQ' => "Martinique", - 'MR' => "Mauritania", - 'MU' => "Mauritius", - 'YT' => "Mayotte", - 'MX' => "Mexico", - 'FM' => "Micronesia, Federated States of", - 'MD' => "Moldova, Republic of", - 'MC' => "Monaco", - 'MN' => "Mongolia", - 'ME' => "Montenegro", - 'MS' => "Montserrat", - 'MA' => "Morocco", - 'MZ' => "Mozambique", - 'MM' => "Myanmar", - 'NA' => "Namibia", - 'NR' => "Nauru", - 'NP' => "Nepal", - 'NL' => "Netherlands", - 'NC' => "New Caledonia", - 'NZ' => "New Zealand", - 'NI' => "Nicaragua", - 'NE' => "Niger", - 'NG' => "Nigeria", - 'NU' => "Niue", - 'NF' => "Norfolk Island", - 'MP' => "Northern Mariana Islands", - 'NO' => "Norway", - 'OM' => "Oman", - 'PK' => "Pakistan", - 'PW' => "Palau", - 'PS' => "Palestine", - 'PA' => "Panama", - 'PG' => "Papua New Guinea", - 'PY' => "Paraguay", - 'PE' => "Peru", - 'PH' => "Philippines", - 'PN' => "Pitcairn", - 'PL' => "Poland", - 'PT' => "Portugal", - 'PR' => "Puerto Rico", - 'QA' => "Qatar", - 'RE' => "Réunion", - 'RO' => "Romania", - 'RU' => "Russian Federation", - 'RW' => "Rwanda", - 'BL' => "Saint Barthélemy", - 'SH' => "Saint Helena, Ascension and Tristan da Cunha", - 'KN' => "Saint Kitts and Nevis", - 'LC' => "Saint Lucia", - 'MF' => "Saint Martin (French part)", - 'PM' => "Saint Pierre and Miquelon", - 'VC' => "Saint Vincent and the Grenadines", - 'WS' => "Samoa", - 'SM' => "San Marino", - 'ST' => "Sao Tome and Principe", - 'SA' => "Saudi Arabia", - 'SN' => "Senegal", - 'RS' => "Serbia", - 'SC' => "Seychelles", - 'SL' => "Sierra Leone", - 'SG' => "Singapore", - 'SX' => "Sint Maarten (Dutch part)", - 'SK' => "Slovakia", - 'SI' => "Slovenia", - 'SB' => "Solomon Islands", - 'SO' => "Somalia", - 'ZA' => "South Africa", - 'GS' => "South Georgia and the South Sandwich Islands", - 'SS' => "South Sudan", - 'ES' => "Spain", - 'LK' => "Sri Lanka", - 'SD' => "Sudan", - 'SR' => "Suriname", - 'SJ' => "Svalbard and Jan Mayen", - 'SZ' => "Swaziland", - 'SE' => "Sweden", - 'CH' => "Switzerland", - 'SY' => "Syrian Arab Republic", - 'TW' => "Taiwan", - 'TJ' => "Tajikistan", - 'TZ' => "Tanzania, United Republic of", - 'TH' => "Thailand", - 'TL' => "Timor-Leste", - 'TG' => "Togo", - 'TK' => "Tokelau", - 'TO' => "Tonga", - 'TT' => "Trinidad and Tobago", - 'TN' => "Tunisia", - 'TR' => "Turkey", - 'TM' => "Turkmenistan", - 'TC' => "Turks and Caicos Islands", - 'TV' => "Tuvalu", - 'UG' => "Uganda", - 'UA' => "Ukraine", - 'AE' => "United Arab Emirates", - 'GB' => "United Kingdom", - 'US' => "United States", - 'UM' => "United States Minor Outlying Islands", - 'UY' => "Uruguay", - 'UZ' => "Uzbekistan", - 'VU' => "Vanuatu", - 'VE' => "Venezuela, Bolivarian Republic of", - 'VN' => "Viet Nam", - 'VG' => "Virgin Islands, British", - 'VI' => "Virgin Islands, U.S.", - 'WF' => "Wallis and Futuna", - 'EH' => "Western Sahara", - 'YE' => "Yemen", - 'ZM' => "Zambia", - 'ZW' => "Zimbabwe" - ]; -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionAnswer.php b/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionAnswer.php deleted file mode 100644 index 6baf2533..00000000 --- a/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionAnswer.php +++ /dev/null @@ -1,103 +0,0 @@ - 'question', - ]; - - protected $hasPropertyMappings = [ - 'hasQuestion' => 'question', - ]; - - /** - * @return bool - */ - public function hasValue():bool { - return !empty($this->value); - } - - /** - * @return ExtraQuestionType - */ - public function getQuestion(): ExtraQuestionType - { - return $this->question; - } - - /** - * @param ExtraQuestionType $question - */ - public function setQuestion(ExtraQuestionType $question): void - { - $this->question = $question; - } - - /** - * @return string - */ - public function getValue(): string - { - return $this->value; - } - - /** - * @param string $value - */ - public function setValue(string $value): void - { - $this->value = $value; - } - - public function __toString():string - { - $value = $this->value; - if($this->question->allowsValues()){ - $value = $this->question->getNiceValue($value); - } - return sprintf("%s : %s", strip_tags($this->question->getLabel()), $value); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionType.php b/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionType.php deleted file mode 100644 index d8395c7b..00000000 --- a/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionType.php +++ /dev/null @@ -1,325 +0,0 @@ -values = new ArrayCollection(); - $this->mandatory = false; - $this->order = 1; - } - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getType(): string - { - return $this->type; - } - - /** - * @return string - */ - public function getPlaceholder(): ?string - { - return $this->placeholder; - } - - /** - * @param string $placeholder - * @throws ValidationException - */ - public function setPlaceholder(string $placeholder): void - { - if(empty($placeholder)) return; - if(!in_array($this->type, ExtraQuestionTypeConstants::AllowedPlaceHolderQuestionType)) - throw new ValidationException(sprintf("%s type does not allows a placeholder", $this->type)); - $this->placeholder = $placeholder; - } - - /** - * @param string $type - * @throws ValidationException - */ - public function setType(string $type): void - { - if(!in_array($type, ExtraQuestionTypeConstants::ValidQuestionTypes)) - throw new ValidationException(sprintf("%s type is not valid", $type)); - - $this->type = $type; - } - - /** - * @return string - */ - public function getLabel(): string - { - return $this->label; - } - - /** - * @param string $label - */ - public function setLabel(string $label): void - { - $this->label = $label; - } - - /** - * @return int - */ - public function getOrder(): int - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order): void - { - $this->order = $order; - } - - /** - * @return bool - */ - public function isMandatory(): bool - { - return $this->mandatory; - } - - /** - * @param bool $mandatory - */ - public function setMandatory(bool $mandatory): void - { - $this->mandatory = $mandatory; - } - - /** - * @param ExtraQuestionTypeValue $value - * @throws ValidationException - */ - public function addValue(ExtraQuestionTypeValue $value){ - if(!$this->allowsValues()) - throw new ValidationException(sprintf("%s type does not allow multiple values.", $this->type)); - if($this->values->contains($value)) return; - $value->setOrder($this->getValueMaxOrder() + 1); - $this->values->add($value); - $value->setQuestion($this); - } - - /** - * @return int - */ - private function getValueMaxOrder():int{ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $value = $this->values->matching($criteria)->first(); - return $value === false ? 0 : $value->getOrder(); - } - - public function allowsValues():bool { - return in_array($this->type, ExtraQuestionTypeConstants::AllowedMultiValueQuestionType); - } - /** - * @param ExtraQuestionTypeValue $value - * @throws ValidationException - */ - public function removeValue(ExtraQuestionTypeValue $value){ - if(!$this->allowsValues()) - throw new ValidationException(sprintf("%s type does not allow multiple values.", $this->type)); - - if(!$this->values->contains($value)) return; - $this->values->removeElement($value); - } - - /** - * @param string $label - * @return ExtraQuestionTypeValue|null - */ - public function getValueByLabel(string $label):?ExtraQuestionTypeValue{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('label', trim($label))); - $value = $this->values->matching($criteria)->first(); - return $value === false ? null : $value; - } - - /** - * @param string $name - * @return ExtraQuestionTypeValue|null - */ - public function getValueByName(string $name):?ExtraQuestionTypeValue{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('value', trim($name))); - $value = $this->values->matching($criteria)->first(); - return $value === false ? null : $value; - } - - /** - * @param string $value - * @return bool - */ - public function allowValue(string $value):bool{ - - if(empty($value) && !$this->isMandatory()) return true; - - if($this->type == ExtraQuestionTypeConstants::ComboBoxQuestionType) - return !is_null($this->getValueById(intval($value))); - - foreach (explode(',',$value) as $v) - { - if(is_null($this->getValueById(intval($v)))) - return false; - } - return true; - } - - /** - * @param int $id - * @return ExtraQuestionTypeValue|null - */ - public function getValueById(int $id):?ExtraQuestionTypeValue{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $value = $this->values->matching($criteria)->first(); - return $value === false ? null : $value; - } - - use OrderableChilds; - - /** - * @param ExtraQuestionTypeValue $value - * @param int $new_order - * @throws ValidationException - */ - public function recalculateValueOrder(ExtraQuestionTypeValue $value, $new_order){ - self::recalculateOrderForSelectable($this->values, $value, $new_order); - } - - /** - * @param string $value - * @return string|null - */ - public function getNiceValue(string $value):?string { - if($this->values->count() == 0) return $value; - - $value = explode(',' , $value); - $dict = []; - $niceValues = []; - - foreach ($this->values as $questionValue){ - $dict[$questionValue->getId()] = $questionValue->getLabel(); - } - - foreach($value as $v){ - $nv = $dict[$v] ?? null; - if(!empty($nv)){ - $niceValues[] = $nv; - } - } - - return implode(',', $niceValues); - } - - /** - * @return ExtraQuestionTypeValue[]|ArrayCollection - */ - public function getValues(){ - return $this->values; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionTypeConstants.php b/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionTypeConstants.php deleted file mode 100644 index 175bf730..00000000 --- a/app/Models/Foundation/Main/ExtraQuestions/ExtraQuestionTypeConstants.php +++ /dev/null @@ -1,50 +0,0 @@ -label; - } - - /** - * @param string $label - */ - public function setLabel(string $label): void - { - $this->label = $label; - } - - /** - * @return string - */ - public function getValue(): ?string - { - return $this->value; - } - - /** - * @param string $value - */ - public function setValue(string $value): void - { - $this->value = $value; - } - - /** - * @return int - */ - public function getOrder(): int - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order): void - { - $this->order = $order; - } - - /** - * @return ExtraQuestionType - */ - public function getQuestion(): ExtraQuestionType - { - return $this->question; - } - - /** - * @param ExtraQuestionType $question - */ - public function setQuestion(ExtraQuestionType $question): void - { - $this->question = $question; - } - - public function __construct() - { - parent::__construct(); - $this->order = 1; - } - - /** - * @return int - */ - public function getQuestionId():int{ - try { - return is_null($this->question) ? 0 : $this->question->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ExtraQuestions/Factories/ExtraQuestionTypeFactory.php b/app/Models/Foundation/Main/ExtraQuestions/Factories/ExtraQuestionTypeFactory.php deleted file mode 100644 index 9a25f31b..00000000 --- a/app/Models/Foundation/Main/ExtraQuestions/Factories/ExtraQuestionTypeFactory.php +++ /dev/null @@ -1,55 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['label'])) - $question->setLabel(trim($data['label'])); - - if(isset($data['type'])) - $question->setType(trim($data['type'])); - - if(isset($data['placeholder'])) - $question->setPlaceholder(trim($data['placeholder'])); - - if(isset($data['mandatory'])) - $question->setMandatory(boolval($data['mandatory'])); - - return $question; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ExtraQuestions/IExtraQuestionTypeRepository.php b/app/Models/Foundation/Main/ExtraQuestions/IExtraQuestionTypeRepository.php deleted file mode 100644 index d799e62e..00000000 --- a/app/Models/Foundation/Main/ExtraQuestions/IExtraQuestionTypeRepository.php +++ /dev/null @@ -1,37 +0,0 @@ -setName(trim($data['name'])); - - if (isset($data['url'])) - $company->setUrl(trim($data['url'])); - - if (isset($data['display_on_site'])) - $company->setDisplayOnSite(boolval($data['display_on_site'])); - - if (isset($data['featured'])) - $company->setFeatured(boolval($data['featured'])); - - if (isset($data['city'])) - $company->setCity(trim($data['city'])); - - if (isset($data['state'])) - $company->setState(trim($data['state'])); - - if (isset($data['country'])) - $company->setCountry(trim($data['country'])); - - if (isset($data['description'])) - $company->setDescription(trim($data['description'])); - - if (isset($data['industry'])) - $company->setIndustry(trim($data['industry'])); - - if (isset($data['products'])) - $company->setProducts(trim($data['products'])); - - if (isset($data['contributions'])) - $company->setContributions(trim($data['contributions'])); - - if (isset($data['contact_email'])) - $company->setContactEmail(trim($data['contact_email'])); - - if (isset($data['member_level'])) - $company->setMemberLevel(trim($data['member_level'])); - - if (isset($data['admin_email'])) - $company->setAdminEmail(trim($data['admin_email'])); - - if (isset($data['color'])) - $company->setColor(trim($data['color'])); - - if (isset($data['overview'])) - $company->setOverview(trim($data['overview'])); - - if (isset($data['commitment'])) - $company->setCommitment(trim($data['commitment'])); - - if (isset($data['commitment_author'])) - $company->setCommitmentAuthor(trim($data['commitment_author'])); - - if (isset($data['is_deleted'])) - $company->setIsDeleted(boolval($data['is_deleted'])); - - return $company; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Factories/ProjectSponsorshipTypeFactory.php b/app/Models/Foundation/Main/Factories/ProjectSponsorshipTypeFactory.php deleted file mode 100644 index 4f33bf71..00000000 --- a/app/Models/Foundation/Main/Factories/ProjectSponsorshipTypeFactory.php +++ /dev/null @@ -1,39 +0,0 @@ -setName(trim($payload['name'])); - - if(isset($payload['description'])) - $projectSponsorshipType->setDescription(trim($payload['description'])); - - if(isset($payload['is_active'])) - $projectSponsorshipType->setIsActive(boolval($payload['is_active'])); - - return $projectSponsorshipType; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Factories/SponsoredProjectFactory.php b/app/Models/Foundation/Main/Factories/SponsoredProjectFactory.php deleted file mode 100644 index f5cd2ad7..00000000 --- a/app/Models/Foundation/Main/Factories/SponsoredProjectFactory.php +++ /dev/null @@ -1,49 +0,0 @@ -setName(trim($payload['name'])); - - if(isset($payload['description'])) - $sponsoredProject->setDescription(trim($payload['description'])); - - if(isset($payload['is_active'])) - $sponsoredProject->setIsActive(boolval($payload['is_active'])); - - return $sponsoredProject; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/File.php b/app/Models/Foundation/Main/File.php deleted file mode 100644 index c99c4e96..00000000 --- a/app/Models/Foundation/Main/File.php +++ /dev/null @@ -1,342 +0,0 @@ -name; - } - - /** - * @param mixed $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return mixed - */ - public function getTitle() - { - return $this->title; - } - - /** - * @param mixed $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @return mixed - */ - public function getContent() - { - return $this->content; - } - - /** - * @param mixed $content - */ - public function setContent($content) - { - $this->content = $content; - } - - /** - * @return mixed - */ - public function getFilename() - { - return $this->filename; - } - - /** - * @param mixed $filename - */ - public function setFilename($filename) - { - $this->filename = $filename; - } - - /** - * @return bool - */ - public function isShowInSearch() - { - return $this->show_in_search; - } - - /** - * @param bool $show_in_search - */ - public function setShowInSearch($show_in_search) - { - $this->show_in_search = $show_in_search; - } - - /** - * @return File - */ - public function getParent() - { - return $this->parent; - } - - /** - * @param File $parent - */ - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - public function __construct() - { - parent::__construct(); - $this->class_name = 'CloudFile'; - $this->show_in_search = true; - $this->cloud_metajson = ""; - $this->cloud_status = "Local"; - $this->cloud_size = 0; - } - - public function setImage(){ - $this->class_name = 'CloudImage'; - } - - public function setFolder(){ - $this->class_name = 'Folder'; - } - - /** - * @return string - */ - public function getCloudStatus() - { - return $this->cloud_status; - } - - /** - * @param string $cloud_status - */ - public function setCloudStatus($cloud_status): void - { - $this->cloud_status = $cloud_status; - } - - /** - * @return int - */ - public function getCloudSize() - { - return $this->cloud_size; - } - - /** - * @param int $cloud_size - */ - public function setCloudSize($cloud_size): void - { - $this->cloud_size = $cloud_size; - } - - /** - * @param string $cloud_metajson - */ - public function setCloudMetaJSON($cloud_metajson): void - { - $this->cloud_metajson = $cloud_metajson; - } - - /** - * @return string - */ - public function getUrl() - { - $local = Config::get("server.assets_base_url", 'https://www.openstack.org/').$this->getFilename(); - return $this->cloud_status == 'Live' ? $this->getCloudLink() : $local; - } - - /** - * @return string - */ - public function getRelativeLinkFor() - { - $fn = $this->getFilename(); - return trim(str_replace("assets", '', $fn), '/'); - } - - /** - * @return string - */ - public function getCloudLink() - { - try { - $relativeLink = ltrim($this->getRelativeLinkFor(), '/'); - return Storage::disk('assets')->url($relativeLink); - } - catch (\Exception $ex){ - Log::warning($ex); - return null; - } - } - - /** - * @param string $imageRelativePath - * @return string|null - */ - public static function getCloudLinkForImages(string $imageRelativePath):?string { - try { - $imageRelativePath = ltrim($imageRelativePath, '/'); - return Storage::disk('static_images')->url($imageRelativePath); - } - catch (\Exception $ex){ - Log::warning($ex); - return null; - } - } - - /** - * @param string|array $key - passing an array as the first argument replaces the meta data entirely - * @param mixed $val - * @return File - chainable - */ - public function setCloudMeta($key, $val = null) - { - if (is_array($key)) { - $data = $key; - } else { - $data = $this->getCloudMetaJSON(); - $data[$key] = $val; - } - - $this->cloud_metajson = json_encode($data); - return $this; - } - - - /** - * @param string $key [optional] - if not present returns the whole array - * @return array - */ - public function getCloudMetaJSON($key = null) - { - $data = json_decode($this->cloud_metajson, true); - if (empty($data) || !is_array($data)) { - $data = array(); - } - - if (!empty($key)) { - return isset($data[$key]) ? $data[$key] : null; - } else { - return $data; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Group.php b/app/Models/Foundation/Main/Group.php deleted file mode 100644 index e18d68ce..00000000 --- a/app/Models/Foundation/Main/Group.php +++ /dev/null @@ -1,193 +0,0 @@ -members = new ArrayCollection(); - $this->groups = new ArrayCollection(); - $this->is_external = false; - } - - /** - * @param Member $member - */ - public function addMember(Member $member){ - if($this->members->contains($member)) return; - $this->members->add($member); - } - - /** - * @param Member $member - */ - public function removeMember(Member $member){ - if(!$this->members->contains($member)) return; - $this->members->removeElement($member); - } - - /** - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return string - */ - public function getCode() - { - return $this->code; - } - - /** - * @param string $code - */ - public function setCode($code) - { - $this->code = $code; - } - - /** - * @return mixed - */ - public function getMembers() - { - return $this->members; - } - - /** - * @param mixed $members - */ - public function setMembers($members) - { - $this->members = $members; - } - - /** - * @return mixed - */ - public function getParent() - { - return $this->parent; - } - - /** - * @param mixed $parent - */ - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * @return mixed - */ - public function getGroups() - { - return $this->groups; - } - - /** - * @param mixed $groups - */ - public function setGroups($groups) - { - $this->groups = $groups; - } - - /** - * @ORM\Column(name="Title", type="string") - * @var string - */ - private $title; - - /** - * @ORM\Column(name="Description", type="string") - * @var string - */ - private $description; - - /** - * @ORM\Column(name="Code", type="string") - * @var string - */ - private $code; - - /** - * @ORM\ManyToMany(targetEntity="models\main\Member", mappedBy="groups", fetch="EXTRA_LAZY") - */ - private $members; - - /** - * @ORM\ManyToOne(targetEntity="Group", inversedBy="groups") - * @ORM\JoinColumn(name="ParentID", referencedColumnName="ID") - */ - private $parent; - - /** - * @ORM\OneToMany(targetEntity="Group", mappedBy="parent") - */ - private $groups; - - /** - * @ORM\Column(name="IsExternal", type="boolean") - * @var bool - */ - private $is_external; - - public function setExternal(){ - $this->is_external = true; - } - - public function isExternal():bool { - return $this->is_external; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/ICompanyMemberLevel.php b/app/Models/Foundation/Main/ICompanyMemberLevel.php deleted file mode 100644 index ebef7454..00000000 --- a/app/Models/Foundation/Main/ICompanyMemberLevel.php +++ /dev/null @@ -1,37 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getIsoCode() - { - return $this->iso_code; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/LegalAgreement.php b/app/Models/Foundation/Main/LegalAgreement.php deleted file mode 100644 index b7d2b857..00000000 --- a/app/Models/Foundation/Main/LegalAgreement.php +++ /dev/null @@ -1,113 +0,0 @@ -signature; - } - - /** - * @param string $signature - */ - public function setSignature(string $signature): void - { - $this->signature = $signature; - } - - /** - * @return int - */ - public function getDocumentId(): int - { - return $this->document_id; - } - - /** - * @return int - */ - public function getOwnerId(){ - try { - return $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @param LegalDocument $document - */ - public function setDocument(LegalDocument $document): void - { - $this->document_id = $document->getId(); - } - - /** - * @return Member - */ - public function getOwner(): Member - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner(Member $owner): void - { - $this->owner = $owner; - } - - public function getContent():?String{ - - } - - public function getTitle():?string{ - - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/LegalDocument.php b/app/Models/Foundation/Main/LegalDocument.php deleted file mode 100644 index d13ab9ee..00000000 --- a/app/Models/Foundation/Main/LegalDocument.php +++ /dev/null @@ -1,84 +0,0 @@ -id = $id; - $this->title = $title; - $this->slug = $slug; - $this->content = $content; - } - - /** - * @return int - */ - public function getId(): int - { - return $this->id; - } - - /** - * @return string - */ - public function getTitle(): string - { - return $this->title; - } - - /** - * @return string - */ - public function getSlug(): string - { - return $this->slug; - } - - /** - * @return string - */ - public function getContent(): string - { - return $this->content; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Member.php b/app/Models/Foundation/Main/Member.php deleted file mode 100644 index cd87f18f..00000000 --- a/app/Models/Foundation/Main/Member.php +++ /dev/null @@ -1,1948 +0,0 @@ -active = false; - $this->email_verified = false; - $this->feedback = new ArrayCollection(); - $this->groups = new ArrayCollection(); - $this->ccla_teams = new ArrayCollection(); - $this->affiliations = new ArrayCollection(); - $this->team_memberships = new ArrayCollection(); - $this->favorites = new ArrayCollection(); - $this->schedule = new ArrayCollection(); - $this->rsvp = new ArrayCollection(); - $this->calendars_sync = new ArrayCollection(); - $this->schedule_sync_info = new ArrayCollection(); - $this->reservations = new ArrayCollection(); - $this->sponsor_memberships = new ArrayCollection(); - $this->summit_registration_orders = new ArrayCollection(); - $this->user_external_id = 0; - $this->membership_type = self::MembershipTypeNone; - $this->schedule_shareable_links = new ArrayCollection(); - $this->summit_permission_groups = new ArrayCollection(); - $this->summit_attendance_metrics = new ArrayCollection(); - $this->legal_agreements = new ArrayCollection(); - $this->track_chairs = new ArrayCollection(); - } - - /** - * @return Affiliation[] - */ - public function getAffiliations() - { - return $this->affiliations; - } - - /** - * @return ArrayCollection|LegalAgreement[] - */ - public function getLegalAgreements(){ - return $this->legal_agreements; - } - - /** - * @return Affiliation[] - */ - public function getCurrentAffiliations() - { - $criteria = Criteria::create() - ->where(Criteria::expr()->eq("is_current", true)) - ->andWhere(Criteria::expr()->eq("end_date", null)) - ->orderBy([ - "start_date" => Criteria::ASC, - ]); - - return $this->affiliations->matching($criteria); - } - - /** - * @param string $orgName - * @return Affiliation|null - */ - public function getAffiliationByOrgName(string $orgName): ?Affiliation - { - $res = $this->affiliations->filter(function ($e) use ($orgName) { - return $e->getOrganization()->getName() == trim($orgName) && $e->isCurrent(); - })->first(); - return $res ? $res : null; - } - - /** - * @return Affiliation[] - */ - public function getAllAffiliations() - { - $criteria = Criteria::create() - ->orderBy([ - "start_date" => Criteria::ASC, - "end_date" => Criteria::ASC, - ]); - return $this->affiliations->matching($criteria); - } - - /** - * @return Group[] - */ - public function getGroups() - { - return $this->groups; - } - - /** - * @return ChatTeamMember[] - */ - public function getTeamMemberships() - { - return $this->team_memberships; - } - - /** - * @param ChatTeamMember[] $team_memberships - */ - public function setTeamMemberships($team_memberships) - { - $this->team_memberships = $team_memberships; - } - - /** - * @param mixed $groups - */ - public function setGroups($groups) - { - $this->groups = $groups; - } - - /** - * @return ArrayCollection|SummitMemberFavorite[] - */ - public function getFavoritesSummitEvents() - { - return $this->favorites; - } - - /** - * @param SummitMemberFavorite[] $favorites - */ - public function setFavoritesSummitEvents($favorites) - { - $this->favorites = $favorites; - } - - /** - * @return string - */ - public function getBio() - { - return $this->bio; - } - - /** - * @return string - */ - public function getLinkedInProfile() - { - return $this->linked_in_profile; - } - - /** - * @return string - */ - public function getIrcHandle() - { - return $this->irc_handle; - } - - /** - * @return string - */ - public function getTwitterHandle() - { - return $this->twitter_handle; - } - - /** - * @return string - */ - public function getState() - { - return $this->state; - } - - /** - * @param string $state - */ - public function setState($state) - { - $this->state = $state; - } - - /** - * @return string - */ - public function getCountry() - { - return $this->country; - } - - /** - * @param string $country - */ - public function setCountry($country) - { - $this->country = $country; - } - - /** - * @return string - */ - public function getSecondEmail() - { - return $this->second_email; - } - - /** - * @param string $second_email - */ - public function setSecondEmail($second_email) - { - $this->second_email = $second_email; - } - - /** - * @return string - */ - public function getThirdEmail() - { - return $this->third_email; - } - - /** - * @param string $third_email - */ - public function setThirdEmail($third_email) - { - $this->third_email = $third_email; - } - - /** - * @return string - */ - public function getEmail() - { - return $this->email; - } - - /** - * @param string $email - */ - public function setEmail($email) - { - $this->email = $email; - } - - /** - * @return string - */ - public function getGitHubUser() - { - return $this->github_user; - } - - /** - * @return bool - */ - public function isEmailVerified() - { - return $this->email_verified; - } - - /** - * @return bool - */ - public function getEmailVerified() - { - return $this->email_verified; - } - - /** - * @param bool $email_verified - */ - public function setEmailVerified($email_verified) - { - $this->email_verified = $email_verified; - } - - /** - * @return \DateTime - */ - public function getEmailVerifiedDate() - { - return $this->email_verified_date; - } - - /** - * @param \DateTime $email_verified_date - */ - public function setEmailVerifiedDate($email_verified_date) - { - $this->email_verified_date = $email_verified_date; - } - - /** - * @return bool - */ - public function isActive() - { - return $this->active; - } - - /** - * @return bool - */ - public function getActive() - { - return $this->active; - } - - /** - * @param bool $active - */ - public function setActive($active) - { - $this->active = $active; - } - - /** - * @return string - */ - public function getGender() - { - return $this->gender; - } - - /** - * @return string|null - */ - public function getLastName():?string - { - return $this->last_name; - } - - /** - * @return string|null - */ - public function getFirstName():?string - { - return $this->first_name; - } - - /** - * @return File - */ - public function getPhoto() - { - return $this->photo; - } - - /** - * @param File $photo - */ - public function setPhoto(File $photo) - { - $this->photo = $photo; - } - - /** - * @return SummitEventFeedback[] - */ - public function getFeedback() - { - return $this->feedback; - } - - /** - * @param Summit $summit - * @return SummitEventFeedback[] - */ - public function getFeedbackBySummit(Summit $summit) - { - return $this->createQueryBuilder() - ->select('distinct f') - ->from('models\summit\SummitEventFeedback', 'f') - ->join('f.event', 'e') - ->join('f.owner', 'o') - ->join('e.summit', 's') - ->where('s.id = :summit_id and o.id = :owner_id and e.published = 1') - ->setParameter('summit_id', $summit->getId()) - ->setParameter('owner_id', $this->getId()) - ->getQuery()->getResult(); - } - - /** - * @param SummitEvent $event - * @return SummitEventFeedback|null - */ - public function getFeedbackByEvent(SummitEvent $event): ?SummitEventFeedback - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('event', $event)); - $feedback = $this->feedback->matching($criteria)->first(); - return $feedback === false ? null : $feedback; - } - - /** - * @param SummitEventFeedback $feedback - */ - public function addFeedback(SummitEventFeedback $feedback) - { - if ($this->feedback->contains($feedback)) return; - $this->feedback->add($feedback); - $feedback->setOwner($this); - } - - /** - * @param SummitEventFeedback $feedback - */ - public function removeFeedback(SummitEventFeedback $feedback) - { - if (!$this->feedback->contains($feedback)) return; - $this->feedback->removeElement($feedback); - $feedback->clearOwner(); - } - - /** - * @param bool $skip_external - * @return bool - */ - public function isAdmin($skip_external = false): bool - { - // admin or super admin - $superAdminGroup = $this->getGroupByCode(IGroup::SuperAdmins); - if (!is_null($superAdminGroup)) { - Log::debug(sprintf("Member::isAdmin has Super Admin Group On DB")); - return true; - } - - $adminGroup = $this->getGroupByCode(IGroup::Administrators); - if (!is_null($adminGroup)) { - Log::debug(sprintf("Member::isAdmin has Admin Group On DB")); - return true; - } - - if (!$skip_external) { - Log::debug(sprintf("Member::isAdmin check on external")); - if ($this->isOnExternalGroup(IGroup::SuperAdmins)) - return true; - - if ($this->isOnExternalGroup(IGroup::Administrators)) - return true; - } - - return false; - } - - public function isSummitAdmin(): bool - { - $summitAdminGroup = $this->getGroupByCode(IGroup::SummitAdministrators); - if (!is_null($summitAdminGroup)) - return true; - if ($this->isOnExternalGroup(IGroup::SummitAdministrators)) - return true; - return false; - } - - /** - * @param string $code - * @return bool - */ - public function isOnExternalGroup(string $code): bool - { - Log::debug(sprintf("Member::isOnExternalGroup id %s code %s", $this->id, $code)); - $resource_server_ctx = App::make(IResourceServerContext::class); - if ($resource_server_ctx instanceof IResourceServerContext) { - foreach ($resource_server_ctx->getCurrentUserGroups() as $group) { - Log::debug(sprintf("Member::isOnExternalGroup id %s code %s external group %s", $this->id, $code, $group['slug'])); - if - ( - isset($group['slug']) && - trim($group['slug']) == trim($code) - ) - return true; - } - } - return false; - } - - /** - * @param $code - * @param bool $skip_external - * @return bool - */ - public function isOnGroup(string $code, $skip_external = false) - { - Log::debug(sprintf("Member::isOnGroup member %s group code %s", $this->id, $code)); - if ($this->isAdmin($skip_external)) { - Log::debug(sprintf("Member::isOnGroup member %s group code %s isAdmin true", $this->id, $code)); - return true; - } - $group = $this->getGroupByCode($code); - if (!is_null($group)) { - Log::debug(sprintf("Member::isOnGroup member %s group code %s belongs to group", $this->id, $code)); - return true; - } - if (!$skip_external) { - Log::debug(sprintf("Member::isOnGroup member %s group code %s check external ones", $this->id, $code)); - return $this->isOnExternalGroup($code); - } - return false; - } - - /** - * @param string $code - * @return Group|null - */ - public function getGroupByCode(string $code): ?Group - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('code', trim($code))); - $res = $this->groups->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param string $code - * @return bool - */ - public function belongsToGroup(string $code): bool - { - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'member_id' => $this->getId(), - 'code' => trim($code), - ] - ); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return intval($res[0]) > 0; - } catch (\Exception $ex) { - - } - return false; - - } - - /** - * @return int[] - */ - public function getGroupsIds() - { - $ids = []; - foreach ($this->getGroups() as $g) { - $ids[] = intval($g->getId()); - } - return $ids; - } - - public function getCCLATeamsIds() - { - $ids = []; - foreach ($this->getCCLATeams() as $t) { - $ids[] = intval($t->getId()); - } - return $ids; - } - - /** - * @return Team[] - */ - public function getCCLATeams() - { - return $this->ccla_teams->toArray(); - } - - /** - * @return string[] - */ - public function getGroupsCodes() - { - $codes = []; - foreach ($this->getGroups() as $g) { - $codes[] = $g->getCode(); - } - // from IDP - $resource_server_ctx = App::make(IResourceServerContext::class); - if ($resource_server_ctx instanceof IResourceServerContext) { - foreach ($resource_server_ctx->getCurrentUserGroups() as $group) { - if (isset($group['slug'])) - $codes[] = trim($group['slug']); - } - } - return $codes; - } - - /** - * @param SummitEvent $event - * @throws ValidationException - */ - public function addFavoriteSummitEvent(SummitEvent $event) - { - if ($this->isOnFavorite($event)) - throw new ValidationException - ( - sprintf('Event %s already belongs to member %s favorites.', $event->getId(), $this->getId()) - ); - if (!$event->isPublished()) - throw new ValidationException - ( - sprintf('Event %s is not published', $event->getId()) - ); - - $favorite = new SummitMemberFavorite(); - - $favorite->setMember($this); - $favorite->setEvent($event); - $this->favorites->add($favorite); - } - - /** - * @param SummitEvent $event - * @return bool - */ - public function isOnFavorite(SummitEvent $event) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('event', $event)); - return $this->favorites->matching($criteria)->count() > 0; - } - - /** - * @param SummitEvent $event - * @throws ValidationException - */ - public function removeFavoriteSummitEvent(SummitEvent $event) - { - $favorite = $this->getFavoriteByEvent($event); - - if (is_null($favorite)) - throw new ValidationException - ( - sprintf('Event %s does not belongs to member %s favorite.', $event->getId(), $this->getId()) - ); - $this->favorites->removeElement($favorite); - $favorite->clearOwner(); - } - - /** - * @param Summit $summit - * @return int[] - */ - public function getFavoritesEventsIds(Summit $summit) - { - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'member_id' => $this->getId(), - 'summit_id' => $summit->getId(), - ] - ); - return $stmt->fetchAll(\PDO::FETCH_COLUMN); - } - - /** - * @param SummitEvent $event - * @throws ValidationException - */ - public function add2Schedule(SummitEvent $event) - { - if ($this->isOnSchedule($event)) - throw new ValidationException - ( - sprintf('Event %s already belongs to member %s schedule.', $event->getId(), $this->getId()) - ); - - if (!$event->isPublished()) - throw new ValidationException - ( - sprintf('Event %s is not published', $event->getId()) - ); - - $schedule = new SummitMemberSchedule(); - - $schedule->setMember($this); - $schedule->setEvent($event); - $this->schedule->add($schedule); - } - - /** - * @param ScheduleCalendarSyncInfo $sync_info - */ - public function add2ScheduleSyncInfo(ScheduleCalendarSyncInfo $sync_info) - { - $sync_info->setMember($this); - $this->schedule_sync_info->add($sync_info); - } - - public function removeFromSchedule(SummitEvent $event) - { - $schedule = $this->getScheduleByEvent($event); - - if (is_null($schedule)) - throw new ValidationException - ( - sprintf('Event %s does not belongs to member %s schedule.', $event->getId(), $this->getId()) - ); - $this->schedule->removeElement($schedule); - $schedule->clearOwner(); - } - - public function removeFromScheduleSyncInfo(ScheduleCalendarSyncInfo $sync_info) - { - $this->schedule_sync_info->removeElement($sync_info); - $sync_info->clearOwner(); - } - - /** - * @param CalendarSyncInfo $calendar_sync_info - * @param int $event_id - * @return bool - */ - public function isEventSynchronized(CalendarSyncInfo $calendar_sync_info, $event_id) - { - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('summit_event_id', $event_id)); - $criteria->andWhere(Criteria::expr()->eq('calendar_sync_info', $calendar_sync_info)); - return $this->schedule_sync_info->matching($criteria)->count() > 0; - } - - /** - * @param SummitEvent $event - * @return bool - */ - public function isOnSchedule(SummitEvent $event) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('event', $event)); - return $this->schedule->matching($criteria)->count() > 0; - } - - /** - * @param SummitEvent $event - * @return null| SummitMemberSchedule - */ - public function getScheduleByEvent(SummitEvent $event) - { - - try { - $query = $this->createQuery("SELECT s from models\main\SummitMemberSchedule s - JOIN s.member a - JOIN s.event e - WHERE a.id = :member_id and e.id = :event_id - "); - return $query - ->setParameter('member_id', $this->getIdentifier()) - ->setParameter('event_id', $event->getIdentifier()) - ->getSingleResult(); - } catch (NoResultException $ex1) { - return null; - } catch (NonUniqueResultException $ex2) { - // should never happen - return null; - } - } - - /** - * @param int $summit_event_id - * @param CalendarSyncInfo $calendar_sync_info - * @return ScheduleCalendarSyncInfo|null - */ - public function getScheduleSyncInfoByEvent($summit_event_id, CalendarSyncInfo $calendar_sync_info) - { - try { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('summit_event_id', $summit_event_id)); - $criteria->andWhere(Criteria::expr()->eq('calendar_sync_info', $calendar_sync_info)); - $res = $this->schedule_sync_info->matching($criteria)->first(); - return $res === false ? null : $res; - } catch (NoResultException $ex1) { - return null; - } catch (NonUniqueResultException $ex2) { - // should never happen - return null; - } - } - - /** - * @param SummitEvent $event - * @return SummitMemberFavorite|null - */ - public function getFavoriteByEvent(SummitEvent $event) - { - try { - $query = $this->createQuery("SELECT f from models\main\SummitMemberFavorite f - JOIN f.member a - JOIN f.event e - WHERE a.id = :member_id and e.id = :event_id - "); - return $query - ->setParameter('member_id', $this->getIdentifier()) - ->setParameter('event_id', $event->getIdentifier()) - ->getSingleResult(); - } catch (NoResultException $ex1) { - return null; - } catch (NonUniqueResultException $ex2) { - // should never happen - return null; - } - } - - /** - * @param Summit $summit - * @return int[] - */ - public function getScheduledEventsIds(Summit $summit) - { - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'member_id' => $this->getId(), - 'summit_id' => $summit->getId(), - ] - ); - return $stmt->fetchAll(\PDO::FETCH_COLUMN); - } - - /** - * @param int $event_id - * @return null|RSVP - */ - public function getRsvpByEvent($event_id) - { - $builder = $this->createQueryBuilder(); - $rsvp = $builder - ->select('r') - ->from('models\summit\RSVP', 'r') - ->join('r.owner', 'o') - ->join('r.event', 'e') - ->where('o.id = :owner_id and e.id = :event_id') - ->setParameter('owner_id', $this->getId()) - ->setParameter('event_id', intval($event_id)) - ->getQuery()->getResult(); - - return count($rsvp) > 0 ? $rsvp[0] : null; - } - - /** - * @param Summit $summit - * @return null|RSVP[] - */ - public function getRsvpBySummit(Summit $summit) - { - $builder = $this->createQueryBuilder(); - $res = $builder - ->select('r') - ->from('models\summit\RSVP', 'r') - ->join('r.owner', 'o') - ->join('r.event', 'e') - ->join('e.summit', 's') - ->where('o.id = :owner_id and s.id = :summit_id') - ->setParameter('owner_id', $this->getId()) - ->setParameter('summit_id', $summit->getId()) - ->getQuery()->getResult(); - - return $res; - } - - /** - * @param Summit $summit - * @return SummitMemberSchedule[] - */ - public function getScheduleBySummit(Summit $summit) - { - - $query = $this->createQuery("SELECT s from models\main\SummitMemberSchedule s - JOIN s.member m - JOIN s.event e - JOIN e.summit su WHERE su.id = :summit_id and m.id = :member_id "); - - return $query - ->setParameter('member_id', $this->getId()) - ->setParameter('summit_id', $summit->getId()) - ->getResult(); - } - - /** - * @param Summit $summit - * @return SummitMemberFavorite[] - */ - public function getFavoritesSummitEventsBySummit(Summit $summit) - { - $query = $this->createQuery("SELECT f from models\main\SummitMemberFavorite f - JOIN f.member m - JOIN f.event e - JOIN e.summit su WHERE su.id = :summit_id and m.id = :member_id "); - - return $query - ->setParameter('member_id', $this->getId()) - ->setParameter('summit_id', $summit->getId()) - ->getResult(); - } - - /** - * @param Summit $summit - * @return CalendarSyncInfo[] - */ - public function getSyncInfoBy(Summit $summit) - { - try { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('summit', $summit)); - $criteria->andWhere(Criteria::expr()->eq('revoked', 0)); - $res = $this->calendars_sync->matching($criteria)->first(); - return $res == false ? null : $res; - } catch (NoResultException $ex1) { - return null; - } catch (NonUniqueResultException $ex2) { - // should never happen - return null; - } - } - - /** - * @param Summit $summit - * @return bool - */ - public function hasSyncInfoFor(Summit $summit) - { - return !is_null($this->getSyncInfoBy($summit)); - } - - /** - * @param CalendarSyncInfo $calendar_sync_info - */ - public function removeFromCalendarSyncInfo(CalendarSyncInfo $calendar_sync_info) - { - $this->calendars_sync->removeElement($calendar_sync_info); - $calendar_sync_info->clearOwner(); - } - - /** - * @param int $affiliation_id - * @return Affiliation|null - */ - public function getAffiliationById($affiliation_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($affiliation_id))); - - $affiliation = $this->affiliations->matching($criteria)->first(); - - return $affiliation ? $affiliation : null; - } - - /** - * @param Affiliation $affiliation - * @return $this - */ - public function removeAffiliation(Affiliation $affiliation) - { - if ($this->affiliations->contains($affiliation)) { - $this->affiliations->removeElement($affiliation); - $affiliation->clearOwner(); - } - return $this; - } - - /** - * @param Affiliation $affiliation - * @return $this - */ - public function addAffiliation(Affiliation $affiliation) - { - if (!$this->affiliations->contains($affiliation)) { - $this->affiliations->add($affiliation); - $affiliation->setOwner($this); - } - return $this; - } - - /** - * @param int $rsvp_id - * @return RSVP|null - */ - public function getRsvpById($rsvp_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $rsvp_id)); - - $rsvp = $this->rsvp->matching($criteria)->first(); - - return $rsvp ? $rsvp : null; - } - - /** - * @param RSVP $rsvp - * @return $this - */ - public function removeRsvp(RSVP $rsvp) - { - $this->rsvp->removeElement($rsvp); - return $this; - } - - /** - * @return string - */ - public function getFullName() - { - $fullname = $this->first_name; - if (!empty($this->last_name)) { - if (!empty($fullname)) $fullname .= ' '; - $fullname .= $this->last_name; - } - return $fullname; - } - - /** - * @return bool - */ - public function hasPhoto() - { - return $this->getPhotoId() > 0; - } - - /** - * @return int - */ - public function getPhotoId() - { - try { - if (is_null($this->photo)) return 0; - return $this->photo->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return string|null - */ - public function getProfilePhotoUrl(): ?string - { - $photoUrl = null; - - if(!empty($this->external_pic)){ - return $this->external_pic; - } - - if ($this->hasPhoto() && $photo = $this->getPhoto()) { - $photoUrl = $photo->getUrl(); - } - - if (empty($photo_url) && !empty($this->getTwitterHandle())) { - $twitterName = $this->getTwitterHandle(); - $photoUrl = sprintf("https://avatars.io/twitter/%s", trim(trim($twitterName, '@'))); - } - - if (empty($photoUrl)) { - // get gravatar by default - $photoUrl = $this->getGravatarUrl(); - } - - return $photoUrl; - } - - /** - * Get either a Gravatar URL or complete image tag for a specified email address. - */ - private function getGravatarUrl(): string - { - $url = 'https://www.gravatar.com/avatar/'; - $url .= md5(strtolower(trim($this->email))); - return $url; - } - - /** - * @param SummitRoomReservation $reservation - * @return $this - */ - public function addReservation(SummitRoomReservation $reservation) - { - if ($this->reservations->contains($reservation)) return $this; - $this->reservations->add($reservation); - $reservation->setOwner($this); - return $this; - } - - /** - * @return ArrayCollection - */ - public function getReservations() - { - return $this->reservations; - } - - /** - * @param Summit $summit - * @return int - * @throws NoResultException - * @throws NonUniqueResultException - */ - public function getReservationsCountBySummit(Summit $summit): int - { - $query = $this->createQuery("SELECT count(rv.id) from models\summit\SummitRoomReservation rv - JOIN rv.owner o - JOIN rv.room r - JOIN r.venue v - JOIN v.summit s - WHERE s.id = :summit_id AND o.id = :owner_id and rv.status not in (:status)"); - return $query - ->setParameter('summit_id', $summit->getId()) - ->setParameter('owner_id', $this->getId()) - ->setParameter('status', [ - SummitRoomReservation::RequestedRefundStatus, - SummitRoomReservation::RefundedStatus, - SummitRoomReservation::Canceled - ]) - ->getSingleScalarResult(); - } - - /** - * @param Summit $summit - * @return SummitRoomReservation[] - * @throws NoResultException - * @throws NonUniqueResultException - */ - public function getReservationsBySummit(Summit $summit) - { - $query = $this->createQuery("SELECT rv from models\summit\SummitRoomReservation rv - JOIN rv.owner o - JOIN rv.room r - JOIN r.venue v - JOIN v.summit s - WHERE s.id = :summit_id AND o.id = :owner_id"); - return $query - ->setParameter('summit_id', $summit->getId()) - ->setParameter('owner_id', $this->getId()) - ->getResult(); - } - - /** - * @param int $reservation_id - * @return SummitRoomReservation - */ - public function getReservationById(int $reservation_id): ?SummitRoomReservation - { - $criteria = Criteria::create() - ->where(Criteria::expr()->eq("id", $reservation_id)); - - return $this->reservations->matching($criteria)->first(); - } - - /** - * @param string|null $first_name - */ - public function setFirstName(?string $first_name): void - { - $this->first_name = $first_name; - } - - /** - * @param string|null $bio - */ - public function setBio(?string $bio): void - { - $this->bio = $bio; - } - - /** - * @param string|null $last_name - */ - public function setLastName(?string $last_name): void - { - $this->last_name = $last_name; - } - - /** - * @return bool - */ - public function hasSpeaker() - { - return $this->getSpeakerId() > 0; - } - - /** - * @return PresentationSpeaker|null - */ - public function getSpeaker(): ?PresentationSpeaker - { - return $this->speaker; - } - - /** - * @return int - */ - public function getSpeakerId() - { - try { - if (is_null($this->speaker)) return 0; - return $this->speaker->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - public function setSpeaker(PresentationSpeaker $speaker) - { - $this->speaker = $speaker; - } - - public function clearSpeaker() - { - $this->speaker = null; - } - - /** - * @return int|null - */ - public function getUserExternalId(): ?int - { - return $this->user_external_id; - } - - /** - * @param int $user_external_id - */ - public function setUserExternalId(int $user_external_id): void - { - $this->user_external_id = $user_external_id; - } - - /** - * @return Sponsor[] - */ - public function getSponsorMemberships() - { - return $this->sponsor_memberships; - } - - /** - * @return ArrayCollection|SummitOrder[] - */ - public function getSummitRegistrationOrders() - { - return $this->summit_registration_orders; - } - - /** - * @param int $order_id - * @return SummitOrder|null - */ - public function getSummitRegistrationOrderById(int $order_id): ?SummitOrder - { - $criteria = Criteria::create() - ->where(Criteria::expr()->eq("id", $order_id)); - $order = $this->summit_registration_orders->matching($criteria)->first(); - - return $order === false ? null : $order; - } - - /** - * @param SummitOrder $summit_order - */ - public function addSummitRegistrationOrder(SummitOrder $summit_order) - { - if ($this->summit_registration_orders->contains($summit_order)) return; - $this->summit_registration_orders->add($summit_order); - $summit_order->setOwner($this); - } - - /** - * @param Summit $summit - * @return Sponsor|null - */ - public function getSponsorBySummit(Summit $summit): ?Sponsor - { - $sponsor = $this->sponsor_memberships->filter(function ($entity) use ($summit) { - return $entity->getSummitId() == $summit->getId(); - })->first(); - - return $sponsor === false ? null : $sponsor; - } - - /** - * @return string|null - */ - public function getMembershipType(): ?string - { - return $this->membership_type; - } - - /** - * @param Group $group - */ - public function add2Group(Group $group) - { - if ($this->groups->contains($group)) return; - $this->groups->add($group); - //$group->addMember($this); - } - - public function removeFromGroup(Group $group) - { - if (!$this->groups->contains($group)) return; - $this->groups->removeElement($group); - //$group->removeMember($this); - } - - /** - * @param PersonalCalendarShareInfo $link - */ - public function addScheduleShareableLink(PersonalCalendarShareInfo $link) - { - if ($this->schedule_shareable_links->contains($link)) return; - $this->schedule_shareable_links->add($link); - $link->setOwner($this); - } - - /** - * @param PersonalCalendarShareInfo $link - */ - public function removeScheduleShareableLink(PersonalCalendarShareInfo $link) - { - if (!$this->schedule_shareable_links->contains($link)) return; - $this->schedule_shareable_links->removeElement($link); - $link->clearOwner(); - } - - /** - * @param Summit $summit - * @return PersonalCalendarShareInfo|null - */ - public function getScheduleShareableLinkBy(Summit $summit): ?PersonalCalendarShareInfo - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('summit', $summit)); - $criteria->andWhere(Criteria::expr()->eq('revoked', false)); - $link = $this->schedule_shareable_links->matching($criteria)->first(); - return $link === false ? null : $link; - } - - /** - * @param Summit $summit - * @return PersonalCalendarShareInfo|null - * @throws \Exception - */ - public function createScheduleShareableLink(Summit $summit): ?PersonalCalendarShareInfo - { - $former_link = $this->getScheduleShareableLinkBy($summit); - - if (!is_null($former_link)) { - return $former_link; - } - - $link = new PersonalCalendarShareInfo(); - $summit->addScheduleShareableLink($link); - $this->addScheduleShareableLink($link); - $link->generateCid(); - return $link; - } - - /** - * @param SummitAdministratorPermissionGroup $group - */ - public function add2SummitAdministratorPermissionGroup(SummitAdministratorPermissionGroup $group) - { - if ($this->summit_permission_groups->contains($group)) return; - $this->summit_permission_groups->add($group); - } - - public function removeFromSummitAdministratorPermissionGroup(SummitAdministratorPermissionGroup $group) - { - if (!$this->summit_permission_groups->contains($group)) return; - $this->summit_permission_groups->removeElement($group); - } - - public function getSummitAdministratorPermissionGroup() - { - return $this->summit_permission_groups; - } - - /** - * @return array - */ - public function getAllAllowedSummitsIds(): array - { - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'member_id' => $this->getId(), - ] - ); - return $stmt->fetchAll(\PDO::FETCH_COLUMN); - } - - /** - * @return bool - */ - public function hasAllowedSummits():bool{ - return count($this->getAllAllowedSummitsIds()) > 0; - } - - /** - * @param Summit $summit - * @return bool - */ - public function hasPaidTicketOnSummit(Summit $summit): bool - { - return count($this->getPaidSummitTicketsIds($summit)) > 0; - } - - /** - * @param Summit $summit - * @param string $groupSlug - * @return bool - */ - public function hasPermissionForOnGroup(Summit $summit, string $groupSlug): bool - { - if(!SummitAdministratorPermissionGroup::isValidGroup($groupSlug)) return false; - - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'member_id' => $this->getId(), - 'summit_id' => $summit->getId() - ] - ); - $allowed_summits = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($allowed_summits) > 0 && $this->isOnGroup($groupSlug); - } - - /** - * @param Summit $summit - * @return bool - */ - public function hasPermissionFor(Summit $summit): bool - { - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'member_id' => $this->getId(), - 'summit_id' => $summit->getId() - ] - ); - $allowed_summits = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($allowed_summits) > 0; - } - - /** - * @param Summit $summit - * @return int[] - */ - public function getPaidSummitTicketsIds(Summit $summit) - { - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'member_id' => $this->getId(), - 'member_email' => $this->email, - 'ticket_status' => IOrderConstants::PaidStatus, - 'summit_id' => $summit->getId(), - ] - ); - return $stmt->fetchAll(\PDO::FETCH_COLUMN); - } - - /** - * @param Summit $summit - * @return bool - */ - public function hasSummitAccess(Summit $summit):bool{ - return count($this->getPaidSummitTicketsIds($summit)) > 0; - } - - /** - * @param Summit $summit - * @return SummitAttendeeTicket[] - */ - public function getPaidSummitTickets(Summit $summit) - { - return $this->getPaidSummitTicketsBySummitId($summit->getId()); - } - - /** - * @param Summit $summit - * @return SummitAttendeeTicket[] - */ - public function getPaidSummitTicketsBySummitId(int $summit_id) - { - - $query = $this->createQuery("SELECT t from models\summit\SummitAttendeeTicket t - JOIN t.owner o - LEFT JOIN o.member m - JOIN o.summit su - WHERE su.id = :summit_id - and ( m.id = :member_id or o.email = :member_email) - and t.status = :ticket_status and t.is_active = :active"); - - return $query - ->setParameter('member_id', $this->getId()) - ->setParameter('member_email', $this->email) - ->setParameter('ticket_status', IOrderConstants::PaidStatus) - ->setParameter('summit_id', $summit_id) - ->setParameter('active', true) - ->getResult(); - } - - /** - * @return string - */ - public function getExternalPic(): ?string - { - return $this->external_pic; - } - - /** - * @param string $external_pic - */ - public function setExternalPic(string $external_pic): void - { - $this->external_pic = $external_pic; - } - - - public function resignFoundationMembership(){ - // Remove member from Foundation group - foreach ($this->groups as $g) { - if ($g->getCode() === IGroup::FoundationMembers) { - $this->removeFromGroup($g); - break; - } - } - - // Remove Member's Legal Agreements - $this->legal_agreements->clear(); - $this->membership_type = self::MembershipTypeCommunity; - $this->resign_date = new \DateTime('now', new \DateTimeZone(self::DefaultTimeZone)); - } - - public function resignMembership(){ - // Remove Member's Legal Agreements - $this->legal_agreements->clear(); - $this->affiliations->clear(); - $this->groups->clear(); - $this->membership_type = self::MembershipTypeNone; - $this->resign_date = new \DateTime('now', new \DateTimeZone(self::DefaultTimeZone)); - } - - public function signFoundationMembership(LegalDocument $document) - { - if (!$this->isFoundationMember()) { - // Set up member with legal agreement for becoming an OpenStack Foundation Member - $legalAgreement = new LegalAgreement(); - $legalAgreement->setOwner($this); - $legalAgreement->setDocument($document); - $this->legal_agreements->add($legalAgreement); - $this->membership_type = self::MembershipTypeFoundation; - $this->resign_date = null; - } - } - - public function isFoundationMember() - { - return $this->belongsToGroup(IGroup::FoundationMembers) && $this->legal_agreements->count() > 0; - } - - /** - * @param SummitTrackChair $trackChair - */ - public function addTrackChair(SummitTrackChair $trackChair){ - if($this->track_chairs->contains($trackChair)) return; - $this->track_chairs->add($trackChair); - $trackChair->setMember($this); - } - - /** - * @param SummitTrackChair $trackChair - */ - public function removeTrackChair(SummitTrackChair $trackChair){ - if(!$this->track_chairs->contains($trackChair)) return; - $this->track_chairs->removeElement($trackChair); - $trackChair->clearMember(); - } - - /** - * @return ArrayCollection|SummitTrackChair[] - */ - public function getTrackChairs(){ - return $this->track_chairs; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/OrderableChilds.php b/app/Models/Foundation/Main/OrderableChilds.php deleted file mode 100644 index bbf4a4b1..00000000 --- a/app/Models/Foundation/Main/OrderableChilds.php +++ /dev/null @@ -1,71 +0,0 @@ -getId() == $entity->getId()) break; - $former_order++; - } - - $collection = array_slice($collection,0, count($collection), false); - $max_order = count($collection); - - if($new_order > $max_order) - throw new ValidationException(sprintf("max order is %s", $max_order)); - - unset($collection[$former_order - 1]); - - $collection = array_merge - ( - array_slice($collection, 0, $new_order-1 , true) , - [$entity] , - array_slice($collection, $new_order -1 , count($collection), true) - ); - - $order = 1; - foreach($collection as $e){ - $e->setOrder($order); - $order++; - } - } - /** - * @param Selectable $collection - * @param IOrderable $element - * @param $new_order - * @throws ValidationException - */ - private static function recalculateOrderForSelectable(Selectable $collection, IOrderable $element, $new_order){ - $criteria = Criteria::create(); - $criteria->orderBy(['order'=> 'ASC']); - - self::recalculateOrderForCollection( $collection->matching($criteria)->toArray(), $element, $new_order); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Organization.php b/app/Models/Foundation/Main/Organization.php deleted file mode 100644 index b9182284..00000000 --- a/app/Models/Foundation/Main/Organization.php +++ /dev/null @@ -1,44 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - /** - * @ORM\Column(name="Name", type="string") - * @var string - */ - private $name; -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/PersonalCalendarShareInfo.php b/app/Models/Foundation/Main/PersonalCalendarShareInfo.php deleted file mode 100644 index 2410d0c9..00000000 --- a/app/Models/Foundation/Main/PersonalCalendarShareInfo.php +++ /dev/null @@ -1,129 +0,0 @@ -revoked = false; - } - - /** - * @return int - */ - public function getOwnerId(){ - try { - return is_null($this->owner) ? 0 : $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return string - * @throws \Exception - */ - public function generateCid():string{ - $this->cid = md5(strval($this->getOwnerId()).strval($this->getSummitId()).random_bytes(8)); - return $this->cid; - } - - /** - * @return string - */ - public function getCid(): string - { - return $this->cid; - } - - /** - * @return bool - */ - public function isRevoked(): bool - { - return $this->revoked; - } - - public function revoke(): void - { - $this->revoked = true; - } - - /** - * @return Member - */ - public function getOwner(): Member - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner(Member $owner): void - { - $this->owner = $owner; - } - - public function clearOwner(){ - $this->owner = null; - } - - /** - * @return string|null - */ - public function getLink():?string{ - if($this->isRevoked()) return null; - return action('OAuth2SummitMembersApiController@getCalendarFeedICS', ['id' => $this->getSummitId(), 'cid' => $this->cid]); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/PushNotificationMessage.php b/app/Models/Foundation/Main/PushNotificationMessage.php deleted file mode 100644 index abcdaa2f..00000000 --- a/app/Models/Foundation/Main/PushNotificationMessage.php +++ /dev/null @@ -1,305 +0,0 @@ -is_sent = false; - $this->approved = false; - $this->priority = self::PriorityNormal; - } - - /** - * @ORM\Column(name="Message", type="string") - * @var string - */ - protected $message; - - /** - * @ORM\Column(name="Priority", type="string") - * @var string - */ - protected $priority; - - /** - * @ORM\Column(name="SentDate", type="datetime") - * @var \DateTime - */ - protected $sent_date; - - /** - * @ORM\Column(name="IsSent", type="boolean") - * @var bool - */ - protected $is_sent; - - /** - * @ORM\Column(name="Approved", type="boolean") - * @var bool - */ - protected $approved; - - /** - * @ORM\Column(name="Platform", type="string") - * @var bool - */ - protected $platform; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID") - * @var Member - */ - protected $owner; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="ApprovedByID", referencedColumnName="ID") - * @var Member - */ - protected $approved_by; - - /** - * @return int - */ - public function getOwnerId(){ - try{ - return is_null($this->owner) ? 0 : $this->owner->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getApprovedById(){ - try{ - return is_null($this->approved_by) ? 0 : $this->approved_by->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * @return $this - */ - public function markSent(){ - $this->is_sent = true; - $now = new \DateTime('now', new \DateTimeZone(SilverstripeBaseModel::DefaultTimeZone)); - $this->sent_date = $now; - return $this; - } - - /** - * @param string $message - */ - public function setMessage($message) - { - $this->message = $message; - } - - /** - * @return \DateTime - */ - public function getSentDate() - { - return $this->sent_date; - } - - /** - * @return \DateTime|null - */ - public function getSentDateUTC(){ - return $this->getDateFromLocalToUTC($this->sent_date); - } - - /** - * @param \DateTime $sent_date - */ - public function setSentDate($sent_date) - { - $this->sent_date = $sent_date; - } - - /** - * @return boolean - */ - public function isSent() - { - return $this->is_sent; - } - - /** - * @return boolean - */ - public function getIsSent() - { - return $this->isSent(); - } - - /** - * @param boolean $is_sent - */ - public function setIsSent($is_sent) - { - $this->is_sent = $is_sent; - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @return bool - */ - public function hasOwner(){ - return $this->getOwnerId() > 0; - } - - /** - * @param Member $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @param Member|null $approved_by - * @return $this - */ - public function approve(Member $approved_by = null){ - $this->approved = true; - $this->approved_by = $approved_by; - return $this; - } - - /** - * @return $this - */ - public function unApprove(){ - $this->approved = false; - $this->approved_by = null; - return $this; - } - - /** - * @return string - */ - public function getPriority() - { - return $this->priority; - } - - /** - * @param string $priority - */ - public function setPriority($priority) - { - $this->priority = $priority; - } - - /** - * @return bool - */ - public function isApproved() - { - return $this->approved; - } - - /** - * @param bool $approved - */ - public function setApproved($approved) - { - $this->approved = $approved; - } - - /** - * @return string - */ - public function getPlatform() - { - return $this->platform; - } - - /** - * @param string $platform - */ - public function setPlatform($platform) - { - $this->platform = $platform; - } - - /** - * @return Member - */ - public function getApprovedBy() - { - return $this->approved_by; - } - - /** - * @return bool - */ - public function hasApprovedBy(){ - return $this->getApprovedById() > 0; - } - - /** - * @param Member $approved_by - */ - public function setApprovedBy($approved_by) - { - $this->approved_by = $approved_by; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/PushNotificationMessagePriority.php b/app/Models/Foundation/Main/PushNotificationMessagePriority.php deleted file mode 100644 index 1ba6affd..00000000 --- a/app/Models/Foundation/Main/PushNotificationMessagePriority.php +++ /dev/null @@ -1,23 +0,0 @@ -members = new ArrayCollection(); - $this->summits = new ArrayCollection(); - } - - /** - * @ORM\ManyToMany(targetEntity="models\main\Member", inversedBy="summit_permission_groups") - * @ORM\JoinTable(name="SummitAdministratorPermissionGroup_Members", - * joinColumns={@ORM\JoinColumn(name="SummitAdministratorPermissionGroupID", referencedColumnName="ID")}, - * inverseJoinColumns={@ORM\JoinColumn(name="MemberID", referencedColumnName="ID")} - * ) - * @var Member[] - */ - private $members; - - /** - * @ORM\ManyToMany(targetEntity="models\summit\Summit", inversedBy="permission_groups") - * @ORM\JoinTable(name="SummitAdministratorPermissionGroup_Summits", - * joinColumns={@ORM\JoinColumn(name="SummitAdministratorPermissionGroupID", referencedColumnName="ID")}, - * inverseJoinColumns={@ORM\JoinColumn(name="SummitID", referencedColumnName="ID")} - * ) - * @var Summit[] - */ - private $summits; - - /** - * @param Member $member - * @throws ValidationException - */ - public function addMember(Member $member) - { - if(!$this->canAddMember($member)){ - throw new ValidationException(sprintf("Member %s should belong to following groups (%s)", $member->getId(), - implode(",", self::ValidGroups))); - } - - if ($this->members->contains($member)) return; - $this->members->add($member); - $member->add2SummitAdministratorPermissionGroup($this); - } - - public function canAddMember(Member $member):bool{ - foreach (self::ValidGroups as $slug){ - if($member->isOnGroup($slug, true)) return true; - } - return false; - } - - /** - * @param Member $member - */ - public function removeMember(Member $member) - { - if (!$this->members->contains($member)) return; - $this->members->removeElement($member); - $member->removeFromSummitAdministratorPermissionGroup($this); - } - - public function getMembers() - { - return $this->members; - } - - public function getMembersIds(): array - { - - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'group_id' => $this->getId(), - ] - ); - return $stmt->fetchAll(\PDO::FETCH_COLUMN); - - } - - /** - * @param Summit $summit - */ - public function addSummit(Summit $summit) - { - if ($this->summits->contains($summit)) return; - $this->summits->add($summit); - $summit->add2SummitAdministratorPermissionGroup($this); - } - - public function removeSummit(Summit $summit) - { - if (!$this->summits->contains($summit)) return; - $this->summits->removeElement($summit); - $summit->removeFromSummitAdministratorPermissionGroup($this); - } - - public function getSummits() - { - return $this->summits; - } - - public function getSummitsIds(): array - { - - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'group_id' => $this->getId(), - ] - ); - return $stmt->fetchAll(\PDO::FETCH_COLUMN); - - } - - /** - * @return string - */ - public function getTitle(): string - { - return $this->title; - } - - /** - * @param string $title - */ - public function setTitle(string $title): void - { - $this->title = $title; - } - - public function clearMembers(){ - $this->members->clear(); - } - - public function clearSummits(){ - $this->summits->clear(); - } - - /** - * @param string $groupSlug - * @return bool - */ - public static function isValidGroup(string $groupSlug):bool { - return in_array($groupSlug,self::ValidGroups); - } - - /** - * @param Member $member - * @return bool - */ - public function hasMember(Member $member):bool{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $member->getId())); - return $this->members->matching($criteria)->count() > 0; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/SummitMemberFavorite.php b/app/Models/Foundation/Main/SummitMemberFavorite.php deleted file mode 100644 index eb688faa..00000000 --- a/app/Models/Foundation/Main/SummitMemberFavorite.php +++ /dev/null @@ -1,77 +0,0 @@ -member; - } - - /** - * @param Member $member - */ - public function setMember($member) - { - $this->member = $member; - } - - - public function clearOwner(){ - $this->member = null; - $this->event = null; - } - - /** - * @return SummitEvent - */ - public function getEvent() - { - return $this->event; - } - - /** - * @param SummitEvent $event - */ - public function setEvent($event) - { - $this->event = $event; - } - - /** - * @ORM\ManyToOne(targetEntity="Member", inversedBy="favorites") - * @ORM\JoinColumn(name="MemberID", referencedColumnName="ID", onDelete="CASCADE") - * @var Member - */ - private $member; - - /** - * @ORM\ManyToOne(targetEntity="models\summit\SummitEvent") - * @ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID", onDelete="CASCADE") - * @var SummitEvent - */ - private $event; -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/SummitMemberSchedule.php b/app/Models/Foundation/Main/SummitMemberSchedule.php deleted file mode 100644 index 1855d6b2..00000000 --- a/app/Models/Foundation/Main/SummitMemberSchedule.php +++ /dev/null @@ -1,78 +0,0 @@ -member; - } - - /** - * @param Member $member - */ - public function setMember($member) - { - $this->member = $member; - } - - - public function clearOwner(){ - $this->member = null; - $this->event = null; - } - - /** - * @return SummitEvent - */ - public function getEvent() - { - return $this->event; - } - - /** - * @param SummitEvent $event - */ - public function setEvent($event) - { - $this->event = $event; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Main/Tag.php b/app/Models/Foundation/Main/Tag.php deleted file mode 100644 index 82a6589f..00000000 --- a/app/Models/Foundation/Main/Tag.php +++ /dev/null @@ -1,69 +0,0 @@ -tag; - } - - /** - * @param string $tag - */ - public function setTag($tag) - { - $this->tag = $tag; - } - - /** - * Tag constructor. - * @param string $tag - */ - public function __construct($tag) - { - parent::__construct(); - $this->tag = $tag; - $this->events = new ArrayCollection(); - } - - public function getEvents(){ - return $this->events; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/Appliance.php b/app/Models/Foundation/Marketplace/Appliance.php deleted file mode 100644 index 44830dc1..00000000 --- a/app/Models/Foundation/Marketplace/Appliance.php +++ /dev/null @@ -1,24 +0,0 @@ -data_centers = new ArrayCollection(); - $this->capabilities_offered = new ArrayCollection(); - $this->data_center_regions = new ArrayCollection(); - } - - /** - * @return DataCenterLocation[] - */ - public function getDataCenters() - { - return $this->data_centers->toArray(); - } - - /** - * @return DataCenterRegion[] - */ - public function getDataCenterRegions() - { - return $this->data_center_regions->toArray(); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/CloudServiceOffered.php b/app/Models/Foundation/Marketplace/CloudServiceOffered.php deleted file mode 100644 index 88271c1b..00000000 --- a/app/Models/Foundation/Marketplace/CloudServiceOffered.php +++ /dev/null @@ -1,61 +0,0 @@ -type; - } - - public function __construct() - { - parent::__construct(); - $this->pricing_schemas = new ArrayCollection(); - } - - /** - * @return PricingSchemaType[] - */ - public function getPricingSchemas() - { - return $this->pricing_schemas->toArray(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/CompanyService.php b/app/Models/Foundation/Marketplace/CompanyService.php deleted file mode 100644 index 765dd4ce..00000000 --- a/app/Models/Foundation/Marketplace/CompanyService.php +++ /dev/null @@ -1,230 +0,0 @@ -reviews = new ArrayCollection(); - $this->videos = new ArrayCollection(); - $this->resources = new ArrayCollection(); - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @return string - */ - public function getSlug() - { - return $this->slug; - } - - /** - * @return string - */ - public function getOverview() - { - return $this->overview; - } - - /** - * @return bool - */ - public function isActive() - { - return $this->is_active; - } - - /** - * @return Company - */ - public function getCompany() - { - return $this->company; - } - - /** - * @return Company - */ - public function getType() - { - return $this->type; - } - - /** - * @return int - */ - public function getCompanyId() - { - try { - return !is_null($this->company)? $this->company->getId():0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getTypeId() - { - try { - return !is_null($this->type)? $this->type->getId():0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return MarketPlaceReview[] - */ - public function getApprovedReviews(){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('is_approved', true)); - return $this->reviews->matching($criteria)->toArray(); - } - - /** - * @return string - */ - public function getCall2ActionUrl() - { - return $this->call_2_action_url; - } - - /** - * @return MarketPlaceReview[] - */ - public function getReviews() - { - return $this->reviews->toArray(); - } - - /** - * @return MarketPlaceVideo[] - */ - public function getVideos() - { - return $this->videos->toArray(); - } - - /** - * @return CompanyServiceResource[] - */ - public function getResources() - { - return $this->resources->toArray(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/CompanyServiceResource.php b/app/Models/Foundation/Marketplace/CompanyServiceResource.php deleted file mode 100644 index 18e9f7ba..00000000 --- a/app/Models/Foundation/Marketplace/CompanyServiceResource.php +++ /dev/null @@ -1,81 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getUri() - { - return $this->uri; - } - - /** - * @return int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @return CompanyService - */ - public function getCompanyService() - { - return $this->company_service; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/ConfigurationManagementType.php b/app/Models/Foundation/Marketplace/ConfigurationManagementType.php deleted file mode 100644 index cc55bfcd..00000000 --- a/app/Models/Foundation/Marketplace/ConfigurationManagementType.php +++ /dev/null @@ -1,37 +0,0 @@ -type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/Consultant.php b/app/Models/Foundation/Marketplace/Consultant.php deleted file mode 100644 index 18308e99..00000000 --- a/app/Models/Foundation/Marketplace/Consultant.php +++ /dev/null @@ -1,132 +0,0 @@ -offices = new ArrayCollection(); - $this->clients = new ArrayCollection(); - $this->spoken_languages = new ArrayCollection(); - $this->configuration_management_expertises = new ArrayCollection(); - $this->expertise_areas = new ArrayCollection(); - $this->services_offered = new ArrayCollection(); - } - - /** - * @return Office[] - */ - public function getOffices() - { - return $this->offices->toArray(); - } - - /** - * @return ConsultantClient[] - */ - public function getClients(){ - return $this->clients->toArray(); - } - - /** - * @return SpokenLanguage[] - */ - public function getSpokenLanguages() - { - return $this->spoken_languages->toArray(); - } - - /** - * @return ConfigurationManagementType[] - */ - public function getConfigurationManagementExpertise() - { - return $this->configuration_management_expertise->toArray(); - } - - /** - * @return OpenStackComponent[] - */ - public function getExpertiseAreas() - { - return $this->expertise_areas->toArray(); - } - - /** - * @return ConsultantServiceOfferedType[] - */ - public function getServicesOffered() - { - return $this->services_offered->toArray(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/ConsultantClient.php b/app/Models/Foundation/Marketplace/ConsultantClient.php deleted file mode 100644 index 1836f9f2..00000000 --- a/app/Models/Foundation/Marketplace/ConsultantClient.php +++ /dev/null @@ -1,66 +0,0 @@ -name; - } - - /** - * @return int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @return Consultant - */ - public function getConsultant() - { - return $this->consultant; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/ConsultantServiceOfferedType.php b/app/Models/Foundation/Marketplace/ConsultantServiceOfferedType.php deleted file mode 100644 index b979233c..00000000 --- a/app/Models/Foundation/Marketplace/ConsultantServiceOfferedType.php +++ /dev/null @@ -1,68 +0,0 @@ -consultant; - } - - /** - * @return ServiceOfferedType - */ - public function getServiceOffered() - { - return $this->service_offered; - } - - /** - * @return Region - */ - public function getRegion() - { - return $this->region; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/DataCenterLocation.php b/app/Models/Foundation/Marketplace/DataCenterLocation.php deleted file mode 100644 index 323d32f0..00000000 --- a/app/Models/Foundation/Marketplace/DataCenterLocation.php +++ /dev/null @@ -1,136 +0,0 @@ -city; - } - - /** - * @return string - */ - public function getState() - { - return $this->state; - } - - /** - * @return string - */ - public function getCountry() - { - return $this->country; - } - - /** - * @return float - */ - public function getLat() - { - return $this->lat; - } - - /** - * @return float - */ - public function getLng() - { - return $this->lng; - } - - /** - * @return CloudService - */ - public function getCloudService() - { - return $this->cloud_service; - } - - /** - * @return DataCenterRegion - */ - public function getRegion() - { - return $this->region; - } - - /** - * @return int - */ - public function getRegionId(){ - try{ - return !is_null($this->region) ? $this->region->getId(): 0; - } - catch (\Exception $ex){ - return 0; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/DataCenterRegion.php b/app/Models/Foundation/Marketplace/DataCenterRegion.php deleted file mode 100644 index 86dc0dde..00000000 --- a/app/Models/Foundation/Marketplace/DataCenterRegion.php +++ /dev/null @@ -1,101 +0,0 @@ -locations = new ArrayCollection(); - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @return string - */ - public function getEndpoint() - { - return $this->endpoint; - } - - /** - * @return string - */ - public function getColor() - { - return $this->color; - } - - /** - * @return DataCenterLocation[] - */ - public function getLocations() - { - return $this->locations->toArray(); - } - - /** - * @return CloudService - */ - public function getCloudService() - { - return $this->cloud_service; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/Distribution.php b/app/Models/Foundation/Marketplace/Distribution.php deleted file mode 100644 index 58a0c2cc..00000000 --- a/app/Models/Foundation/Marketplace/Distribution.php +++ /dev/null @@ -1,24 +0,0 @@ -type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/HyperVisorType.php b/app/Models/Foundation/Marketplace/HyperVisorType.php deleted file mode 100644 index 4a97d409..00000000 --- a/app/Models/Foundation/Marketplace/HyperVisorType.php +++ /dev/null @@ -1,37 +0,0 @@ -type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/IApplianceRepository.php b/app/Models/Foundation/Marketplace/IApplianceRepository.php deleted file mode 100644 index ede3ef52..00000000 --- a/app/Models/Foundation/Marketplace/IApplianceRepository.php +++ /dev/null @@ -1,23 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getDescripion() - { - return $this->descripion; - } - - /** - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * @return InteropCapabilityType - */ - public function getType() - { - return $this->type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/InteropCapabilityType.php b/app/Models/Foundation/Marketplace/InteropCapabilityType.php deleted file mode 100644 index 9b7018fc..00000000 --- a/app/Models/Foundation/Marketplace/InteropCapabilityType.php +++ /dev/null @@ -1,38 +0,0 @@ -name; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/InteropDesignatedSection.php b/app/Models/Foundation/Marketplace/InteropDesignatedSection.php deleted file mode 100644 index d143ffa6..00000000 --- a/app/Models/Foundation/Marketplace/InteropDesignatedSection.php +++ /dev/null @@ -1,80 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * @return string - */ - public function getGuidance() - { - return $this->guidance; - } - - /** - * @return string - */ - public function getComment() - { - return $this->comment; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/InteropProgramVersion.php b/app/Models/Foundation/Marketplace/InteropProgramVersion.php deleted file mode 100644 index b4e0b0f5..00000000 --- a/app/Models/Foundation/Marketplace/InteropProgramVersion.php +++ /dev/null @@ -1,68 +0,0 @@ -capabilities = new ArrayCollection(); - $this->designated_sections = new ArrayCollection(); - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/MarketPlaceReview.php b/app/Models/Foundation/Marketplace/MarketPlaceReview.php deleted file mode 100644 index 26f7cd75..00000000 --- a/app/Models/Foundation/Marketplace/MarketPlaceReview.php +++ /dev/null @@ -1,96 +0,0 @@ -title; - } - - /** - * @return string - */ - public function getComment() - { - return $this->comment; - } - - /** - * @return string - */ - public function getRating() - { - return $this->rating; - } - - /** - * @return bool - */ - public function isApproved() - { - return $this->is_approved; - } - - /** - * @return CompanyService - */ - public function getCompanyService() - { - return $this->company_service; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/MarketPlaceType.php b/app/Models/Foundation/Marketplace/MarketPlaceType.php deleted file mode 100644 index 0138b84e..00000000 --- a/app/Models/Foundation/Marketplace/MarketPlaceType.php +++ /dev/null @@ -1,66 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getSlug() - { - return $this->slug; - } - - /** - * @return bool - */ - public function isActive() - { - return $this->is_active; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/MarketPlaceVideo.php b/app/Models/Foundation/Marketplace/MarketPlaceVideo.php deleted file mode 100644 index f3d29a9a..00000000 --- a/app/Models/Foundation/Marketplace/MarketPlaceVideo.php +++ /dev/null @@ -1,95 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @return string - */ - public function getYoutubeId() - { - return $this->youtube_id; - } - - /** - * @return MarketPlaceVideoType - */ - public function getType() - { - return $this->type; - } - - /** - * @return CompanyService - */ - public function getCompanyService() - { - return $this->company_service; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/MarketPlaceVideoType.php b/app/Models/Foundation/Marketplace/MarketPlaceVideoType.php deleted file mode 100644 index b39b39ce..00000000 --- a/app/Models/Foundation/Marketplace/MarketPlaceVideoType.php +++ /dev/null @@ -1,37 +0,0 @@ -type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/Office.php b/app/Models/Foundation/Marketplace/Office.php deleted file mode 100644 index a9a17b56..00000000 --- a/app/Models/Foundation/Marketplace/Office.php +++ /dev/null @@ -1,151 +0,0 @@ -address; - } - - /** - * @return string - */ - public function getAddress2() - { - return $this->address2; - } - - /** - * @return string - */ - public function getState() - { - return $this->state; - } - - /** - * @return string - */ - public function getZipCode() - { - return $this->zip_code; - } - - /** - * @return string - */ - public function getCity() - { - return $this->city; - } - - /** - * @return string - */ - public function getCountry() - { - return $this->country; - } - - /** - * @return float - */ - public function getLat() - { - return $this->lat; - } - - /** - * @return float - */ - public function getLng() - { - return $this->lng; - } - - /** - * @return Consultant - */ - public function getConsultant() - { - return $this->consultant; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/OpenStackImplementation.php b/app/Models/Foundation/Marketplace/OpenStackImplementation.php deleted file mode 100644 index ff2c352a..00000000 --- a/app/Models/Foundation/Marketplace/OpenStackImplementation.php +++ /dev/null @@ -1,247 +0,0 @@ -hypervisors = new ArrayCollection(); - $this->guests = new ArrayCollection(); - $this->capabilities = new ArrayCollection(); - } - - /** - * @return bool - */ - public function isCompatibleWithStorage() - { - return $this->is_compatible_with_storage; - } - - /** - * @return bool - */ - public function isCompatibleWithCompute() - { - return $this->is_compatible_with_compute; - } - - /** - * @return bool - */ - public function isCompatibleWithFederatedIdentity() - { - return $this->is_compatible_with_federated_identity; - } - - /*** - * @return bool - */ - public function isCompatibleWithPlatform() - { - return $this->isCompatibleWithStorage() && $this->isCompatibleWithCompute(); - } - - /*** - * @return bool - */ - public function isOpenStackPowered() - { - $storage = $this->isCompatibleWithStorage(); - $compute = $this->isCompatibleWithCompute(); - $platform = $this->isCompatibleWithPlatform(); - return ($storage || $compute || $platform) && !$this->isOpenStackPoweredExpired(); - } - - /** - * @return bool - */ - public function isOpenStackPoweredExpired() - { - $res = false; - if(!$this->expire_date) return $res; - $utc_timezone = new DateTimeZone("UTC"); - $time_zone = new DateTimeZone('America/Chicago'); - $expiry_date = new DateTime($this->expire_date->format(DateTime::ISO8601), $time_zone); - $expiry_date = $expiry_date->setTimezone($utc_timezone); - $utc_now = new DateTime(null, new DateTimeZone("UTC")); - return $utc_now > $expiry_date; - } - - /** - * @return string - */ - public function getTestedCapabilityTypeLabel() - { - if ($this->isCompatibleWithPlatform()) { - return 'Platform'; - } else if ($this->isCompatibleWithCompute()) { - return 'Compute'; - } else if ($this->isCompatibleWithStorage()) { - return 'Storage'; - } - } - - /** - * @return bool - */ - public function isOpenStackTested() - { - try { - $program_version = $this->program_version; - return !is_null($program_version) && $program_version->getId() > 0; - } - catch(\Exception $ex){ - return false; - } - } - - /** - * @return null|string - */ - public function getOpenStackTestedLabel(){ - if(!$this->isOpenStackTested()) return null; - return $this->getTestedCapabilityTypeLabel().' '.$this->program_version->getName(); - } - /** - * @return DateTime - */ - public function getExpireDate() - { - return $this->expire_date; - } - - /** - * @return string - */ - public function getNotes() - { - return $this->notes; - } - - /** - * @return OpenStackImplementationApiCoverage - */ - public function getCapabilities() - { - return $this->capabilities->toArray(); - } - - /** - * @return HyperVisorType[] - */ - public function getHypervisors() - { - return $this->hypervisors->toArray(); - } - - /** - * @return GuestOSType[] - */ - public function getGuests() - { - return $this->guests->toArray(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/OpenStackImplementationApiCoverage.php b/app/Models/Foundation/Marketplace/OpenStackImplementationApiCoverage.php deleted file mode 100644 index dd9a1976..00000000 --- a/app/Models/Foundation/Marketplace/OpenStackImplementationApiCoverage.php +++ /dev/null @@ -1,88 +0,0 @@ -percent; - } - - /** - * @return OpenStackReleaseSupportedApiVersion - */ - public function getReleaseSupportedApiVersion() - { - return $this->release_supported_api_version; - } - - /** - * @return OpenStackImplementation - */ - public function getImplementation() - { - return $this->implementation; - } - - /** - * @return bool - */ - public function hasReleaseSupportedApiVersion(){ - try{ - if(is_null($this->release_supported_api_version)) return false; - return $this->release_supported_api_version->getId() > 0; - } - catch (\Exception $ex){ - return false; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/PricingSchemaType.php b/app/Models/Foundation/Marketplace/PricingSchemaType.php deleted file mode 100644 index 8e2349f8..00000000 --- a/app/Models/Foundation/Marketplace/PricingSchemaType.php +++ /dev/null @@ -1,37 +0,0 @@ -type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/PrivateCloudService.php b/app/Models/Foundation/Marketplace/PrivateCloudService.php deleted file mode 100644 index dfcaf7c8..00000000 --- a/app/Models/Foundation/Marketplace/PrivateCloudService.php +++ /dev/null @@ -1,24 +0,0 @@ -name; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/RegionalSupport.php b/app/Models/Foundation/Marketplace/RegionalSupport.php deleted file mode 100644 index b1be0ead..00000000 --- a/app/Models/Foundation/Marketplace/RegionalSupport.php +++ /dev/null @@ -1,91 +0,0 @@ -supported_channel_types = new ArrayCollection(); - } - - /** - * @return int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @return Region - */ - public function getRegion() - { - return $this->region; - } - - /** - * @return RegionalSupportedCompanyService - */ - public function getCompanyService() - { - return $this->company_service; - } - - /** - * @return SupportChannelType[] - */ - public function getSupportedChannelTypes() - { - return $this->supported_channel_types->toArray(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/RegionalSupportedCompanyService.php b/app/Models/Foundation/Marketplace/RegionalSupportedCompanyService.php deleted file mode 100644 index ad2fd479..00000000 --- a/app/Models/Foundation/Marketplace/RegionalSupportedCompanyService.php +++ /dev/null @@ -1,45 +0,0 @@ -regional_supports = new ArrayCollection(); - } - - /** - * @return RegionalSupport[] - */ - public function getRegionalSupports() - { - return $this->regional_supports->toArray(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/RemoteCloudService.php b/app/Models/Foundation/Marketplace/RemoteCloudService.php deleted file mode 100644 index 4f5f5bbf..00000000 --- a/app/Models/Foundation/Marketplace/RemoteCloudService.php +++ /dev/null @@ -1,78 +0,0 @@ -hardware_spec; - } - - /** - * @return string - */ - public function getPricingModels() - { - return $this->pricing_models; - } - - /** - * @return string - */ - public function getPublishedSla() - { - return $this->published_sla; - } - - /** - * @return bool - */ - public function isVendorManagedUpgrades() - { - return $this->vendor_managed_upgrades; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/ServiceOfferedType.php b/app/Models/Foundation/Marketplace/ServiceOfferedType.php deleted file mode 100644 index fa0b2e53..00000000 --- a/app/Models/Foundation/Marketplace/ServiceOfferedType.php +++ /dev/null @@ -1,37 +0,0 @@ -type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/SpokenLanguage.php b/app/Models/Foundation/Marketplace/SpokenLanguage.php deleted file mode 100644 index d5bbc57a..00000000 --- a/app/Models/Foundation/Marketplace/SpokenLanguage.php +++ /dev/null @@ -1,37 +0,0 @@ -name; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Marketplace/SupportChannelType.php b/app/Models/Foundation/Marketplace/SupportChannelType.php deleted file mode 100644 index 5233aa7a..00000000 --- a/app/Models/Foundation/Marketplace/SupportChannelType.php +++ /dev/null @@ -1,38 +0,0 @@ -type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Software/OpenStackApiVersion.php b/app/Models/Foundation/Software/OpenStackApiVersion.php deleted file mode 100644 index 2e89ca5f..00000000 --- a/app/Models/Foundation/Software/OpenStackApiVersion.php +++ /dev/null @@ -1,81 +0,0 @@ -version; - } - - /** - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * @return OpenStackComponent - */ - public function getComponent() - { - return $this->component; - } - - /** - * @return bool - */ - public function hasComponent(){ - try{ - if(is_null($this->component)) return false; - return $this->component->getId() > 0 ; - } - catch (\Exception $ex){ - return false; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Software/OpenStackComponent.php b/app/Models/Foundation/Software/OpenStackComponent.php deleted file mode 100644 index 361bfe01..00000000 --- a/app/Models/Foundation/Software/OpenStackComponent.php +++ /dev/null @@ -1,65 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getCodeName() - { - return $this->code_name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Software/OpenStackRelease.php b/app/Models/Foundation/Software/OpenStackRelease.php deleted file mode 100644 index cde01b09..00000000 --- a/app/Models/Foundation/Software/OpenStackRelease.php +++ /dev/null @@ -1,66 +0,0 @@ -name; - } - - /** - * @return string - */ - public function getReleaseNumber() - { - return $this->release_number; - } - - /** - * @return DateTime - */ - public function getReleaseDate() - { - return $this->release_date; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Software/OpenStackReleaseSupportedApiVersion.php b/app/Models/Foundation/Software/OpenStackReleaseSupportedApiVersion.php deleted file mode 100644 index afdbd647..00000000 --- a/app/Models/Foundation/Software/OpenStackReleaseSupportedApiVersion.php +++ /dev/null @@ -1,135 +0,0 @@ -version; - } - - /** - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * @return OpenStackComponent - */ - public function getComponent() - { - return $this->component; - } - - /** - * @return OpenStackApiVersion - */ - public function getApiVersion() - { - return $this->api_version; - } - - /** - * @return OpenStackRelease - */ - public function getRelease() - { - return $this->release; - } - - /** - * @return bool - */ - public function hasApiVersion(){ - try{ - if(is_null($this->api_version)) return false; - return $this->api_version->getId() > 0 ; - } - catch (\Exception $ex){ - return false; - } - } - - /** - * @return bool - */ - public function hasComponent(){ - try{ - if(is_null($this->component)) return false; - return $this->component->getId() > 0 ; - } - catch (\Exception $ex){ - return false; - } - } - - /** - * @return bool - */ - public function hasRelease(){ - try{ - if(is_null($this->release)) return false; - return $this->release->getId() > 0 ; - } - catch (\Exception $ex){ - return false; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/AllowedCurrencies.php b/app/Models/Foundation/Summit/AllowedCurrencies.php deleted file mode 100644 index 6d4949cf..00000000 --- a/app/Models/Foundation/Summit/AllowedCurrencies.php +++ /dev/null @@ -1,25 +0,0 @@ -synchronized_events = new ArrayCollection(); - } - - /** - * @ORM\Column(name="Provider", type="string") - * @var string - */ - protected $provider; - - /** - * @ORM\Column(name="CalendarExternalId", type="string") - * @var string - */ - protected $external_id; - - /** - * @ORM\Column(name="ETag", type="string") - * @var string - */ - protected $etag; - - /** - * @ORM\Column(name="Revoked", type="boolean") - * @var bool - */ - protected $revoked; - - use SummitOwned; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member", inversedBy="calendars_sync") - * @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID", onDelete="CASCADE") - * @var Member - */ - protected $owner; - - /** - * @ORM\OneToMany(targetEntity="ScheduleCalendarSyncInfo", mappedBy="calendar_sync_info", cascade={"persist"}, orphanRemoval=true) - * @var ScheduleCalendarSyncInfo[] - */ - protected $synchronized_events; - - /** - * @return string - */ - public function getProvider() - { - return $this->provider; - } - - /** - * @param string $provider - */ - public function setProvider($provider) - { - $this->provider = $provider; - } - - /** - * @return string - */ - public function getExternalId() - { - return $this->external_id; - } - - /** - * @param string $external_id - */ - public function setExternalId($external_id) - { - $this->external_id = $external_id; - } - - /** - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * @param string $etag - */ - public function setEtag($etag) - { - $this->etag = $etag; - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @return ScheduleCalendarSyncInfo[] - */ - public function getSynchronizedEvents() - { - return $this->synchronized_events; - } - - /** - * @return bool - */ - public function isRevoked() - { - return $this->revoked; - } - - /** - * @param bool $revoked - */ - public function setRevoked($revoked) - { - $this->revoked = $revoked; - } - - public function clearOwner(){ - $this->owner = null; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/CalendarSyncInfoCalDav.php b/app/Models/Foundation/Summit/CalendarSync/CalendarSyncInfoCalDav.php deleted file mode 100644 index 0619c8be..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/CalendarSyncInfoCalDav.php +++ /dev/null @@ -1,155 +0,0 @@ -user_name; - } - - /** - * @param string $user_name - */ - public function setUserName($user_name) - { - $this->user_name = $user_name; - } - - /** - * @return string - */ - public function getUserPassword() - { - return Encryption::decrypt($this->user_password); - } - - /** - * @param string $user_password - */ - public function setUserPassword($user_password) - { - $this->user_password = Encryption::encrypt($user_password); - } - - /** - * @return string - */ - public function getUserPrincipalUrl() - { - return $this->user_principal_url; - } - - /** - * @param string $user_principal_url - */ - public function setUserPrincipalUrl($user_principal_url) - { - $this->user_principal_url = $user_principal_url; - } - - /** - * @return string - */ - public function getServer(){ - $result = parse_url($this->user_principal_url); - - if(!$result) throw new \InvalidArgumentException(sprintf("user_principal_url %s is invalid", $this->user_principal_url)); - if(!isset($result['scheme'])) - throw new \InvalidArgumentException(sprintf("user_principal_url %s is invalid", $this->user_principal_url)); - if(!isset($result['host'])) - throw new \InvalidArgumentException(sprintf("user_principal_url %s is invalid", $this->user_principal_url)); - - return $result['scheme']."://".$result['host']; - } - - /** - * @return string - */ - public function getCalendarUrl(){ - return $this->external_id; - } - - /** - * @return string - */ - public function getCalendarDisplayName() - { - return $this->calendar_display_name; - } - - /** - * @param string $calendar_display_name - */ - public function setCalendarDisplayName($calendar_display_name) - { - $this->calendar_display_name = $calendar_display_name; - } - - /** - * @return string - */ - public function getCalendarSyncToken() - { - return $this->calendar_sync_token; - } - - /** - * @param string $calendar_sync_token - */ - public function setCalendarSyncToken($calendar_sync_token) - { - $this->calendar_sync_token = $calendar_sync_token; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/CalendarSyncInfoOAuth2.php b/app/Models/Foundation/Summit/CalendarSync/CalendarSyncInfoOAuth2.php deleted file mode 100644 index fd37fbf9..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/CalendarSyncInfoOAuth2.php +++ /dev/null @@ -1,72 +0,0 @@ -access_token); - return json_decode($access_token, true); - } - - /** - * @param string $access_token - */ - public function setAccessToken($access_token) - { - $this->access_token = Encryption::encrypt - ( - json_encode($access_token) - ); - } - - /** - * @return string - */ - public function getRefreshToken() - { - return Encryption::decrypt($this->refresh_token); - } - - /** - * @param string $refresh_token - */ - public function setRefreshToken($refresh_token) - { - $this->refresh_token = Encryption::encrypt($refresh_token); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/ScheduleCalendarSyncInfo.php b/app/Models/Foundation/Summit/CalendarSync/ScheduleCalendarSyncInfo.php deleted file mode 100644 index 24f168d1..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/ScheduleCalendarSyncInfo.php +++ /dev/null @@ -1,307 +0,0 @@ -summit_event_id; - } - - /** - * @param mixed $summit_event_id - */ - public function setSummitEventId($summit_event_id) - { - $this->summit_event_id = $summit_event_id; - } - - /** - * @return SummitEvent - */ - public function getSummitEvent() - { - $id = $this->summit_event_id; - try { - $event = $this->getEM()->find(SummitEvent::class, $id); - } - catch(\Exception $ex){ - return null; - } - return $event; - } - - /** - * @param SummitEvent $summit_event - */ - public function setSummitEvent($summit_event) - { - $this->summit_event_id = $summit_event->getId(); - } - - /** - * @ORM\Column(name="LocationID", type="integer") - * @var int - */ - private $location_id; - - /** - * @ORM\Column(name="ExternalId", type="string") - * @var string - */ - private $external_id; - - /** - * @ORM\Column(name="ETag", type="string") - * @var string - */ - private $etag; - - /** - * @ORM\Column(name="VCard", type="string") - * @var string - */ - private $vcard; - - /** - * @ORM\Column(name="CalendarEventExternalUrl", type="string") - * @var string - */ - private $external_url; - - /** - * @ORM\ManyToOne(targetEntity="models\summit\CalendarSync\CalendarSyncInfo", inversedBy="synchronized_events") - * @ORM\JoinColumn(name="CalendarSyncInfoID", referencedColumnName="ID", nullable=true ) - * @var CalendarSyncInfo - */ - private $calendar_sync_info; - - /** - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * @return Member - */ - public function getMember() - { - return $this->member; - } - - /** - * @param Member $member - */ - public function setMember($member) - { - $this->member = $member; - } - - - public function clearOwner(){ - $this->member = null; - $this->event = null; - } - - /** - * @return \DateTime - */ - public function getCreated() - { - return $this->created; - } - - /** - * @param \DateTime $created - */ - public function setCreated($created) - { - $this->created = $created; - } - - /** - * @return \DateTime - */ - public function getLastEdited() - { - return $this->last_edited; - } - - /** - * @param \DateTime $last_edited - */ - public function setLastEdited($last_edited) - { - $this->last_edited = $last_edited; - } - - /** - * @return string - */ - public function getExternalId() - { - return $this->external_id; - } - - /** - * @param string $external_id - */ - public function setExternalId($external_id) - { - $this->external_id = $external_id; - } - - /** - * @return string - */ - public function getEtag() - { - return $this->etag; - } - - /** - * @param string $etag - */ - public function setEtag($etag) - { - $this->etag = $etag; - } - - /** - * @return string - */ - public function getExternalUrl() - { - return $this->external_url; - } - - /** - * @param string $external_url - */ - public function setExternalUrl($external_url) - { - $this->external_url = $external_url; - } - - /** - * @return CalendarSyncInfo - */ - public function getCalendarSyncInfo() - { - return $this->calendar_sync_info; - } - - /** - * @param CalendarSyncInfo $calendar_sync_info - */ - public function setCalendarSyncInfo($calendar_sync_info) - { - $this->calendar_sync_info = $calendar_sync_info; - } - - /** - * @return SummitAbstractLocation - */ - public function getLocation() - { - $id = $this->location_id; - try { - $location = $this->getEM()->find(SummitAbstractLocation::class, $id); - } - catch(\Exception $ex){ - return null; - } - return $location; - } - - /** - * @param int location_id - */ - public function setLocationId($location_id) - { - $this->location_id = $location_id; - } - - /** - * @return string - */ - public function getVCard() - { - return $this->vcard; - } - - /** - * @param string $vcard - */ - public function setVCard($vcard) - { - $this->vcard = $vcard; - } - - /** - * @return string - */ - public function toJson(){ - return json_encode([ - 'external_id' => $this->external_id, - 'etag' => $this->etag, - 'external_url' => $this->external_url, - 'vcard' => $this->vcard, - ]); - } - - /** - * @param string $str_json - * @return ScheduleCalendarSyncInfo - */ - public static function buildFromJson($str_json){ - $res = json_decode($str_json, true); - $o = new ScheduleCalendarSyncInfo(); - $o->setExternalId($res['external_id']); - $o->setEtag($res['etag']); - $o->setExternalUrl($res['external_url']); - $o->setVCard($res['vcard']); - return $o; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AbstractCalendarSyncWorkRequest.php b/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AbstractCalendarSyncWorkRequest.php deleted file mode 100644 index 740e69eb..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AbstractCalendarSyncWorkRequest.php +++ /dev/null @@ -1,110 +0,0 @@ -is_processed = false; - } - - /** - * @ORM\Column(name="Type", type="string") - * @var string - */ - protected $type; - - /** - * @ORM\Column(name="IsProcessed", type="boolean", options={"default":"0"}) - * @var bool - */ - protected $is_processed; - - /** - * @ORM\Column(name="ProcessedDate", type="datetime") - * @var \DateTime - */ - protected $processed_date; - - - /** - * @return mixed - */ - public function getType() - { - return $this->type; - } - - /** - * @param mixed $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return bool - */ - public function IsProcessed() - { - return $this->is_processed; - } - - /** - * @param bool $is_processed - */ - public function setIsProcessed($is_processed) - { - $this->is_processed = $is_processed; - } - - /** - * @return \DateTime - */ - public function getProcessedDate() - { - return $this->processed_date; - } - - /** - * @param \DateTime $processed_date - */ - public function setProcessedDate($processed_date) - { - $this->processed_date = $processed_date; - } - - - public function markProcessed(){ - $this->is_processed = true; - $this->processed_date = new \DateTime('now', new \DateTimeZone(SilverstripeBaseModel::DefaultTimeZone)); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminScheduleSummitActionSyncWorkRequest.php b/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminScheduleSummitActionSyncWorkRequest.php deleted file mode 100644 index 76f33018..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminScheduleSummitActionSyncWorkRequest.php +++ /dev/null @@ -1,61 +0,0 @@ -created_by; - } - - /** - * @param Member $created_by - */ - public function setCreatedBy($created_by) - { - $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; - } - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminSummitEventActionSyncWorkRequest.php b/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminSummitEventActionSyncWorkRequest.php deleted file mode 100644 index ec126e5d..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminSummitEventActionSyncWorkRequest.php +++ /dev/null @@ -1,75 +0,0 @@ -summit_event_id; - } - - /** - * @param mixed $summit_event_id - */ - public function setSummitEventId($summit_event_id) - { - $this->summit_event_id = $summit_event_id; - } - - /** - * @return SummitEvent - */ - public function getSummitEvent() - { - $id = $this->summit_event_id; - try { - $event = $this->getEM()->find(SummitEvent::class, $id); - } - catch(\Exception $ex){ - return null; - } - return $event; - } - - /** - * @param SummitEvent $summit_event - */ - public function setSummitEvent($summit_event) - { - $this->summit_event_id = $summit_event->getId(); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminSummitLocationActionSyncWorkRequest.php b/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminSummitLocationActionSyncWorkRequest.php deleted file mode 100644 index 45868bef..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/AdminSummitLocationActionSyncWorkRequest.php +++ /dev/null @@ -1,63 +0,0 @@ -location_id; - try { - $location = $this->getEM()->find(SummitAbstractLocation::class, $id); - } - catch(\Exception $ex){ - return null; - } - return $location; - } - - /** - * @return int - */ - public function getLocationId() - { - return $this->location_id; - } - - /** - * @param int $location_id - */ - public function setLocationId($location_id) - { - $this->location_id = $location_id; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberCalendarScheduleSummitActionSyncWorkRequest.php b/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberCalendarScheduleSummitActionSyncWorkRequest.php deleted file mode 100644 index 7a6911a7..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberCalendarScheduleSummitActionSyncWorkRequest.php +++ /dev/null @@ -1,99 +0,0 @@ -calendar_id; - } - - /** - * @param string $calendar_id - */ - public function setCalendarId($calendar_id) - { - $this->calendar_id = $calendar_id; - } - - /** - * @return string - */ - public function getCalendarName() - { - return $this->calendar_name; - } - - /** - * @param string $calendar_name - */ - public function setCalendarName($calendar_name) - { - $this->calendar_name = $calendar_name; - } - - /** - * @return string - */ - public function getCalendarDescription() - { - return $this->calendar_description; - } - - /** - * @param string $calendar_description - */ - public function setCalendarDescription($calendar_description) - { - $this->calendar_description = $calendar_description; - } - - /** - * @return string - */ - public function getSubType(){ - return self::SubType; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberEventScheduleSummitActionSyncWorkRequest.php b/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberEventScheduleSummitActionSyncWorkRequest.php deleted file mode 100644 index 7f3fb5a0..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberEventScheduleSummitActionSyncWorkRequest.php +++ /dev/null @@ -1,78 +0,0 @@ -summit_event_id; - } - - /** - * @param mixed $summit_event_id - */ - public function setSummitEventId($summit_event_id) - { - $this->summit_event_id = $summit_event_id; - } - - /** - * @return SummitEvent - */ - public function getSummitEvent() - { - $id = $this->summit_event_id; - try { - $event = $this->getEM()->find(SummitEvent::class, $id); - } - catch(\Exception $ex){ - return null; - } - return $event; - } - - /** - * @param SummitEvent $summit_event - */ - public function setSummitEvent($summit_event) - { - $this->summit_event_id = $summit_event->getId(); - } - /** - * @return string - */ - public function getSubType(){ - return self::SubType; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberScheduleSummitActionSyncWorkRequest.php b/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberScheduleSummitActionSyncWorkRequest.php deleted file mode 100644 index 83bf97ec..00000000 --- a/app/Models/Foundation/Summit/CalendarSync/WorkQueue/MemberScheduleSummitActionSyncWorkRequest.php +++ /dev/null @@ -1,77 +0,0 @@ -owner; - } - - /** - * @param Member $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @return CalendarSyncInfo - */ - public function getCalendarSyncInfo() - { - return $this->calendar_sync_info; - } - - /** - * @param CalendarSyncInfo $calendar_sync_info - */ - public function setCalendarSyncInfo($calendar_sync_info) - { - $this->calendar_sync_info = $calendar_sync_info; - } - - public function getSubType(){ - return null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/DefaultTrackTagGroup.php b/app/Models/Foundation/Summit/DefaultTrackTagGroup.php deleted file mode 100644 index 93a360e0..00000000 --- a/app/Models/Foundation/Summit/DefaultTrackTagGroup.php +++ /dev/null @@ -1,142 +0,0 @@ -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 int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order) - { - $this->order = $order; - } - - /** - * @return bool - */ - public function isMandatory() - { - return $this->is_mandatory; - } - - /** - * @param bool $is_mandatory - */ - public function setIsMandatory($is_mandatory) - { - $this->is_mandatory = $is_mandatory; - } - - /** - * @return DefaultTrackTagGroupAllowedTag[] - */ - public function getAllowedTags() - { - return $this->allowed_tags; - } - - /** - * @param DefaultTrackTagGroupAllowedTag[] $allowed_tags - */ - public function setAllowedTags($allowed_tags) - { - $this->allowed_tags = $allowed_tags; - } - - public function __construct() - { - parent::__construct(); - $this->allowed_tags = new ArrayCollection; - $this->is_mandatory = false; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/DefaultTrackTagGroupAllowedTag.php b/app/Models/Foundation/Summit/DefaultTrackTagGroupAllowedTag.php deleted file mode 100644 index 1dda458b..00000000 --- a/app/Models/Foundation/Summit/DefaultTrackTagGroupAllowedTag.php +++ /dev/null @@ -1,95 +0,0 @@ -track_tag_group) ? 0 : $this->track_tag_group->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getTagId(){ - try { - return is_null($this->tag) ? 0 : $this->tag->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return Tag - */ - public function getTag() - { - return $this->tag; - } - - /** - * @param Tag $tag - */ - public function setTag(Tag $tag) - { - $this->tag = $tag; - } - - /** - * @return DefaultTrackTagGroup - */ - public function getTrackTagGroup() - { - return $this->track_tag_group; - } - - /** - * @param DefaultTrackTagGroup $track_tag_group - */ - public function setTrackTagGroup(DefaultTrackTagGroup $track_tag_group) - { - $this->track_tag_group = $track_tag_group; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Defaults/DefaultPresentationType.php b/app/Models/Foundation/Summit/Defaults/DefaultPresentationType.php deleted file mode 100644 index 30644d88..00000000 --- a/app/Models/Foundation/Summit/Defaults/DefaultPresentationType.php +++ /dev/null @@ -1,279 +0,0 @@ -max_speakers; - } - - /** - * @param int $max_speakers - */ - public function setMaxSpeakers($max_speakers) - { - $this->max_speakers = $max_speakers; - } - - /** - * @return int - */ - public function getMinSpeakers() - { - return $this->min_speakers; - } - - /** - * @param int $min_speakers - */ - public function setMinSpeakers($min_speakers) - { - $this->min_speakers = $min_speakers; - } - - /** - * @return int - */ - public function getMaxModerators() - { - return $this->max_moderators; - } - - /** - * @param int $max_moderators - */ - public function setMaxModerators($max_moderators) - { - $this->max_moderators = $max_moderators; - } - - /** - * @return int - */ - public function getMinModerators() - { - return $this->min_moderators; - } - - /** - * @param int $min_moderators - */ - public function setMinModerators($min_moderators) - { - $this->min_moderators = $min_moderators; - } - - /** - * @return bool - */ - public function isUseSpeakers() - { - return $this->use_speakers; - } - - /** - * @param bool $use_speakers - */ - public function setUseSpeakers($use_speakers) - { - $this->use_speakers = $use_speakers; - } - - /** - * @return bool - */ - public function isAreSpeakersMandatory() - { - return $this->are_speakers_mandatory; - } - - /** - * @param bool $are_speakers_mandatory - */ - public function setAreSpeakersMandatory($are_speakers_mandatory) - { - $this->are_speakers_mandatory = $are_speakers_mandatory; - } - - /** - * @return bool - */ - public function isUseModerator() - { - return $this->use_moderator; - } - - /** - * @param bool $use_moderator - */ - public function setUseModerator($use_moderator) - { - $this->use_moderator = $use_moderator; - } - - /** - * @return bool - */ - public function isModeratorMandatory() - { - return $this->is_moderator_mandatory; - } - - /** - * @param bool $is_moderator_mandatory - */ - public function setIsModeratorMandatory($is_moderator_mandatory) - { - $this->is_moderator_mandatory = $is_moderator_mandatory; - } - - /** - * @return bool - */ - public function isShouldBeAvailableOnCfp() - { - return $this->should_be_available_on_cfp; - } - - /** - * @param bool $should_be_available_on_cfp - */ - public function setShouldBeAvailableOnCfp($should_be_available_on_cfp) - { - $this->should_be_available_on_cfp = $should_be_available_on_cfp; - } - - /** - * @return string - */ - public function getModeratorLabel() - { - return $this->moderator_label; - } - - /** - * @param string $moderator_label - */ - public function setModeratorLabel($moderator_label) - { - $this->moderator_label = $moderator_label; - } - - protected function newType(){ - return new PresentationType(); - } - - /** - * @param Summit $summit - * @return SummitEventType - */ - public function buildType(Summit $summit){ - $new_type = parent::buildType($summit); - $new_type->setMaxSpeakers($this->max_speakers); - $new_type->setMinSpeakers($this->min_speakers); - $new_type->setMaxModerators($this->max_moderators); - $new_type->setMinModerators($this->min_moderators); - $new_type->setUseSpeakers($this->use_speakers); - $new_type->setAreSpeakersMandatory($this->are_speakers_mandatory); - $new_type->setUseModerator($this->use_moderator); - $new_type->setIsModeratorMandatory($this->is_moderator_mandatory); - $new_type->setShouldBeAvailableOnCfp($this->should_be_available_on_cfp); - $new_type->setModeratorLabel($this->moderator_label); - return $new_type; - } - - public function __construct() - { - parent::__construct(); - $this->use_speakers = false; - $this->are_speakers_mandatory = false; - $this->use_moderator = false; - $this->is_moderator_mandatory = false; - $this->should_be_available_on_cfp = false; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Defaults/DefaultSummitEventType.php b/app/Models/Foundation/Summit/Defaults/DefaultSummitEventType.php deleted file mode 100644 index 97358fab..00000000 --- a/app/Models/Foundation/Summit/Defaults/DefaultSummitEventType.php +++ /dev/null @@ -1,214 +0,0 @@ -type; - } - - /** - * @param string $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return string - */ - public function getColor() - { - return $this->color; - } - - /** - * @param string $color - */ - public function setColor($color) - { - $this->color = $color; - } - - /** - * @return bool - */ - public function isBlackoutTimes() - { - return $this->blackout_times; - } - - /** - * @param bool $blackout_times - */ - public function setBlackoutTimes($blackout_times) - { - $this->blackout_times = $blackout_times; - } - - /** - * @return bool - */ - public function isUseSponsors() - { - return $this->use_sponsors; - } - - /** - * @param bool $use_sponsors - */ - public function setUseSponsors($use_sponsors) - { - $this->use_sponsors = $use_sponsors; - } - - /** - * @return bool - */ - public function isAreSponsorsMandatory() - { - return $this->are_sponsors_mandatory; - } - - /** - * @param bool $are_sponsors_mandatory - */ - public function setAreSponsorsMandatory($are_sponsors_mandatory) - { - $this->are_sponsors_mandatory = $are_sponsors_mandatory; - } - - /** - * @return bool - */ - public function isAllowsAttachment() - { - return $this->allows_attachment; - } - - /** - * @param bool $allows_attachment - */ - public function setAllowsAttachment($allows_attachment) - { - $this->allows_attachment = $allows_attachment; - } - - /** - * @return bool - */ - public function isPrivate() - { - return $this->is_private; - } - - /** - * @param bool $is_private - */ - public function setIsPrivate($is_private) - { - $this->is_private = $is_private; - } - - protected function newType(){ - return new SummitEventType(); - } - - /** - * @param Summit $summit - * @return SummitEventType - */ - public function buildType(Summit $summit){ - $new_type = $this->newType(); - $new_type->setSummit($summit); - $new_type->setType($this->type); - $new_type->setColor($this->color); - $new_type->setBlackoutTimes($this->blackout_times); - $new_type->setUseSponsors($this->use_sponsors); - $new_type->setAreSponsorsMandatory($this->are_sponsors_mandatory); - $new_type->setAllowsAttachment($this->allows_attachment); - $new_type->setIsPrivate($this->is_private); - $new_type->setAsDefault(); - return $new_type; - } - - public function __construct() - { - $this->blackout_times = false; - $this->use_sponsors = false; - $this->are_sponsors_mandatory = false; - $this->allows_attachment = false; - $this->is_private = false; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EmailFlows/SummitEmailEventFlow.php b/app/Models/Foundation/Summit/EmailFlows/SummitEmailEventFlow.php deleted file mode 100644 index b5caa5fb..00000000 --- a/app/Models/Foundation/Summit/EmailFlows/SummitEmailEventFlow.php +++ /dev/null @@ -1,86 +0,0 @@ -email_template_identifier; - } - - public function getFlowName():string{ - return $this->event_type->getFlow()->getName(); - } - - public function getEventTypeName():string{ - return $this->event_type->getName(); - } - - /** - * @param string $email_template_identifier - */ - public function setEmailTemplateIdentifier(string $email_template_identifier): void - { - $this->email_template_identifier = $email_template_identifier; - } - - /** - * @return SummitEmailEventFlowType - */ - public function getEventType(): SummitEmailEventFlowType - { - return $this->event_type; - } - - /** - * @param SummitEmailEventFlowType $event_type - */ - public function setEventType(SummitEmailEventFlowType $event_type): void - { - $this->event_type = $event_type; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EmailFlows/SummitEmailEventFlowType.php b/app/Models/Foundation/Summit/EmailFlows/SummitEmailEventFlowType.php deleted file mode 100644 index f5191a99..00000000 --- a/app/Models/Foundation/Summit/EmailFlows/SummitEmailEventFlowType.php +++ /dev/null @@ -1,114 +0,0 @@ -flow; - } - - /** - * @param SummitEmailFlowType $flow - */ - public function setFlow(SummitEmailFlowType $flow): void - { - $this->flow = $flow; - } - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getSlug(): string - { - return $this->slug; - } - - /** - * @param string $slug - */ - public function setSlug(string $slug): void - { - $this->slug = $slug; - } - - /** - * @return string - */ - public function getDefaultEmailTemplate(): string - { - return $this->default_email_template; - } - - /** - * @param string $default_email_template - */ - public function setDefaultEmailTemplate(string $default_email_template): void - { - $this->default_email_template = $default_email_template; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EmailFlows/SummitEmailFlowType.php b/app/Models/Foundation/Summit/EmailFlows/SummitEmailFlowType.php deleted file mode 100644 index 5e01566f..00000000 --- a/app/Models/Foundation/Summit/EmailFlows/SummitEmailFlowType.php +++ /dev/null @@ -1,83 +0,0 @@ -flow_event_types = new ArrayCollection(); - } - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @param SummitEmailEventFlowType $event_type - */ - public function addFlowEventType(SummitEmailEventFlowType $event_type){ - if($this->flow_event_types->contains($event_type)) return; - $this->flow_event_types->add($event_type); - $event_type->setFlow($this); - } - - public function removeFlowEventType(SummitEmailEventFlowType $event_type){ - if(!$this->flow_event_types->contains($event_type)) return; - $this->flow_event_types->removeElement($event_type); - } - - public function clearFlowEventType(){ - $this->flow_event_types->clear(); - } - - public function getEventTypes(){ - return $this->flow_event_types; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/EntityEventList.php b/app/Models/Foundation/Summit/EntityEvents/EntityEventList.php deleted file mode 100644 index 09d06bb2..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/EntityEventList.php +++ /dev/null @@ -1,126 +0,0 @@ -container = $values; - } - - /** - * @return array - */ - public function values(){ - return array_values($this->container); - } - - /** - * @return int - */ - public function size(){ - return count($this->container); - } - /** - * @return int - */ - public function getIdx(){ return $this->idx; } - - /** - * Whether a offset exists - * @link http://php.net/manual/en/arrayaccess.offsetexists.php - * @param mixed $offset

- * An offset to check for. - *

- * @return boolean true on success or false on failure. - *

- *

- * The return value will be casted to boolean if non-boolean was returned. - * @since 5.0.0 - */ - public function offsetExists($offset) - { - return isset($this->container[$offset]); - } - - /** - * Offset to retrieve - * @link http://php.net/manual/en/arrayaccess.offsetget.php - * @param mixed $offset

- * The offset to retrieve. - *

- * @return mixed Can return all value types. - * @since 5.0.0 - */ - public function offsetGet($offset) - { - return isset($this->container[$offset]) ? $this->container[$offset] : null; - } - - /** - * Offset to set - * @link http://php.net/manual/en/arrayaccess.offsetset.php - * @param mixed $offset

- * The offset to assign the value to. - *

- * @param mixed $value

- * The value to set. - *

- * @return void - * @since 5.0.0 - */ - public function offsetSet($offset, $value) - { - if (is_null($offset)) { - ++$this->idx; - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Offset to unset - * @link http://php.net/manual/en/arrayaccess.offsetunset.php - * @param mixed $offset

- * The offset to unset. - *

- * @return void - * @since 5.0.0 - */ - public function offsetUnset($offset) - { - unset($this->container[$offset]); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/SummitEntityEventProcessContext.php b/app/Models/Foundation/Summit/EntityEvents/SummitEntityEventProcessContext.php deleted file mode 100644 index a83859f7..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/SummitEntityEventProcessContext.php +++ /dev/null @@ -1,179 +0,0 @@ -list = new EntityEventList(); - $this->current_member = $current_member; - } - - /** - * @return Member|null - */ - public function getCurrentMember(){ return $this->current_member; } - - /** - * @return int|null - */ - public function getCurrentMemberId(){ - return !is_null($this->current_member) ? $this->current_member->getId() : null; - } - - /** - * @param SummitEntityEvent $entity_event - * @return bool - */ - public function existsOpType(SummitEntityEvent $entity_event){ - switch($entity_event->getType()){ - case 'INSERT': return $this->existsInsertOp($entity_event);break; - case 'UPDATE': return $this->existsUpdateOp($entity_event);break; - case 'DELETE': return $this->existsDeleteOp($entity_event);break; - default: throw new \InvalidArgumentException;break; - } - } - - public function registerOpType(SummitEntityEvent $entity_event){ - switch($entity_event->getType()){ - case 'INSERT': return $this->registerInsertOp($entity_event);break; - case 'UPDATE': return $this->registerUpdateOp($entity_event);break; - case 'DELETE': return $this->registerDeleteOp($entity_event);break; - default: throw new \InvalidArgumentException;break; - } - } - /** - * @param SummitEntityEvent $entity_event - * @return bool - */ - public function existsDeleteOp(SummitEntityEvent $entity_event){ - return isset($this->delete_operations[$entity_event->getKey()]); - } - - /** - * @param SummitEntityEvent $entity_event - */ - public function registerDeleteOp(SummitEntityEvent $entity_event){ - $this->delete_operations[$entity_event->getKey()] = $entity_event->getKey(); - } - - /** - * @param SummitEntityEvent $entity_event - * @return bool - */ - public function existsUpdateOp(SummitEntityEvent $entity_event){ - return isset($this->update_operations[$entity_event->getKey()]); - } - - /** - * @param SummitEntityEvent $entity_event - */ - public function registerUpdateOp(SummitEntityEvent $entity_event){ - $this->update_operations[$entity_event->getKey()] = $entity_event->getKey(); - } - - /** - * @param SummitEntityEvent $entity_event - * @return bool - */ - public function existsInsertOp(SummitEntityEvent $entity_event){ - return isset($this->insert_operations[$entity_event->getKey()]); - } - - /** - * @param SummitEntityEvent $entity_event - */ - public function registerInsertOp(SummitEntityEvent $entity_event){ - $this->insert_operations[$entity_event->getKey()] = $entity_event->getKey(); - } - - /** - * @param SummitEntityEvent $entity_event - */ - public function registerSummitEventOp(SummitEntityEvent $entity_event){ - $key = $entity_event->getKey(); - if(!isset($this->summit_events_operations[$key])) $this->summit_events_operations[$key] = array(); - array_push($this->summit_events_operations[$key], ['idx' => $this->list->getIdx() - 1 , 'op' => $entity_event->getType()]); - } - - /** - * @param SummitEntityEvent $e - */ - public function registerEntityEvent(SummitEntityEvent $e){ - $this->list[] = SerializerRegistry::getInstance()->getSerializer($e)->serialize - ( - implode(',',['speakers','tracks','sponsors', 'floor']) - ); - } - - /** - * @return array - */ - public function getListValues(){ - return $this->list->values(); - } - - public function postProcessList(){ - foreach ($this->summit_events_operations as $key => $ops) { - $last_idx = null; - $last_op = null; - $must_insert = false; - foreach ($ops as $op) { - if (!is_null($last_idx)) - unset($this->list[$last_idx]); - - $last_op = $op['op']; - $last_idx = intval($op['idx']); - $must_insert = !$must_insert && $last_op === 'INSERT' ? true : $must_insert; - } - $last_op = $must_insert && $last_op !== 'DELETE' ? 'INSERT' : $last_op; - $summit_events_ops[$key] = array(['idx' => $last_idx, 'op' => ($last_op)]); - // element update - $e = $this->list[$last_idx]; - $e['type'] = $last_op; - $this->list[$last_idx] = $e; - } - } - - /** - * @return int - */ - public function getListSize(){ - return $this->list->size(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventType.php deleted file mode 100644 index 266ec802..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventType.php +++ /dev/null @@ -1,61 +0,0 @@ -entity_event = $entity_event; - $this->process_ctx = $process_ctx; - } - - /** - * @return IEntity|null - */ - abstract protected function registerEntity(); - - /** - * @return EntityManager - */ - protected function getEM(){ - return Registry::getManager(self::EntityManager); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventTypeFactory.php b/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventTypeFactory.php deleted file mode 100644 index e4b01baf..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventTypeFactory.php +++ /dev/null @@ -1,164 +0,0 @@ -getEntityClassName()) - { - case 'Presentation': - case 'SummitEvent': - case 'SummitEventWithFile': - { - if ($e->getType() === 'UPDATE' || $e->getType() === "INSERT") - return new SummitEventEntityEventInsertOrUpdateType($e, $ctx); - return new SummitEventEntityEventDeleteType($e, $ctx); - } - break; - case 'SummitGroupEvent': - { - if ($e->getType() === 'UPDATE' || $e->getType() === "INSERT") - return new SummitGroupEventEntityEventInsertOrUpdateType($e, $ctx); - - return new SummitEventEntityEventDeleteType($e, $ctx); - } - break; - case 'MySchedule': - case 'MyFavorite': - { - return new MyScheduleEntityEventType($e, $ctx); - } - break; - case 'Summit': - { - return new SummitEntityEventType($e, $ctx); - } - break; - case 'SummitEventType': - case 'PresentationType': - { - return new SummitEventTypeEntityEventType($e, $ctx); - } - break; - case 'SummitWIFIConnection': { - return new SummitWIFIConnectionEntityEventType($e, $ctx); - } - break; - case 'SummitVenue': - case 'SummitVenueRoom': - case 'SummitAirport': - case 'SummitHotel': - case 'SummitGeoLocatedLocation': - case 'SummitExternalLocation': - case 'SummitAbstractLocation': - case 'VenueFloorFromVenueRoom': - { - return new SummitLocationEntityEventType($e, $ctx); - } - break; - case 'PresentationSpeaker': - { - return new PresentationSpeakerEntityEventType($e, $ctx); - } - break; - case 'SummitTicketType': - { - return new SummitTicketTypeEntityEventType($e, $ctx); - } - break; - case 'SummitLocationImage': - case 'SummitLocationMap': - { - return new SummitLocationImageEventType($e, $ctx); - } - break; - case 'PresentationCategory': - { - return new PresentationCategoryEntityEventType($e, $ctx); - } - break; - case 'PresentationCategoryGroup': - case 'PrivatePresentationCategoryGroup': - { - return new PresentationCategoryGroupEntityEventType($e, $ctx); - } - break; - case 'PresentationSlide': - case 'PresentationVideo': - case 'PresentationLink': - { - return new PresentationMaterialEntityEventType($e, $ctx); - } - break; - case 'SpeakerFromPresentation': - case 'SummitTypeFromEvent': - case 'SponsorFromEvent': - { - return new SummitEventRelationEntityEventType($e, $ctx); - } - break; - case 'TrackFromTrackGroup': - { - return new TrackFromTrackGroupEventType($e, $ctx); - } - break; - case 'SummitVenueFloor': - { - return new SummitVenueFloorEntityEventType($e, $ctx); - } - break; - case 'WipeData': - { - return new WipeDataEntityEventType($e, $ctx); - } - break; - default: - throw new InvalidArgumentException(sprintf('invalid entity class name %s!', $e->getEntityClassName())); - break; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/GenericSummitEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/GenericSummitEntityEventType.php deleted file mode 100644 index 72f78008..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/GenericSummitEntityEventType.php +++ /dev/null @@ -1,35 +0,0 @@ -process_ctx->existsOpType($this->entity_event)) return; - $this->process_ctx->registerOpType($this->entity_event); - if ($this->entity_event->getType() === 'UPDATE' || $this->entity_event->getType() === "INSERT") { - $entity = $this->registerEntity(); - if (is_null($entity)) return; - } - $this->process_ctx->registerEntityEvent($this->entity_event); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/IEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/IEntityEventType.php deleted file mode 100644 index 91b0572a..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/IEntityEventType.php +++ /dev/null @@ -1,22 +0,0 @@ -process_ctx->getCurrentMemberId(); - if (is_null($member_id) || intval($member_id) !== $this->entity_event->getOwnerId()) return; - if($this->entity_event->getType() === 'INSERT'){ - $entity = $this->registerEntity(); - if (is_null($entity)) return; - } - $this->process_ctx->registerEntityEvent($this->entity_event); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryEntityEventType.php deleted file mode 100644 index 9889098e..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryEntityEventType.php +++ /dev/null @@ -1,32 +0,0 @@ -entity_event->getSummit()->getPresentationCategory($this->entity_event->getEntityId()); - if(is_null($entity)) return null; - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryGroupEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryGroupEntityEventType.php deleted file mode 100644 index 8488f3cc..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryGroupEntityEventType.php +++ /dev/null @@ -1,34 +0,0 @@ -entity_event->getSummit()->getCategoryGroupById($this->entity_event->getEntityId()); - if(is_null($entity)) return null; - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationMaterialEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationMaterialEntityEventType.php deleted file mode 100644 index c0f5b8d1..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationMaterialEntityEventType.php +++ /dev/null @@ -1,37 +0,0 @@ -entity_event->getMetadata(); - if(!isset($metadata['presentation_id'])) return null; - $presentation = $this->entity_event->getSummit()->getScheduleEvent(intval($metadata['presentation_id'])); - if (is_null($presentation)) return null; - $material = $presentation->getMaterial($this->entity_event->getEntityId()); - if(is_null($material)) return null; - $this->entity_event->registerEntity($material); - return $material; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationSpeakerEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationSpeakerEntityEventType.php deleted file mode 100644 index f4f8b693..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationSpeakerEntityEventType.php +++ /dev/null @@ -1,34 +0,0 @@ -entity_event->getSummit()->getSpeaker($this->entity_event->getEntityId()); - if(!is_null($entity)) - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEntityEventType.php deleted file mode 100644 index cfcb7278..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEntityEventType.php +++ /dev/null @@ -1,34 +0,0 @@ -entity_event->getSummit(); - if(is_null($summit)) return null; - if($summit->getId() !== $this->entity_event->getEntityId()) return null; - return $this->entity_event->registerEntity($summit); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventDeleteType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventDeleteType.php deleted file mode 100644 index 58aa2b0b..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventDeleteType.php +++ /dev/null @@ -1,30 +0,0 @@ -process_ctx->existsDeleteOp($this->entity_event)) return; - $this->process_ctx->registerDeleteOp($this->entity_event); - $this->process_ctx->registerEntityEvent($this->entity_event); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventInsertOrUpdateType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventInsertOrUpdateType.php deleted file mode 100644 index 4677dbb5..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventInsertOrUpdateType.php +++ /dev/null @@ -1,50 +0,0 @@ -entity_event->getMetadata(); - $published_old = isset($metadata['pub_old']) ? (bool)intval($metadata['pub_old']) : false; - $published_current = isset($metadata['pub_new']) ? (bool)intval($metadata['pub_new']) : false; - - // the event was not published at the moment of UPDATE .. then skip it! - if (!$published_old && !$published_current) return; - $entity = $this->registerEntity(); - if (!is_null($entity)) // if event exists its bc its published - { - $this->entity_event->setType - ( - $published_current && isset($metadata['pub_old']) && !$published_old ? 'INSERT' : $this->entity_event->getType() - ); - - $this->process_ctx->registerEntityEvent($this->entity_event); - $this->process_ctx->registerSummitEventOp($this->entity_event); - return; - } - // if does not exists on schedule delete it - $this->entity_event->setType('DELETE'); - $chain = new SummitEventEntityEventDeleteType($this->entity_event, $this->process_ctx); - return $chain->process(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventType.php deleted file mode 100644 index ed15e858..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventType.php +++ /dev/null @@ -1,38 +0,0 @@ -getEntity(); - if(!is_null($entity)) - $this->entity_event->registerEntity($entity); - return $entity; - } - - /** - * @return SummitEvent|null - */ - protected function getEntity(){ - return $this->entity_event->getSummit()->getScheduleEvent($this->entity_event->getEntityId()); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventRelationEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventRelationEntityEventType.php deleted file mode 100644 index 719cdeea..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventRelationEntityEventType.php +++ /dev/null @@ -1,51 +0,0 @@ -entity_event->getMetadata(); - if(!isset($metadata['event_id'])) return null; - $event = $this->entity_event->getSummit()->getScheduleEvent(intval($metadata['event_id'])); - if (is_null($event)) return null; - $this->entity_event->setEntityClassName($event->getClassName()); - $this->entity_event->registerEntity($event); - return $event; - } - - /** - * @return void - */ - public function process() - { - $entity = $this->registerEntity(); - if(is_null($entity)) return; - $this->entity_event->setType('UPDATE'); - if($this->process_ctx->existsUpdateOp($this->entity_event)) return; - $this->process_ctx->registerUpdateOp($this->entity_event); - $this->process_ctx->registerEntityEvent($this->entity_event); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventTypeEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventTypeEntityEventType.php deleted file mode 100644 index 987a8600..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventTypeEntityEventType.php +++ /dev/null @@ -1,33 +0,0 @@ -entity_event->getSummit()->getEventType($this->entity_event->getEntityId()); - if(!is_null($entity)) - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitGroupEventEntityEventInsertOrUpdateType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitGroupEventEntityEventInsertOrUpdateType.php deleted file mode 100644 index a64cf7c3..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitGroupEventEntityEventInsertOrUpdateType.php +++ /dev/null @@ -1,63 +0,0 @@ -entity_event->getMetadata(); - $published_old = isset($metadata['pub_old']) ? (bool)intval($metadata['pub_old']) : false; - $published_current = isset($metadata['pub_new']) ? (bool)intval($metadata['pub_new']) : false; - - // the event was not published at the moment of UPDATE .. then skip it! - if (!$published_old && !$published_current) return; - $entity = $this->getEntity(); - - $current_member = $this->process_ctx->getCurrentMember(); - - if (is_null($current_member)) return; - - if (!Summit::allowToSee($entity, $current_member)) return; - - if (!is_null($entity)) // if event exists its bc its published - { - $this->registerEntity(); - $this->entity_event->setType - ( - $published_current && isset($metadata['pub_old']) && !$published_old ? - 'INSERT' : - $this->entity_event->getType() - ); - - $this->process_ctx->registerEntityEvent($this->entity_event); - $this->process_ctx->registerSummitEventOp($this->entity_event); - return; - } - // if does not exists on schedule delete it - $this->entity_event->setType('DELETE'); - $chain = new SummitEventEntityEventDeleteType($this->entity_event, $this->process_ctx); - return $chain->process(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationEntityEventType.php deleted file mode 100644 index 214526f1..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationEntityEventType.php +++ /dev/null @@ -1,37 +0,0 @@ -entity_event->getType(); - // if there is an insert in place, skip it - if($type === 'UPDATE' && $this->process_ctx->existsInsertOp($this->entity_event)) return null; - $entity = $this->entity_event->getSummit()->getLocation($this->entity_event->getEntityId()); - if(is_null($entity)) return null; - return $this->entity_event->registerEntity($entity); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationImageEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationImageEventType.php deleted file mode 100644 index 3da2fb69..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationImageEventType.php +++ /dev/null @@ -1,37 +0,0 @@ -entity_event->getMetadata(); - if(!isset($metadata['location_id'])) return null; - $location = $this->entity_event->getSummit()->getLocation(intval($metadata['location_id'])); - if(is_null($location)) return null; - $entity = $location->getImage($this->entity_event->getEntityId()); - if(is_null($entity)) return null; - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitTicketTypeEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitTicketTypeEntityEventType.php deleted file mode 100644 index e6c78981..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitTicketTypeEntityEventType.php +++ /dev/null @@ -1,33 +0,0 @@ -entity_event->getSummit()->getTicketTypeById($this->entity_event->getEntityId()); - if(!is_null($entity)) - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitTypeEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitTypeEntityEventType.php deleted file mode 100644 index 907ae6a0..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitTypeEntityEventType.php +++ /dev/null @@ -1,34 +0,0 @@ -entity_event->getSummit()->getSummitType($this->entity_event->getEntityId()); - if(!is_null($entity)) - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitVenueFloorEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitVenueFloorEntityEventType.php deleted file mode 100644 index b0c34f2e..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitVenueFloorEntityEventType.php +++ /dev/null @@ -1,37 +0,0 @@ -entity_event->getMetadata(); - if(!isset($metadata['venue_id'])) return null; - $location = $this->entity_event->getSummit()->getLocation(intval($metadata['venue_id'])); - if (is_null($location)) return null; - $floor = $location->getFloor($this->entity_event->getEntityId()); - if(is_null($floor)) return null; - $this->entity_event->registerEntity($floor); - return $floor; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitWIFIConnectionEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitWIFIConnectionEntityEventType.php deleted file mode 100644 index 02b13fa7..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/SummitWIFIConnectionEntityEventType.php +++ /dev/null @@ -1,34 +0,0 @@ -entity_event->getSummit()->getWifiConnection($this->entity_event->getEntityId()); - if(!is_null($entity)) - $this->entity_event->registerEntity($entity); - return $entity; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/TrackFromTrackGroupEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/TrackFromTrackGroupEventType.php deleted file mode 100644 index e8c1b1c2..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/TrackFromTrackGroupEventType.php +++ /dev/null @@ -1,49 +0,0 @@ -entity_event->getMetadata(); - if(!isset($metadata['group_id'])) return null; - $group = $this->entity_event->getSummit()->getCategoryGroupById(intval($metadata['group_id'])); - if (is_null($group)) return null; - $this->entity_event->registerEntity($group); - return $group; - } - - /** - * @return void - */ - public function process() - { - $entity = $this->registerEntity(); - if(is_null($entity)) return; - $this->entity_event->setType('UPDATE'); - $this->entity_event->setEntityClassName('PresentationCategoryGroup'); - if($this->process_ctx->existsUpdateOp($this->entity_event)) return; - $this->process_ctx->registerUpdateOp($this->entity_event); - $this->process_ctx->registerEntityEvent($this->entity_event); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/WipeDataEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/WipeDataEntityEventType.php deleted file mode 100644 index 42438cef..00000000 --- a/app/Models/Foundation/Summit/EntityEvents/Types/WipeDataEntityEventType.php +++ /dev/null @@ -1,48 +0,0 @@ -entity_event->getEntityId() > 0) { - $attendee_id = intval($this->entity_event->getEntityId()); - $member_id = $this->process_ctx->getCurrentMemberId(); - $attendee = $this->entity_event->getSummit()->getAttendeeByMemberId($member_id); - // if we are not the recipient or its already processed then continue - if(is_null($attendee) || $attendee->getId() != $attendee_id) return; - } - $this->entity_event->setType('TRUNCATE'); - $this->process_ctx->registerEntityEvent($this->entity_event); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/ISummitEventLevel.php b/app/Models/Foundation/Summit/Events/ISummitEventLevel.php deleted file mode 100644 index 67510a29..00000000 --- a/app/Models/Foundation/Summit/Events/ISummitEventLevel.php +++ /dev/null @@ -1,28 +0,0 @@ - 'presentation', - 'getTypeId' => 'type', - 'getCreatedById' => 'created_by', - 'getUpdatedById' => 'updated_by', - ]; - - protected $hasPropertyMappings = [ - 'hasPresentation' => 'presentation', - 'hasType' => 'type', - 'hasCreatedBy' => 'created_by', - 'hasUpdatedBy' => 'updated_by', - ]; - - public function __construct() - { - parent::__construct(); - $this->is_completed = false; - } - - /** - * @ORM\ManyToOne(targetEntity="Presentation", inversedBy="actions", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="PresentationID", referencedColumnName="ID", onDelete="CASCADE") - * @var Presentation - */ - private $presentation; - - /** - * @ORM\ManyToOne(targetEntity="PresentationActionType", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="TypeID", referencedColumnName="ID", onDelete="CASCADE") - * @var PresentationActionType - */ - private $type; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="CreatedByID", referencedColumnName="ID", onDelete="SET NULL") - * @var Member - */ - private $created_by; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="UpdateByID", referencedColumnName="ID", onDelete="SET NULL") - * @var Member - */ - private $updated_by; - - /** - * @return bool - */ - public function isCompleted(): bool - { - return $this->is_completed; - } - - /** - * @param bool $is_completed - */ - public function setIsCompleted(bool $is_completed): void - { - $this->is_completed = $is_completed; - } - - /** - * @return Presentation - */ - public function getPresentation(): Presentation - { - return $this->presentation; - } - - /** - * @param Presentation $presentation - */ - public function setPresentation(Presentation $presentation): void - { - $this->presentation = $presentation; - } - - /** - * @return PresentationActionType - */ - public function getType(): PresentationActionType - { - return $this->type; - } - - /** - * @param PresentationActionType $type - */ - public function setType(PresentationActionType $type): void - { - $this->type = $type; - } - - /** - * @return Member - */ - public function getCreatedBy(): ?Member - { - return $this->created_by; - } - - /** - * @param Member $created_by - */ - public function setCreatedBy(Member $created_by): void - { - $this->created_by = $created_by; - } - - /** - * @return Member - */ - public function getUpdatedBy(): ?Member - { - return $this->updated_by; - } - - /** - * @param Member $updated_by - */ - public function setUpdatedBy(Member $updated_by): void - { - $this->updated_by = $updated_by; - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/Actions/PresentationActionType.php b/app/Models/Foundation/Summit/Events/Presentations/Actions/PresentationActionType.php deleted file mode 100644 index 81a7ba6e..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/Actions/PresentationActionType.php +++ /dev/null @@ -1,96 +0,0 @@ -order; - } - - /** - * @param int $order - */ - public function setOrder($order): void - { - $this->order = $order; - } - - /** - * @return string - */ - public function getLabel(): string - { - return $this->label; - } - - /** - * @param string $label - */ - public function setLabel(string $label): void - { - $this->label = $label; - } - - - public function __construct() - { - parent::__construct(); - $this->order = 1; - } - - /** - * @ORM\PostPersist - */ - public function inserted($args) - { - Event::dispatch(new PresentationActionTypeCreated($this)); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/ExtraQuestions/PresentationExtraQuestionAnswer.php b/app/Models/Foundation/Summit/Events/Presentations/ExtraQuestions/PresentationExtraQuestionAnswer.php deleted file mode 100644 index 969bc864..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/ExtraQuestions/PresentationExtraQuestionAnswer.php +++ /dev/null @@ -1,69 +0,0 @@ -presentation; - } - - /** - * @param Presentation $presentation - */ - public function setPresentation(Presentation $presentation): void - { - $this->presentation = $presentation; - } - - public function clearPresentation() - { - $this->presentation = null; - } - - use One2ManyPropertyTrait; - - protected $getIdMappings = [ - 'getPresentationId' => 'presentation', - 'getQuestionId' => 'question', - ]; - - protected $hasPropertyMappings = [ - 'hasPresentation' => 'presentation', - 'hasQuestion' => 'question', - ]; - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/IPresentationType.php b/app/Models/Foundation/Summit/Events/Presentations/IPresentationType.php deleted file mode 100644 index 1a905e97..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/IPresentationType.php +++ /dev/null @@ -1,23 +0,0 @@ -link; - } - - /** - * @param string $link - */ - public function setLink($link) - { - $this->link = $link; - } - /** - * @ORM\Column(name="Link", type="string") - * @var string - */ - private $link; - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMaterial.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMaterial.php deleted file mode 100644 index 1fc49569..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMaterial.php +++ /dev/null @@ -1,207 +0,0 @@ -presentation; - } - - /** - * @param Presentation $presentation - */ - public function setPresentation(Presentation $presentation){ - $this->presentation = $presentation; - } - - - public function unsetPresentation(){ - $this->presentation = null; - } - - /** - * @return int - */ - public function getPresentationId(){ - try { - return $this->presentation->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return string - */ - public function getDisplayOnSite() - { - return $this->display_on_site; - } - - /** - * @param string $display_on_site - */ - public function setDisplayOnSite($display_on_site) - { - $this->display_on_site = $display_on_site; - } - - /** - * @return string - */ - public function getFeatured() - { - return $this->featured; - } - - /** - * @param string $featured - */ - public function setFeatured($featured) - { - $this->featured = $featured; - } - - /** - * @ORM\Column(name="Name", type="string") - * @var string - */ - protected $name; - - /** - * @ORM\Column(name="Description", type="string") - * @var string - */ - protected $description; - - /** - * @ORM\Column(name="DisplayOnSite", type="boolean") - * @var string - */ - protected $display_on_site; - - /** - * @ORM\Column(name="`Order`", type="integer") - * @var int - */ - protected $order; - - /** - * @return int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order) - { - $this->order = $order; - } - - /** - * @ORM\Column(name="Featured", type="boolean") - * @var string - */ - protected $featured; - - public function __construct() - { - parent::__construct(); - $this->featured = false; - $this->display_on_site = false; - $this->order = 0; - } - - /** - * @ORM\PostPersist - */ - public function inserted($args){ - Event::fire(new PresentationMaterialCreated($this)); - } - - public function clearPresentation(){ - $this->presentation = null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMediaUpload.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMediaUpload.php deleted file mode 100644 index 80cf46b0..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMediaUpload.php +++ /dev/null @@ -1,154 +0,0 @@ -filename; - } - - /** - * @param string $filename - */ - public function setFilename(string $filename): void - { - $this->filename = $filename; - } - - /** - * @return SummitMediaUploadType|null - */ - public function getMediaUploadType(): ?SummitMediaUploadType - { - return $this->media_upload_type; - } - - /** - * @param SummitMediaUploadType $media_upload_type - */ - public function setMediaUploadType(SummitMediaUploadType $media_upload_type): void - { - $this->media_upload_type = $media_upload_type; - } - - /** - * @return bool - */ - public function isMandatory():bool{ - return $this->media_upload_type->isMandatory(); - } - - /** - * @return int - */ - public function getMediaUploadTypeId(){ - try { - return is_null($this->media_upload_type) ? 0 : $this->media_upload_type->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasMediaUploadType():bool{ - return $this->getMediaUploadTypeId() > 0; - } - - public function clearMediaUploadType(){ - $this->media_upload_type = null; - } - - /** - * @param string $storageType - * @param string|null $mountingFolder - * @return string - */ - public function getRelativePath(string $storageType = IStorageTypesConstants::PublicType, ?string $mountingFolder = null):string { - return sprintf('%s/%s', $this->getPath($storageType, $mountingFolder), $this->getFilename()); - } - - /** - * @param string $storageType - * @param string|null $mountingFolder - * @return string - */ - public function getPath(string $storageType = IStorageTypesConstants::PublicType, ?string $mountingFolder = null): string { - - if(empty($mountingFolder)) - $mountingFolder = Config::get('mediaupload.mounting_folder'); - - Log::debug(sprintf("PresentationMediaUpload::getPath storageType %s mountingFolder %s", $storageType, $mountingFolder)); - - $summit = $this->getPresentation()->getSummit(); - $presentation = $this->getPresentation(); - $format = $storageType == IStorageTypesConstants::PublicType ? '%s/%s/%s': '%s/'.IStorageTypesConstants::PrivateType.'/%s/%s'; - - if($this->legacy_path_format) - return sprintf($format, $mountingFolder, $summit->getId(), $presentation->getId()); - - $presentation->generateSlug(); - return sprintf($format, $mountingFolder, sprintf("%s-%s", $summit->getId(), filter_var($summit->getRawSlug(), FILTER_SANITIZE_ENCODED)), sprintf("%s-%s", $presentation->getId(), filter_var($presentation->getSlug(), FILTER_SANITIZE_ENCODED))); - } - - public function __construct() - { - parent::__construct(); - $this->legacy_path_format = true; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationSlide.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationSlide.php deleted file mode 100644 index 59fd72f2..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationSlide.php +++ /dev/null @@ -1,104 +0,0 @@ -slide; - } - - public function clearSlide(){ - $this->slide = null; - } - - /** - * @param File $slide - */ - public function setSlide($slide) - { - $this->slide = $slide; - } - - /** - * @return string - */ - public function getLink() - { - return $this->link; - } - - /** - * @param string $link - */ - public function setLink($link) - { - $this->link = $link; - } - - public function clearLink():void - { - $this->link = ""; - } - - /** - * @return bool - */ - public function hasSlide(){ - return $this->getSlideId() > 0; - } - - /** - * @return int - */ - public function getSlideId(){ - try{ - return !is_null($this->slide) ? $this->slide->getId():0; - } - catch(\Exception $ex){ - return 0; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationVideo.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationVideo.php deleted file mode 100644 index 753c7006..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationVideo.php +++ /dev/null @@ -1,151 +0,0 @@ -youtube_id; - } - - /** - * @param string $youtube_id - */ - public function setYoutubeId($youtube_id) - { - $this->youtube_id = $youtube_id; - } - - /** - * @return \DateTime - */ - public function getDateUploaded() - { - return $this->date_uploaded; - } - - /** - * @param \DateTime $date_uploaded - */ - public function setDateUploaded($date_uploaded) - { - $this->date_uploaded = $date_uploaded; - } - - /** - * @return bool - */ - public function getHighlighted() - { - return (bool)$this->highlighted; - } - - /** - * @param bool $highlighted - */ - public function setHighlighted($highlighted) - { - $this->highlighted = $highlighted; - } - - /** - * @return int - */ - public function getViews() - { - return $this->views; - } - - /** - * @param int $views - */ - public function setViews($views) - { - $this->views = $views; - } - - /** - * @ORM\Column(name="DateUploaded", type="datetime") - * @var \DateTime - */ - private $date_uploaded; - - /** - * @ORM\Column(name="Highlighted", type="boolean") - * @var bool - */ - private $highlighted; - - /** - * @ORM\Column(name="Views", type="integer") - * @var int - */ - private $views; - - public function __construct() - { - parent::__construct(); - $this->highlighted = false; - $this->views = 0; - $this->date_uploaded = new \DateTime(); - $this->external_url = null; - } - - /** - * @return string - */ - public function getExternalUrl(): ?string - { - return $this->external_url; - } - - /** - * @param string $external_url - */ - public function setExternalUrl(?string $external_url): void - { - $this->external_url = $external_url; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/Presentation.php b/app/Models/Foundation/Summit/Events/Presentations/Presentation.php deleted file mode 100644 index 9339921d..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/Presentation.php +++ /dev/null @@ -1,1692 +0,0 @@ -to_record; - } - - /** - * @param bool $to_record - */ - public function setToRecord($to_record) - { - $this->to_record = $to_record; - } - - /** - * @return boolean - */ - public function getToRecord() - { - return $this->to_record; - } - - /** - * Presentation constructor. - */ - public function __construct() - { - parent::__construct(); - $this->progress = self::PHASE_NEW; - $this->materials = new ArrayCollection(); - $this->speakers = new ArrayCollection(); - $this->answers = new ArrayCollection(); - $this->comments = new ArrayCollection(); - $this->track_chair_views = new ArrayCollection(); - $this->votes = new ArrayCollection(); - $this->category_changes_requests = new ArrayCollection(); - $this->selected_presentations = new ArrayCollection(); - $this->actions = new ArrayCollection(); - $this->extra_question_answers = new ArrayCollection(); - $this->to_record = false; - $this->attending_media = false; - $this->will_all_speakers_attend = false; - $this->disclaimer_accepted_date = null; - } - - /** - * @return string - */ - public function getProblemAddressed() - { - return $this->problem_addressed; - } - - /** - * @param string $problem_addressed - */ - public function setProblemAddressed($problem_addressed) - { - $this->problem_addressed = $problem_addressed; - } - - /** - * @return string - */ - public function getAttendeesExpectedLearnt() - { - return $this->attendees_expected_learnt; - } - - /** - * @param string $attendees_expected_learnt - */ - public function setAttendeesExpectedLearnt($attendees_expected_learnt) - { - $this->attendees_expected_learnt = $attendees_expected_learnt; - } - - /** - * @return string - */ - public function getClassName() - { - return self::ClassNamePresentation; - } - - /** - * @return ArrayCollection|PresentationSpeaker[] - */ - public function getSpeakers() - { - return $this->speakers; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function addSpeaker(PresentationSpeaker $speaker) - { - if ($this->speakers->contains($speaker)) return; - $this->speakers->add($speaker); - $speaker->addPresentation($this); - } - - public function clearSpeakers() - { - $this->speakers->clear(); - } - - /** - * @return int[] - */ - public function getSpeakerIds() - { - return $this->speakers->map(function ($entity) { - return $entity->getId(); - })->toArray(); - } - - /** - * @return PresentationVideo[] - */ - public function getVideos() - { - return $this->materials->filter(function ($element) { - return $element instanceof PresentationVideo; - }); - } - - /** - * @param int $material_id - * @return PresentationMaterial|null - */ - public function getMaterial($material_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($material_id))); - $material = $this->materials->matching($criteria)->first(); - return $material === false ? null : $material; - } - - /** - * @param PresentationVideo $video - * @return $this - */ - public function addVideo(PresentationVideo $video) - { - $this->materials->add($video); - $video->setPresentation($this); - $video->setOrder($this->getMaterialsMaxOrder() + 1); - return $this; - } - - public function getVideosWithExternalUrls(){ - return $this->materials->filter(function ($element) { - return $element instanceof PresentationVideo && !empty($element->getExternalUrl()); - }); - } - - /** - * @return bool - */ - public function hasVideos() - { - return count($this->getVideos()) > 0; - } - - /** - * @param int $video_id - * @return PresentationVideo - */ - public function getVideoBy($video_id) - { - $res = $this->materials - ->filter(function ($element) use ($video_id) { - return $element instanceof PresentationVideo && $element->getId() == $video_id; - }) - ->first(); - return $res === false ? null : $res; - } - - /** - * @param int $slide_id - * @return PresentationSlide - */ - public function getSlideBy($slide_id) - { - $res = $this->materials - ->filter(function ($element) use ($slide_id) { - return $element instanceof PresentationSlide && $element->getId() == $slide_id; - }) - ->first(); - return $res === false ? null : $res; - } - - /** - * @param int $link_id - * @return PresentationLink - */ - public function getLinkBy($link_id) - { - $res = $this->materials - ->filter(function ($element) use ($link_id) { - return $element instanceof PresentationLink && $element->getId() == $link_id; - }) - ->first(); - return $res === false ? null : $res; - } - - /** - * @param int $mediaUploadId - * @return PresentationMediaUpload - */ - public function getMediaUploadBy($mediaUploadId) - { - $res = $this->materials - ->filter(function ($element) use ($mediaUploadId) { - return $element instanceof PresentationMediaUpload && $element->getId() == $mediaUploadId; - }) - ->first(); - return $res === false ? null : $res; - } - - - /** - * @param PresentationVideo $video - */ - public function removeVideo(PresentationVideo $video) - { - $this->materials->removeElement($video); - $video->unsetPresentation(); - } - - /** - * @param PresentationSlide $slide - */ - public function removeSlide(PresentationSlide $slide) - { - $this->materials->removeElement($slide); - $slide->unsetPresentation(); - } - - /** - * @param PresentationLink $link - */ - public function removeLink(PresentationLink $link) - { - $this->materials->removeElement($link); - $link->unsetPresentation(); - } - - /** - * @param PresentationMediaUpload $mediaUpload - */ - public function removeMediaUpload(PresentationMediaUpload $mediaUpload) - { - $this->materials->removeElement($mediaUpload); - $mediaUpload->unsetPresentation(); - } - - /** - * @param PresentationSpeaker $speaker - */ - public function removeSpeaker(PresentationSpeaker $speaker) - { - if (!$this->speakers->contains($speaker)) return; - $this->speakers->removeElement($speaker); - } - - /** - * @param PresentationSpeaker $speaker - * @return bool - */ - public function isSpeaker(PresentationSpeaker $speaker) - { - return $this->speakers->contains($speaker); - } - - /** - * @return PresentationSlide[] - */ - public function getSlides() - { - return $this->materials->filter(function ($element) { - return $element instanceof PresentationSlide; - }); - } - - /** - * @param PresentationSlide $slide - * @return $this - */ - public function addSlide(PresentationSlide $slide) - { - $this->materials->add($slide); - $slide->setPresentation($this); - $slide->setOrder($this->getMaterialsMaxOrder() + 1); - return $this; - } - - /** - * @return ArrayCollection|PresentationMediaUpload[] - */ - public function getMediaUploads() - { - return $this->materials->filter(function ($element) { - return $element instanceof PresentationMediaUpload; - }); - } - - /** - * @param SummitMediaUploadType $media_upload_type - * @return bool - */ - public function hasMediaUploadByType(SummitMediaUploadType $media_upload_type): bool - { - $res = $this->materials->filter(function ($element) use ($media_upload_type) { - return $element instanceof PresentationMediaUpload && $element->getMediaUploadTypeId() == $media_upload_type->getId(); - }); - return $res->count() > 0; - } - - /** - * @param PresentationMediaUpload $mediaUpload - * @return $this - */ - public function addMediaUpload(PresentationMediaUpload $mediaUpload) - { - $this->materials->add($mediaUpload); - $mediaUpload->setPresentation($this); - $mediaUpload->setOrder($this->getMaterialsMaxOrder() + 1); - return $this; - } - - /** - * @return int - */ - protected function getMaterialsMaxOrder() - { - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $material = $this->materials->matching($criteria)->first(); - return $material === false ? 0 : $material->getOrder(); - } - - /** - * @return bool - */ - public function hasSlides() - { - return count($this->getSlides()) > 0; - } - - /** - * @return PresentationLink[] - */ - public function getLinks() - { - return $this->materials->filter(function ($element) { - return $element instanceof PresentationLink; - }); - } - - /** - * @return bool - */ - public function hasLinks() - { - return count($this->getLinks()) > 0; - } - - /** - * @param PresentationLink $link - * @return $this - */ - public function addLink(PresentationLink $link) - { - $this->materials->add($link); - $link->setPresentation($this); - $link->setOrder($this->getMaterialsMaxOrder() + 1); - return $this; - } - - /** - * @return int - */ - public function getModeratorId() - { - try { - return !is_null($this->moderator) ? $this->moderator->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - public function hasModerator(): bool - { - return $this->getModeratorId() > 0; - } - - /** - * @return int - */ - public function getSelectionPlanId() - { - try { - return !is_null($this->selection_plan) ? $this->selection_plan->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - - /** - * @return PresentationSpeaker - */ - public function getModerator() - { - return $this->moderator; - } - - /** - * @param PresentationSpeaker $moderator - */ - public function setModerator(PresentationSpeaker $moderator) - { - $this->moderator = $moderator; - } - - public function unsetModerator() - { - $this->moderator = null; - } - - /** - * @return string - */ - public function getStatus() - { - return $this->status; - } - - /** - * @param string $status - */ - public function setStatus($status) - { - $this->status = $status; - } - - /** - * @return string - */ - public function getStatusNice() - { - if ($this->isPublished()) - return 'Accepted'; - return $this->status; - } - - /** - * @return string - */ - public function getProgressNice() - { - switch ($this->progress) { - case self::PHASE_NEW: - return 'NEW'; - break; - case self::PHASE_SUMMARY: - return 'SUMMARY'; - break; - case self::PHASE_UPLOADS: - return 'UPLOADS'; - break; - case self::PHASE_TAGS: - return 'TAGS'; - break; - case self::PHASE_SPEAKERS: - return 'SPEAKERS'; - break; - case self::PHASE_COMPLETE: - return 'COMPLETE'; - break; - default: - return 'NEW'; - break; - } - } - - /** - * @return mixed - */ - public function getProgress() - { - return $this->progress; - } - - /** - * @return bool - */ - public function isCompleted(): bool - { - return $this->progress == Presentation::PHASE_COMPLETE; - } - - /** - * @param int $progress - */ - public function setProgress(int $progress) - { - if ($this->progress < $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; - } - - /** - * @return bool - */ - public function getAttendingMedia() - { - return $this->attending_media; - } - - /** - * @param bool $attending_media - */ - public function setAttendingMedia($attending_media) - { - $this->attending_media = $attending_media; - } - - /** - * @return string - * @throws ValidationException - */ - public function getSelectionStatus() - { - - $session_sel = $this->createQuery("SELECT sp from models\summit\SummitSelectedPresentation sp - JOIN sp.list l - JOIN sp.presentation p - WHERE p.id = :presentation_id - AND sp.collection = :collection - AND l.list_type = :list_type - AND l.list_class = :list_class") - ->setParameter('presentation_id', $this->id) - ->setParameter('collection', SummitSelectedPresentation::CollectionSelected) - ->setParameter('list_type', SummitSelectedPresentationList::Group) - ->setParameter('list_class', SummitSelectedPresentationList::Session)->getResult(); - - // Error out if a talk has more than one selection - if (count($session_sel) > 1) { - throw new ValidationException(sprintf('presentation %s has more than 1 (one) selection.', $this->id)); - } - - $selection = null; - if (count($session_sel) == 1) { - $selection = $session_sel[0]; - } - - if (!$selection) { - return Presentation::SelectionStatus_Unaccepted; - } - if ($selection->getOrder() <= $this->getCategory()->getSessionCount()) { - return Presentation::SelectionStatus_Accepted; - } - - return Presentation::SelectionStatus_Alternate; - } - - public function getRank(): ?int - { - $session_sel = $this->createQuery("SELECT sp from models\summit\SummitSelectedPresentation sp - JOIN sp.list l - JOIN sp.presentation p - WHERE p.id = :presentation_id - AND sp.collection = :collection - AND l.list_type = :list_type - AND l.list_class = :list_class") - ->setParameter('presentation_id', $this->id) - ->setParameter('collection', SummitSelectedPresentation::CollectionSelected) - ->setParameter('list_type', SummitSelectedPresentationList::Group) - ->setParameter('list_class', SummitSelectedPresentationList::Session)->getResult(); - - // Error out if a talk has more than one selection - if (count($session_sel) > 1) { - throw new ValidationException(sprintf('presentation %s has more than 1 (one) selection.', $this->id)); - } - - $selection = null; - - if (count($session_sel) == 1) { - $selection = $session_sel[0]; - } - - if (!$selection) { - return null; - } - - return $selection->getOrder(); - } - - /** - * @return SelectionPlan|null - */ - public function getSelectionPlan():?SelectionPlan - { - return $this->selection_plan; - } - - /** - * @param SelectionPlan $selection_plan - */ - public function setSelectionPlan($selection_plan) - { - $this->selection_plan = $selection_plan; - } - - public function clearSelectionPlan() - { - $this->selection_plan = null; - } - - /** - * @deprecated - * @return Member - */ - public function getCreator() - { - return $this->created_by; - } - - /** - * @deprecated moved to created by attribute - * @param Member $creator - */ - public function setCreator(Member $creator) - { - $this->created_by = $creator; - } - - /** - * @deprecated - * @return TrackAnswer[] - */ - public function getAnswers() - { - return $this->answers; - } - - /** - * @deprecated - * @param TrackAnswer[] $answers - */ - public function setAnswers($answers) - { - $this->answers = $answers; - } - - /** - * @deprecated - * @param TrackAnswer $answer - */ - public function addAnswer(TrackAnswer $answer) - { - $this->answers->add($answer); - $answer->setPresentation($this); - } - - /** - * @param string $link - * @return PresentationLink|null - */ - public function findLink($link) - { - $links = $this->getLinks(); - - foreach ($links as $entity) { - if ($entity->getLink() == $link) - return $entity; - } - return null; - } - - public function clearLinks() - { - $links = $this->getLinks(); - - foreach ($links as $link) { - $this->materials->removeElement($link); - $link->clearPresentation(); - } - } - - /** - * @deprecated - * @param TrackQuestionTemplate $question - * @return TrackAnswer|null - */ - public function getTrackExtraQuestionAnswer(TrackQuestionTemplate $question) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('question', $question)); - $res = $this->answers->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @return SummitPresentationComment[] - */ - public function getPublicComments() - { - return $this->comments->filter(function ($element) { - return $element instanceof SummitPresentationComment && $element->isPublic(); - }); - } - - /** - * @return int - */ - public function getCommentsCount():int{ - return $this->comments->count(); - } - - - /** - * @return ArrayCollection|SummitPresentationComment[] - */ - public function getComments(){ - return $this->comments; - } - - /** - * @deprecated - * @return int - */ - public function getCreatorId() - { - try { - if (is_null($this->created_by)) return 0; - return $this->created_by->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @param PresentationSpeaker $speaker - * @return bool - */ - public function canEdit(PresentationSpeaker $speaker) - { - if ($this->getCreatedById() == $speaker->getMemberId()) return true; - if ($this->getModeratorId() == $speaker->getId()) return true; - if ($this->isSpeaker($speaker)) return true; - return false; - } - - - /** - * @return bool - */ - public function fulfilMediaUploadsConditions():bool{ - - $summitMediaUploadCount = $this->summit->getMediaUploadsMandatoryCount(); - if($summitMediaUploadCount === 0) return true; - if($summitMediaUploadCount > $this->getMediaUploadsMandatoryCount()) return false; - return true; - } - - /** - * @return bool - */ - public function fulfilSpeakersConditions(): bool - { - $type = $this->type; - if (!$type instanceof PresentationType) return false; - - if ($type->isUseModerator()) { - $count = $this->getModeratorId() > 0 ? 1 : 0; - $max = $type->getMaxModerators(); - $min = $type->getMinModerators(); - if ($type->isModeratorMandatory() && $min > $count) return false; - if ($count > $max) return false; - } - - if ($type->isUseSpeakers()) { - $count = $this->speakers->count(); - $max = $type->getMaxSpeakers(); - $min = $type->getMinSpeakers(); - if ($type->isAreSpeakersMandatory() && $min > $count) return false; - if ($count > $max) return false; - } - - return true; - } - - /** - * @param PresentationMaterial $material - * @param int $new_order - * @throws ValidationException - */ - public function recalculateMaterialOrder(PresentationMaterial $material, $new_order) - { - self::recalculateOrderForSelectable($this->materials, $material, $new_order); - } - - use OrderableChilds; - - /** - * @return bool - */ - public function isSubmitted(): bool - { - return $this->progress == Presentation::PHASE_COMPLETE && $this->status == Presentation::STATUS_RECEIVED; - } - - /** - * @return string - */ - public function getSlug(): ?string - { - return $this->slug; - } - - protected static $default_replacements = [ - '/\s/' => '-', // remove whitespace - '/_/' => '-', // underscores to dashes - '/[^A-Za-z0-9+.\-]+/' => '', // remove non-ASCII chars, only allow alphanumeric plus dash and dot - '/[\-]{2,}/' => '-', // remove duplicate dashes - '/^[\.\-_]+/' => '', // Remove all leading dots, dashes or underscores - ]; - - public function generateSlug(): void - { - if (empty($this->title)) return; - $this->slug = trim(Transliterator::utf8ToAscii($this->title)); - - foreach (self::$default_replacements as $regex => $replace) { - $this->slug = preg_replace($regex, $replace, $this->slug); - } - } - - /** - * @param string $title - * @return $this - */ - public function setTitle($title) - { - $this->title = $title; - $this->generateSlug(); - return $this; - } - - /** - * Gets a link to edit this presentation - * - * @return string - */ - public function getEditLink(): string - { - return sprintf - ( - "%s/app/%s/presentations/%s/summary", - Config::get('cfp.base_url'), - $this->summit->getRawSlug(), - $this->id - ); - } - - /** - * @return int - */ - public function getMediaUploadsMandatoryCount(): int - { - return $this->materials->filter(function ($element) { - return $element instanceof PresentationMediaUpload && $element->isMandatory(); - })->count(); - } - - /** - * @param Member $viewer - */ - public function addTrackChairView(Member $viewer) - { - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('viewer', $viewer)); - if($this->track_chair_views->matching($criteria)->count() > 0) - return; - $view = PresentationTrackChairView::build($viewer, $this); - $this->track_chair_views->add($view); - } - - /** - * @param Member $commenter - * @param string $body - * @param bool $is_public - * @return SummitPresentationComment - */ - public function addTrackChairComment(Member $commenter, string $body, $is_public = true) - { - $comment = SummitPresentationComment::createComment - ( - $commenter, - $this, - $body, - $is_public - ); - - $this->comments->add($comment); - return $comment; - } - - /** - * @param Member $commenter - * @param string $body - * @return SummitPresentationComment - */ - public function addTrackChairNotification(Member $commenter, string $body) - { - $comment = SummitPresentationComment::createNotification - ( - $commenter, - $this, - $body - ); - - $this->comments->add($comment); - return $comment; - } - - public function hasViews(): bool - { - return $this->track_chair_views->count() > 0; - } - - /** - * @return ArrayCollection|PresentationTrackChairView[] - */ - public function getViewers() - { - return $this->track_chair_views; - } - - /** - * @return array - */ - public function getMemberViewers(){ - return array_map(function ($view) { - return $view->getViewer(); - }, $this->track_chair_views->getValues()); - } - - public function getViewsCount(): int - { - return $this->track_chair_views->count(); - } - - public function clearViews():void{ - $this->track_chair_views->clear(); - } - - /** - * @param string $list_class - * @return bool - * @throws \Doctrine\ORM\NonUniqueResultException - */ - public function isGroupSelected($list_class = SummitSelectedPresentationList::Session): bool - { - return $this->createQuery("SELECT COUNT(sp.id) from models\summit\SummitSelectedPresentation sp - JOIN sp.list l - JOIN sp.presentation p - WHERE p.id = :presentation_id - AND sp.collection = :collection - AND l.list_type = :list_type - AND l.list_class = :list_class") - ->setParameter('presentation_id', $this->id) - ->setParameter('collection', SummitSelectedPresentation::CollectionSelected) - ->setParameter('list_type', SummitSelectedPresentationList::Group) - ->setParameter('list_class', $list_class)->getSingleScalarResult() > 0; - } - - /** - * @param Member $member - * @param string $list_class - * @return SummitSelectedPresentation|null - */ - public function getSelectionByMemberAndListClass(Member $member, $list_class = SummitSelectedPresentationList::Session): ?SummitSelectedPresentation - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('member', $member)); - $selection = $this->selected_presentations->matching($criteria)->filter(function ($election) use ($list_class) { - $list = $election->getList(); - return $list->getListClass() === $list_class; - })->first(); - - return $selection === false ? null : $selection; - } - - /** - * @param Member $member - * @param string $list_class - * @return string|null - */ - public function getSelectionCurrentSelectionType(Member $member, $list_class = SummitSelectedPresentationList::Session): ?string - { - $selection = $this->getSelectionByMemberAndListClass($member, $list_class); - if (is_null($selection)) return null; - return $selection->getCollection(); - } - - /** - * @param string $collection_type - * @return array|Member[] - */ - public function getSelectionMembers(string $collection_type): array - { - - $selections = $this->selected_presentations->filter(function ($selection) use ($collection_type) { - $list = $selection->getList(); - return $list->getListType() === SummitSelectedPresentationList::Individual - && $selection->getCollection() == $collection_type; - })->getValues(); - - if (!count($selections)) return []; - - return array_map(function ($selection) { - return $selection->getMember(); - }, $selections); - } - - /** - * @param string $collection_type - * @return int - */ - public function getSelectionMembersCount(string $collection_type): int{ - return $this->selected_presentations->filter(function ($selection) use ($collection_type) { - $list = $selection->getList(); - return $list->getListType() === SummitSelectedPresentationList::Individual - && $selection->getCollection() == $collection_type; - })->count(); - } - - /** - * @return array|Member[] - */ - public function getSelectors() - { - return $this->getSelectionMembers(SummitSelectedPresentation::CollectionSelected); - } - - /** - * @return int - */ - public function getSelectorsCount():int{ - return $this->getSelectionMembersCount(SummitSelectedPresentation::CollectionSelected); - } - - public function isSelectedByAnyone():bool{ - return $this->getSelectorsCount() > 0; - } - - /** - * @return array|Member[] - */ - public function getLikers() - { - return $this->getSelectionMembers(SummitSelectedPresentation::CollectionMaybe); - } - - /** - * @return int - */ - public function getLikersCount():int{ - return $this->getSelectionMembersCount(SummitSelectedPresentation::CollectionMaybe); - } - - /** - * @return array|Member[] - */ - public function getPassers() - { - return $this->getSelectionMembers(SummitSelectedPresentation::CollectionPass); - } - - /** - * @return int - */ - public function getPassersCount():int{ - return $this->getSelectionMembersCount(SummitSelectedPresentation::CollectionPass); - } - - /** - * @return int - */ - public function getVotesTotalPoints(): int - { - $res = $this->createQuery("SELECT SUM(v.vote) from models\summit\PresentationVote v - JOIN v.presentation p - WHERE p.id = :presentation_id") - ->setParameter('presentation_id', $this->id)->getSingleScalarResult(); - return is_null($res) ? 0: intval($res); - } - - /** - * @return int - */ - public function getVotesCount(): int - { - - $res = $this->createQuery("SELECT COUNT(v.id) from models\summit\PresentationVote v - JOIN v.presentation p - WHERE p.id = :presentation_id") - ->setParameter('presentation_id', $this->id)->getSingleScalarResult(); - return is_null($res) ? 0: intval($res); - } - - /** - * @return float - */ - public function getVotesAverage(): float - { - $res = $this->createQuery("SELECT AVG(v.vote) from models\summit\PresentationVote v - JOIN v.presentation p - WHERE p.id = :presentation_id") - ->setParameter('presentation_id', $this->id)->getSingleScalarResult(); - return is_null($res) ? 0: floatval($res); - } - - /** - * @return float - */ - public function getPopularityScore():float - { - - $weight_select = floatval(Config::get("track_chairs.weight_select")); - $weight_maybe = floatval(Config::get("track_chairs.weight_maybe")); - $weight_pass = floatval(Config::get("track_chairs.weight_pass")); - - return ( - ($this->getSelectorsCount() * $weight_select) + - ($this->getLikersCount() * $weight_maybe) + - ($this->getPassersCount()* $weight_pass) - ); - } - - public function clearCategoryChangeRequests():void{ - $this->category_changes_requests->clear(); - } - - /** - * @return ArrayCollection|SummitCategoryChange[] - */ - public function getCategoryChangeRequests(){ - return $this->category_changes_requests; - } - - /** - * @return ArrayCollection|SummitCategoryChange[] - */ - public function getPendingCategoryChangeRequests(){ - $criteria = Criteria::create(); - $criteria->andWhere(Criteria::expr()->eq('status', ISummitCategoryChangeStatus::Pending)); - return $this->category_changes_requests->matching($criteria); - } - - /** - * @param Member $requester - * @param PresentationCategory $newCategory - * @return SummitCategoryChange - * @throws ValidationException - */ - public function addCategoryChangeRequest - ( - Member $requester, - PresentationCategory $newCategory - ):SummitCategoryChange - { - $criteria = Criteria::create(); - $criteria->andWhere(Criteria::expr()->eq('new_category', $newCategory)); - $criteria->andWhere(Criteria::expr()->eq('status', ISummitCategoryChangeStatus::Pending)); - - if($this->category_changes_requests->matching($criteria)->count() > 0) - throw new ValidationException(sprintf("There is already a pending category change request for this category.")); - - if($this->category->getId() == $newCategory->getId()) - throw new ValidationException("This presentation already belongs to %s.", $newCategory->getTitle()); - - $request = SummitCategoryChange::create($this, $requester, $newCategory); - - $this->category_changes_requests->add($request); - - return $request; - } - - /** - * @param int $id - * @return SummitCategoryChange|null - */ - public function getCategoryChangeRequest(int $id):?SummitCategoryChange{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $res = $this->category_changes_requests->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param Member $member - * @return int - * @throws ValidationException - */ - public function getRemainingSelectionsForMember(Member $member):int{ - $list = $this->category->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Individual, $member); - if(is_null($list) || !$list instanceof SummitSelectedPresentationList) return $this->category->getTrackChairAvailableSlots(); - return $list->getAvailableSlots(); - } - - /** - * @param PresentationActionType $type - * @return bool - */ - public function hasActionByType(PresentationActionType $type):bool{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('type', $type)); - return $this->actions->matching($criteria)->count() > 0; - } - - /** - * @param PresentationActionType $type - * @return PresentationAction|null - */ - public function getActionByType(PresentationActionType $type):?PresentationAction { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('type', $type)); - $res = $this->actions->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param int $id - * @return PresentationAction|null - */ - public function getActionById(int $id):?PresentationAction { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $res = $this->actions->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param bool $complete - * @param PresentationActionType $type - * @return PresentationAction|null - */ - public function setCompletionByType(bool $complete, PresentationActionType $type):?PresentationAction{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('type', $type)); - $res = $this->actions->matching($criteria)->first(); - if($res === false) return null; - $res->setIsCompleted($complete); - return $res; - } - - public function initializeActions():void { - Log::debug(sprintf("Presentation::initializeActions presentation %s", $this->id)); - foreach ($this->summit->getPresentationActionTypes() as $presentationActionType){ - if(!$this->hasActionByType($presentationActionType)){ - // create it - Log::debug - ( - sprintf - ( - "Presentation::initializeActions creating new presentation action for type %s", - $presentationActionType->getLabel() - ) - ); - $action = new PresentationAction(); - $action->setType($presentationActionType); - $action->setPresentation($this); - $this->actions->add($action); - } - } - } - - /** - * @param $a - * @param $b - * @return int - */ - private function actionSort($a,$b) { - $o1 = $a->getType()->getOrder(); - $o2 = $b->getType()->getOrder(); - if ($o1 == $o2) { - return 0; - } - return ($o1 < $o2) ? -1 : 1; - } - - /** - * @return array|PresentationAction[] - */ - public function getPresentationActions(){ - // ordered by type order - $array =$this->actions->toArray(); - usort($array, [ $this , 'actionSort' ]); - return $array; - } - - /** - * @return bool - */ - public function isWillAllSpeakersAttend(): bool - { - return $this->will_all_speakers_attend; - } - - /** - * @param bool $will_all_speakers_attend - */ - public function setWillAllSpeakersAttend(bool $will_all_speakers_attend): void - { - $this->will_all_speakers_attend = $will_all_speakers_attend; - } - - /** - * @return PresentationExtraQuestionAnswer[] - */ - public function getExtraQuestionAnswers() - { - return $this->extra_question_answers; - } - - /** - * @param SummitSelectionPlanExtraQuestionType $question - * @return PresentationExtraQuestionAnswer|null - */ - public function getExtraQuestionAnswerByQuestion(SummitSelectionPlanExtraQuestionType $question):?PresentationExtraQuestionAnswer{ - $answer = $this->extra_question_answers->matching( - $criteria = Criteria::create() - ->where(Criteria::expr()->eq("question", $question)) - )->first(); - return $answer ? $answer : null; - } - - public function clearExtraQuestionAnswers() - { - return $this->extra_question_answers->clear(); - } - - /** - * @param PresentationExtraQuestionAnswer $answer - */ - public function addExtraQuestionAnswer(PresentationExtraQuestionAnswer $answer){ - if($this->extra_question_answers->contains($answer)) return; - $this->extra_question_answers->add($answer); - $answer->setPresentation($this); - } - - /** - * @param PresentationExtraQuestionAnswer $answer - */ - public function removeExtraQuestionAnswer(PresentationExtraQuestionAnswer $answer){ - if(!$this->extra_question_answers->contains($answer)) return; - $this->extra_question_answers->removeElement($answer); - $answer->clearPresentation(); - } - - /** - * @return \DateTime - */ - public function getDisclaimerAcceptedDate(): ?\DateTime - { - return $this->disclaimer_accepted_date; - } - - /** - * @return bool - */ - public function isDisclaimerAccepted():bool{ - return !is_null($this->disclaimer_accepted_date); - } - - /** - * @param \DateTime $disclaimer_accepted_date - */ - public function setDisclaimerAcceptedDate(\DateTime $disclaimer_accepted_date): void - { - $this->disclaimer_accepted_date = $disclaimer_accepted_date; - } - - - public function clearMediaUploads():void{ - $mediaUploads = $this->getMediaUploads(); - - if ($mediaUploads->count()) { - Log::debug("Presentation::clearMediaUploads processing media uploads"); - $private_paths = []; - $public_paths = []; - - foreach ($mediaUploads as $mediaUpload) { - - $mediaUploadType = $mediaUpload->getMediaUploadType(); - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPrivateStorageType()); - - if (!is_null($strategy)) { - $privatePath = $mediaUpload->getPath(IStorageTypesConstants::PrivateType); - if(!isset($private_paths[$privatePath])) - $private_paths[$privatePath] = $strategy; - Log::debug(sprintf("Presentation::clearMediaUploads marking as deleted %s/%s ", $privatePath, $mediaUpload->getFilename())); - $strategy->markAsDeleted($privatePath, $mediaUpload->getFilename()); - } - - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPublicStorageType()); - - if (!is_null($strategy)) { - $publicPath = $mediaUpload->getPath(IStorageTypesConstants::PublicType); - if(!isset($public_paths[$publicPath])) - $public_paths[$publicPath] = $strategy; - Log::debug(sprintf("Presentation::clearMediaUploads marking as deleted %s/%s ", $publicPath, $mediaUpload->getFilename())); - $strategy->markAsDeleted($publicPath, $mediaUpload->getFilename()); - } - } - - foreach($private_paths as $path => $strategy){ - Log::debug(sprintf("Presentation::clearMediaUploads marking as deleted path ( private) %s.", $path)); - $strategy->markAsDeleted($path); - } - - foreach($public_paths as $path => $strategy){ - Log::debug(sprintf("Presentation::clearMediaUploads as deleted path ( public ) %s.", $path)); - $strategy->markAsDeleted($path); - } - - } - } -} diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php deleted file mode 100644 index 02d49502..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php +++ /dev/null @@ -1,711 +0,0 @@ -description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return string - */ - public function getCode() - { - return $this->code; - } - - /** - * @param string $code - */ - public function setCode($code) - { - $this->code = $code; - } - - /** - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @ORM\ManyToMany(targetEntity="models\summit\PresentationCategoryGroup", mappedBy="categories") - * @var PresentationCategoryGroup[] - */ - private $groups; - - /** - * @ORM\ManyToMany(targetEntity="models\summit\SummitTrackChair", mappedBy="categories") - * @var SummitTrackChair[] - */ - private $track_chairs; - - /** - * @ORM\ManyToMany(targetEntity="models\main\Tag", cascade={"persist"}) - * @ORM\JoinTable(name="PresentationCategory_AllowedTags", - * joinColumns={@ORM\JoinColumn(name="PresentationCategoryID", referencedColumnName="ID")}, - * inverseJoinColumns={@ORM\JoinColumn(name="TagID", referencedColumnName="ID")} - * ) - * @var Tag[] - */ - protected $allowed_tags; - - /** - * @ORM\ManyToMany(targetEntity="App\Models\Foundation\Summit\Events\Presentations\TrackQuestions\TrackQuestionTemplate", cascade={"persist"}, inversedBy="tracks") - * @ORM\JoinTable(name="PresentationCategory_ExtraQuestions", - * joinColumns={@ORM\JoinColumn(name="PresentationCategoryID", referencedColumnName="ID")}, - * inverseJoinColumns={@ORM\JoinColumn(name="TrackQuestionTemplateID", referencedColumnName="ID")} - * ) - * @var TrackQuestionTemplate[] - */ - protected $extra_questions; - - /** - * @ORM\ManyToOne(targetEntity="models\main\File", cascade={"persist","remove"}) - * @ORM\JoinColumn(name="IconID", referencedColumnName="ID") - * @var File - */ - protected $icon; - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitSelectedPresentationList", mappedBy="category", cascade={"persist","remove"}, orphanRemoval=true) - * @var SummitSelectedPresentationList[] - */ - protected $selection_lists; - - /** - * @return TrackQuestionTemplate[]|ArrayCollection - */ - public function getExtraQuestions(){ - return $this->extra_questions; - } - - /** - * @param TrackQuestionTemplate $extra_question - * @return $this - */ - public function addExtraQuestion(TrackQuestionTemplate $extra_question){ - if($this->extra_questions->contains($extra_question)) return $this; - $this->extra_questions->add($extra_question); - return $this; - } - - /** - * @param TrackQuestionTemplate $extra_question - * @return $this - */ - public function removeExtraQuestion(TrackQuestionTemplate $extra_question){ - if(!$this->extra_questions->contains($extra_question)) return $this; - $this->extra_questions->removeElement($extra_question); - return $this; - } - - /** - * @return $this - */ - public function clearExtraQuestions(){ - $this->extra_questions->clear(); - return $this; - } - /** - * @param int $id - * @return TrackQuestionTemplate|null - */ - public function getExtraQuestionById($id){ - $res = $this->extra_questions->filter(function(TrackQuestionTemplate $question) use($id){ - return $question->getIdentifier() == $id; - }); - $res = $res->first(); - return $res === false ? null : $res; - } - - /** - * @param string $name - * @return TrackQuestionTemplate|null - */ - public function getExtraQuestionByName($name){ - $res = $this->extra_questions->filter(function(TrackQuestionTemplate $question) use($name){ - return $question->getName() == trim($name); - }); - $res = $res->first(); - return $res === false ? null : $res; - } - - public function __construct() - { - parent::__construct(); - - $this->groups = new ArrayCollection; - $this->allowed_tags = new ArrayCollection; - $this->extra_questions = new ArrayCollection; - $this->track_chairs = new ArrayCollection; - $this->selection_lists = new ArrayCollection(); - $this->session_count = 0; - $this->alternate_count = 0; - $this->lightning_alternate_count = 0; - $this->lightning_count = 0; - $this->chair_visible = false; - $this->voting_visible = false; - } - - /** - * @return string - */ - public function getSlug() - { - return $this->slug; - } - - /** - * @return PresentationCategoryGroup[] - */ - public function getGroups(){ - return $this->groups; - } - - /** - * @param PresentationCategoryGroup $group - * @return $this - */ - public function addToGroup(PresentationCategoryGroup $group){ - if($this->groups->contains($group)) return $this; - $this->groups->add($group); - return $this; - } - - /** - * @param PresentationCategoryGroup $group - * @return $this - */ - public function removeFromGroup(PresentationCategoryGroup $group){ - if(!$this->groups->contains($group)) return $this; - $this->groups->removeElement($group); - return $this; - } - - /** - * @param SummitTrackChair $trackChair - * @return $this - */ - public function addToTrackChairs(SummitTrackChair $trackChair){ - if($this->track_chairs->contains($trackChair)) return $this; - $this->track_chairs->add($trackChair); - return $this; - } - - /** - * @return ArrayCollection|SummitTrackChair[] - */ - public function getTrackChairs(){ - return $this->track_chairs; - } - - /** - * @param SummitTrackChair $trackChair - * @return $this - */ - public function removeFromTrackChairs(SummitTrackChair $trackChair){ - if(!$this->track_chairs->contains($trackChair)) return $this; - $this->track_chairs->removeElement($trackChair); - return $this; - } - - /** - * @return Tag[] - */ - public function getAllowedTags(){ - return $this->allowed_tags; - } - - public function clearAllowedTags(){ - $this->allowed_tags->clear(); - } - - /** - * @param string $tag_value - * @return Tag|null - */ - public function getAllowedTagByVal($tag_value){ - $res = $this->allowed_tags->filter(function($e) use($tag_value){ - return strtolower(trim($e->getTag())) == strtolower(trim($tag_value)); - }); - return $res->count() > 0 ? $res->first() : null; - } - - /** - * @param Tag $tag - * @return $this - */ - public function addAllowedTag(Tag $tag){ - if($this->allowed_tags->contains($tag)) return $this; - $this->allowed_tags->add($tag); - return $this; - } - - /** - * @param int $group_id - * @return PresentationCategoryGroup|null - */ - public function getGroupById($group_id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($group_id))); - $res = $this->groups->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param int $group_id - * @return bool - */ - public function belongsToGroup($group_id){ - return $this->getGroupById($group_id) != null; - } - - /** - * @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; - } - - /** - * @return bool - */ - public function isVotingVisible() - { - return $this->voting_visible; - } - - /** - * @param bool $voting_visible - */ - public function setVotingVisible($voting_visible) - { - $this->voting_visible = $voting_visible; - } - - /** - * @return bool - */ - public function isChairVisible() - { - return $this->chair_visible; - } - - /** - * @param bool $chair_visible - */ - public function setChairVisible($chair_visible) - { - $this->chair_visible = $chair_visible; - } - - /** - * @return $this - */ - public function calculateSlug(){ - if(empty($this->title)) return $this; - $clean_title = preg_replace ("/[^a-zA-Z0-9 ]/", "", $this->title); - $this->slug = preg_replace('/\s+/', '-', strtolower($clean_title)); - return $this; - } - - /** - * @return SummitEvent[] - */ - public function getRelatedPublishedSummitEvents(){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this->summit); - $native_query->setParameter("track", $this); - - $res = $native_query->getResult(); - - return $res; - } - - /** - * @return int[] - */ - public function getRelatedPublishedSummitEventsIds(){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this->summit); - $native_query->setParameter("track", $this); - - $res = $native_query->getResult(); - - return $res; - } - - /** - * @return string|null - */ - public function getColor():?string - { - return $this->color; - } - - /** - * @param string|null $color - */ - public function setColor(?string $color) - { - $this->color = $color; - } - - /** - * @return File|null - */ - public function getIcon(): ?File - { - return $this->icon; - } - - /** - * @param File $icon - */ - public function setIcon(File $icon): void - { - $this->icon = $icon; - } - - public function clearIcon():void{ - $this->icon = null; - } - - /** - * @return bool - */ - public function hasIcon(){ - return $this->getIconId() > 0; - } - - /** - * @return int - */ - public function getIconId() - { - try{ - if(is_null($this->icon)) return 0; - return $this->icon->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return string|null - */ - public function getIconUrl():?string{ - $photoUrl = null; - if($this->hasIcon() && $photo = $this->getIcon()){ - $photoUrl = $photo->getUrl(); - } - return $photoUrl; - } - - public function addSelectionList(SummitSelectedPresentationList $selection_list){ - if($this->selection_lists->contains($selection_list)) return; - $this->selection_lists->add($selection_list); - $selection_list->setCategory($this); - } - - public function removeSelectionList(SummitSelectedPresentationList $selection_list){ - if(!$this->selection_lists->contains($selection_list)) return; - $this->selection_lists->removeElement($selection_list); - $selection_list->clearCategory($this); - } - - /** - * @param string $list_type - * @param Member|null $owner - * @return SummitSelectedPresentationList|null - * @throws ValidationException - */ - public function getSelectionListByTypeAndOwner(string $list_type, ?Member $owner = null):?SummitSelectedPresentationList{ - if(!in_array($list_type, SummitSelectedPresentationList::ValidListTypes)) - throw new ValidationException(sprintf("List Type %s is not valid.", $list_type)); - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('list_type', $list_type)); - $criteria->andWhere(Criteria::expr()->eq('category', $this)); - - if($list_type == SummitSelectedPresentationList::Individual){ - $criteria->andWhere(Criteria::expr()->eq('owner', $owner)); - } - - $list = $this->selection_lists->matching($criteria)->first(); - return $list === false ? null : $list; - } - - /** - * @return ArrayCollection|SummitSelectedPresentationList[] - */ - public function getSelectionLists(){ - return $this->selection_lists; - } - - /** - * @param int $list_id - * @return SummitSelectedPresentationList|null - */ - public function getSelectionListById(int $list_id):?SummitSelectedPresentationList{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $list_id)); - - $list = $this->selection_lists->matching($criteria)->first(); - return $list === false ? null : $list; - } - - public function isTrackChair(Member $member):bool{ - return $this->track_chairs->filter(function($t) use($member){ - return $t->getMember()->getId() == $member->getId(); - })->count() > 0; - } - - public function getTrackChairAvailableSlots():int{ - return $this->session_count + $this->alternate_count; - } - - /** - * @param Member $member - * @return SummitSelectedPresentationList - * @throws ValidationException - */ - public function createIndividualSelectionList(Member $member ):SummitSelectedPresentationList{ - if(!is_null($member)) { - $individual_selection_list = $this->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Individual, $member); - - if (is_null($individual_selection_list)) { - $individual_selection_list = new SummitSelectedPresentationList(); - Log::debug(sprintf("PresentationCategory::createSelectionLists adding individual list for track %s and member %s", $this->getId(), $member->getId())); - $individual_selection_list->setName(sprintf("%s Individual Selection List for %s", $member->getFullName(), $this->getTitle())); - $individual_selection_list->setListType(SummitSelectedPresentationList::Individual); - $individual_selection_list->setListClass(SummitSelectedPresentationList::Session); - $individual_selection_list->setOwner($member); - $this->addSelectionList($individual_selection_list); - } - } - return $individual_selection_list; - } - - /** - * @return SummitSelectedPresentationList - * @throws ValidationException - */ - public function createTeamSelectionList():SummitSelectedPresentationList{ - $team_selection_list = $this->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Group); - if (is_null($team_selection_list)) { - Log::debug(sprintf("PresentationCategory::createSelectionLists adding team list for track %s", $this->getId())); - $team_selection_list = new SummitSelectedPresentationList(); - $team_selection_list->setName(sprintf("Team Selections for %s", $this->getTitle())); - $team_selection_list->setListType(SummitSelectedPresentationList::Group); - $team_selection_list->setListClass(SummitSelectedPresentationList::Session); - $this->addSelectionList($team_selection_list); - } - return $team_selection_list; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php deleted file mode 100644 index 936b7802..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php +++ /dev/null @@ -1,224 +0,0 @@ -name; - } - - /** - * @param mixed $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return mixed - */ - public function getColor() - { - return $this->color; - } - - /** - * @param mixed $color - */ - public function setColor($color) - { - $this->color = $color; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @ORM\ManyToOne(targetEntity="Summit", inversedBy="category_groups") - * @ORM\JoinColumn(name="SummitID", referencedColumnName="ID") - * @var Summit - */ - protected $summit; - - public function setSummit($summit){ - $this->summit = $summit; - } - - /** - * @return int - */ - public function getSummitId(){ - try { - return is_null($this->summit) ? 0 : $this->summit->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - public function clearSummit(){ - $this->summit = null; - } - - /** - * @return Summit - */ - public function getSummit(){ - return $this->summit; - } - - public function __construct() - { - parent::__construct(); - $this->categories = new ArrayCollection; - } - - /** - * owning side - * @ORM\ManyToMany(targetEntity="models\summit\PresentationCategory", inversedBy="groups") - * @ORM\JoinTable(name="PresentationCategoryGroup_Categories", - * joinColumns={@ORM\JoinColumn(name="PresentationCategoryGroupID", referencedColumnName="ID")}, - * inverseJoinColumns={@ORM\JoinColumn(name="PresentationCategoryID", referencedColumnName="ID")} - * ) - * @var PresentationCategory[] - */ - protected $categories; - - /** - * @return PresentationCategory[] - */ - public function getCategories() - { - return $this->categories; - } - - /** - * @param PresentationCategory $track - */ - public function addCategory(PresentationCategory $track){ - $track->addToGroup($this); - $this->categories[] = $track; - } - - /** - * @param PresentationCategory $track - */ - public function removeCategory(PresentationCategory $track){ - $track->removeFromGroup($this); - $this->categories->removeElement($track); - } - - /** - * @param int $category_id - * @return PresentationCategory|null - */ - public function getCategoryById($category_id){ - /*$criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($category_id))); - $res = $this->categories->matching($criteria)->first(); - return $res === false ? null : $res;*/ - $res = $this->categories->filter(function(PresentationCategory $t) use($category_id){ - return $t->getId() == $category_id; - })->first(); - - return $res == false ? null : $res; - } - - /** - * @param int $category_id - * @return bool - */ - public function hasCategory($category_id){ - return $this->getCategoryById($category_id) != null; - } - - const ClassName = 'PresentationCategoryGroup'; - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - public static $metadata = [ - 'class_name' => self::ClassName, - 'id' => 'integer', - 'summit_id' => 'integer', - 'name' => 'string', - 'color' => 'string', - 'description' => 'string', - 'categories' => 'array' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return self::$metadata; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroupConstants.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroupConstants.php deleted file mode 100644 index 6622ad1f..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroupConstants.php +++ /dev/null @@ -1,26 +0,0 @@ -execute(['summit_id' => $summit->getId(), 'type' => $type]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0; - } catch (\Exception $ex) { - - } - return false; - } - - /** - * @return array() - */ - static public function presentationTypes() - { - return [IPresentationType::Presentation, IPresentationType::Keynotes, IPresentationType::LightingTalks, IPresentationType::Panel]; - } - - /** - * @return int - */ - public function getMaxSpeakers() - { - return $this->max_speakers; - } - - /** - * @return int - */ - public function getMinSpeakers() - { - return $this->min_speakers; - } - - /** - * @return int - */ - public function getMaxModerators() - { - return $this->max_moderators; - } - - /** - * @return int - */ - public function getMinModerators() - { - return $this->min_moderators; - } - - /** - * @return bool - */ - public function isUseSpeakers() - { - return $this->use_speakers; - } - - /** - * @return bool - */ - public function isAreSpeakersMandatory() - { - return $this->are_speakers_mandatory; - } - - /** - * @return bool - */ - public function isUseModerator() - { - return $this->use_moderator; - } - - /** - * @return bool - */ - public function isModeratorMandatory() - { - return $this->is_moderator_mandatory; - } - - /** - * @return bool - */ - public function isShouldBeAvailableOnCfp() - { - return $this->should_be_available_on_cfp; - } - - /** - * @return string - */ - public function getModeratorLabel() - { - return $this->moderator_label; - } - - public function getClassName() - { - return 'PresentationType'; - } - - const ClassName = 'PRESENTATION_TYPE'; - - /** - * @param int $max_speakers - */ - public function setMaxSpeakers($max_speakers) - { - $this->max_speakers = $max_speakers; - } - - /** - * @param int $min_speakers - */ - public function setMinSpeakers($min_speakers) - { - $this->min_speakers = $min_speakers; - } - - /** - * @param int $max_moderators - */ - public function setMaxModerators($max_moderators) - { - $this->max_moderators = $max_moderators; - } - - /** - * @param int $min_moderators - */ - public function setMinModerators($min_moderators) - { - $this->min_moderators = $min_moderators; - } - - /** - * @param bool $use_speakers - */ - public function setUseSpeakers($use_speakers) - { - $this->use_speakers = $use_speakers; - } - - /** - * @param bool $are_speakers_mandatory - */ - public function setAreSpeakersMandatory($are_speakers_mandatory) - { - $this->are_speakers_mandatory = $are_speakers_mandatory; - } - - /** - * @param bool $use_moderator - */ - public function setUseModerator($use_moderator) - { - $this->use_moderator = $use_moderator; - } - - /** - * @param bool $is_moderator_mandatory - */ - public function setIsModeratorMandatory($is_moderator_mandatory) - { - $this->is_moderator_mandatory = $is_moderator_mandatory; - } - - /** - * @param bool $should_be_available_on_cfp - */ - public function setShouldBeAvailableOnCfp($should_be_available_on_cfp) - { - $this->should_be_available_on_cfp = $should_be_available_on_cfp; - } - - /** - * @param string $moderator_label - */ - public function setModeratorLabel($moderator_label) - { - $this->moderator_label = $moderator_label; - } - - public function __construct() - { - parent::__construct(); - $this->are_speakers_mandatory = false; - $this->use_speakers = false; - $this->use_moderator = false; - $this->is_moderator_mandatory = false; - $this->should_be_available_on_cfp = false; - $this->allows_level = true; - $this->allowed_media_upload_types = new ArrayCollection(); - $this->max_moderators = 0; - $this->max_speakers = 0; - $this->min_moderators = 0; - $this->min_speakers = 0; - } - - public function addAllowedMediaUploadType(SummitMediaUploadType $type) - { - if ($this->allowed_media_upload_types->contains($type)) return; - $this->allowed_media_upload_types->add($type); - } - - public function removeAllowedMediaUploadType(SummitMediaUploadType $type) - { - if (!$this->allowed_media_upload_types->contains($type)) return; - $this->allowed_media_upload_types->removeElement($type); - } - - public function clearAllowedMediaUploadType() - { - $this->allowed_media_upload_types->clear(); - } - - public function getAllowedMediaUploadTypes() - { - return $this->allowed_media_upload_types; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationVote.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationVote.php deleted file mode 100644 index a59fb6a7..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/PresentationVote.php +++ /dev/null @@ -1,83 +0,0 @@ -vote; - } - - /** - * @return string - */ - public function getContent(): string - { - return $this->content; - } - - /** - * @return Member - */ - public function getVoter(): Member - { - return $this->voter; - } - - /** - * @return Presentation - */ - public function getPresentation(): Presentation - { - return $this->presentation; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/PrivatePresentationCategoryGroup.php b/app/Models/Foundation/Summit/Events/Presentations/PrivatePresentationCategoryGroup.php deleted file mode 100644 index c661bb8d..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/PrivatePresentationCategoryGroup.php +++ /dev/null @@ -1,244 +0,0 @@ -allowed_groups->contains($group)) return; - $this->allowed_groups->add($group); - } - - /** - * @param Group $group - */ - public function removeFromGroup(Group $group) - { - if (!$this->allowed_groups->contains($group)) return; - $this->allowed_groups->removeElement($group); - } - - /** - * @param int $group_id - * @return Group|null - */ - public function getGroupById($group_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($group_id))); - $res = $this->allowed_groups->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param int $group_id - * @return bool - */ - public function belongsToGroup($group_id) - { - return $this->getGroupById($group_id) != null; - } - - /** - * @return bool - */ - public function isSubmissionOpen() - { - - if (empty($this->submission_begin_date) || empty($this->submission_end_date)) { - return false; - } - - $start_date = new DateTime($this->submission_begin_date->getTimestamp(), new DateTimeZone('UTC')); - $end_date = new DateTime($this->submission_end_date->getTimestamp(), new DateTimeZone('UTC')); - $now = new DateTime('now', new DateTimeZone('UTC')); - - return ($now >= $start_date && $now <= $end_date); - } - - public function __construct() - { - parent::__construct(); - $this->allowed_groups = new ArrayCollection; - $this->max_submission_allowed_per_user = 0; - } - - /** - * @return DateTime - */ - public function getSubmissionBeginDate() - { - return $this->submission_begin_date; - } - - /** - * @return DateTime - */ - public function getSubmissionEndDate() - { - return $this->submission_end_date; - } - - /** - * @return int - */ - public function getMaxSubmissionAllowedPerUser() - { - return $this->max_submission_allowed_per_user; - } - - /** - * @return Group[] - */ - public function getAllowedGroups() - { - return $this->allowed_groups; - } - - const ClassName = 'PrivatePresentationCategoryGroup'; - - /** - * @return string - */ - public function getClassName() - { - return self::ClassName; - } - - /** - * @param DateTime $submission_begin_date - */ - public function setSubmissionBeginDate(DateTime $submission_begin_date) - { - $summit = $this->getSummit(); - if (!is_null($summit)) { - $submission_begin_date = $summit->convertDateFromTimeZone2UTC($submission_begin_date); - } - $this->submission_begin_date = $submission_begin_date; - } - - /** - * @param DateTime $submission_end_date - */ - public function setSubmissionEndDate(DateTime $submission_end_date) - { - $summit = $this->getSummit(); - if (!is_null($summit)) { - $submission_end_date = $summit->convertDateFromTimeZone2UTC($submission_end_date); - } - $this->submission_end_date = $submission_end_date; - } - - /** - * @param int $max_submission_allowed_per_user - */ - public function setMaxSubmissionAllowedPerUser($max_submission_allowed_per_user) - { - $this->max_submission_allowed_per_user = $max_submission_allowed_per_user; - } - - /** - * @return DateTime|null - */ - public function getLocalSubmissionBeginDate() - { - $res = null; - if(!empty($this->submission_begin_date)) { - $value = clone $this->submission_begin_date; - $summit = $this->getSummit(); - if(!is_null($summit)) - { - $res = $summit->convertDateFromUTC2TimeZone($value); - } - } - return $res; - } - - /** - * @return DateTime|null - */ - public function getLocalSubmissionEndDate() - { - $res = null; - if(!empty($this->submission_end_date)) { - $value = clone $this->submission_end_date; - $summit = $this->getSummit(); - if(!is_null($summit)) - { - $res = $summit->convertDateFromUTC2TimeZone($value); - } - } - return $res; - } - - - public static $metadata = [ - 'class_name' => self::ClassName, - 'submission_begin_date' => 'datetime', - 'submission_end_date' => 'datetime', - 'max_submission_allowed_per_user' => 'integer', - 'allowed_groups' => 'array' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(PresentationCategoryGroup::getMetadata(), self::$metadata); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/SpeakerPresentationLink.php b/app/Models/Foundation/Summit/Events/Presentations/SpeakerPresentationLink.php deleted file mode 100644 index ae967765..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/SpeakerPresentationLink.php +++ /dev/null @@ -1,114 +0,0 @@ -link = $link; - $this->title = $title; - } - - /** - * @return string - */ - public function getLink() - { - return $this->link; - } - - /** - * @param string $link - */ - public function setLink($link) - { - $this->link = $link; - } - - /** - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @return PresentationSpeaker - */ - public function getSpeaker() - { - return $this->speaker; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker($speaker) - { - $this->speaker = $speaker; - } - - /** - * @return int - */ - public function getSpeakerId(){ - try { - return !is_null($this->speaker) ? $this->speaker->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/ISummitCategoryChangeStatus.php b/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/ISummitCategoryChangeStatus.php deleted file mode 100644 index aaf0674f..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/ISummitCategoryChangeStatus.php +++ /dev/null @@ -1,26 +0,0 @@ - 'viewer', - 'getPresentationId' => 'presentation', - ]; - - protected $hasPropertyMappings = [ - 'hasViewer' => 'viewer', - 'hasPresentation' => 'presentation', - ]; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="TrackChairID", referencedColumnName="ID", onDelete="CASCADE") - * @var Member - */ - private $viewer; - - /** - * @ORM\ManyToOne(targetEntity="models\summit\Presentation", inversedBy="track_chair_views") - * @ORM\JoinColumn(name="PresentationID", referencedColumnName="ID", onDelete="CASCADE") - * @var Presentation - */ - private $presentation; - - /** - * @param Member $viewer - * @param Presentation $presentation - * @return PresentationTrackChairView - */ - public static function build(Member $viewer, Presentation $presentation){ - $view = new PresentationTrackChairView(); - $view->viewer = $viewer; - $view->presentation = $presentation; - return $view; - } - - /** - * @return Member - */ - public function getViewer(): Member - { - return $this->viewer; - } - - /** - * @return Presentation - */ - public function getPresentation(): Presentation - { - return $this->presentation; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitCategoryChange.php b/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitCategoryChange.php deleted file mode 100644 index 0efe1011..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitCategoryChange.php +++ /dev/null @@ -1,260 +0,0 @@ - 'presentation', - 'getNewCategoryId' => 'new_category', - 'getOldCategoryId' => 'old_category', - 'getRequesterId' => 'requester', - 'getAproverId' => 'aprover', - ]; - - protected $hasPropertyMappings = [ - 'hasPresentation' => 'presentation', - 'hasNewCategory' => 'new_category', - 'hasOldCategory' => 'old_category', - 'hasAprover' => 'aprover', - ]; - - - /** - * @return string - */ - public function getReason(): ?string - { - return $this->reason; - } - - /** - * @return int - */ - public function getStatus(): int - { - return $this->status; - } - - /** - * @return \DateTime - */ - public function getApprovalDate(): ?\DateTime - { - return $this->approval_date; - } - - /** - * @return Presentation - */ - public function getPresentation(): Presentation - { - return $this->presentation; - } - - /** - * @param Presentation $presentation - */ - public function setPresentation(Presentation $presentation): void - { - $this->presentation = $presentation; - } - - /** - * @return PresentationCategory - */ - public function getNewCategory(): PresentationCategory - { - return $this->new_category; - } - - /** - * @param PresentationCategory $new_category - */ - public function setNewCategory(PresentationCategory $new_category): void - { - $this->new_category = $new_category; - } - - /** - * @return PresentationCategory - */ - public function getOldCategory(): PresentationCategory - { - return $this->old_category; - } - - /** - * @param PresentationCategory $old_category - */ - public function setOldCategory(PresentationCategory $old_category): void - { - $this->old_category = $old_category; - } - - /** - * @return Member - */ - public function getRequester(): Member - { - return $this->requester; - } - - /** - * @return Member - */ - public function getAprover(): ?Member - { - return $this->aprover; - } - - public function __construct() - { - parent::__construct(); - $this->status = ISummitCategoryChangeStatus::Pending; - } - - /** - * @return string - */ - public function getNiceStatus():string{ - if($this->status == ISummitCategoryChangeStatus::Pending) return "Pending"; - if($this->status == ISummitCategoryChangeStatus::Rejected) return "Rejected"; - if($this->status == ISummitCategoryChangeStatus::Approved) return "Approved"; - return "Pending"; - } - - /** - * @return bool - */ - public function isPending():bool{ - return $this->status == ISummitCategoryChangeStatus::Pending; - } - - /** - * @param Member $aprover - * @param string|null $reason - * @throws \Exception - */ - public function approve(Member $aprover, ?string $reason = null):void{ - $this->setStatus($aprover, ISummitCategoryChangeStatus::Approved, $reason); - } - - /** - * @param Member $aprover - * @param string|null $reason - * @throws \Exception - */ - public function reject(Member $aprover, ?string $reason = null):void{ - $this->setStatus($aprover, ISummitCategoryChangeStatus::Rejected, $reason); - } - - /** - * @param Member $aprover - * @param int $status - * @param string|null $reason - * @throws \Exception - */ - private function setStatus(Member $aprover, int $status, ?string $reason = null):void{ - $this->aprover = $aprover; - $this->approval_date = new \DateTime('now', new \DateTimeZone('UTC')); - $this->status = $status; - $this->reason = empty($reason)? "No Reason":$reason; - } - - /** - * @param Presentation $presentation - * @param Member $requester - * @param PresentationCategory $newCategory - * @return SummitCategoryChange - */ - static public function create - ( - Presentation $presentation, - Member $requester, - PresentationCategory $newCategory - ):SummitCategoryChange{ - - $request = new SummitCategoryChange(); - $request->requester = $requester; - $request->presentation = $presentation; - $request->old_category = $presentation->getCategory(); - $request->new_category = $newCategory; - - return $request; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitPresentationComment.php b/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitPresentationComment.php deleted file mode 100644 index 6ee6ed94..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitPresentationComment.php +++ /dev/null @@ -1,216 +0,0 @@ -is_activity = false; - $this->is_public = false; - } - - /** - * @return string - */ - public function getBody(): string - { - return $this->body; - } - - /** - * @param string $body - */ - public function setBody(string $body): void - { - $this->body = $body; - } - - /** - * @return bool - */ - public function isActivity(): bool - { - return $this->is_activity; - } - - /** - * @param bool $is_activity - */ - public function setIsActivity(bool $is_activity): void - { - $this->is_activity = $is_activity; - } - - /** - * @return bool - */ - public function isPublic(): bool - { - return $this->is_public; - } - - /** - * @param bool $is_public - */ - public function setIsPublic(bool $is_public): void - { - $this->is_public = $is_public; - } - - /** - * @return Presentation - */ - public function getPresentation(): Presentation - { - return $this->presentation; - } - - /** - * @param Presentation $presentation - */ - public function setPresentation(Presentation $presentation): void - { - $this->presentation = $presentation; - } - - /** - * @return Member - */ - public function getCreator(): Member - { - return $this->creator; - } - - /** - * @param Member $creator - */ - public function setCreator(Member $creator): void - { - $this->creator = $creator; - } - - /** - * @return int - */ - public function getCreatorId():int - { - try{ - if(is_null($this->creator)) return 0; - return $this->creator->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getPresentationId():int - { - try{ - if(is_null($this->presentation)) return 0; - return $this->presentation->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - public static function createComment - ( - Member $creator, - Presentation $presentation, - string $body, - bool $is_public = true - ):SummitPresentationComment{ - $comment = new SummitPresentationComment(); - $comment->is_public = $is_public; - $comment->body = $body; - $comment->creator = $creator; - $comment->presentation = $presentation; - return $comment; - } - - public static function createNotification - ( - Member $creator, - Presentation $presentation, - string $body - ):SummitPresentationComment{ - $comment = new SummitPresentationComment(); - - $body = str_replace( - [ - '{member}', - '{presentation}' - ], - [ - $creator->getFullName(), - $presentation->getTitle() - ], - $body - ); - $comment->body = $body; - $comment->creator = $creator; - $comment->is_activity = true; - $comment->presentation = $presentation; - return $comment; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitSelectedPresentation.php b/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitSelectedPresentation.php deleted file mode 100644 index 200b9c08..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitSelectedPresentation.php +++ /dev/null @@ -1,206 +0,0 @@ -collection; - } - - /** - * @param string $collection - * @throws ValidationException - */ - public function setCollection(string $collection): void - { - if (!in_array($collection, self::ValidCollectionTypes)) - throw new ValidationException(sprintf("collection type %s is not valid", $collection)); - $this->collection = $collection; - } - - /** - * @return int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order) - { - $this->order = $order; - } - - /** - * @return SummitSelectedPresentationList|null - */ - public function getList():?SummitSelectedPresentationList - { - 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; - } - - public function getPresentationId(): int - { - try { - return is_null($this->presentation) ? 0 : $this->presentation->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - public function getMemberId(): int - { - try { - return is_null($this->member) ? 0 : $this->member->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - public function getListId(): int - { - try { - return is_null($this->list) ? 0 : $this->list->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @param SummitSelectedPresentationList $selection_list - * @param Presentation $presentation - * @param string $collection - * @param Member|null $owner - * @return SummitSelectedPresentation - */ - static public function create( - SummitSelectedPresentationList $selection_list, - Presentation $presentation, - string $collection, - ?Member $owner): SummitSelectedPresentation - { - $selection = new SummitSelectedPresentation(); - $selection->list = $selection_list; - $selection->presentation = $presentation; - $selection->collection = $collection; - $selection->member = $owner; - return $selection; - } - - public function clearList():void{ - $this->list = null; - } -} diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitSelectedPresentationList.php b/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitSelectedPresentationList.php deleted file mode 100644 index 4ae39c7e..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitSelectedPresentationList.php +++ /dev/null @@ -1,370 +0,0 @@ -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; - } - - public function clearCategory(){ - $this->category = null; - } - - public function getCategoryId():int{ - try{ - return is_null($this->category)? 0: $this->category->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getOwnerId():int{ - try{ - return is_null($this->owner)? 0: $this->owner->getId(); - } - catch (\Exception $ex){ - return 0; - } - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @return SummitSelectedPresentation[] - */ - public function getSelectedPresentations() - { - return $this->selected_presentations; - } - - /** - * @param string $collection - * @return ArrayCollection|\Doctrine\Common\Collections\Collection - * @throws ValidationException - */ - public function getSelectedPresentationsByCollection(string $collection){ - if(!in_array($collection, SummitSelectedPresentation::ValidCollectionTypes)) - throw new ValidationException(sprintf("Collection type %s is not valid.", $collection)); - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('collection', $collection)); - $criteria->orderBy(['order'=> 'ASC']); - - return $this->selected_presentations->matching($criteria); - } - - - public function isOwner(Member $owner):bool{ - return $this->getOwnerId() === $owner->getId(); - } - - /** - * @param Member $member - * @return bool - */ - public function canEdit(Member $member):bool - { - - // if is individual only owner can edit it - if ($this->list_type == self::Individual && $this->isOwner($member)){ - return true; - } - - if($this->list_type == self::Group){ - return $this->category->getSummit()->isTrackChair($member, $this->category) || $this->category->getSummit()->isTrackChairAdmin($member); - } - - return false; - } - - /** - * @param string|null $oldHash - * @return bool - */ - public function compareHash(?string $oldHash):bool{ - if(empty($this->hash)) return true; - if(!empty($this->hash) && empty($oldHash)) return false; - return hash_equals($this->hash, $oldHash); - } - - public function isGroup():bool { - return ($this->list_type == SummitSelectedPresentationList::Group); - } - - /** - * @param SummitSelectedPresentation $selection - */ - public function removeSelection(SummitSelectedPresentation $selection){ - if(!$this->selected_presentations->contains($selection)) return; - $this->selected_presentations->removeElement($selection); - $selection->clearList(); - } - - public function clearSelections(){ - $this->selected_presentations->clear(); - } - - /** - * @param SummitSelectedPresentation $selection - */ - public function addSelection(SummitSelectedPresentation $selection){ - if($this->selected_presentations->contains($selection)) return; - $this->selected_presentations->add($selection); - $selection->setList($this); - } - - /** - * @param Presentation $presentation - * @return SummitSelectedPresentation|null - */ - public function getSelectionByPresentation(Presentation $presentation):?SummitSelectedPresentation{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('presentation', $presentation)); - - $res = $this->selected_presentations->matching($criteria)->first(); - - return $res === false ? null : $res; - } - - - public function recalculateHash():string{ - Log::debug(sprintf("recalculating hash for list %s", $this->id)); - if(!$this->isGroup()){ - throw new ValidationException("You could only calculate hash on Team list"); - } - - $criteria = Criteria::create(); - $criteria->orderBy(['order'=> 'ASC']); - $hash = ''; - foreach ($this->selected_presentations->matching($criteria) as $p){ - $hash .= strval($p->getPresentationId()); - } - $this->hash = md5($hash); - - return $this->hash; - } - - /** - * @param string $collection - * @return int - * @throws ValidationException - */ - public function getHighestOrderInListByCollection(string $collection):int{ - if(!in_array($collection, SummitSelectedPresentation::ValidCollectionTypes)) - throw new ValidationException(sprintf("collection %s is not valid.", $collection)); - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('collection', $collection)); - $criteria->orderBy(['order'=> 'DESC']); - $highest = $this->selected_presentations->matching($criteria)->first(); - return $highest === false ? 0: $highest->getOrder(); - } - - - /** - * @return int - * @throws ValidationException - */ - public function getAvailableSlots():int{ - $selection_count = $this->getSelectedPresentationsByCollection - ( - SummitSelectedPresentation::CollectionSelected - )->count(); - return $this->getMaxPresentations() - $selection_count; - } - - /** - * @return mixed - */ - public function getMaxPresentations():int - { - return $this->category->getTrackChairAvailableSlots(); - } - - public function getMaxAlternates() - { - return intval($this->Category()->AlternateCount); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitTrackChair.php b/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitTrackChair.php deleted file mode 100644 index 4178b64d..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackChairs/SummitTrackChair.php +++ /dev/null @@ -1,161 +0,0 @@ -categories; - } - - /** - * @param int $track_id - * @return PresentationCategory|null - */ - public function getCategory(int $track_id):?PresentationCategory{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($track_id))); - $category = $this->categories->matching($criteria)->first(); - return $category === false ? null : $category; - } - - /** - * @param PresentationCategory $track - * @throws ValidationException - */ - public function addCategory(PresentationCategory $track){ - if($this->categories->contains($track)) - return; - if(!$track->isChairVisible()) - throw new ValidationException(sprintf("Category %s is not visible by track chairs.", $track->getId())); - - $track->addToTrackChairs($this); - $this->categories[] = $track; - } - - /** - * @param PresentationCategory $track - * @throws ValidationException - */ - public function removeCategory(PresentationCategory $track){ - if(!$this->categories->contains($track)) - return; - $track->removeFromTrackChairs($this); - $this->categories->removeElement($track); - - $list = $track->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Individual, $this->member); - // if we remove the track , then we need to remove the selection lists - if(!is_null($list)){ - $track->removeSelectionList($list); - } - } - - /** - * @return Member - */ - public function getMember(): Member - { - return $this->member; - } - - /** - * @param Member $member - */ - public function setMember(Member $member): void - { - $this->member = $member; - } - - public function isCategoryAllowed(PresentationCategory $category):bool{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $category->getId())); - $category = $this->categories->matching($criteria)->first(); - return $category === false ? false : true; - } - - - public function clearCategories():void{ - $this->categories->clear(); - } - - /** - * @return int - */ - public function getMemberId(){ - try { - return is_null($this->member) ? 0 : $this->member->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - public function __construct() - { - parent::__construct(); - $this->categories = new ArrayCollection(); - } - - public function clearMember():void{ - $this->member = null; - } - - public function getCategoriesIds():array{ - $res = []; - foreach ($this->categories as $c){ - $res[] = $c->getId(); - } - return $res; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackAnswer.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackAnswer.php deleted file mode 100644 index e1401418..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackAnswer.php +++ /dev/null @@ -1,112 +0,0 @@ -value; - } - - /** - * @param string $value - */ - public function setValue($value) - { - $this->value = $value; - } - - /** - * @return TrackQuestionTemplate - */ - public function getQuestion() - { - return $this->question; - } - - /** - * @param TrackQuestionTemplate $question - */ - public function setQuestion($question) - { - $this->question = $question; - } - - /** - * @return Presentation - */ - public function getPresentation() - { - return $this->presentation; - } - - /** - * @param Presentation $presentation - */ - public function setPresentation($presentation) - { - $this->presentation = $presentation; - } - - /** - * @return string - */ - public function getQuestionName(){ - return $this->question->getName(); - } - - /** - * @return int - */ - public function getQuestionId(){ - return $this->question->getId(); - } - - public function __construct() - { - parent::__construct(); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackCheckBoxListQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackCheckBoxListQuestionTemplate.php deleted file mode 100644 index 19e0e16b..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackCheckBoxListQuestionTemplate.php +++ /dev/null @@ -1,43 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackMultiValueQuestionTemplate::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackCheckBoxQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackCheckBoxQuestionTemplate.php deleted file mode 100644 index 6f391e05..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackCheckBoxQuestionTemplate.php +++ /dev/null @@ -1,42 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackSingleValueTemplateQuestion::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackDropDownQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackDropDownQuestionTemplate.php deleted file mode 100644 index 72caec60..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackDropDownQuestionTemplate.php +++ /dev/null @@ -1,97 +0,0 @@ -is_multi_select = false; - $this->is_country_selector = false; - } - - /** - * @return bool - */ - public function isMultiSelect() - { - return $this->is_multi_select; - } - - /** - * @param bool $is_multi_select - */ - public function setIsMultiSelect($is_multi_select) - { - $this->is_multi_select = $is_multi_select; - } - - /** - * @return bool - */ - public function isCountrySelector() - { - return $this->is_country_selector; - } - - /** - * @param bool $is_country_selector - */ - public function setIsCountrySelector($is_country_selector) - { - $this->is_country_selector = $is_country_selector; - } - - - const ClassName = 'TrackDropDownQuestionTemplate'; - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - public static $metadata = [ - 'class_name' => self::ClassName, - 'is_multi_select' => 'boolean', - 'is_country_selector' => 'boolean', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackMultiValueQuestionTemplate::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackLiteralContentQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackLiteralContentQuestionTemplate.php deleted file mode 100644 index 54fe95bc..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackLiteralContentQuestionTemplate.php +++ /dev/null @@ -1,66 +0,0 @@ -content; - } - - /** - * @param string $content - */ - public function setContent($content) - { - $this->content = $content; - } - - const ClassName = 'TrackLiteralContentQuestionTemplate'; - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - public static $metadata = [ - 'class_name' => self::ClassName, - 'content' => 'string', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackQuestionTemplate::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackMultiValueQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackMultiValueQuestionTemplate.php deleted file mode 100644 index 3323b48c..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackMultiValueQuestionTemplate.php +++ /dev/null @@ -1,203 +0,0 @@ -values = new ArrayCollection; - } - - /** - * @return string - */ - public function getEmptyString() - { - return $this->empty_string; - } - - /** - * @param string $empty_string - */ - public function setEmptyString($empty_string) - { - $this->empty_string = $empty_string; - } - - /** - * @return TrackQuestionValueTemplate[] - */ - public function getValues() - { - return $this->values; - } - - /** - * @param TrackQuestionValueTemplate[] $values - */ - public function setValues($values) - { - $this->values = $values; - } - - /** - * @return TrackQuestionValueTemplate - */ - public function getDefaultValue() - { - return $this->default_value; - } - - /** - * @param TrackQuestionValueTemplate $default_value - */ - public function setDefaultValue($default_value) - { - $this->default_value = $default_value; - } - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - const ClassName = 'TrackMultiValueQuestionTemplate'; - - public static $metadata = [ - 'class_name' => self::ClassName, - 'empty_string' => 'string', - 'default_value_id' => 'int', - 'values' => 'array' - ]; - - /** - * @return int - */ - public function getDefaultValueId(){ - try{ - if(is_null($this->default_value)) return 0; - return $this->default_value->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param int $id - * @return TrackQuestionValueTemplate - */ - public function getValueById($id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $res = $this->values->matching($criteria)->first(); - return $res ? $res : null; - } - - /** - * @param string $value - * @return TrackQuestionValueTemplate - */ - public function getValueByValue($value){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('value', strtolower(trim($value)))); - $res = $this->values->matching($criteria)->first(); - return $res ? $res : null; - } - - /** - * @param string $label - * @return TrackQuestionValueTemplate - */ - public function getValueByLabel($label){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('label', strtolower(trim($label)))); - $res = $this->values->matching($criteria)->first(); - return $res ? $res : null; - } - - /** - * @param TrackQuestionValueTemplate $value - * @return $this - */ - public function addValue(TrackQuestionValueTemplate $value){ - $values = $this->getValues(); - $this->values->add($value); - $value->setOwner($this); - $value->setOrder(count($values)); - return $this; - } - - use OrderableChilds; - - /** - * @param TrackQuestionValueTemplate $value - * @param int $new_order - * @throws ValidationException - */ - public function recalculateValueOrder(TrackQuestionValueTemplate $value, $new_order){ - self::recalculateOrderForSelectable($this->values, $value, $new_order); - } - - /** - * @param TrackQuestionValueTemplate $value - * @return $this - */ - public function removeValue(TrackQuestionValueTemplate $value){ - $this->values->removeElement($value); - $value->clearOwner(); - return $this; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackQuestionTemplate.php deleted file mode 100644 index 2e98acc3..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackQuestionTemplate.php +++ /dev/null @@ -1,271 +0,0 @@ -is_mandatory = false; - $this->is_read_only = false; - $this->tracks = new ArrayCollection(); - $this->answers = new ArrayCollection(); - } - - public static $metadata = [ - 'name' => 'string', - 'label' => 'string', - 'is_mandatory' => 'boolean', - 'is_read_only' => 'boolean', - 'after_question' => 'string', - 'tracks' => 'array', - 'answers' => 'array', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return self::$metadata; - } - - /** - * @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 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 string - */ - public function getAfterQuestion() - { - return $this->after_question; - } - - /** - * @param string $after_question - */ - public function setAfterQuestion($after_question) - { - $this->after_question = $after_question; - } - - /** - * @return PresentationCategory[] - */ - public function getTracks() - { - return $this->tracks; - } - - /** - * @param PresentationCategory[] $tracks - */ - public function setTracks($tracks) - { - $this->tracks = $tracks; - } - - /** - * @return $this - */ - public function clearTracks(){ - - foreach($this->tracks as $track) - $track->removeExtraQuestion($this); - $this->tracks->clear(); - return $this; - } - - /** - * @param PresentationCategory $track - * @return $this - */ - public function addTrack(PresentationCategory $track){ - - if($this->tracks->contains($track)) - return $this; - $this->tracks->add($track); - $track->addExtraQuestion($this); - return $this; - } - - /** - * @param PresentationCategory $track - * @return $this - */ - public function removeTrack(PresentationCategory $track){ - if(!$this->tracks->contains($track)) - return $this; - $track->removeExtraQuestion($this); - $this->tracks->removeElement($track); - return $this; - } - - /** - * @return TrackAnswer[] - */ - public function getAnswers() - { - return $this->answers; - } - - /** - * @param TrackAnswer[] $answers - */ - public function setAnswers($answers) - { - $this->answers = $answers; - } - - /** - * @param TrackAnswer $answer - */ - public function addAnswer(TrackAnswer $answer){ - $this->answers->add($answer); - $answer->setQuestion($this); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackQuestionTemplateConstants.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackQuestionTemplateConstants.php deleted file mode 100644 index ff10b0fe..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackQuestionTemplateConstants.php +++ /dev/null @@ -1,30 +0,0 @@ -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 TrackMultiValueQuestionTemplate - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @param TrackMultiValueQuestionTemplate $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - public function clearOwner(){ - $this->owner = null; - } - - /** - * @return int - */ - public function getOwnerId(){ - try{ - if(is_null($this->owner)) return 0; - return $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackRadioButtonListQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackRadioButtonListQuestionTemplate.php deleted file mode 100644 index 302fc2df..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackRadioButtonListQuestionTemplate.php +++ /dev/null @@ -1,43 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackMultiValueQuestionTemplate::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackSingleValueTemplateQuestion.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackSingleValueTemplateQuestion.php deleted file mode 100644 index 672ca1e0..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackSingleValueTemplateQuestion.php +++ /dev/null @@ -1,66 +0,0 @@ - self::ClassName, - 'initial_value' => 'string', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @return string - */ - public function getInitialValue() - { - return $this->initial_value; - } - - /** - * @param string $initial_value - */ - public function setInitialValue($initial_value) - { - $this->initial_value = $initial_value; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackTextBoxQuestionTemplate.php b/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackTextBoxQuestionTemplate.php deleted file mode 100644 index 0dbd20b0..00000000 --- a/app/Models/Foundation/Summit/Events/Presentations/TrackQuestions/TrackTextBoxQuestionTemplate.php +++ /dev/null @@ -1,42 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(TrackSingleValueTemplateQuestion::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/RSVP.php b/app/Models/Foundation/Summit/Events/RSVP/RSVP.php deleted file mode 100644 index dc0fcbb0..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/RSVP.php +++ /dev/null @@ -1,276 +0,0 @@ -seat_type = null; - $this->answers = new ArrayCollection(); - $this->been_emailed = false; - $this->event_uri = null; - } - - /** - * @return bool - */ - public function hasSeatTypeSet():bool{ - return !empty($this->seat_type); - } - - /** - * @return ArrayCollection - */ - public function getAnswers() - { - return $this->answers; - } - - /** - * @param ArrayCollection $answers - */ - public function setAnswers($answers) - { - $this->answers = $answers; - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner(Member $owner){ - $this->owner = $owner; - } - - /** - * @return SummitEvent - */ - public function getEvent() - { - return $this->event; - } - - /** - * @return int - */ - public function getEventId(){ - try{ - return $this->event->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasEvent(){ - return $this->getEventId() > 0; - } - - /** - * @return bool - */ - public function hasOwner(){ - return $this->getOwnerId() > 0; - } - - /** - * @return int - */ - public function getOwnerId(){ - try{ - return $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @param SummitEvent $event - */ - public function setEvent(SummitEvent $event){ - $this->event = $event; - } - - /** - * @return string - */ - public function getSeatType():?string - { - return $this->seat_type; - } - - /** - * @param string $seat_type - * @throws ValidationException - */ - public function setSeatType(string $seat_type) - { - if(!in_array($seat_type, self::ValidSeatTypes)) - throw new ValidationException(sprintf("Seat type %s is not valid."), $seat_type); - $this->seat_type = $seat_type; - } - - /** - * @return bool - */ - public function isBeenEmailed(): bool - { - return $this->been_emailed; - } - - /** - * @param bool $been_emailed - */ - public function setBeenEmailed(bool $been_emailed): void - { - $this->been_emailed = $been_emailed; - } - - public function clearEvent(){ - $this->event = null; - } - - public function clearOwner(){ - $this->owner = null; - } - - /** - * @param RSVPQuestionTemplate $question - * @return RSVPAnswer|null - */ - public function findAnswerByQuestion(RSVPQuestionTemplate $question):?RSVPAnswer{ - $criteria = Criteria::create(); - $criteria = $criteria->where(Criteria::expr()->eq('question', $question)); - $answer = $this->answers->matching($criteria)->first(); - return !$answer ? null:$answer; - } - - public function addAnswer(RSVPAnswer $answer){ - if($this->answers->contains($answer)) return; - $this->answers->add($answer); - $answer->setRsvp($this); - } - - public function removeAnswer(RSVPAnswer $answer){ - if(!$this->answers->contains($answer)) return; - $this->answers->removeElement($answer); - $answer->clearRSVP(); - } - - public function clearAnswers(){ - $this->answers->clear(); - } - - /** - * @return string|null - */ - public function getConfirmationNumber():?string{ - if(!$this->hasEvent()) return null; - if(!$this->getEvent()->hasSummit()) return null; - $summit = $this->event->getSummit(); - $summit_title = substr($summit->getName(),0,3); - $summit_year = $summit->getLocalBeginDate()->format('y'); - return strtoupper($summit_title).$summit_year.$this->id; - } - - /** - * @return string - */ - public function getEventUri(): ?string - { - return $this->event_uri; - } - - /** - * @param string $event_uri - */ - public function setEventUri(string $event_uri): void - { - $this->event_uri = $event_uri; - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/RSVPAnswer.php b/app/Models/Foundation/Summit/Events/RSVP/RSVPAnswer.php deleted file mode 100644 index 1264a728..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/RSVPAnswer.php +++ /dev/null @@ -1,131 +0,0 @@ -value; - } - - /** - * @param array|string $value - */ - public function setValue($value) - { - if (is_array($value)) { - $value = implode(',', $value); - } - $this->value = $value; - } - - /** - * @return int - */ - public function getQuestionId() - { - try{ - return $this->question->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getRSVPId() - { - try{ - return $this->rsvp->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return RSVP - */ - public function getRsvp(): RSVP - { - return $this->rsvp; - } - - /** - * @param RSVP $rsvp - */ - public function setRsvp(RSVP $rsvp): void - { - $this->rsvp = $rsvp; - } - - /** - * @return RSVPQuestionTemplate - */ - public function getQuestion(): RSVPQuestionTemplate - { - return $this->question; - } - - /** - * @param RSVPQuestionTemplate $question - */ - public function setQuestion(RSVPQuestionTemplate $question): void - { - $this->question = $question; - } - - public function clearRSVP(){ - $this->rsvp = null; - } - - public function clearQuestion(){ - $this->question = null; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPCheckBoxListQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPCheckBoxListQuestionTemplate.php deleted file mode 100644 index 2c0c9868..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPCheckBoxListQuestionTemplate.php +++ /dev/null @@ -1,55 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPMultiValueQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(!is_array($value)) return false; - foreach($value as $valId){ - $val = $this->getValueById(intval($valId)); - if(is_null($val)) return false; - } - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPDropDownQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPDropDownQuestionTemplate.php deleted file mode 100644 index 9a079c52..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPDropDownQuestionTemplate.php +++ /dev/null @@ -1,141 +0,0 @@ -is_multiselect; - } - - /** - * @param bool $is_multiselect - */ - public function setIsMultiselect($is_multiselect) - { - $this->is_multiselect = $is_multiselect; - } - - /** - * @return bool - */ - public function isCountrySelector() - { - return $this->is_country_selector; - } - - /** - * @param bool $is_country_selector - */ - public function setIsCountrySelector($is_country_selector) - { - $this->is_country_selector = $is_country_selector; - } - - /** - * @return bool - */ - public function getUseChosenPlugin() - { - return $this->use_chosen_plugin; - } - - /** - * @param bool $use_chosen_plugin - */ - public function setUseChosenPlugin($use_chosen_plugin) - { - $this->use_chosen_plugin = $use_chosen_plugin; - } - - public function __construct() - { - parent::__construct(); - $this->use_chosen_plugin = false; - $this->is_multiselect = false; - $this->is_country_selector = false; - } - - - public static $metadata = [ - 'use_chosen_plugin' => 'boolean', - 'is_multiselect' => 'boolean', - 'is_country_selector' => 'boolean', - 'class_name' => self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPMultiValueQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(!$this->is_multiselect){ - if(!is_string($value)) return false; - $valId = intval($value); - $val = $this->getValueById($valId); - if(is_null($val)) return false; - return true; - } - if(!is_array($value)) return false; - foreach($value as $valId){ - $val = $this->getValueById(intval($valId)); - if(is_null($val)) return false; - } - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPLiteralContentQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPLiteralContentQuestionTemplate.php deleted file mode 100644 index 2fa3d189..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPLiteralContentQuestionTemplate.php +++ /dev/null @@ -1,65 +0,0 @@ -content; - } - - /** - * @param string $content - */ - public function setContent($content) - { - $this->content = $content; - } - - public static $metadata = [ - 'content' => 'string', - 'class_name' => self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPQuestionTemplate::getMetadata(), self::$metadata); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberEmailQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberEmailQuestionTemplate.php deleted file mode 100644 index 20e58a86..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberEmailQuestionTemplate.php +++ /dev/null @@ -1,54 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPTextBoxQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(!is_string($value)) return false; - if (!filter_var($value, FILTER_VALIDATE_EMAIL)) { - return false; - } - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberFirstNameQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberFirstNameQuestionTemplate.php deleted file mode 100644 index 5dbf8808..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberFirstNameQuestionTemplate.php +++ /dev/null @@ -1,51 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPTextBoxQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(!is_string($value)) return false; - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberLastNameQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberLastNameQuestionTemplate.php deleted file mode 100644 index 637b3943..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMemberLastNameQuestionTemplate.php +++ /dev/null @@ -1,51 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPTextBoxQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(!is_string($value)) return false; - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMultiValueQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMultiValueQuestionTemplate.php deleted file mode 100644 index 9b5e3040..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPMultiValueQuestionTemplate.php +++ /dev/null @@ -1,199 +0,0 @@ -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 self::ClassName; - } - - const ClassName = 'RSVPMultiValueQuestionTemplate'; - - public static $metadata = [ - 'empty_string' => 'string', - 'values' => 'array', - 'default_value_id' => 'integer', - 'class_name' => self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @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; - } - } - - /** - * @param int $id - * @return RSVPQuestionValueTemplate - */ - public function getValueById($id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $res = $this->values->matching($criteria)->first(); - return $res ? $res : null; - } - - /** - * @param string $value - * @return RSVPQuestionValueTemplate - */ - public function getValueByValue($value){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('value', trim($value))); - $res = $this->values->matching($criteria)->first(); - return $res ? $res : null; - } - - /** - * @param RSVPQuestionValueTemplate $value - * @return $this - */ - public function addValue(RSVPQuestionValueTemplate $value){ - $values = $this->getValues(); - $this->values->add($value); - $value->setOwner($this); - $value->setOrder(count($values) + 1); - return $this; - } - - use OrderableChilds; - - /** - * @param RSVPQuestionValueTemplate $value - * @param int $new_order - * @throws ValidationException - */ - public function recalculateValueOrder(RSVPQuestionValueTemplate $value, $new_order){ - self::recalculateOrderForSelectable($this->values, $value, $new_order); - } - - /** - * @param RSVPQuestionValueTemplate $value - * @return $this - */ - public function removeValue(RSVPQuestionValueTemplate $value){ - $this->values->removeElement($value); - $value->clearOwner(); - return $this; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionDependsOn.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionDependsOn.php deleted file mode 100644 index a6c87080..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionDependsOn.php +++ /dev/null @@ -1,153 +0,0 @@ -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; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionTemplate.php deleted file mode 100644 index be23add5..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionTemplate.php +++ /dev/null @@ -1,224 +0,0 @@ -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 int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $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'; - } - - public function clearTemplate(){ - $this->template = null; - } - - public function __construct() - { - parent::__construct(); - $this->is_mandatory = false; - $this->is_read_only = false; - $this->order = 0; - } - - public static $metadata = [ - 'name' => 'string', - 'label' => 'string', - 'is_mandatory' => 'boolean', - 'is_read_only' => 'boolean', - 'template_id' => 'integer', - 'order' => 'integer' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return self::$metadata; - } - - /** - * @param array|string|null $value - * @return bool - */ - public function isValidValue($value):bool { - return true; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionValueTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionValueTemplate.php deleted file mode 100644 index faf0d692..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPQuestionValueTemplate.php +++ /dev/null @@ -1,129 +0,0 @@ -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; - } - } - - public function clearOwner(){ - $this->owner = null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPRadioButtonListQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPRadioButtonListQuestionTemplate.php deleted file mode 100644 index 128f40c4..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPRadioButtonListQuestionTemplate.php +++ /dev/null @@ -1,54 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPMultiValueQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(!is_string($value)) return false; - $valId = intval($value); - $val = $this->getValueById($valId); - if(is_null($val)) return false; - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPSingleValueTemplateQuestion.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPSingleValueTemplateQuestion.php deleted file mode 100644 index 4685682d..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPSingleValueTemplateQuestion.php +++ /dev/null @@ -1,76 +0,0 @@ -initial_value; - } - - /** - * @param string $initial_value - */ - public function setInitialValue($initial_value) - { - $this->initial_value = $initial_value; - } - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - const ClassName = 'RSVPSingleValueTemplateQuestion'; - - public static $metadata = [ - 'initial_value' => 'string', - 'class_name' => self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPQuestionTemplate::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(empty($value) && !$this->is_mandatory) return true; - if(!is_string($value)) return false; - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTemplate.php deleted file mode 100644 index 2853c708..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTemplate.php +++ /dev/null @@ -1,208 +0,0 @@ -title; - } - - /** - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @return bool - */ - public function isEnabled() - { - return $this->is_enabled; - } - - /** - * @param bool $is_enabled - */ - public function setIsEnabled($is_enabled) - { - $this->is_enabled = $is_enabled; - } - - /** - * @return Member - */ - public function getCreatedBy() - { - return $this->created_by; - } - - /** - * @param Member $created_by - */ - public function setCreatedBy(Member $created_by) - { - $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 ArrayCollection|\Doctrine\Common\Collections\Collection - */ - 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; - } - - /** - * @param string $name - * @return RSVPQuestionTemplate - */ - public function getQuestionByName($name){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $res = $this->questions->matching($criteria)->first(); - return $res ? $res : null; - } - - /** - * @param int $id - * @return RSVPQuestionTemplate - */ - public function getQuestionById($id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $res = $this->questions->matching($criteria)->first(); - return $res ? $res : null; - } - - /** - * @param RSVPQuestionTemplate $question - * @return $this - */ - public function addQuestion(RSVPQuestionTemplate $question){ - $questions = $this->getQuestions(); - $this->questions->add($question); - $question->setTemplate($this); - $question->setOrder(count($questions) + 1); - return $this; - } - - use OrderableChilds; - - /** - * @param RSVPQuestionTemplate $question - * @param int $new_order - * @throws ValidationException - */ - public function recalculateQuestionOrder(RSVPQuestionTemplate $question, $new_order){ - self::recalculateOrderForSelectable($this->questions, $question, $new_order); - } - - /** - * @param RSVPQuestionTemplate $question - * @return $this - */ - public function removeQuestion(RSVPQuestionTemplate $question){ - $this->questions->removeElement($question); - $question->clearTemplate(); - return $this; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTextAreaQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTextAreaQuestionTemplate.php deleted file mode 100644 index 9f260d56..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTextAreaQuestionTemplate.php +++ /dev/null @@ -1,51 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPSingleValueTemplateQuestion::getMetadata(), self::$metadata); - } - - /** - * @param array|string $value - * @return bool - */ - public function isValidValue($value): bool - { - if(!is_string($value)) return false; - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTextBoxQuestionTemplate.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTextBoxQuestionTemplate.php deleted file mode 100644 index 0aeeec16..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/RSVPTextBoxQuestionTemplate.php +++ /dev/null @@ -1,42 +0,0 @@ - self::ClassName, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(RSVPSingleValueTemplateQuestion::getMetadata(), self::$metadata); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/RSVP/Templates/SummitRSVPTemplateQuestionConstants.php b/app/Models/Foundation/Summit/Events/RSVP/Templates/SummitRSVPTemplateQuestionConstants.php deleted file mode 100644 index d4a092a7..00000000 --- a/app/Models/Foundation/Summit/Events/RSVP/Templates/SummitRSVPTemplateQuestionConstants.php +++ /dev/null @@ -1,40 +0,0 @@ -entity_id = $entity_id; - } - - /** - * @return int - */ - public function getEntityId(){return $this->entity_id;} - - /** - * @ORM\Column(name="EntityClassName", type="string") - */ - private $entity_class_name; - - /** - * @return string - */ - public function getEntityClassName(){return $this->entity_class_name;} - - /** - * @param string $entity_class_name - */ - public function setEntityClassName($entity_class_name){$this->entity_class_name = $entity_class_name;} - - /** - * @ORM\Column(name="Type", type="string") - */ - private $type; - - /** - * @return string - */ - public function getType(){return $this->type;} - - /** - * @param string $type - */ - public function setType($type){$this->type = $type;} - - /** - * @ORM\Column(name="Metadata", type="string") - */ - private $metadata; - - /** - * @param string $metadata - */ - public function setMetadata($metadata){ - $this->metadata = $metadata; - } - - /** - * @return array - */ - public function getMetadata(){ - return !empty($this->metadata) ? json_decode($this->metadata, true) : array(); - } - - /** - * @return string - */ - public function getRawMetadata(){ - return $this->metadata; - } - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member", cascade={"persist"}) - * @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID") - * @var Member - */ - private $owner; - - /** - * @return int - */ - public function getOwnerId(){ - try{ - return is_null($this->owner) ? 0 : $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasOwner(){ - return $this->getOwnerId() > 0; - } - - /** - * @return Member - */ - public function getOwner(){ - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner(Member $owner){ - $this->owner = $owner; - } - - /** - * @return string - */ - public function getKey(){ - return sprintf("%s.%s", $this->entity_class_name, $this->entity_id); - } - - /** - * @var IEntity - */ - private $entity; - - /** - * @return IEntity - */ - public function getEntity(){ - return $this->entity; - } - - /** - * @param IEntity $entity - * @return IEntity - */ - public function registerEntity(IEntity $entity){ - $this->entity = $entity; - return $this->entity; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/SummitEvent.php b/app/Models/Foundation/Summit/Events/SummitEvent.php deleted file mode 100644 index a518ab99..00000000 --- a/app/Models/Foundation/Summit/Events/SummitEvent.php +++ /dev/null @@ -1,1331 +0,0 @@ - 'created_by', - 'getUpdatedById' => 'updated_by', - ]; - - protected $hasPropertyMappings = [ - 'hasCreatedBy' => 'created_by', - 'hasUpdatedBy' => 'updated_by', - ]; - - /** - * @ORM\Column(name="Title", type="string") - * @var string - */ - protected $title; - - /** - * @ORM\Column(name="Abstract", type="string") - * @var string - */ - protected $abstract; - - /** - * @ORM\Column(name="SocialSummary", type="string") - * @var string - */ - protected $social_summary; - - /** - * @ORM\Column(name="Occupancy", type="string") - * @var string - */ - protected $occupancy; - - /** - * @ORM\Column(name="Level", type="string") - * @var string - */ - protected $level; - - /** - * @ORM\Column(name="StartDate", type="datetime") - * @var \DateTime - */ - protected $start_date; - - /** - * @ORM\Column(name="EndDate", type="datetime") - * @var \DateTime - */ - protected $end_date; - - /** - * @ORM\Column(name="Published", type="boolean") - * @var bool - */ - protected $published; - - /** - * @ORM\Column(name="PublishedDate", type="datetime") - * @var \DateTime - */ - protected $published_date; - - /** - * @ORM\Column(name="AllowFeedBack", type="boolean") - * @var bool - */ - protected $allow_feedback; - - /** - * @ORM\Column(name="AvgFeedbackRate", type="float") - * @var float - */ - protected $avg_feedback; - - /** - * @ORM\Column(name="HeadCount", type="integer") - * @var int - */ - protected $head_count; - - /** - * @ORM\Column(name="RSVPMaxUserNumber", type="integer") - * @var int - */ - protected $rsvp_max_user_number; - - /** - * @ORM\Column(name="RSVPMaxUserWaitListNumber", type="integer") - * @var int - */ - protected $rsvp_max_user_wait_list_number; - - /** - * @ORM\ManyToOne(targetEntity="App\Models\Foundation\Summit\Events\RSVP\RSVPTemplate", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="RSVPTemplateID", referencedColumnName="ID", onDelete="SET NULL") - * @var RSVPTemplate - */ - protected $rsvp_template; - - /** - * @ORM\OneToMany(targetEntity="models\summit\RSVP", mappedBy="event", cascade={"persist"}, fetch="EXTRA_LAZY") - * @var RSVP[] - */ - protected $rsvp; - - /** - * @ORM\Column(name="RSVPLink", type="string") - * @var string - */ - protected $rsvp_link; - - /** - * @ORM\Column(name="ExternalId", type="string") - * @var string - */ - protected $external_id; - - /** - * @ORM\ManyToOne(targetEntity="PresentationCategory", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="CategoryID", referencedColumnName="ID", onDelete="SET NULL") - * @var PresentationCategory - */ - protected $category = null; - - /** - * @ORM\ManyToOne(targetEntity="SummitEventType", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="TypeID", referencedColumnName="ID", onDelete="SET NULL") - * @var SummitEventType - */ - protected $type; - - /** - * @ORM\ManyToOne(targetEntity="SummitAbstractLocation", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="LocationID", referencedColumnName="ID", onDelete="SET NULL") - * @var SummitAbstractLocation - */ - protected $location = null; - - /** - * @ORM\ManyToMany(targetEntity="models\main\Company", inversedBy="sponsorships", fetch="EXTRA_LAZY") - * @ORM\JoinTable(name="SummitEvent_Sponsors", - * joinColumns={@ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID", onDelete="CASCADE")}, - * inverseJoinColumns={@ORM\JoinColumn(name="CompanyID", referencedColumnName="ID", onDelete="CASCADE")} - * ) - */ - protected $sponsors; - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitEventFeedback", mappedBy="event", cascade={"persist"}, fetch="EXTRA_LAZY") - * @ORM\Cache("NONSTRICT_READ_WRITE") - * @var SummitEventFeedback[] - */ - protected $feedback; - - /** - * @ORM\ManyToMany(targetEntity="models\main\Tag", cascade={"persist"}, inversedBy="events", fetch="EXTRA_LAZY") - * @ORM\JoinTable(name="SummitEvent_Tags", - * joinColumns={@ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID")}, - * inverseJoinColumns={@ORM\JoinColumn(name="TagID", referencedColumnName="ID")} - * ) - */ - protected $tags; - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitEventAttendanceMetric", mappedBy="event", cascade={"persist","remove"}, orphanRemoval=true, fetch="EXTRA_LAZY") - * @var SummitEventAttendanceMetric[] - */ - protected $attendance_metrics; - - /** - * @ORM\Column(name="StreamingUrl", type="string") - * @var string - */ - protected $streaming_url; - - /** - * @ORM\Column(name="MuxAssetID", type="string") - * @var string - */ - protected $mux_asset_id; - - /** - * @ORM\Column(name="MuxPlaybackID", type="string") - * @var string - */ - protected $mux_playback_id; - - /** - * @ORM\Column(name="EtherpadLink", type="string") - * @var string - */ - protected $etherpad_link; - - /** - * @ORM\Column(name="MeetingUrl", type="string") - * @var string - */ - protected $meeting_url; - /** - * @var PreRemoveEventArgs - */ - protected $pre_remove_events; - /** - * @var PreUpdateEventArgs - */ - protected $pre_update_args; - - /** - * @ORM\ManyToOne(targetEntity="models\main\File", cascade={"persist"}) - * @ORM\JoinColumn(name="ImageID", referencedColumnName="ID") - * @var File - */ - protected $image; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="CreatedByID", referencedColumnName="ID", onDelete="SET NULL") - * @var Member - */ - protected $created_by = null; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member", fetch="EXTRA_LAZY") - * @ORM\JoinColumn(name="UpdatedByID", referencedColumnName="ID", onDelete="SET NULL") - * @var Member - */ - protected $updated_by = null; - - /** - * SummitEvent constructor. - */ - public function __construct() - { - parent::__construct(); - - $this->allow_feedback = false; - $this->published = false; - $this->avg_feedback = 0; - $this->head_count = 0; - $this->rsvp_max_user_number = 0; - $this->rsvp_max_user_wait_list_number = 0; - - $this->tags = new ArrayCollection(); - $this->feedback = new ArrayCollection(); - $this->sponsors = new ArrayCollection(); - $this->rsvp = new ArrayCollection(); - $this->attendance_metrics = new ArrayCollection(); - } - - use SummitOwned; - - /** - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * @param string $title - * @return $this - */ - public function setTitle($title) - { - $this->title = $title; - return $this; - } - - /** - * @return boolean - */ - public function getAllowFeedback() - { - return $this->allow_feedback; - } - - /** - * @return boolean - */ - public function isAllowFeedback() - { - return $this->getAllowFeedback(); - } - - /** - * @param bool $allow_feeback - * @return $this - */ - public function setAllowFeedBack($allow_feeback) - { - $this->allow_feedback = $allow_feeback; - return $this; - } - - /** - * @return PresentationCategory - */ - public function getCategory() - { - return $this->category; - } - - /** - * @param PresentationCategory $category - * @return $this - */ - public function setCategory(PresentationCategory $category) - { - $this->category = $category; - return $this; - } - - /** - * @return int - */ - public function getCategoryId() - { - try { - return !is_null($this->category) ? $this->category->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - public function hasCategory():bool{ - return $this->getCategoryId() > 0; - } - - /** - * @return string - */ - public function getAbstract() - { - return $this->abstract; - } - - /** - * @param string $abstract - */ - public function setAbstract($abstract) - { - $this->abstract = $abstract; - } - - /** - * @return string - */ - public function getSocialSummary() - { - return $this->social_summary; - } - - /** - * @param string $social_summary - */ - public function setSocialSummary($social_summary) - { - $this->social_summary = $social_summary; - } - - /** - * @return DateTime - */ - public function getPublishedDate() - { - return $this->published_date; - } - - /** - * @param DateTime $published_date - */ - public function setPublishedDate($published_date) - { - $this->published_date = $published_date; - } - - /** - * @return float - */ - public function getAvgFeedbackRate() - { - return !is_null($this->avg_feedback) ? $this->avg_feedback : 0.0; - } - - /** - * @param float $avg_feedback - */ - public function setAvgFeedbackRate($avg_feedback) - { - $this->avg_feedback = $avg_feedback; - } - - /** - * @return string - */ - public function getRSVPLink() - { - if ($this->hasRSVPTemplate()) { - - $summit = $this->getSummit(); - $schedule_page = $summit->getSchedulePage(); - if (empty($schedule_page)) return ''; - $url = sprintf("%s%s/events/%s/%s/rsvp", - Config::get("server.assets_base_url", 'https://www.openstack.org/'), - $schedule_page, - $this->getId(), - $this->getSlug() - ); - return $url; - } - return $this->rsvp_link; - } - - /** - * @param string $rsvp_link - */ - public function setRSVPLink($rsvp_link) - { - $this->rsvp_link = $rsvp_link; - $this->rsvp_template = null; - $this->rsvp_max_user_wait_list_number = 0; - $this->rsvp_max_user_number = 0; - } - - /** - * @return bool - */ - public function hasRSVPTemplate() - { - return $this->getRSVPTemplateId() > 0; - } - - /** - * @return int - */ - public function getRSVPTemplateId() - { - try { - return !is_null($this->rsvp_template) ? $this->rsvp_template->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - public function getSlug() - { - $slugify = new Slugify(); - return $slugify->slugify($this->title); - } - - /** - * @return bool - */ - public function hasRSVP() - { - return !empty($this->rsvp_link) || $this->hasRSVPTemplate(); - } - - /** - * @return bool - */ - public function isExternalRSVP() - { - return !empty($this->rsvp_link) && !$this->hasRSVPTemplate(); - } - - /** - * @return int - */ - public function getHeadCount() - { - return $this->head_count; - } - - /** - * @param int $head_count - */ - public function setHeadCount($head_count) - { - $this->head_count = $head_count; - } - - /** - * @return int - */ - public function getTypeId() - { - try { - return !is_null($this->type) ? $this->type->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return SummitEventType|null - */ - public function getType() - { - return $this->type; - } - - /** - * @param SummitEventType $type - * @return $this - */ - public function setType(SummitEventType $type) - { - $this->type = $type; - return $this; - } - - public function clearLocation() - { - $this->location = null; - return $this; - } - - /** - * @return SummitAbstractLocation - */ - public function getLocation() - { - return $this->location; - } - - /** - * @param SummitAbstractLocation $location - * @return $this - */ - public function setLocation(SummitAbstractLocation $location) - { - $this->location = $location; - return $this; - } - - /** - * @return array - */ - public function getSponsorsIds() - { - return $this->sponsors->map(function ($entity) { - return $entity->getId(); - })->toArray(); - } - - /** - * @return Company[] - */ - public function getSponsors() - { - return $this->sponsors; - } - - /** - * @param Company $sponsor - */ - public function addSponsor(Company $sponsor) - { - $this->sponsors->add($sponsor); - } - - public function clearSponsors() - { - $this->sponsors->clear(); - } - - public function addFeedBack(SummitEventFeedback $feedback) - { - $this->feedback->add($feedback); - $feedback->setEvent($this); - } - - /** - * @return SummitEventFeedback[] - */ - public function getFeedback() - { - $criteria = Criteria::create(); - $criteria = $criteria->orderBy(['created' => Criteria::DESC]); - return $this->feedback->matching($criteria); - } - - /** - * @return ArrayCollection - */ - public function getTags() - { - return $this->tags; - } - - /** - * @param Tag $tag - */ - public function addTag(Tag $tag) - { - if ($this->tags->contains($tag)) return; - $this->tags->add($tag); - } - - public function clearTags() - { - $this->tags->clear(); - } - - /** - * @return void - * @throws ValidationException - */ - public function publish() - { - if ($this->isPublished()) - throw new ValidationException('Already published Summit Event'); - - $start_date = $this->getStartDate(); - $end_date = $this->getEndDate(); - - if ((is_null($start_date) || is_null($end_date))) - throw new ValidationException('To publish this event you must define a start/end datetime!'); - - $summit = $this->getSummit(); - - if (is_null($summit)) - throw new ValidationException('To publish you must assign a summit'); - - $timezone = $summit->getTimeZoneId(); - - if (empty($timezone)) { - throw new ValidationException('Invalid Summit TimeZone!'); - } - - if ($end_date < $start_date) - throw new ValidationException('start datetime must be greather or equal than end datetime!'); - - $this->published = true; - $this->published_date = new DateTime(); - } - - /** - * @return bool - */ - public function isPublished() - { - return $this->getPublished(); - } - - /** - * @return bool - */ - public function getPublished() - { - return (bool)$this->published; - } - - /** - * @return \DateTime|null - */ - public function getStartDate() - { - return $this->start_date; - } - - /** - * @param DateTime $value - * @return $this - */ - public function setStartDate(DateTime $value) - { - $summit = $this->getSummit(); - if (!is_null($summit)) { - $value = $summit->convertDateFromTimeZone2UTC($value); - } - $this->start_date = $value; - return $this; - } - - public function setRawStartDate(DateTime $value){ - $this->start_date = $value; - } - - /** - * @return \DateTime|null - */ - public function getEndDate() - { - return $this->end_date; - } - - /** - * @param DateTime $value - * @return $this - */ - public function setEndDate(DateTime $value) - { - $summit = $this->getSummit(); - if (!is_null($summit)) { - $value = $summit->convertDateFromTimeZone2UTC($value); - } - $this->end_date = $value; - return $this; - } - - public function setRawEndDate(DateTime $value){ - $this->end_date = $value; - } - /** - * @return void - */ - public function unPublish() - { - $this->published = false; - $this->published_date = null; - } - - /** - * @ORM\PreRemove: - */ - public function deleting($args) - { - $this->pre_remove_events = new PreRemoveEventArgs - ( - [ - 'id' => $this->id, - 'class_name' => $this->getClassName(), - 'summit' => $this->summit, - 'published' => $this->isPublished(), - ] - ); - } - - /** - * @return string - */ - public function getClassName() - { - return "SummitEvent"; - } - - /** - * @ORM\preRemove: - */ - public function deleted($args) - { - if (is_null($this->summit)) return; - if ($this->summit->isDeleting()) return; - Event::fire(new SummitEventDeleted(null, $this->pre_remove_events)); - $this->pre_remove_events = null; - } - - /** - * @ORM\PreUpdate: - */ - public function updating(PreUpdateEventArgs $args) - { - $this->pre_update_args = $args; - } - - /** - * @ORM\PostUpdate: - */ - public function updated($args) - { - Event::fire(new SummitEventUpdated($this, $this->pre_update_args)); - $this->pre_update_args = null; - } - - // events - - /** - * @ORM\PostPersist - */ - public function inserted($args) - { - Event::fire(new SummitEventCreated($this, $args)); - } - - /** - * @return ArrayCollection - */ - public function getRsvp() - { - return $this->rsvp; - } - - /** - * @param ArrayCollection $rsvp - */ - public function setRsvp($rsvp) - { - $this->rsvp = $rsvp; - } - - /** - * @return string - */ - public function getLocationName() - { - return $this->hasLocation() ? $this->location->getName() : 'TBD'; - } - - /** - * @return bool - */ - public function hasLocation() - { - return $this->getLocationId() > 0; - } - - /** - * @return int - */ - public function getLocationId() - { - try { - return !is_null($this->location) ? $this->location->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return int - */ - public function getRSVPMaxUserNumber() - { - return $this->rsvp_max_user_number; - } - - /** - * @param int $rsvp_max_user_number - */ - public function setRSVPMaxUserNumber($rsvp_max_user_number) - { - $this->rsvp_max_user_number = $rsvp_max_user_number; - } - - /** - * @return mixed - */ - public function getRSVPMaxUserWaitListNumber() - { - return $this->rsvp_max_user_wait_list_number; - } - - /** - * @param mixed $rsvp_max_user_wait_list_number - */ - public function setRSVPMaxUserWaitListNumber($rsvp_max_user_wait_list_number) - { - $this->rsvp_max_user_wait_list_number = $rsvp_max_user_wait_list_number; - } - - /** - * @return string - */ - public function getOccupancy() - { - return $this->occupancy; - } - - /** - * @param string $occupancy - */ - public function setOccupancy($occupancy) - { - $this->occupancy = $occupancy; - } - - /** - * @return string - */ - public function getExternalId(): ?string - { - return $this->external_id; - } - - /** - * @param string $external_id - */ - public function setExternalId(string $external_id): void - { - $this->external_id = $external_id; - } - - /** - * @return string - * @throws ValidationException - */ - public function getCurrentRSVPSubmissionSeatType(): string - { - - if (!$this->hasRSVPTemplate()) - throw new ValidationException(sprintf("Event %s has not RSVP configured.", $this->id)); - - if (!$this->getRSVPTemplate()->isEnabled()) { - throw new ValidationException(sprintf("Event %s has not RSVP configured.", $this->id)); - } - - $count_regular = $this->getRSVPSeatTypeCount(RSVP::SeatTypeRegular); - if ($count_regular < intval($this->rsvp_max_user_number)) return RSVP::SeatTypeRegular; - $count_wait = $this->getRSVPSeatTypeCount(RSVP::SeatTypeWaitList); - if ($count_wait < intval($this->rsvp_max_user_wait_list_number)) return RSVP::SeatTypeWaitList; - throw new ValidationException(sprintf("Event %s is Full.", $this->id)); - } - - /** - * @return RSVPTemplate - */ - public function getRSVPTemplate() - { - return $this->rsvp_template; - } - - /** - * @param RSVPTemplate $rsvp_template - */ - public function setRSVPTemplate(RSVPTemplate $rsvp_template) - { - $this->rsvp_template = $rsvp_template; - $this->rsvp_link = ''; - } - - /** - * @param string $seat_type - * @return int - */ - public function getRSVPSeatTypeCount(string $seat_type): int - { - $criteria = Criteria::create(); - $criteria = $criteria->where(Criteria::expr()->eq('seat_type', $seat_type)); - return $this->rsvp->matching($criteria)->count(); - } - - /** - * @param string $seat_type - * @return bool - */ - public function couldAddSeatType(string $seat_type): bool - { - switch ($seat_type) { - case RSVP::SeatTypeRegular: - { - $count_regular = $this->getRSVPSeatTypeCount(RSVP::SeatTypeRegular); - return $count_regular < intval($this->rsvp_max_user_number); - } - case RSVP::SeatTypeWaitList: - { - $count_wait = $this->getRSVPSeatTypeCount(RSVP::SeatTypeWaitList); - return $count_wait < intval($this->rsvp_max_user_wait_list_number); - } - } - return false; - } - - public function getRSVPRegularCount(): ?int - { - return $this->getRSVPSeatTypeCount(RSVP::SeatTypeRegular); - } - - public function getRSVPWaitCount(): ?int - { - return $this->getRSVPSeatTypeCount(RSVP::SeatTypeWaitList); - } - - /** - * @param RSVP $rsvp - * @throws ValidationException - */ - public function addRSVPSubmission(RSVP $rsvp) - { - if (!$this->hasRSVPTemplate()) { - throw new ValidationException(sprintf("Event %s has not RSVP configured.", $this->id)); - } - - if (!$this->getRSVPTemplate()->isEnabled()) { - throw new ValidationException(sprintf("Event %s has not RSVP configured.", $this->id)); - } - - if ($this->rsvp->contains($rsvp)) return; - $this->rsvp->add($rsvp); - $rsvp->setEvent($this); - } - - /** - * @param RSVP $rsvp - */ - public function removeRSVPSubmission(RSVP $rsvp) - { - if (!$this->rsvp->contains($rsvp)) return; - $this->rsvp->removeElement($rsvp); - $rsvp->clearEvent(); - } - - /** - * @return string - */ - public function getDateNice(): string - { - $start_date = $this->getStartDateNice(); - $end_date = $this->getEndDateNice(); - $date_nice = ''; - - if ($start_date == 'TBD' || $end_date == 'TBD') return $start_date; - - $date_nice = date('l, F j, g:ia', strtotime($start_date)) . '-' . date('g:ia', strtotime($end_date)); - return $date_nice; - } - - /** - * @return string - */ - public function getStartDateNice(): string - { - $start_date = $this->getLocalStartDate(); - if (empty($start_date)) return 'TBD'; - return $start_date->format("Y-m-d H:i:s"); - } - - /** - * @return DateTime|null - */ - public function getLocalStartDate() - { - if (!empty($this->start_date)) { - $value = clone $this->start_date; - $summit = $this->getSummit(); - if (!is_null($summit)) { - $res = $summit->convertDateFromUTC2TimeZone($value); - } - return $res; - } - return null; - } - - /** - * @return string - */ - public function getEndDateNice(): string - { - $end_date = $this->getLocalEndDate(); - if (empty($end_date)) return 'TBD'; - return $end_date->format("Y-m-d H:i:s"); - } - - /** - * @return DateTime|null - */ - public function getLocalEndDate() - { - if (!empty($this->end_date)) { - $value = clone $this->end_date; - $summit = $this->getSummit(); - if (!is_null($summit)) { - $res = $summit->convertDateFromUTC2TimeZone($value); - } - return $res; - } - return null; - } - - /** - * @return bool - */ - public function isLive(): bool - { - return !empty($this->streaming_url); - } - - /** - * @return string - */ - public function getStreamingUrl(): ?string - { - return $this->streaming_url; - } - - /** - * @param string $streaming_url - */ - public function setStreamingUrl(?string $streaming_url): void - { - $this->streaming_url = $streaming_url; - } - - /** - * @return string - */ - public function getEtherpadLink(): ?string - { - return $this->etherpad_link; - } - - /** - * @param string $etherpad_link - */ - public function setEtherpadLink(?string $etherpad_link): void - { - $this->etherpad_link = $etherpad_link; - } - - /** - * @return string - */ - public function getMeetingUrl(): ?string - { - return $this->meeting_url; - } - - /** - * @param string $meeting_url - */ - public function setMeetingUrl(string $meeting_url): void - { - $this->meeting_url = $meeting_url; - } - - /** - * @return int - */ - public function getTotalAttendanceCount():int{ - return $this->attendance_metrics->count(); - } - - public function getAttendance(){ - return $this->attendance_metrics; - } - - /** - * @return int - */ - public function getCurrentAttendanceCount():int{ - $criteria = Criteria::create(); - $criteria = $criteria->where(Criteria::expr()->isNull('outgress_date')); - return $this->attendance_metrics->matching($criteria)->count(); - } - - public function getCurrentAttendance(){ - $criteria = Criteria::create(); - $criteria = $criteria->where(Criteria::expr()->isNull('outgress_date')); - $criteria = $criteria->orderBy(['created' => Criteria::DESC]); - return $this->attendance_metrics->matching($criteria)->toArray(); - } - - use HasImageTrait; - - /** - * @param Member|null $member - * @return bool - */ - public function hasAccess(?Member $member):bool{ - // is member is null then service account access. - - if(is_null($member)) return true; - if($this->summit->isPubliclyOpen()) return true; - - if($member->isAdmin()) return true; - if($member->hasPaidTicketOnSummit($this->summit)) return true; - return false; - } - - /** - * @return bool - */ - public function isMuxStream():bool{ - if(empty($this->streaming_url)) return false; - if (preg_match("/(.*\.mux\.com)/i", $this->streaming_url)) return true; - return false; - } - - /** - * @return string|null - */ - public function getStreamThumbnailUrl():?string{ - if($this->isMuxStream()){ - $matches = []; - if(preg_match("/^(.*\.mux\.com)\/(.*)(\.m3u8)$/",$this->streaming_url, $matches)){ - return sprintf("https://image.mux.com/%s/thumbnail.jpg", $matches[2]); - } - } - return null; - } - - /** - * @return string - */ - public function getMuxAssetId(): ?string - { - return $this->mux_asset_id; - } - - /** - * @param string $mux_asset_id - */ - public function setMuxAssetId(string $mux_asset_id): void - { - $this->mux_asset_id = $mux_asset_id; - } - - /** - * @return string - */ - public function getMuxPlaybackId(): ?string - { - return $this->mux_playback_id; - } - - /** - * @param string $mux_playback_id - */ - public function setMuxPlaybackId(string $mux_playback_id): void - { - $this->mux_playback_id = $mux_playback_id; - } - - /** - * @return string - */ - public function getLevel() - { - return $this->level; - } - - /** - * @param string $level - * @throws ValidationException - */ - public function setLevel(string $level):void - { - if(!in_array($level, ISummitEventLevel::ValidLevels)) - throw new ValidationException(sprintf("Level %s is invalid.", $level)); - $this->level = $level; - } - - /** - * @return Member - */ - public function getCreatedBy(): ?Member - { - return $this->created_by; - } - - /** - * @param Member $created_by - */ - public function setCreatedBy(Member $created_by): void - { - $this->created_by = $created_by; - } - - /** - * @return Member - */ - public function getUpdatedBy(): ?Member - { - return $this->updated_by; - } - - /** - * @param Member $updated_by - */ - public function setUpdatedBy(Member $updated_by): void - { - $this->updated_by = $updated_by; - } - - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/SummitEventFeedback.php b/app/Models/Foundation/Summit/Events/SummitEventFeedback.php deleted file mode 100644 index 9cddbedf..00000000 --- a/app/Models/Foundation/Summit/Events/SummitEventFeedback.php +++ /dev/null @@ -1,153 +0,0 @@ -rate; - } - - /** - * @param int $rate - */ - public function setRate($rate) - { - $this->rate = $rate; - } - - /** - * @return string - */ - public function getNote() - { - return $this->note; - } - - /** - * @param string $note - */ - public function setNote($note) - { - $this->note = $note; - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner(Member $owner){ - $this->owner = $owner; - } - - /** - * @return SummitEvent - */ - public function getEvent() - { - return $this->event; - } - - /** - * @return int - */ - public function getEventId(){ - try{ - return $this->event->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasOwner(){ - return $this->getOwnerId() > 0; - } - - /** - * @return int - */ - public function getOwnerId(){ - try{ - return $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - public function clearOwner(){ - $this->owner = null; - } - - /** - * @param SummitEvent $event - */ - public function setEvent(SummitEvent $event){ - $this->event = $event; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/SummitEventType.php b/app/Models/Foundation/Summit/Events/SummitEventType.php deleted file mode 100644 index e337d7b3..00000000 --- a/app/Models/Foundation/Summit/Events/SummitEventType.php +++ /dev/null @@ -1,343 +0,0 @@ -type; - } - - /** - * @param string $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return string - */ - public function getColor() - { - return $this->color; - } - - /** - * @param string $color - */ - public function setColor($color) - { - $this->color = $color; - } - - /** - * @return bool - */ - public function getBlackoutTimes() - { - return $this->blackout_times; - } - - /** - * @return bool - */ - public function isBlackoutTimes(){ - return $this->getBlackoutTimes(); - } - - /** - * @param bool $blackout_times - */ - public function setBlackoutTimes($blackout_times) - { - $this->blackout_times = $blackout_times; - } - - /** - * @param Summit $summit - * @param string $type - * @return bool - */ - static public function IsSummitEventType(Summit $summit, $type){ - return !PresentationType::IsPresentationEventType($summit, $type); - } - - /** - * @return bool - */ - public function isUseSponsors() - { - return $this->use_sponsors; - } - - /** - * @return bool - */ - public function isAreSponsorsMandatory() - { - return $this->are_sponsors_mandatory; - } - - /** - * @return bool - */ - public function isAllowsAttachment() - { - return $this->allows_attachment; - } - - public function getClassName(){ - return 'SummitEventType'; - } - - const ClassName = 'EVENT_TYPE'; - - /** - * @return boolean - */ - public function isDefault() - { - return $this->is_default; - } - - public function setAsDefault() - { - $this->is_default = true; - } - - public function setAsNonDefault() - { - $this->is_default = false; - } - - public function setIsDefault(bool $is_default){ - $this->is_default = $is_default; - } - - /** - * @param bool $use_sponsors - */ - public function setUseSponsors($use_sponsors) - { - $this->use_sponsors = $use_sponsors; - } - - /** - * @param bool $are_sponsors_mandatory - */ - public function setAreSponsorsMandatory($are_sponsors_mandatory) - { - $this->are_sponsors_mandatory = $are_sponsors_mandatory; - } - - /** - * @param bool $allows_attachment - */ - public function setAllowsAttachment($allows_attachment) - { - $this->allows_attachment = $allows_attachment; - } - - public function __construct() - { - parent::__construct(); - $this->is_default = false; - $this->use_sponsors = false; - $this->blackout_times = false; - $this->are_sponsors_mandatory = false; - $this->allows_attachment = false; - $this->is_private = false; - $this->allows_level = false; - $this->summit_documents = new ArrayCollection(); - } - - /** - * @return bool - */ - public function isPrivate() - { - return $this->is_private; - } - - /** - * @param bool $is_private - */ - public function setIsPrivate($is_private) - { - $this->is_private = $is_private; - } - - /** - * @return SummitEvent[] - */ - public function getRelatedPublishedSummitEvents(){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this->summit); - $native_query->setParameter("type", $this); - - $res = $native_query->getResult(); - - return $res; - } - - /** - * @return int[] - */ - public function getRelatedPublishedSummitEventsIds(){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this->summit); - $native_query->setParameter("type", $this); - - $res = $native_query->getResult(); - - return $res; - } - - public function getSummitDocuments(){ - return $this->summit_documents; - } - - public function addSummitDocument(SummitDocument $doc){ - if($this->summit_documents->contains($doc)) return; - $this->summit_documents->add($doc); - } - - public function removeSummitDocument(SummitDocument $doc){ - if(!$this->summit_documents->contains($doc)) return; - $this->summit_documents->removeElement($doc); - } - - public function clearSummitDocuments(){ - $this->summit_documents->clear(); - } - - /** - * @return bool - */ - public function isAllowsLevel(): bool - { - return $this->allows_level; - } - - /** - * @param bool $allows_level - */ - public function setAllowsLevel(bool $allows_level): void - { - $this->allows_level = $allows_level; - } - -} diff --git a/app/Models/Foundation/Summit/Events/SummitEventTypeConstants.php b/app/Models/Foundation/Summit/Events/SummitEventTypeConstants.php deleted file mode 100644 index e38b4bbe..00000000 --- a/app/Models/Foundation/Summit/Events/SummitEventTypeConstants.php +++ /dev/null @@ -1,27 +0,0 @@ -attachment; - } - - /** - * @param File $attachment - */ - public function setAttachment($attachment) - { - $this->attachment = $attachment; - } - - /** - * @return bool - */ - public function hasAttachment(){ - return $this->getAttachmentId() > 0; - } - - /** - * @return int - */ - public function getAttachmentId(){ - try{ - return !is_null($this->attachment)?$this->attachment->getId():0; - } - catch(\Exception $ex){ - return 0; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Events/SummitGroupEvent.php b/app/Models/Foundation/Summit/Events/SummitGroupEvent.php deleted file mode 100644 index 9039ec34..00000000 --- a/app/Models/Foundation/Summit/Events/SummitGroupEvent.php +++ /dev/null @@ -1,91 +0,0 @@ -groups = new ArrayCollection(); - } - - /** - * @return Group[] - */ - public function getGroups() - { - return $this->groups; - } - - /** - * @param ArrayCollection $groups - */ - public function setGroups($groups) - { - $this->groups = $groups; - } - - /** - * @return int[] - */ - public function getGroupsIds(){ - $ids = []; - foreach ($this->getGroups() as $g){ - $ids[] = intval($g->getId()); - } - return $ids; - } - - /** - * @param Group $group - */ - public function addGroup(Group $group){ - $this->groups->add($group); - } - - public function clearGroups(){ - $this->groups->clear(); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/ExtraQuestions/SummitSelectionPlanExtraQuestionType.php b/app/Models/Foundation/Summit/ExtraQuestions/SummitSelectionPlanExtraQuestionType.php deleted file mode 100644 index 75fb4f92..00000000 --- a/app/Models/Foundation/Summit/ExtraQuestions/SummitSelectionPlanExtraQuestionType.php +++ /dev/null @@ -1,63 +0,0 @@ -selection_plan; - } - - /** - * @param SelectionPlan $selection_plan - */ - public function setSelectionPlan(SelectionPlan $selection_plan): void - { - $this->selection_plan = $selection_plan; - } - - use One2ManyPropertyTrait; - - protected $getIdMappings = [ - 'getSelectionPlanId' => 'selection_plan', - ]; - - protected $hasPropertyMappings = [ - 'hasSelectionPlan' => 'selection_plan', - ]; - - public function clearSelectionPlan():void{ - $this->selection_plan = null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PaymentGatewayProfileFactory.php b/app/Models/Foundation/Summit/Factories/PaymentGatewayProfileFactory.php deleted file mode 100644 index 511ce0eb..00000000 --- a/app/Models/Foundation/Summit/Factories/PaymentGatewayProfileFactory.php +++ /dev/null @@ -1,86 +0,0 @@ -setTestKeys([ - 'publishable_key' => $test_publishable_key, - 'secret_key' => $test_secret_key - ]); - - $live_publishable_key = $params['live_publishable_key'] ?? null; - $live_secret_key = $params['live_secret_key'] ?? null; - $profile->setLiveKeys( - [ - 'publishable_key' => $live_publishable_key, - 'secret_key' => $live_secret_key, - ] - ); - - $profile->setTestWebhookSecretKey($params['test_web_hook_secret'] ?? ''); - $profile->setLiveWebhookSecretKey($params['live_web_hook_secret'] ?? ''); - - if (isset($params['test_mode_enabled'])) - boolval($params['test_mode_enabled']) == true ? $profile->setTestMode() : $profile->setLiveMode(); - } - - // common properties - if (isset($params['application_type'])) - $profile->setApplicationType($params['application_type']); - - if (isset($params['active'])) - boolval(['active']) == true ? $profile->activate() : $profile->disable(); - - if (isset($params['send_email_receipt'])) - $profile->setSendEmailReceipt(boolval($params['send_email_receipt'])); - - return $profile; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationActionTypeFactory.php b/app/Models/Foundation/Summit/Factories/PresentationActionTypeFactory.php deleted file mode 100644 index c5197428..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationActionTypeFactory.php +++ /dev/null @@ -1,41 +0,0 @@ -setLabel(trim($data['label'])); - - return $action; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationCategoryFactory.php b/app/Models/Foundation/Summit/Factories/PresentationCategoryFactory.php deleted file mode 100644 index 6ca3fc4d..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationCategoryFactory.php +++ /dev/null @@ -1,74 +0,0 @@ -setTitle(trim($data['name'])); - - if(isset($data['code']) && !empty($data['code'])) - $track->setCode(trim($data['code'])); - - if(isset($data['color'])) - $track->setColor(trim($data['color'])); - - if(isset($data['description'])) - $track->setDescription(trim($data['description'])); - - $track->calculateSlug(); - - if(isset($data['session_count'])) - $track->setSessionCount(intval($data['session_count'])); - - if(isset($data['alternate_count'])) - $track->setAlternateCount(intval($data['alternate_count'])); - - if(isset($data['lightning_count'])) - $track->setLightningCount(intval($data['lightning_count'])); - - if(isset($data['lightning_alternate_count'])) - $track->setLightningAlternateCount(intval($data['lightning_alternate_count'])); - - if(isset($data['voting_visible'])) - $track->setVotingVisible(boolval($data['voting_visible'])); - - if(isset($data['chair_visible'])) - $track->setChairVisible(boolval($data['chair_visible'])); - - return $track; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationCategoryGroupFactory.php b/app/Models/Foundation/Summit/Factories/PresentationCategoryGroupFactory.php deleted file mode 100644 index 03aff701..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationCategoryGroupFactory.php +++ /dev/null @@ -1,117 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['description'])) - $track_group->setDescription(trim($data['description'])); - - if(isset($data['color'])) - $track_group->setColor(trim($data['color'])); - - return $track_group; - } - - /** - * @param Summit $summit - * @param PrivatePresentationCategoryGroup $track_group - * @param array $data - * @return PresentationCategoryGroup - */ - private static function populatePrivatePresentationCategoryGroup - ( - Summit $summit, - PrivatePresentationCategoryGroup $track_group, - array $data - ) - { - - $track_group->setSummit($summit); - - if(isset($data['submission_begin_date'])) { - $start_datetime = intval($data['submission_begin_date']); - $start_datetime = new \DateTime("@$start_datetime"); - $start_datetime->setTimezone($summit->getTimeZone()); - $track_group->setSubmissionBeginDate($start_datetime); - } - - if(isset($data['submission_end_date'])) { - $end_datetime = intval($data['submission_end_date']); - $end_datetime = new \DateTime("@$end_datetime"); - $end_datetime->setTimezone($summit->getTimeZone()); - $track_group->setSubmissionEndDate($end_datetime); - } - - if(isset($data['max_submission_allowed_per_user'])) - $track_group->setMaxSubmissionAllowedPerUser(intval($data['max_submission_allowed_per_user'])); - - return self::populatePresentationCategoryGroup($track_group, $data); - } - - /** - * @param Summit $summit - * @param PresentationCategoryGroup $track_group - * @param array $data - * @return PresentationCategoryGroup - */ - public static function populate(Summit $summit, PresentationCategoryGroup $track_group, array $data){ - if($track_group instanceof PrivatePresentationCategoryGroup){ - return self::populatePrivatePresentationCategoryGroup($summit, $track_group, $data); - } - else if($track_group instanceof PresentationCategoryGroup){ - return self::populatePresentationCategoryGroup($track_group, $data); - } - return $track_group; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationFactory.php b/app/Models/Foundation/Summit/Factories/PresentationFactory.php deleted file mode 100644 index eafaa061..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationFactory.php +++ /dev/null @@ -1,147 +0,0 @@ -setTitle(html_entity_decode(trim($payload['title']))); - - if (isset($payload['description'])) - $presentation->setAbstract(html_entity_decode(trim($payload['description']))); - - if (isset($payload['social_description'])) - $presentation->setSocialSummary(strip_tags(trim($payload['social_description']))); - - $event_type = $presentation->getType(); - if (isset($payload['level']) && !is_null($event_type) && $event_type->isAllowsLevel()) - $presentation->setLevel($payload['level']); - } - - if (isset($payload['will_all_speakers_attend'])) - $presentation->setWillAllSpeakersAttend(boolval($payload['will_all_speakers_attend'])); - - if (isset($payload['attendees_expected_learnt'])) - $presentation->setAttendeesExpectedLearnt(html_entity_decode($payload['attendees_expected_learnt'])); - - $presentation->setAttendingMedia(isset($payload['attending_media']) ? - filter_var($payload['attending_media'], FILTER_VALIDATE_BOOLEAN) : 0); - - $presentation->setToRecord(isset($data['to_record']) ? - filter_var($data['to_record'], FILTER_VALIDATE_BOOLEAN) : 0); - - if (isset($payload['disclaimer_accepted']) && !empty($payload['disclaimer_accepted'])) { - $disclaimer_accepted = boolval($payload['disclaimer_accepted']); - if ($disclaimer_accepted && !$presentation->isDisclaimerAccepted()) { - $presentation->setDisclaimerAcceptedDate - ( - new \DateTime('now', new \DateTimeZone('UTC')) - ); - } - } - - // links - - if (isset($payload['links'])) { - - if (count($payload['links']) > Presentation::MaxAllowedLinks) { - throw new ValidationException(trans( - 'validation_errors.PresentationService.saveOrUpdatePresentation.MaxAllowedLinks', - [ - 'max_allowed_links' => Presentation::MaxAllowedLinks - ])); - } - - $presentation->clearLinks(); - foreach ($payload['links'] as $link) { - $presentationLink = new PresentationLink(); - $presentationLink->setName(trim($link)); - $presentationLink->setLink(trim($link)); - $presentation->addLink($presentationLink); - } - } - // extra questions - $extra_questions = $payload['extra_questions'] ?? []; - $selection_plan = $presentation->getSelectionPlan(); - if (count($extra_questions) && !is_null($selection_plan)) { - // extra questions values - $mandatory_questions = $selection_plan->getMandatoryExtraQuestions(); - if (count($extra_questions) < $mandatory_questions->count()) { - throw new ValidationException - ( - sprintf - ( - "You neglected to fill in all mandatory questions for the presentation %s (%s) .", - count($extra_questions), - $mandatory_questions->count() - ) - ); - } - $questions = $selection_plan->getExtraQuestions(); - if ($questions->count() > 0) { - $presentation->clearExtraQuestionAnswers(); - foreach ($questions as $question) { - if (!$question instanceof SummitSelectionPlanExtraQuestionType) continue; - foreach ($extra_questions as $question_answer) { - if (intval($question_answer['question_id']) == $question->getId()) { - $value = trim($question_answer['answer']); - - if (empty($value) && $question->isMandatory()) - throw new ValidationException(sprintf('Question "%s" is mandatory', $question->getLabel())); - - if ($question->allowsValues() && !$question->allowValue($value)) { - Log::warning(sprintf("value %s is not allowed for question %s", $value, $question->getName())); - throw new ValidationException("The answer you provided is invalid"); - } - - $answer = new PresentationExtraQuestionAnswer(); - $answer->setQuestion($question); - $answer->setValue($value); - $presentation->addExtraQuestionAnswer($answer); - break; - } - } - } - - } - } - - return $presentation; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationLinkFactory.php b/app/Models/Foundation/Summit/Factories/PresentationLinkFactory.php deleted file mode 100644 index 251a91c0..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationLinkFactory.php +++ /dev/null @@ -1,42 +0,0 @@ -setLink(trim($data['link'])); - - return $link; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationMaterialFactory.php b/app/Models/Foundation/Summit/Factories/PresentationMaterialFactory.php deleted file mode 100644 index b91b5661..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationMaterialFactory.php +++ /dev/null @@ -1,39 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['description'])) - $presentationMaterial->setDescription(trim($data['description'])); - - if(isset($data['display_on_site'])) - $presentationMaterial->setDisplayOnSite(isset($data['display_on_site']) ? boolval($data['display_on_site']) : true); - - return $presentationMaterial; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationMediaUploadFactory.php b/app/Models/Foundation/Summit/Factories/PresentationMediaUploadFactory.php deleted file mode 100644 index 885bc94c..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationMediaUploadFactory.php +++ /dev/null @@ -1,53 +0,0 @@ -setDisplayOnSite(isset($data['display_on_site']) ? boolval($data['display_on_site']) : true); - - if(isset($data['file_name'])) - $media_upload->setFilename(trim($data['file_name'])); - - if(isset($data['presentation']) && $data['presentation'] instanceof Presentation) - $media_upload->setPresentation($data['presentation']); - - if(isset($data['media_upload_type']) && $data['media_upload_type'] instanceof SummitMediaUploadType) - $media_upload->setMediaUploadType($data['media_upload_type']); - - return $media_upload; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationSlideFactory.php b/app/Models/Foundation/Summit/Factories/PresentationSlideFactory.php deleted file mode 100644 index 9087e671..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationSlideFactory.php +++ /dev/null @@ -1,42 +0,0 @@ -setLink(trim($data['link'])); - - return $slide; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationSpeakerSummitAssistanceConfirmationRequestFactory.php b/app/Models/Foundation/Summit/Factories/PresentationSpeakerSummitAssistanceConfirmationRequestFactory.php deleted file mode 100644 index 5228f377..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationSpeakerSummitAssistanceConfirmationRequestFactory.php +++ /dev/null @@ -1,62 +0,0 @@ -setSummit($summit); - $request->setSpeaker($speaker); - $request = self::populate($request, $data); - return $request; - } - - /** - * @param PresentationSpeakerSummitAssistanceConfirmationRequest $summit_assistance - * @param array $data - * @return PresentationSpeakerSummitAssistanceConfirmationRequest - */ - public static function populate - ( - PresentationSpeakerSummitAssistanceConfirmationRequest $summit_assistance, - array $data - ) - { - $on_site_phone = isset($data['on_site_phone']) ? trim($data['on_site_phone']) : null; - $registered = isset($data['registered']) ? boolval($data['registered']) : 0; - $checked_in = isset($data['checked_in']) ? boolval($data['checked_in']) : 0; - $confirmed = isset($data['is_confirmed']) ? boolval($data['is_confirmed']) : 0; - - $summit_assistance->setOnSitePhone($on_site_phone); - $summit_assistance->setRegistered($registered); - $summit_assistance->setIsConfirmed($confirmed); - $summit_assistance->setCheckedIn($checked_in); - - return $summit_assistance; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/PresentationVideoFactory.php b/app/Models/Foundation/Summit/Factories/PresentationVideoFactory.php deleted file mode 100644 index b97089b6..00000000 --- a/app/Models/Foundation/Summit/Factories/PresentationVideoFactory.php +++ /dev/null @@ -1,48 +0,0 @@ -setYoutubeId(trim($data['youtube_id'])); - - if(isset($data['external_url'])) - $video->setExternalUrl(trim($data['external_url'])); - - if($video->getId() == 0) - $video->setDateUploaded(new \DateTime()); - return $video; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SpeakerEditPermissionRequestFactory.php b/app/Models/Foundation/Summit/Factories/SpeakerEditPermissionRequestFactory.php deleted file mode 100644 index 29f86b44..00000000 --- a/app/Models/Foundation/Summit/Factories/SpeakerEditPermissionRequestFactory.php +++ /dev/null @@ -1,34 +0,0 @@ -setSpeaker($speaker); - $request->setRequestedBy($requestor); - return $request; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SpeakerSelectionAnnouncementEmailTypeFactory.php b/app/Models/Foundation/Summit/Factories/SpeakerSelectionAnnouncementEmailTypeFactory.php deleted file mode 100644 index dbb429da..00000000 --- a/app/Models/Foundation/Summit/Factories/SpeakerSelectionAnnouncementEmailTypeFactory.php +++ /dev/null @@ -1,52 +0,0 @@ -hasPublishedRegularPresentations($summit, $role, true, $summit->getExcludedCategoriesForAcceptedPresentations()) || - $speaker->hasPublishedLightningPresentations($summit, $role, true, $summit->getExcludedCategoriesForAcceptedPresentations()); - $has_rejected = $speaker->hasRejectedPresentations($summit, $role, true, $summit->getExcludedCategoriesForRejectedPresentations()); - $has_alternate = $speaker->hasAlternatePresentations($summit, $role, true, $summit->getExcludedCategoriesForAcceptedPresentations()); - - if($has_published && !$has_rejected && !$has_alternate) - return SpeakerAnnouncementSummitEmail::TypeAccepted; - - if(!$has_published && !$has_rejected && $has_alternate) - return SpeakerAnnouncementSummitEmail::TypeAlternate; - - if(!$has_published && $has_rejected && !$has_alternate) - return SpeakerAnnouncementSummitEmail::TypeRejected; - - if($has_published && !$has_rejected && $has_alternate) - return SpeakerAnnouncementSummitEmail::TypeAcceptedAlternate; - - if($has_published && $has_rejected && !$has_alternate) - return SpeakerAnnouncementSummitEmail::TypeAcceptedRejected; - - if(!$has_published && $has_rejected && $has_alternate) - return SpeakerAnnouncementSummitEmail::TypeAcceptedRejected; - - if($has_published && $has_rejected && $has_alternate) - return SpeakerAnnouncementSummitEmail::TypeAcceptedAlternate; - - return SpeakerAnnouncementSummitEmail::TypeNone; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SponsorFactory.php b/app/Models/Foundation/Summit/Factories/SponsorFactory.php deleted file mode 100644 index bd6dc1db..00000000 --- a/app/Models/Foundation/Summit/Factories/SponsorFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -setCompany($data['company']); - - if(isset($data['sponsorship'])) - $sponsor->setSponsorship($data['sponsorship']); - - return $sponsor; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SponsorUserInfoGrantFactory.php b/app/Models/Foundation/Summit/Factories/SponsorUserInfoGrantFactory.php deleted file mode 100644 index 4b63f9cb..00000000 --- a/app/Models/Foundation/Summit/Factories/SponsorUserInfoGrantFactory.php +++ /dev/null @@ -1,56 +0,0 @@ -setLabel(trim($data['label'])); - - if(isset($data['name'])) - $sponsorship_type->setName(trim($data['name'])); - - if(isset($data['size'])) - $sponsorship_type->setSize(trim($data['size'])); - - return $sponsorship_type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitAccessLevelTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitAccessLevelTypeFactory.php deleted file mode 100644 index 7f9a5a02..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitAccessLevelTypeFactory.php +++ /dev/null @@ -1,50 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['description'])) - $access_level->setDescription(trim($data['description'])); - - if(isset($data['template_content'])) - $access_level->setTemplateContent(trim($data['template_content'])); - - if(isset($data['is_default'])) - $access_level->setIsDefault(boolval($data['is_default'])); - - return $access_level; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitAttendeeFactory.php b/app/Models/Foundation/Summit/Factories/SummitAttendeeFactory.php deleted file mode 100644 index b000e56a..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitAttendeeFactory.php +++ /dev/null @@ -1,151 +0,0 @@ -setEmail($member->getEmail()); - $attendee->setMember($member); - } - else{ - $attendee->clearMember(); - } - - if(isset($payload['email']) && !empty($payload['email'])) - $attendee->setEmail(trim($payload['email'])); - - $summit->addAttendee($attendee); - - if(isset($payload['external_id'])) - $attendee->setExternalId(trim($payload['external_id'])); - - if(isset($payload['first_name'])) - $attendee->setFirstName(trim($payload['first_name'])); - - if (isset($payload['last_name'])) - $attendee->setSurname(trim($payload['last_name'])); - - if (isset($payload['company']) && !empty($payload['company'])) - $attendee->setCompanyName(trim($payload['company'])); - - if (isset($payload['admin_notes']) && !empty($payload['admin_notes'])) - $attendee->setAdminNotes(trim($payload['admin_notes'])); - - if (isset($payload['shared_contact_info'])) - $attendee->setShareContactInfo(boolval($payload['shared_contact_info'])); - - if (isset($payload['summit_hall_checked_in']) && !empty($payload['summit_hall_checked_in'])) { - $summit_hall_checked_in = boolval($payload['summit_hall_checked_in']); - $attendee->setSummitHallCheckedIn(boolval($payload['summit_hall_checked_in'])); - - if ($summit_hall_checked_in && !$attendee->hasCheckedIn()) { - $attendee->setSummitHallCheckedIn - ( - $summit_hall_checked_in - ); - } - } - - if (isset($payload['disclaimer_accepted']) && !empty($payload['disclaimer_accepted'])) { - $disclaimer_accepted = boolval($payload['disclaimer_accepted']); - if ($disclaimer_accepted && !$attendee->isDisclaimerAccepted()) { - $attendee->setDisclaimerAcceptedDate - ( - new \DateTime('now', new \DateTimeZone('UTC')) - ); - } - } - - // extra questions - - $extra_questions = $payload['extra_questions'] ?? []; - - if (count($extra_questions)) { - // only check if question are populated - $mandatory_questions = $summit->getMandatoryOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage); - if (count($extra_questions) < $mandatory_questions->count()) { - throw new ValidationException("You neglected to fill in all mandatory questions for the attendee."); - } - $questions = $summit->getOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage); - if ($questions->count() > 0) { - $attendee->clearExtraQuestionAnswers(); - foreach ($questions as $question) { - if (!$question instanceof SummitOrderExtraQuestionType) continue; - foreach ($extra_questions as $question_answer) { - if (intval($question_answer['question_id']) == $question->getId()) { - $value = trim($question_answer['answer']); - - if (empty($value) && $question->isMandatory()) - throw new ValidationException(sprintf('Question "%s" is mandatory', $question->getLabel())); - - if ($question->allowsValues() && !$question->allowValue($value)) { - Log::warning(sprintf("value %s is not allowed for question %s", $value, $question->getName())); - throw new ValidationException("The answer you provided is invalid"); - } - - $answer = new SummitOrderExtraQuestionAnswer(); - $answer->setQuestion($question); - $answer->setValue($value); - $attendee->addExtraQuestionAnswer($answer); - - break; - } - } - } - } - } - - return $attendee; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitAttendeeTicketFactory.php b/app/Models/Foundation/Summit/Factories/SummitAttendeeTicketFactory.php deleted file mode 100644 index 6bc258ae..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitAttendeeTicketFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -addTicket($ticket); - - if(isset($data['external_order_id'])) - $ticket->setExternalOrderId($data['external_order_id']); - if(isset($data['external_attendee_id'])) - $ticket->setExternalAttendeeId($data['external_attendee_id']); - - $ticket->setTicketType($type); - - return $ticket; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitBadgeFeatureTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitBadgeFeatureTypeFactory.php deleted file mode 100644 index 9a45c632..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitBadgeFeatureTypeFactory.php +++ /dev/null @@ -1,49 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['description'])) - $feature->setDescription(trim($data['description'])); - - if(isset($data['template_content'])) - $feature->setTemplateContent(trim($data['template_content'])); - - return $feature; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitBadgeTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitBadgeTypeFactory.php deleted file mode 100644 index 102ad4cb..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitBadgeTypeFactory.php +++ /dev/null @@ -1,50 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['description'])) - $badge_type->setDescription(trim($data['description'])); - - if(isset($data['template_content'])) - $badge_type->setTemplateContent(trim($data['template_content'])); - - if(isset($data['is_default'])) - $badge_type->setIsDefault(boolval($data['is_default'])); - - return $badge_type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitDocumentFactory.php b/app/Models/Foundation/Summit/Factories/SummitDocumentFactory.php deleted file mode 100644 index 5844585d..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitDocumentFactory.php +++ /dev/null @@ -1,52 +0,0 @@ -setName(trim($payload['name'])); - - if(isset($payload['label'])) - $document->setLabel(trim($payload['label'])); - - if(isset($payload['show_always'])) - $document->setShowAlways(boolval($payload['show_always'])); - - if(isset($payload['description'])) - $document->setDescription(trim($payload['description'])); - - return $document; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitEventFactory.php b/app/Models/Foundation/Summit/Factories/SummitEventFactory.php deleted file mode 100644 index f841943a..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitEventFactory.php +++ /dev/null @@ -1,103 +0,0 @@ -isPrivate()) - $event = new SummitGroupEvent(); - - if($type->isAllowsAttachment()) - $event = new SummitEventWithFile(); - - $event->setSummit($summit); - $event->setType($type); - - return self::populate($event, $payload); - } - - /** - * @param SummitEvent $event - * @param array $payload - * @return SummitEvent - * @throws ValidationException - */ - static public function populate(SummitEvent $event, array $payload):SummitEvent{ - - if (isset($payload['title'])) - $event->setTitle(html_entity_decode(trim($payload['title']))); - - if (isset($payload['description'])) - $event->setAbstract(html_entity_decode(trim($payload['description']))); - - if (isset($payload['social_description'])) - $event->setSocialSummary(strip_tags(trim($payload['social_description']))); - - $event_type = $event->getType(); - if (isset($payload['level']) && !is_null($event_type) && $event_type->isAllowsLevel()) - $event->setLevel($payload['level']); - - if (isset($payload['rsvp_link']) && isset($payload['rsvp_template_id'])) { - throw new ValidationException - ( - "rsvp_link and rsvp_template_id are both set, you need to specify only one." - ); - } - - if (isset($payload['rsvp_link'])) { - $event->setRSVPLink(html_entity_decode(trim($payload['rsvp_link']))); - } - - if (isset($payload['streaming_url'])) { - $event->setStreamingUrl(html_entity_decode(trim($payload['streaming_url']))); - } - - if (isset($payload['etherpad_link'])) { - $event->setEtherpadLink(html_entity_decode(trim($payload['etherpad_link']))); - } - - if (isset($payload['meeting_url'])) { - $event->setMeetingUrl(html_entity_decode(trim($payload['meeting_url']))); - } - - if (isset($payload['head_count'])) - $event->setHeadCount(intval($payload['head_count'])); - - if (isset($payload['occupancy'])) - $event->setOccupancy($payload['occupancy']); - - $event->setAllowFeedBack(isset($payload['allow_feedback']) ? - filter_var($payload['allow_feedback'], FILTER_VALIDATE_BOOLEAN) : - false); - - return $event; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitEventFeedbackFactory.php b/app/Models/Foundation/Summit/Factories/SummitEventFeedbackFactory.php deleted file mode 100644 index 185a8ac7..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitEventFeedbackFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -setRate(intval($data['rate'])); - - $note = isset($data['note']) ? trim($data['note']) : ""; - $feedback->setNote($note); - return $feedback; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitEventTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitEventTypeFactory.php deleted file mode 100644 index 9cbb3f6c..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitEventTypeFactory.php +++ /dev/null @@ -1,132 +0,0 @@ -setMinSpeakers(intval($data['min_speakers'])); - } - - if(isset($data['max_speakers'])) { - $event_type->setMaxSpeakers(intval($data['max_speakers'])); - } - - if(isset($data['min_moderators'])) { - $event_type->setMinModerators(intval($data['min_moderators'])); - } - - if(isset($data['max_moderators'])) { - $event_type->setMaxModerators(intval($data['max_moderators'])); - } - - if(isset($data['use_speakers'])) { - $event_type->setUseSpeakers(boolval($data['use_speakers'])); - } - - if(isset($data['are_speakers_mandatory'])) { - $event_type->setAreSpeakersMandatory(boolval($data['are_speakers_mandatory'])); - } - - if(isset($data['use_moderator'])) { - $event_type->setUseModerator(boolval($data['use_moderator'])); - } - - if(isset($data['is_moderator_mandatory'])) { - $event_type->setIsModeratorMandatory(boolval($data['is_moderator_mandatory'])); - } - - if(isset($data['moderator_label'])) { - $event_type->setModeratorLabel(trim($data['moderator_label'])); - } - - if(isset($data['should_be_available_on_cfp'])) { - $event_type->setShouldBeAvailableOnCfp(boolval($data['should_be_available_on_cfp'])); - } - } - } - break; - } - - if(isset($data['name'])) - $event_type->setType(trim($data['name'])); - - if(isset($data['color'])) - $event_type->setColor(trim($data['color'])); - - if(isset($data['black_out_times'])) - $event_type->setBlackoutTimes(boolval($data['black_out_times'])); - - if(isset($data['use_sponsors'])) - $event_type->setUseSponsors(boolval($data['use_sponsors'])); - - if(isset($data['are_sponsors_mandatory'])) - $event_type->setAreSponsorsMandatory(boolval($data['are_sponsors_mandatory'])); - - if(isset($data['allows_attachment'])) - $event_type->setAllowsAttachment(boolval($data['allows_attachment'])); - - if(isset($data['is_private'])) - $event_type->setIsPrivate(boolval($data['is_private'])); - - if(isset($data['is_default'])) - $event_type->setIsDefault(boolval($data['is_default'])); - - if(isset($data['allows_level'])) - $event_type->setAllowsLevel(boolval($data['allows_level'])); - - $summit->addEventType($event_type); - return $event_type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitFactory.php b/app/Models/Foundation/Summit/Factories/SummitFactory.php deleted file mode 100644 index d204409e..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitFactory.php +++ /dev/null @@ -1,423 +0,0 @@ -setName(trim($data['name'])); - } - - if(isset($data['time_zone_id']) ){ - $summit->setTimeZoneId(trim($data['time_zone_id'])); - } - - if(isset($data['max_submission_allowed_per_user']) ){ - $summit->setMaxSubmissionAllowedPerUser(intval($data['max_submission_allowed_per_user'])); - } - - if(isset($data['active']) ){ - $summit->setActive(boolval($data['active'])); - } - - if(isset($data['available_on_api']) ){ - $summit->setAvailableOnApi(boolval($data['available_on_api'])); - } - - if(isset($data['dates_label']) ){ - $summit->setDatesLabel(trim($data['dates_label'])); - } - - if(isset($data['calendar_sync_name']) ){ - $summit->setCalendarSyncName(trim($data['calendar_sync_name'])); - } - - if(isset($data['calendar_sync_desc']) ){ - $summit->setCalendarSyncDesc(trim($data['calendar_sync_desc'])); - } - - // BOOKING PERIOD - if(array_key_exists('begin_allow_booking_date', $data) && array_key_exists('end_allow_booking_date', $data)) { - if (isset($data['begin_allow_booking_date']) && isset($data['end_allow_booking_date'])) { - $val1 = intval($data['begin_allow_booking_date']); - if($val1 > 0) { - $start_datetime = new \DateTime("@$val1"); - $start_datetime->setTimezone($summit->getTimeZone()); - // set local time from UTC - $summit->setBeginAllowBookingDate($start_datetime); - } - else{ - $summit->clearAllowBookingDates(); - } - - $val2 = intval($data['end_allow_booking_date']); - if($val2 > 0) { - $end_datetime = new \DateTime("@$val2"); - $end_datetime->setTimezone($summit->getTimeZone()); - // set local time from UTC - $summit->setEndAllowBookingDate($end_datetime); - } - else{ - $summit->clearAllowBookingDates(); - } - } - else{ - $summit->clearAllowBookingDates(); - } - } - // SUMMIT PERIOD - if(array_key_exists('start_date', $data) && array_key_exists('end_date', $data)) { - if (isset($data['start_date']) && isset($data['end_date'])) { - - $val1 = intval($data['start_date']); - if($val1 > 0) { - $start_datetime = new \DateTime("@$val1"); - $start_datetime->setTimezone($summit->getTimeZone()); - // set local time from UTC - $summit->setBeginDate($start_datetime); - } - else{ - $summit->clearBeginEndDates(); - } - - $val2 = intval($data['end_date']); - if($val2 > 0) { - $end_datetime = new \DateTime("@$val2"); - $end_datetime->setTimezone($summit->getTimeZone()); - // set local time from UTC - $summit->setEndDate($end_datetime); - } - else{ - $summit->clearBeginEndDates(); - } - } - else{ - $summit->clearBeginEndDates(); - } - } - - // REGISTRATION PERIOD - if(array_key_exists('registration_begin_date', $data) && array_key_exists('registration_end_date', $data)) { - if (isset($data['registration_begin_date']) && isset($data['registration_end_date'])) { - - $val1 = intval($data['registration_begin_date']); - - if($val1 > 0) { - $start_datetime = new \DateTime("@$val1"); - $start_datetime->setTimezone($summit->getTimeZone()); - // set local time from UTC - $summit->setRegistrationBeginDate($start_datetime); - } - else{ - $summit->clearRegistrationDates(); - } - - $val2 = intval($data['registration_end_date']); - if($val2 > 0) { - $end_datetime = new \DateTime("@$val2"); - $end_datetime->setTimezone($summit->getTimeZone()); - // set local time from UTC - $summit->setRegistrationEndDate($end_datetime); - - $summit_end_date = $summit->getLocalEndDate(); - - if(!is_null($summit_end_date)){ - // registration end date could be after summit end date due people could get registered after summit is end - // to obtain access to summit content ( mainly for virtual events) - if($start_datetime > $summit_end_date) - throw new ValidationException("The Registration Begin Date cannot be after the Summit End Date."); - } - } - else{ - $summit->clearRegistrationDates(); - } - } - else{ - $summit->clearRegistrationDates(); - } - } - - if(array_key_exists('start_showing_venues_date', $data)){ - if (isset($data['start_showing_venues_date'])) { - $val = intval($data['start_showing_venues_date']); - if($val > 0) { - $start_datetime = new \DateTime("@$val"); - $start_datetime->setTimezone($summit->getTimeZone()); - // set local time from UTC - $summit->setStartShowingVenuesDate($start_datetime); - } - else{ - $summit->clearStartShowingVenuesDate(); - } - } - else{ - $summit->clearStartShowingVenuesDate(); - } - } - - if(array_key_exists('reassign_ticket_till_date', $data)){ - if (isset($data['reassign_ticket_till_date'])) { - - $val = intval($data['reassign_ticket_till_date']); - if($val > 0) { - $date = new \DateTime("@$val"); - $date->setTimezone($summit->getTimeZone()); - - - // set local time from UTC - $summit->setReassignTicketTillDate($date); - } - else - { - $summit->clearReassignTicketTillDate(); - } - } - else{ - $summit->clearReassignTicketTillDate(); - } - } - - if(array_key_exists('schedule_start_date', $data)) { - if (isset($data['schedule_start_date'])) { - $val = intval($data['schedule_start_date']); - if($val > 0) { - $start_datetime = new \DateTime("@$val"); - $start_datetime->setTimezone($summit->getTimeZone()); - - // set local time from UTC - $summit->setScheduleDefaultStartDate($start_datetime); - } - else{ - $summit->clearScheduleDefaultStartDate(); - } - } - else{ - $summit->clearScheduleDefaultStartDate(); - } - } - - if(isset($data['link']) ){ - $summit->setLink(trim($data['link'])); - } - - if(isset($data['registration_disclaimer_mandatory']) ){ - $registration_disclaimer_mandatory = boolval($data['registration_disclaimer_mandatory']); - $summit->setRegistrationDisclaimerMandatory($registration_disclaimer_mandatory); - if($registration_disclaimer_mandatory){ - - $registration_disclaimer_content = $data['registration_disclaimer_content'] ?? ''; - if(empty($registration_disclaimer_content)){ - throw new ValidationException("registration_disclaimer_content is mandatory"); - } - } - } - - if(isset($data['registration_disclaimer_content'])){ - $summit->setRegistrationDisclaimerContent(trim($data['registration_disclaimer_content'])); - } - - if(isset($data['link']) ){ - $summit->setLink(trim($data['link'])); - } - - if(isset($data['slug']) ){ - $summit->setRawSlug(trim($data['slug'])); - } - - if(isset($data['secondary_registration_link']) ){ - $summit->setSecondaryRegistrationLink(trim($data['secondary_registration_link'])); - } - - if(isset($data['secondary_registration_label']) ){ - $summit->setSecondaryRegistrationLabel(trim($data['secondary_registration_label'])); - } - - if(isset($data['meeting_room_booking_start_time']) ){ - // no need to convert to UTC, its only relative time - $meeting_room_booking_start_time = intval($data['meeting_room_booking_start_time']); - $meeting_room_booking_start_time = new \DateTime("@$meeting_room_booking_start_time"); - $summit->setMeetingRoomBookingStartTime($meeting_room_booking_start_time); - } - - if(isset($data['meeting_room_booking_end_time']) ){ - // no need to convert to UTC, its only relative time - $meeting_room_booking_end_time = intval($data['meeting_room_booking_end_time']); - $meeting_room_booking_end_time = new \DateTime("@$meeting_room_booking_end_time"); - $summit->setMeetingRoomBookingEndTime($meeting_room_booking_end_time); - } - - if(isset($data['meeting_room_booking_slot_length']) ){ - // minutes - $summit->setMeetingRoomBookingSlotLength(intval($data['meeting_room_booking_slot_length'])); - } - - if(isset($data['registration_reminder_email_days_interval']) ){ - // days - $summit->setRegistrationReminderEmailDaysInterval(intval($data['registration_reminder_email_days_interval'])); - } - - if(isset($data['meeting_room_booking_max_allowed']) ){ - // maximun books per user - $summit->setMeetingRoomBookingMaxAllowed(intval($data['meeting_room_booking_max_allowed'])); - } - - // external schedule feed - - if(isset($data['api_feed_type'])){ - $summit->setApiFeedType($data['api_feed_type']); - } - - if(isset($data['api_feed_url'])){ - $summit->setApiFeedUrl(trim($data['api_feed_url'])); - } - - if(isset($data['api_feed_key'])){ - $summit->setApiFeedKey(trim($data['api_feed_key'])); - } - - // schedule - - if(isset($data['schedule_default_page_url'])){ - $summit->setScheduleDefaultPageUrl(trim($data['schedule_default_page_url'])); - } - - if(isset($data['schedule_default_event_detail_url'])){ - $summit->setScheduleDefaultEventDetailUrl(trim($data['schedule_default_event_detail_url'])); - } - - if(isset($data['schedule_og_site_name'])){ - $summit->setScheduleOgSiteName(trim($data['schedule_og_site_name'])); - } - - if(isset($data['schedule_og_image_url'])){ - $summit->setScheduleOgImageUrl(trim($data['schedule_og_image_url'])); - } - - if(isset($data['schedule_og_image_secure_url'])){ - $summit->setScheduleOgImageSecureUrl(trim($data['schedule_og_image_secure_url'])); - } - - if(isset($data['schedule_og_image_width'])){ - $summit->setScheduleOgImageWidth(intval($data['schedule_og_image_width'])); - } - - if(isset($data['schedule_og_image_height'])){ - $summit->setScheduleOgImageHeight(intval($data['schedule_og_image_height'])); - } - - if(isset($data['schedule_facebook_app_id'])){ - $summit->setScheduleFacebookAppId(trim($data['schedule_facebook_app_id'])); - } - - if(isset($data['schedule_ios_app_name'])){ - $summit->setScheduleIosAppName(trim($data['schedule_ios_app_name'])); - } - - if(isset($data['schedule_ios_app_store_id'])){ - $summit->setScheduleIosAppStoreId(trim($data['schedule_ios_app_store_id'])); - } - - if(isset($data['schedule_ios_app_custom_schema'])){ - $summit->setScheduleIosAppCustomSchema(trim($data['schedule_ios_app_custom_schema'])); - } - - if(isset($data['schedule_android_app_name'])){ - $summit->setScheduleAndroidAppName(trim($data['schedule_android_app_name'])); - } - - if(isset($data['schedule_android_app_package'])){ - $summit->setScheduleAndroidAppPackage(trim($data['schedule_android_app_package'])); - } - - if(isset($data['schedule_android_custom_schema'])){ - $summit->setScheduleAndroidCustomSchema(trim($data['schedule_android_custom_schema'])); - } - - if(isset($data['schedule_twitter_app_name'])){ - $summit->setScheduleTwitterAppName(trim($data['schedule_twitter_app_name'])); - } - - if(isset($data['schedule_twitter_text'])){ - $summit->setScheduleTwitterText(trim($data['schedule_twitter_text'])); - } - - // external registration feed - - if(isset($data['external_summit_id']) ){ - $summit->setExternalSummitId(trim($data['external_summit_id'])); - } - - if(isset($data['external_registration_feed_type']) ){ - $summit->setExternalRegistrationFeedType(trim($data['external_registration_feed_type'])); - } - - if(isset($data['external_registration_feed_api_key']) ){ - $summit->setExternalRegistrationFeedApiKey(trim($data['external_registration_feed_api_key'])); - } - - $summit->generateRegistrationSlugPrefix(); - - // urls - - if(isset($data['default_page_url']) ){ - $summit->setDefaultPageUrl(trim($data['default_page_url'])); - } - - if(isset($data['speaker_confirmation_default_page_url']) ){ - $summit->setSpeakerConfirmationDefaultPageUrl(trim($data['speaker_confirmation_default_page_url'])); - } - - if(isset($data['virtual_site_url']) ){ - $summit->setVirtualSiteUrl(trim($data['virtual_site_url'])); - } - - if(isset($data['marketing_site_url']) ){ - $summit->setMarketingSiteUrl(trim($data['marketing_site_url'])); - } - - if(isset($data['virtual_site_oauth2_client_id']) ){ - $summit->setVirtualSiteOAuth2ClientId(trim($data['virtual_site_oauth2_client_id'])); - } - - if(isset($data['marketing_site_oauth2_client_id']) ){ - $summit->setMarketingSiteOAuth2ClientId(trim($data['marketing_site_oauth2_client_id'])); - } - - if(isset($data['support_email']) ){ - $summit->setSupportEmail(trim($data['support_email'])); - } - - return $summit; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitLocationBannerFactory.php b/app/Models/Foundation/Summit/Factories/SummitLocationBannerFactory.php deleted file mode 100644 index 4fc17922..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitLocationBannerFactory.php +++ /dev/null @@ -1,152 +0,0 @@ -setTitle(trim($data['title'])); - - if(isset($data['content'])) - $banner->setContent(trim($data['content'])); - - if(isset($data['type'])) - $banner->setType(trim($data['type'])); - - if(isset($data['enabled'])) - $banner->setEnabled(boolval($data['enabled'])); - - $banner->setLocation($location); - - return $banner; - } - - /** - * @param Summit $summit - * @param SummitAbstractLocation $location - * @param ScheduledSummitLocationBanner $banner - * @param array $data - * @return ScheduledSummitLocationBanner - * @throws ValidationException - */ - private static function populateScheduledSummitLocationBanner(Summit $summit, SummitAbstractLocation $location, ScheduledSummitLocationBanner $banner, array $data){ - - self::populateSummitLocationBanner($summit, $location, $banner, $data); - - if (isset($data['start_date']) && isset($data['end_date'])) { - $start_datetime = intval($data['start_date']); - $start_datetime = new \DateTime("@$start_datetime"); - $start_datetime->setTimezone($summit->getTimeZone()); - $end_datetime = intval($data['end_date']); - $end_datetime = new \DateTime("@$end_datetime"); - $end_datetime->setTimezone($summit->getTimeZone()); - $interval_seconds = $end_datetime->getTimestamp() - $start_datetime->getTimestamp(); - $minutes = $interval_seconds / 60; - if ($minutes < self::MinBannerDisplayMinutes) - throw new ValidationException - ( - sprintf - ( - "schedule banner should last at least %s minutes - current duration %s", - self::MinBannerDisplayMinutes, - $minutes - ) - ); - - // set local time from UTC - $banner->setStartDate($start_datetime); - $banner->setEndDate($end_datetime); - - if(!$summit->isTimeFrameInsideSummitDuration($banner->getLocalStartDate(), $banner->getLocalEndDate())){ - throw new ValidationException - ( - sprintf - ( - 'start/end datetime must be between summit start/end datetime! (%s - %s)', - $summit->getLocalBeginDate()->format('Y-m-d H:i:s'), - $summit->getLocalEndDate()->format('Y-m-d H:i:s') - ) - ); - } - } - - return $banner; - } - - /** - * @param Summit $summit - * @param SummitAbstractLocation $location - * @param SummitLocationBanner $banner - * @param array $data - * @return ScheduledSummitLocationBanner|SummitLocationBanner - */ - public static function populate - ( - Summit $summit, - SummitAbstractLocation $location, - SummitLocationBanner $banner, - array $data - ) - { - - if($banner instanceof ScheduledSummitLocationBanner){ - return self::populateScheduledSummitLocationBanner($summit, $location, $banner, $data); - } - else if($banner instanceof SummitLocationBanner){ - return self::populateSummitLocationBanner($summit, $location, $banner, $data); - } - return $banner; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitLocationFactory.php b/app/Models/Foundation/Summit/Factories/SummitLocationFactory.php deleted file mode 100644 index e9217c87..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitLocationFactory.php +++ /dev/null @@ -1,281 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['short_name'])) - $location->setShortName(trim($data['short_name'])); - - if(isset($data['description'])) - $location->setDescription(trim($data['description'])); - - return $location; - } - - /** - * @param SummitGeoLocatedLocation $location - * @param array $data - * @return SummitGeoLocatedLocation - */ - private static function populateSummitGeoLocatedLocation(SummitGeoLocatedLocation $location, array $data){ - if(isset($data['address_1'])) - $location->setAddress1(trim($data['address_1'])); - - if(isset($data['address_2'])) - $location->setAddress2(trim($data['address_2'])); - - if(isset($data['zip_code'])) - $location->setZipCode(trim($data['zip_code'])); - - if(isset($data['city'])) - $location->setCity(trim($data['city'])); - - if(isset($data['state'])) - $location->setState(trim($data['state'])); - - if(isset($data['country'])) - $location->setCountry(trim($data['country'])); - - if(isset($data['website_url'])) - $location->setWebsiteUrl(trim($data['website_url'])); - - if(isset($data['lng'])) - $location->setLng(trim($data['lng'])); - - if(isset($data['lat'])) - $location->setLat(trim($data['lat'])); - - if(isset($data['display_on_site'])) - $location->setDisplayOnSite(boolval($data['display_on_site'])); - - if(isset($data['details_page'])) - $location->setDetailsPage(boolval($data['details_page'])); - - if(isset($data['location_message'])) - $location->setLocationMessage(trim($data['location_message'])); - - return $location; - } - - /** - * @param SummitVenue $venue - * @param array $data - * @return SummitVenue - */ - public static function populateSummitVenue(SummitVenue $venue, array $data){ - self::populateSummitGeoLocatedLocation - ( - self::populateSummitAbstractLocation($venue, $data), - $data - ); - - if(isset($data['is_main'])) - $venue->setIsMain(boolval($data['is_main'])); - - return $venue; - } - - /** - * @param SummitExternalLocation $external_location - * @param array $data - * @return SummitExternalLocation - */ - public static function populateSummitExternalLocation(SummitExternalLocation $external_location, array $data){ - - self::populateSummitGeoLocatedLocation - ( - self::populateSummitAbstractLocation($external_location, $data), - $data - ); - - if(isset($data['capacity'])) - $external_location->setCapacity(intval($data['capacity'])); - - return $external_location; - } - - /** - * @param SummitHotel $hotel - * @param array $data - * @return SummitHotel - */ - public static function populateSummitHotel(SummitHotel $hotel, array $data){ - - self::populateSummitExternalLocation - ( - self::populateSummitGeoLocatedLocation - ( - self::populateSummitAbstractLocation($hotel, $data), - $data - ), - $data - ); - - if(isset($data['hotel_type'])) - $hotel->setHotelType(trim($data['hotel_type'])); - - if(isset($data['sold_out'])) - $hotel->setSoldOut(boolval($data['sold_out'])); - - if(isset($data['booking_link'])) - $hotel->setBookingLink(trim($data['booking_link'])); - - return $hotel; - } - - /** - * @param SummitAirport $airport - * @param array $data - * @return SummitAirport - */ - public static function populateSummitAirport(SummitAirport $airport, array $data){ - - self::populateSummitExternalLocation - ( - self::populateSummitGeoLocatedLocation - ( - self::populateSummitAbstractLocation($airport, $data), - $data - ), - $data - ); - - if(isset($data['airport_type'])) - $airport->setAirportType(trim($data['airport_type'])); - - return $airport; - } - - /** - * @param SummitVenueRoom $room - * @param array $data - * @return SummitVenueRoom - */ - public static function populateSummitVenueRoom(SummitVenueRoom $room, array $data){ - - self::populateSummitAbstractLocation($room, $data); - - if(isset($data['capacity'])) - $room->setCapacity(intval($data['capacity'])); - - if(isset($data['override_blackouts'])) - $room->setOverrideBlackouts(boolval($data['override_blackouts'])); - - return $room; - } - - /** - * @param SummitBookableVenueRoom $room - * @param array $data - * @return SummitBookableVenueRoom - */ - public static function populateSummitVenueBookableRoom(SummitBookableVenueRoom $room, array $data){ - - self::populateSummitVenueRoom($room, $data); - - if(isset($data['time_slot_cost'])) - $room->setTimeSlotCost(intval($data['time_slot_cost'])); - - if(isset($data['currency'])) - $room->setCurrency(trim($data['currency'])); - - return $room; - } - - - /** - * @param SummitAbstractLocation $location - * @param array $data - * @return SummitAbstractLocation - */ - public static function populate(SummitAbstractLocation $location, array $data){ - if($location instanceof SummitVenue){ - return self::populateSummitVenue($location, $data); - } - if($location instanceof SummitHotel){ - return self::populateSummitHotel($location, $data); - } - if($location instanceof SummitAirport){ - return self::populateSummitAirport($location, $data); - } - if($location instanceof SummitExternalLocation){ - return self::populateSummitExternalLocation($location, $data); - } - if($location instanceof SummitBookableVenueRoom){ - return self::populateSummitVenueBookableRoom($location, $data); - } - if($location instanceof SummitVenueRoom){ - return self::populateSummitVenueRoom($location, $data); - } - return $location; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitLocationImageFactory.php b/app/Models/Foundation/Summit/Factories/SummitLocationImageFactory.php deleted file mode 100644 index 92e1adb2..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitLocationImageFactory.php +++ /dev/null @@ -1,55 +0,0 @@ -setClassName(SummitLocationImage::TypeMap); - return self::populate($image, $data); - } - - /** - * @param array $data - * @return SummitLocationImage - */ - public static function buildImage(array $data){ - $image = new SummitLocationImage(); - $image->setClassName(SummitLocationImage::TypeImage); - return self::populate($image, $data); - } - - /** - * @param SummitLocationImage $image - * @param array $data - * @return SummitLocationImage - */ - public static function populate(SummitLocationImage $image, array $data){ - if(isset($data['name'])) - $image->setName(trim($data['name'])); - - if(isset($data['description'])) - $image->setDescription(trim($data['description'])); - - return $image; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitMediaFileTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitMediaFileTypeFactory.php deleted file mode 100644 index b900beff..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitMediaFileTypeFactory.php +++ /dev/null @@ -1,40 +0,0 @@ -setName(trim($data['name'])); - } - if(isset($data['description'])){ - $type->setDescription(trim($data['description'])); - } - if(isset($data['allowed_extensions'])){ - $allowed_extensions = implode('|', $data['allowed_extensions']); - $type->setAllowedExtensions($allowed_extensions); - } - $type->markAsUserDefined(); - return $type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitMediaUploadTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitMediaUploadTypeFactory.php deleted file mode 100644 index 10478a36..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitMediaUploadTypeFactory.php +++ /dev/null @@ -1,59 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['description'])) - $type->setDescription(trim($data['description'])); - - if(isset($data['max_size'])) // in KB - $type->setMaxSize(intval($data['max_size'])); - - if(isset($data['private_storage_type'])) - $type->setPrivateStorageType(trim($data['private_storage_type'])); - - if(isset($data['public_storage_type'])) - $type->setPublicStorageType(trim($data['public_storage_type'])); - - if(isset($data['is_mandatory'])) - if(boolval($data['is_mandatory'])) - $type->markAsMandatory(); - else - $type->markAsOptional(); - - return $type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitMetricFactory.php b/app/Models/Foundation/Summit/Factories/SummitMetricFactory.php deleted file mode 100644 index 53b0c22d..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitMetricFactory.php +++ /dev/null @@ -1,65 +0,0 @@ -setType($data['type']); - if(isset($data['location'])) - $metric->setLocation(urldecode($data['location'])); - return $metric; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitOrderExtraQuestionTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitOrderExtraQuestionTypeFactory.php deleted file mode 100644 index a3640d3d..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitOrderExtraQuestionTypeFactory.php +++ /dev/null @@ -1,46 +0,0 @@ -setUsage(trim($data['usage'])); - - if(isset($data['printable'])) - $question->setPrintable(boolval($data['printable'])); - - return $question; - } - - protected static function getNewEntity(): ExtraQuestionType - { - return new SummitOrderExtraQuestionType; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitOrderExtraQuestionValueFactory.php b/app/Models/Foundation/Summit/Factories/SummitOrderExtraQuestionValueFactory.php deleted file mode 100644 index 13bc5c2d..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitOrderExtraQuestionValueFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -setLabel(trim($data['label'])); - - if(isset($data['value'])) - $value->setValue(trim($data['value'])); - - return $value; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitOrderFactory.php b/app/Models/Foundation/Summit/Factories/SummitOrderFactory.php deleted file mode 100644 index 98d71771..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitOrderFactory.php +++ /dev/null @@ -1,126 +0,0 @@ -setSummit($summit); - - if(isset($payload['external_id'])) - $order->setExternalId(trim($payload['external_id'])); - - if(isset($payload['owner_first_name']) && !is_null($payload['owner_first_name'])) - $order->setOwnerFirstName(trim($payload['owner_first_name'])); - - if (isset($payload['owner_last_name']) && !is_null($payload['owner_last_name'])) - $order->setOwnerSurname(trim($payload['owner_last_name'])); - - if (isset($payload['owner_email']) && !is_null($payload['owner_email'])) - $order->setOwnerEmail(trim($payload['owner_email'])); - - if (isset($payload['owner_company']) && !is_null($payload['owner_company'])) - $order->setOwnerCompany(trim($payload['owner_company'])); - - if (isset($payload['billing_address_1']) && !is_null($payload['billing_address_1'])) - $order->setBillingAddress1(trim($payload['billing_address_1'])); - - if (isset($payload['billing_address_2']) && !is_null($payload['billing_address_2'])) - $order->setBillingAddress2(trim($payload['billing_address_2'])); - - if (isset($payload['billing_address_city']) && !is_null($payload['billing_address_city'])) - $order->setBillingAddressCity(trim($payload['billing_address_city'])); - - if (isset($payload['billing_address_zip_code']) && !is_null($payload['billing_address_zip_code'])) - $order->setBillingAddressZipCode(trim($payload['billing_address_zip_code'])); - - if (isset($payload['billing_address_state']) && !is_null($payload['billing_address_state'])) - $order->setBillingAddressState(trim($payload['billing_address_state'])); - - if (isset($payload['billing_address_country']) && !is_null($payload['billing_address_country'])) - $order->setBillingAddressCountryIsoCode(trim($payload['billing_address_country'])); - - // extra questions - - $extra_questions = $payload['extra_questions'] ?? []; - - if (count($extra_questions) > 0) { - $mandatory_questions = $summit->getMandatoryOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::OrderQuestionUsage); - - if (count($extra_questions) < $mandatory_questions->count()) { - throw new ValidationException("You neglected to fill in all mandatory questions for the order."); - } - - $questions = $summit->getOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::OrderQuestionUsage); - - if ($questions->count() > 0) { - $order->clearExtraQuestionAnswers(); - foreach ($questions as $question) { - if (!$question instanceof SummitOrderExtraQuestionType) continue; - foreach ($extra_questions as $question_answer) { - if (intval($question_answer['question_id']) == $question->getId()) { - - $value = trim($question_answer['answer']); - if (empty($value) && $question->isMandatory()) - throw new ValidationException(sprintf('Question "%s" is mandatory', $question->getLabel())); - - if ($question->allowsValues() && !$question->allowValue($value)) { - Log::warning(sprintf("value %s is not allowed for question %s", $value, $question->getName())); - throw new ValidationException("The answer you provided is invalid"); - } - - $answer = new SummitOrderExtraQuestionAnswer(); - $answer->setQuestion($question); - $answer->setValue($value); - $order->addExtraQuestionAnswer($answer); - - break; - } - } - } - } - } - - return $order; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitPromoCodeFactory.php b/app/Models/Foundation/Summit/Factories/SummitPromoCodeFactory.php deleted file mode 100644 index 53c5e75f..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitPromoCodeFactory.php +++ /dev/null @@ -1,233 +0,0 @@ -addAllowedTicketType($ticket_type); - } - } - - if(isset($params['badge_features'])){ - foreach ($params['badge_features'] as $feature){ - $promo_code->addBadgeFeatureType($feature); - } - } - - if(isset($data['external_id'])){ - $promo_code->setExternalId(trim($params['external_id'])); - } - - if(isset($data['code'])) - $promo_code->setCode(trim($data['code'])); - - if(isset($data['quantity_available'])) - $promo_code->setQuantityAvailable(intval($data['quantity_available'])); - - if(isset($data['valid_since_date'])) { - $val = intval($data['valid_since_date']); - if($val > 0) { - $val = new \DateTime("@$val"); - $val->setTimezone($summit->getTimeZone()); - $promo_code->setValidSinceDate($summit->convertDateFromTimeZone2UTC($val)); - } - else{ - $promo_code->setValidSinceDate(null); - } - } - - if(isset($data['valid_until_date'])) { - $val = intval($data['valid_until_date']); - if($val > 0) { - $val = new \DateTime("@$val"); - $val->setTimezone($summit->getTimeZone()); - $promo_code->setValidUntilDate($summit->convertDateFromTimeZone2UTC($val)); - } - else{ - $promo_code->setValidUntilDate(null); - } - } - - switch ($data['class_name']){ - case SummitRegistrationDiscountCode::ClassName:{ - if(isset($data['amount'])) - $promo_code->setAmount(floatval($data['amount'])); - if(isset($data['rate'])) - $promo_code->setRate(floatval($data['rate'])); - } - break; - case MemberSummitRegistrationPromoCode::ClassName:{ - if(isset($params['owner'])) - $promo_code->setOwner($params['owner']); - if(isset($data['type'])) - $promo_code->setType($data['type']); - if(isset($data['first_name'])) - $promo_code->setFirstName(trim($data['first_name'])); - if(isset($data['last_name'])) - $promo_code->setLastName(trim($data['last_name'])); - if(isset($data['email'])) - $promo_code->setEmail(trim($data['email'])); - } - break; - case SpeakerSummitRegistrationPromoCode::ClassName:{ - if(isset($data['type'])) - $promo_code->setType($data['type']); - if(isset($params['speaker'])) - $promo_code->setSpeaker($params['speaker']); - } - break; - case SponsorSummitRegistrationPromoCode::ClassName:{ - - if(isset($params['owner'])) - $promo_code->setOwner($params['owner']); - if(isset($data['type'])) - $promo_code->setType($data['type']); - if(isset($data['first_name'])) - $promo_code->setFirstName(trim($data['first_name'])); - if(isset($data['last_name'])) - $promo_code->setLastName(trim($data['last_name'])); - if(isset($data['email'])) - $promo_code->setEmail(trim($data['email'])); - - $promo_code->setSponsor($params['sponsor']); - } - break; - case MemberSummitRegistrationDiscountCode::ClassName:{ - if(isset($params['owner'])) - $promo_code->setOwner($params['owner']); - if(isset($data['type'])) - $promo_code->setType($data['type']); - if(isset($data['first_name'])) - $promo_code->setFirstName(trim($data['first_name'])); - if(isset($data['last_name'])) - $promo_code->setLastName(trim($data['last_name'])); - if(isset($data['email'])) - $promo_code->setEmail(trim($data['email'])); - if(isset($data['amount'])) - $promo_code->setAmount(floatval($data['amount'])); - if(isset($data['rate'])) - $promo_code->setRate(floatval($data['rate'])); - } - break; - case SpeakerSummitRegistrationDiscountCode::ClassName:{ - if(isset($data['type'])) - $promo_code->setType($data['type']); - if(isset($params['speaker'])) - $promo_code->setSpeaker($params['speaker']); - if(isset($data['amount'])) - $promo_code->setAmount(floatval($data['amount'])); - if(isset($data['rate'])) - $promo_code->setRate(floatval($data['rate'])); - } - break; - case SponsorSummitRegistrationDiscountCode::ClassName:{ - if(isset($params['owner'])) - $promo_code->setOwner($params['owner']); - if(isset($data['type'])) - $promo_code->setType($data['type']); - if(isset($data['first_name'])) - $promo_code->setFirstName(trim($data['first_name'])); - if(isset($data['last_name'])) - $promo_code->setLastName(trim($data['last_name'])); - if(isset($data['email'])) - $promo_code->setEmail(trim($data['email'])); - if(isset($data['amount'])) - $promo_code->setAmount(floatval($data['amount'])); - if(isset($data['rate'])) - $promo_code->setRate(floatval($data['rate'])); - if(isset($params['sponsor'])) - $promo_code->setSponsor($params['sponsor']); - if(isset($data['amount'])) - $promo_code->setAmount(floatval($data['amount'])); - if(isset($data['rate'])) - $promo_code->setRate(floatval($data['rate'])); - } - break; - } - - $summit->addPromoCode($promo_code); - return $promo_code; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitPushNotificationFactory.php b/app/Models/Foundation/Summit/Factories/SummitPushNotificationFactory.php deleted file mode 100644 index 6b178995..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitPushNotificationFactory.php +++ /dev/null @@ -1,61 +0,0 @@ -setMessage(trim($data['message'])); - - if(isset($data['channel'])) - $notification->setChannel(trim($data['channel'])); - - if(isset($data['platform'])) - $notification->setPlatform(trim($data['platform'])); - - if(isset($params['event'])) - $notification->setSummitEvent($params['event']); - - if(isset($params['group'])) - $notification->setGroup($params['group']); - - if(isset($params['owner'])) - $notification->setOwner($params['owner']); - - if(isset($params['recipients'])) - { - foreach($params['recipients'] as $recipient) - $notification->addRecipient($recipient); - } - - $notification->setSummit($summit); - - return $notification; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRSVPFactory.php b/app/Models/Foundation/Summit/Factories/SummitRSVPFactory.php deleted file mode 100644 index 469cf4e8..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRSVPFactory.php +++ /dev/null @@ -1,104 +0,0 @@ -setOwner($owner); - - if(!$rsvp->hasSeatTypeSet()) - $rsvp->setSeatType($summitEvent->getCurrentRSVPSubmissionSeatType()); - - $template = $summitEvent->getRSVPTemplate(); - - if(isset($data['event_uri']) && !empty($data['event_uri'])){ - $rsvp->setEventUri($data['event_uri']); - } - - $answers = $data['answers'] ?? []; - - // restructuring for a quick search - if(count($answers)){ - $bucket = []; - foreach ($answers as $answer_dto){ - $bucket[intval($answer_dto['question_id'])] = $answer_dto; - } - $answers = $bucket; - } - - foreach($template->getQuestions() as $question){ - - if(!$question instanceof RSVPQuestionTemplate) continue; - $answer_dto = $answers[$question->getId()] ?? null; - $value = $answer_dto['value'] ?? null; - - if($question->isMandatory() && - ( - is_null($value) || - (is_string($value) && empty($value)) || - (is_array($value)) && count($value) == 0 - ) - ) - throw new ValidationException(sprintf("Question '%s' is mandatory.", $question->getLabel())); - - $answer = $rsvp->findAnswerByQuestion($question); - if(is_null($answer)) - $answer = new RSVPAnswer(); - - if(!$question->isValidValue($value)) - throw new ValidationException(sprintf("Value is not valid for Question '%s'.", $question->getLabel())); - - $answer->setValue($value); - $answer->setQuestion($question); - $rsvp->addAnswer($answer); - } - - $summitEvent->addRSVPSubmission($rsvp); - - return $rsvp; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateFactory.php b/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateFactory.php deleted file mode 100644 index 5c1d0ca4..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -setTitle(trim($data['title'])); - - if(isset($data['is_enabled'])) - $template->setIsEnabled(boolval($data['is_enabled'])); - - return $template; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateQuestionFactory.php b/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateQuestionFactory.php deleted file mode 100644 index f00120bd..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateQuestionFactory.php +++ /dev/null @@ -1,204 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['label'])) - $question->setLabel(trim($data['label'])); - - if(isset($data['is_mandatory'])) - $question->setIsMandatory(boolval($data['is_mandatory'])); - - if(isset($data['is_read_only'])) - $question->setIsReadOnly(boolval($data['is_read_only'])); - - return $question; - } - - /** - * @param RSVPSingleValueTemplateQuestion $question - * @param array $data - * @return RSVPQuestionTemplate - */ - private static function populateRSVPSingleValueTemplateQuestion(RSVPSingleValueTemplateQuestion $question, array $data){ - if(isset($data['initial_value'])) - $question->setInitialValue(trim($data['initial_value'])); - - return self::populateRSVPQuestionTemplate($question, $data); - } - - /** - * @param RSVPMultiValueQuestionTemplate $question - * @param array $data - * @return RSVPQuestionTemplate - */ - private static function populateRSVPMultiValueQuestionTemplate(RSVPMultiValueQuestionTemplate $question, array $data){ - - if(isset($data['empty_string'])) - $question->setEmptyString(trim($data['empty_string'])); - - return self::populateRSVPQuestionTemplate($question, $data); - } - - /** - * @param RSVPDropDownQuestionTemplate $question - * @param array $data - * @return RSVPQuestionTemplate - */ - private static function populateRSVPDropDownQuestionTemplate(RSVPDropDownQuestionTemplate $question, array $data){ - - if(isset($data['is_multiselect'])) - $question->setIsMultiselect(boolval($data['is_multiselect'])); - - if(isset($data['is_country_selector'])) - $question->setIsCountrySelector(boolval($data['is_country_selector'])); - - if(isset($data['use_chosen_plugin'])) - $question->setUseChosenPlugin(boolval($data['use_chosen_plugin'])); - - return self::populateRSVPMultiValueQuestionTemplate($question, $data); - } - - /** - * @param RSVPLiteralContentQuestionTemplate $question - * @param array $data - * @return RSVPQuestionTemplate - */ - private static function populateRSVPLiteralContentQuestionTemplate(RSVPLiteralContentQuestionTemplate $question, array $data){ - if(isset($data['content'])) - $question->setContent(trim($data['content'])); - return self::populateRSVPQuestionTemplate($question, $data); - } - - /** - * @param RSVPQuestionTemplate $question - * @param array $data - * @return RSVPQuestionTemplate - */ - public static function populate(RSVPQuestionTemplate $question, array $data){ - - if($question instanceof RSVPMemberEmailQuestionTemplate){ - return self::populateRSVPSingleValueTemplateQuestion($question, $data); - } - - if($question instanceof RSVPMemberFirstNameQuestionTemplate){ - return self::populateRSVPSingleValueTemplateQuestion($question, $data); - } - - if($question instanceof RSVPMemberLastNameQuestionTemplate){ - return self::populateRSVPSingleValueTemplateQuestion($question, $data); - } - - if($question instanceof RSVPTextBoxQuestionTemplate){ - return self::populateRSVPSingleValueTemplateQuestion($question, $data); - } - - if($question instanceof RSVPTextAreaQuestionTemplate){ - return self::populateRSVPSingleValueTemplateQuestion($question, $data); - } - - if($question instanceof RSVPCheckBoxListQuestionTemplate){ - return self::populateRSVPMultiValueQuestionTemplate($question, $data); - } - - if($question instanceof RSVPRadioButtonListQuestionTemplate){ - return self::populateRSVPMultiValueQuestionTemplate($question, $data); - } - - if($question instanceof RSVPDropDownQuestionTemplate){ - return self::populateRSVPDropDownQuestionTemplate($question, $data); - } - - if($question instanceof RSVPLiteralContentQuestionTemplate){ - return self::populateRSVPLiteralContentQuestionTemplate($question, $data); - } - - return $question; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateQuestionValueFactory.php b/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateQuestionValueFactory.php deleted file mode 100644 index 0620623c..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRSVPTemplateQuestionValueFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -setValue(trim($data['value'])); - - if(isset($data['label'])) - $value->setLabel(trim($data['label'])); - - return $value; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRefundPolicyTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitRefundPolicyTypeFactory.php deleted file mode 100644 index 1fa3a414..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRefundPolicyTypeFactory.php +++ /dev/null @@ -1,47 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['refund_rate'])) - $policy->setRefundRate(floatval($data['refund_rate'])); - - if(isset($data['until_x_days_before_event_starts'])) - $policy->setUntilXDaysBeforeEventStarts(intval($data['until_x_days_before_event_starts'])); - - return $policy; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRegistrationDiscountCodeTicketTypeRuleFactory.php b/app/Models/Foundation/Summit/Factories/SummitRegistrationDiscountCodeTicketTypeRuleFactory.php deleted file mode 100644 index b96ee8ca..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRegistrationDiscountCodeTicketTypeRuleFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -setAmount(floatval($data['amount'])); - if(isset($data['rate'])) - $rule->setRate(floatval($data['rate'])); - if(isset($data['ticket_type'])) - $rule->setTicketType($data['ticket_type']); - return $rule; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRegistrationInvitationFactory.php b/app/Models/Foundation/Summit/Factories/SummitRegistrationInvitationFactory.php deleted file mode 100644 index 8683f624..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRegistrationInvitationFactory.php +++ /dev/null @@ -1,44 +0,0 @@ -setEmail(trim($data['email'])); - if(isset($data['first_name'])){ - $invitation->setFirstName(trim($data['first_name'])); - } - if(isset($data['last_name'])){ - $invitation->setLastName(trim($data['last_name'])); - } - return $invitation; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitRoomReservationFactory.php b/app/Models/Foundation/Summit/Factories/SummitRoomReservationFactory.php deleted file mode 100644 index 220ffe98..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitRoomReservationFactory.php +++ /dev/null @@ -1,56 +0,0 @@ -setOwner($data['owner']); - if(isset($data['currency'])) - $reservation->setCurrency(trim($data['currency'])); - if(isset($data['amount'])) - $reservation->setAmount(intval($data['amount'])); - - // dates ( they came on local time epoch , so must be converted to utc using - // summit timezonefloatval - if(isset($data['start_datetime'])) { - $val = intval($data['start_datetime']); - $val = new \DateTime("@$val"); - $val->setTimezone($summit->getTimeZone()); - $reservation->setStartDatetime($summit->convertDateFromTimeZone2UTC($val)); - } - - if(isset($data['end_datetime'])){ - $val = intval($data['end_datetime']); - $val = new \DateTime("@$val"); - $val->setTimezone($summit->getTimeZone()); - $reservation->setEndDatetime($summit->convertDateFromTimeZone2UTC($val)); - } - - return $reservation; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitSelectionPlanExtraQuestionTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitSelectionPlanExtraQuestionTypeFactory.php deleted file mode 100644 index 04e63072..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitSelectionPlanExtraQuestionTypeFactory.php +++ /dev/null @@ -1,29 +0,0 @@ -setSummit($summit); - - if(isset($data['name'])) - $selection_plan->setName(trim($data['name'])); - - if(isset($data['is_enabled'])) - $selection_plan->setIsEnabled(boolval($data['is_enabled'])); - - if(isset($data['allow_new_presentations'])) - $selection_plan->setAllowNewPresentations(boolval($data['allow_new_presentations'])); - - if(isset($data['max_submission_allowed_per_user']) ){ - $selection_plan->setMaxSubmissionAllowedPerUser(intval($data['max_submission_allowed_per_user'])); - } - - if(array_key_exists('submission_begin_date', $data) && array_key_exists('submission_end_date', $data)) { - if (isset($data['submission_begin_date']) && isset($data['submission_end_date'])) { - $start_datetime = intval($data['submission_begin_date']); - $start_datetime = new \DateTime("@$start_datetime"); - $start_datetime->setTimezone($summit->getTimeZone()); - $end_datetime = intval($data['submission_end_date']); - $end_datetime = new \DateTime("@$end_datetime"); - $end_datetime->setTimezone($summit->getTimeZone()); - - // set local time from UTC - $selection_plan->setSubmissionBeginDate($start_datetime); - $selection_plan->setSubmissionEndDate($end_datetime); - } - else{ - $selection_plan->clearSubmissionDates(); - } - } - - if(array_key_exists('voting_begin_date', $data) && array_key_exists('voting_end_date', $data)) { - if (isset($data['voting_begin_date']) && isset($data['voting_end_date'])) { - $start_datetime = intval($data['voting_begin_date']); - $start_datetime = new \DateTime("@$start_datetime"); - $start_datetime->setTimezone($summit->getTimeZone()); - $end_datetime = intval($data['voting_end_date']); - $end_datetime = new \DateTime("@$end_datetime"); - $end_datetime->setTimezone($summit->getTimeZone()); - - // set local time from UTC - $selection_plan->setVotingBeginDate($start_datetime); - $selection_plan->setVotingEndDate($end_datetime); - } - else{ - $selection_plan->clearVotingDates(); - } - } - - if(array_key_exists('selection_begin_date', $data) && array_key_exists('selection_end_date', $data)) { - if (isset($data['selection_begin_date']) && isset($data['selection_end_date'])) { - $start_datetime = intval($data['selection_begin_date']); - $start_datetime = new \DateTime("@$start_datetime"); - $start_datetime->setTimezone($summit->getTimeZone()); - $end_datetime = intval($data['selection_end_date']); - $end_datetime = new \DateTime("@$end_datetime"); - $end_datetime->setTimezone($summit->getTimeZone()); - - // set local time from UTC - $selection_plan->setSelectionBeginDate($start_datetime); - $selection_plan->setSelectionEndDate($end_datetime); - } - else{ - $selection_plan->clearSelectionDates(); - } - } - - return $selection_plan; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitTaxTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitTaxTypeFactory.php deleted file mode 100644 index ad981f59..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitTaxTypeFactory.php +++ /dev/null @@ -1,47 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['tax_id'])) - $tax_type->setTaxId(trim($data['tax_id'])); - - if(isset($data['rate'])) - $tax_type->setRate(floatval($data['rate'])); - - return $tax_type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitTicketTypeFactory.php b/app/Models/Foundation/Summit/Factories/SummitTicketTypeFactory.php deleted file mode 100644 index ac8d534f..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitTicketTypeFactory.php +++ /dev/null @@ -1,117 +0,0 @@ -setSummit($summit); - return self::populate($ticket_type, $data); - } - - /** - * @param SummitTicketType $ticket_type - * @param array $data - * @return SummitTicketType - */ - public static function populate(SummitTicketType $ticket_type, array $data){ - - if(isset($data['name'])) - $ticket_type->setName(trim($data['name'])); - - if(isset($data['description'])) - $ticket_type->setDescription(trim($data['description'])); - - if(isset($data['external_id'])) - $ticket_type->setExternalId(trim($data['external_id'])); - - if(isset($data['cost'])) - $ticket_type->setCost(floatval($data['cost'])); - - if(isset($data['currency'])) - $ticket_type->setCurrency(trim($data['currency'])); - - if(isset($data['quantity_2_sell'])) - $ticket_type->setQuantity2Sell(intval($data['quantity_2_sell'])); - - if(isset($data['max_quantity_per_order'])) - $ticket_type->setMaxQuantityPerOrder(intval($data['max_quantity_per_order'])); - - // Sales Period - if(isset($data['sales_start_date'])){ - $val = intval($data['sales_start_date']); - if($val > 0) { - // we need a registration period defined to set this - $summit = $ticket_type->getSummit(); - if(is_null($summit)){ - throw new ValidationException("Summit is not defined."); - } - if(!$summit->isRegistrationPeriodDefined()) - throw new ValidationException("Summit Registration Period is not defined."); - - $val = new \DateTime("@$val"); - $val->setTimezone($summit->getTimeZone()); - $ticket_type->setSalesStartDate($summit->convertDateFromTimeZone2UTC($val)); - - if(!$summit->isDateOnRegistrationPeriod($ticket_type->getSalesStartDate())){ - throw new ValidationException(sprintf("Ticket Type Sales Start Date is not under Summit Registration Period")); - } - } - else{ - $ticket_type->clearSalesStartDate(); - } - } - - if(isset($data['sales_end_date'])){ - $val = intval($data['sales_end_date']); - if($val > 0) { - // we need a registration period defined to set this - $summit = $ticket_type->getSummit(); - if(is_null($summit)){ - throw new ValidationException("Summit is not defined."); - } - - if(!$summit->isRegistrationPeriodDefined()) - throw new ValidationException("Summit Registration Period is not defined."); - - $val = new \DateTime("@$val"); - $val->setTimezone($summit->getTimeZone()); - $ticket_type->setSalesEndDate($summit->convertDateFromTimeZone2UTC($val)); - - if(!$summit->isDateOnRegistrationPeriod($ticket_type->getSalesEndDate())){ - throw new ValidationException(sprintf("Ticket Type Sales End Date is not under Summit Registration Period")); - } - } - else{ - $ticket_type->clearSalesEndDate(); - } - } - - if(isset($data['badge_type'])) - $ticket_type->setBadgeType($data['badge_type']); - - return $ticket_type; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/SummitVenueFloorFactory.php b/app/Models/Foundation/Summit/Factories/SummitVenueFloorFactory.php deleted file mode 100644 index 1b1f6038..00000000 --- a/app/Models/Foundation/Summit/Factories/SummitVenueFloorFactory.php +++ /dev/null @@ -1,47 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['description'])) - $floor->setDescription(trim($data['description'])); - - if(isset($data['number'])) - $floor->setNumber(intval($data['number'])); - - return $floor; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/TrackQuestionTemplateFactory.php b/app/Models/Foundation/Summit/Factories/TrackQuestionTemplateFactory.php deleted file mode 100644 index e6211207..00000000 --- a/app/Models/Foundation/Summit/Factories/TrackQuestionTemplateFactory.php +++ /dev/null @@ -1,184 +0,0 @@ -setInitialValue(trim($data['initial_value'])); - - return self::populateTrackQuestionTemplate($question, $data); - } - - /** - * @param TrackMultiValueQuestionTemplate $question - * @param array $data - * @return TrackQuestionTemplate - */ - private static function populateTrackMultiValueQuestionTemplate(TrackMultiValueQuestionTemplate $question, array $data) - { - - if (isset($data['empty_string'])) - $question->setEmptyString(trim($data['empty_string'])); - - return self::populateTrackQuestionTemplate($question, $data); - } - - /** - * @param TrackQuestionTemplate $question - * @param array $data - * @return TrackQuestionTemplate - */ - private static function populateTrackQuestionTemplate(TrackQuestionTemplate $question, array $data) - { - - if (isset($data['name'])) - $question->setName(trim($data['name'])); - - if (isset($data['label'])) - $question->setLabel(trim($data['label'])); - - if (isset($data['is_mandatory'])) - $question->setIsMandatory(boolval($data['is_mandatory'])); - - if (isset($data['is_read_only'])) - $question->setIsReadOnly(boolval($data['is_read_only'])); - - return $question; - } - - /** - * @param TrackDropDownQuestionTemplate $question - * @param array $data - * @return TrackQuestionTemplate - */ - private static function populateTrackDropDownQuestionTemplate(TrackDropDownQuestionTemplate $question, array $data) - { - - if (isset($data['is_multiselect'])) - $question->setIsMultiselect(boolval($data['is_multiselect'])); - - if (isset($data['is_country_selector'])) - $question->setIsCountrySelector(boolval($data['is_country_selector'])); - - return self::populateTrackMultiValueQuestionTemplate($question, $data); - } - - /** - * @param TrackLiteralContentQuestionTemplate $question - * @param array $data - * @return TrackQuestionTemplate - */ - private static function populateTrackLiteralContentQuestionTemplate(TrackLiteralContentQuestionTemplate $question, array $data) - { - if (isset($data['content'])) - $question->setContent(trim($data['content'])); - return self::populateTrackQuestionTemplate($question, $data); - } - - /** - * @param TrackQuestionTemplate $question - * @param array $data - * @return TrackQuestionTemplate - */ - public static function populate(TrackQuestionTemplate $question, array $data){ - if($question instanceof TrackTextBoxQuestionTemplate){ - return self::populateTrackSingleValueTemplateQuestion($question, $data); - } - if($question instanceof TrackCheckBoxQuestionTemplate){ - return self::populateTrackSingleValueTemplateQuestion($question, $data); - } - if($question instanceof TrackCheckBoxListQuestionTemplate){ - return self::populateTrackMultiValueQuestionTemplate($question, $data); - } - - if($question instanceof TrackRadioButtonListQuestionTemplate){ - return self::populateTrackMultiValueQuestionTemplate($question, $data); - } - - if($question instanceof TrackDropDownQuestionTemplate){ - return self::populateTrackDropDownQuestionTemplate($question, $data); - } - - if($question instanceof TrackLiteralContentQuestionTemplate){ - return self::populateTrackLiteralContentQuestionTemplate($question, $data); - } - - return $question; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/TrackQuestionValueTemplateFactory.php b/app/Models/Foundation/Summit/Factories/TrackQuestionValueTemplateFactory.php deleted file mode 100644 index 55c2c519..00000000 --- a/app/Models/Foundation/Summit/Factories/TrackQuestionValueTemplateFactory.php +++ /dev/null @@ -1,45 +0,0 @@ -setValue(trim($data['value'])); - - if(isset($data['label'])) - $value->setLabel(trim($data['label'])); - - return $value; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Factories/TrackTagGroupFactory.php b/app/Models/Foundation/Summit/Factories/TrackTagGroupFactory.php deleted file mode 100644 index 7c19d03f..00000000 --- a/app/Models/Foundation/Summit/Factories/TrackTagGroupFactory.php +++ /dev/null @@ -1,53 +0,0 @@ -setName(trim($data['name'])); - - if(isset($data['label'])) - $track_tag_group->setLabel(trim($data['label'])); - - if(isset($data['is_mandatory'])){ - $track_tag_group->setIsMandatory(boolval($data['is_mandatory'])); - } - - return $track_tag_group; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/ISponsorshipTypeConstants.php b/app/Models/Foundation/Summit/ISponsorshipTypeConstants.php deleted file mode 100644 index 48a3f442..00000000 --- a/app/Models/Foundation/Summit/ISponsorshipTypeConstants.php +++ /dev/null @@ -1,33 +0,0 @@ -getLocation()->getSummit(); - if(!is_null($summit)) - { - $value = $summit->convertDateFromTimeZone2UTC($value); - } - $this->start_date = $value; - return $this; - } - - /** - * @return DateTime|null - */ - public function getLocalStartDate() - { - $res = null; - if(!empty($this->start_date)) { - $value = clone $this->start_date; - $summit = $this->getLocation()->getSummit(); - if(!is_null($summit)) - { - $res = $summit->convertDateFromUTC2TimeZone($value); - } - } - return $res; - } - - /** - * @return \DateTime|null - */ - public function getStartDate() - { - return $this->start_date; - } - - /** - * @param DateTime $value - * @return $this - */ - public function setEndDate(DateTime $value) - { - $summit = $this->getLocation()->getSummit(); - if(!is_null($summit)) - { - $value = $summit->convertDateFromTimeZone2UTC($value); - } - $this->end_date = $value; - return $this; - } - - /** - * @return DateTime|null - */ - public function getLocalEndDate() - { - $res = null; - if(!empty($this->end_date)) { - $value = clone $this->end_date; - $summit = $this->getLocation()->getSummit(); - if(!is_null($summit)) - { - $res = $summit->convertDateFromUTC2TimeZone($value); - } - } - return $res; - } - - /** - * @return \DateTime|null - */ - public function getEndDate() - { - return $this->end_date; - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/Banners/SummitLocationBanner.php b/app/Models/Foundation/Summit/Locations/Banners/SummitLocationBanner.php deleted file mode 100644 index d13b202d..00000000 --- a/app/Models/Foundation/Summit/Locations/Banners/SummitLocationBanner.php +++ /dev/null @@ -1,175 +0,0 @@ -title; - } - - /** - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @return string - */ - public function getContent() - { - return $this->content; - } - - /** - * @param string $content - */ - public function setContent($content) - { - $this->content = $content; - } - - /** - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * @param string $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return bool - */ - public function isEnabled() - { - return $this->enabled; - } - - /** - * @param bool $enabled - */ - public function setEnabled($enabled) - { - $this->enabled = $enabled; - } - - /** - * @return SummitAbstractLocation - */ - public function getLocation() - { - return $this->location; - } - - /** - * @param SummitAbstractLocation $location - */ - public function setLocation(SummitAbstractLocation $location) - { - $this->location = $location; - } - - public function clearLocation(){ - $this->location = null; - } - - /** - * @return bool - */ - public function hasLocation(){ - return $this->getLocationId() > 0; - } - - /** - * @return int - */ - public function getLocationId() - { - try { - return !is_null($this->location)? $this->location->getId():0; - } - catch(\Exception $ex){ - return 0; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/Banners/SummitLocationBannerConstants.php b/app/Models/Foundation/Summit/Locations/Banners/SummitLocationBannerConstants.php deleted file mode 100644 index f913dd61..00000000 --- a/app/Models/Foundation/Summit/Locations/Banners/SummitLocationBannerConstants.php +++ /dev/null @@ -1,24 +0,0 @@ - 'string', - 'short_name' => 'string', - 'description' => 'string', - 'type' => [ self::TypeExternal, self::TypeInternal], - 'banners' => 'array', - 'order' => 'integer', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return self::$metadata; - } - - public function __construct() - { - parent::__construct(); - $this->order = 0; - $this->type = self::TypeNone; - $this->banners = new ArrayCollection; - } - - /** - * @return string - */ - public function getClassName(){ - return 'SummitAbstractLocation'; - } - - /** - * @return int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order) - { - $this->order = $order; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return string - */ - public function getLocationType() - { - return $this->type; - } - - /** - * @param string $type - */ - public function setLocationType($type) - { - $this->type = $type; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - use SummitOwned; - - /** - * @return boolean - */ - public function isOverrideBlackouts() - { - return false; - } - - /** - * @param SummitLocationBanner $banner - * @throws ValidationException - */ - public function validateBanner(SummitLocationBanner $banner){ - - if($banner->getClassName() == SummitLocationBanner::ClassName){ - // only one static banner could exist at the same time - foreach ($this->banners as $old_banner){ - if($old_banner->getClassName() == SummitLocationBanner::ClassName && $old_banner->isEnabled() && $old_banner->getId() != $banner->getId()){ - throw new ValidationException - ( - sprintf - ('already exist an enabled static banner for location %s', $this->id) - ); - } - } - } - - if($banner instanceof ScheduledSummitLocationBanner){ - // do not overlap enabled ones - $new_start = $banner->getLocalStartDate(); - $new_end = $banner->getLocalEndDate(); - - foreach ($this->banners as $old_banner){ - 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) - if($new_start <= $old_end && $new_end >= $old_start){ - // overlap!!! - throw new ValidationException - ( - sprintf - ( - 'schedule time range (%s to %s) overlaps with an existent scheduled time range (%s to %s) - banner id %s', - $new_start->format('Y-m-d H:i:s'), - $new_end->format('Y-m-d H:i:s'), - $old_start->format('Y-m-d H:i:s'), - $old_end->format('Y-m-d H:i:s'), - $old_banner->id - ) - ); - } - } - } - } - - } - /** - * @param SummitLocationBanner $banner - * @return $this - * @throws ValidationException - */ - public function addBanner(SummitLocationBanner $banner){ - - $this->validateBanner($banner); - $this->banners->add($banner); - $banner->setLocation($this); - return $this; - } - - /** - * @param SummitLocationBanner $banner - * @return $this - */ - public function removeBanner(SummitLocationBanner $banner){ - $this->banners->removeElement($banner); - $banner->clearLocation(); - return $this; - } - - /** - * @param int $banner_id - * @return SummitLocationBanner|null - */ - public function getBannerById($banner_id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($banner_id))); - $banner = $this->banners->matching($criteria)->first(); - return $banner === false ? null : $banner; - } - - /** - * @param string $class_name - * @return SummitLocationBanner|null - */ - public function getBannerByClass($class_name){ - - } - - /** - * @return string - */ - public function getShortName(): ?string - { - return $this->short_name; - } - - /** - * @param string $short_name - */ - public function setShortName(string $short_name): void - { - $this->short_name = $short_name; - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitAirport.php b/app/Models/Foundation/Summit/Locations/SummitAirport.php deleted file mode 100644 index aa79f5dc..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitAirport.php +++ /dev/null @@ -1,73 +0,0 @@ -airport_type; - } - - /** - * @param string $airport_type - */ - public function setAirportType($airport_type) - { - $this->airport_type = $airport_type; - } - - /** - * @ORM\Column(name="Type", type="string") - */ - private $airport_type; - - public static $metadata = [ - 'class_name' => self::ClassName, - 'airport_type' => [self::AirportTypeInternational, self::AirportTypeDomestic], - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitExternalLocation::getMetadata(), self::$metadata); - } - - public function __construct() - { - parent::__construct(); - $this->airport_type = self::AirportTypeInternational; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoom.php b/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoom.php deleted file mode 100644 index cfb8ce76..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoom.php +++ /dev/null @@ -1,357 +0,0 @@ -reservations = new ArrayCollection(); - $this->attributes = new ArrayCollection(); - } - - /** - * @param SummitRoomReservation $reservation - * @return $this - * @throws ValidationException - */ - public function addReservation(SummitRoomReservation $reservation){ - - if(!$this->summit->isBookingPeriodOpen()) - throw new ValidationException(sprintf("booking period is not open for summit %s", $this->summit->getId())); - - $criteria = Criteria::create(); - $start_date = $reservation->getStartDatetime(); - $end_date = $reservation->getEndDatetime(); - $summit = $this->summit; - $local_start_date = $summit->convertDateFromUTC2TimeZone(clone $start_date); - $local_end_date = $summit->convertDateFromUTC2TimeZone(clone $end_date); - - if(!$summit->isTimeFrameOnBookingPeriod($local_start_date, $local_end_date)) - throw new ValidationException("requested reservation slot does not belong to summit booking period"); - - $criteria - ->where(Criteria::expr()->eq('start_datetime', $start_date)) - ->andWhere(Criteria::expr()->eq('end_datetime',$end_date)) - ->andWhere(Criteria::expr()->notIn("status", [ - SummitRoomReservation::RequestedRefundStatus, - SummitRoomReservation::RefundedStatus, - SummitRoomReservation::Canceled - ])); - - if($this->reservations->matching($criteria)->count() > 0) - throw new ValidationException(sprintf("reservation overlaps an existent reservation (1)")); - - $criteria - ->where(Criteria::expr()->lt('start_datetime', $end_date)) - ->andWhere(Criteria::expr()->gt('end_datetime', $start_date)) - ->andWhere(Criteria::expr()->notIn("status", [ - SummitRoomReservation::RequestedRefundStatus, - SummitRoomReservation::RefundedStatus, - SummitRoomReservation::Canceled - ])); - - if($this->reservations->matching($criteria)->count() > 0) - throw new ValidationException(sprintf("reservation overlaps an existent reservation (2)")); - - $start_time = $summit->getMeetingRoomBookingStartTime(); - $end_time = $summit->getMeetingRoomBookingEndTime(); - - $local_start_time = new \DateTime("now", $this->summit->getTimeZone()); - $local_start_time->setTime( - intval($start_time->format("H")), - intval($start_time->format("i")), - intval($start_time->format("s")) - ); - - $local_end_time = new \DateTime("now", $this->summit->getTimeZone()); - $local_end_time->setTime( - intval($end_time->format("H")), - intval($end_time->format("i")), - intval($end_time->format("s")) - ); - - $local_start_time->setDate - ( - intval($local_start_date->format("Y")), - intval($local_start_date->format("m")), - intval($local_start_date->format("d")) - ); - - $local_end_time->setDate - ( - intval($local_start_date->format("Y")), - intval($local_start_date->format("m")), - intval($local_start_date->format("d")) - ); - - if(!($local_start_time <= $local_start_date - && $local_end_date <= $local_end_time)) - throw new ValidationException - ( - sprintf - ( - "requested booking time slot is not allowed! requested [from %s to %s] allowed [from %s to %s]", - $local_start_date->format("Y-m-d H:i:s"), - $local_end_date->format("Y-m-d H:i:s"), - $local_start_time->format("Y-m-d H:i:s"), - $local_end_time->format("Y-m-d H:i:s") - ) - ); - - $interval = $end_date->diff($start_date); - $minutes = ($interval->d * 24 * 60) + ($interval->h * 60) + $interval->i; - if($minutes != $summit->getMeetingRoomBookingSlotLength()) - throw new ValidationException - ( - sprintf - ( - "requested booking time slot is not allowed! request slot (%s minutes) - summit allowed slot (%s minutes)", - $minutes, - $summit->getMeetingRoomBookingSlotLength() - ) - ); - - $now_utc = new \DateTime('now', new \DateTimeZone('UTC')); - // we cant choose the slots on the past or slots that are going on - if((($now_utc > $end_date) || ( $start_date <= $now_utc && $now_utc <= $end_date ))){ - throw new ValidationException("selected slot is on the past"); - } - - $this->reservations->add($reservation); - $reservation->setRoom($this); - return $this; - } - - /** - * @return int - */ - public function getTimeSlotCost(): int - { - return $this->time_slot_cost; - } - - /** - * @param int $time_slot_cost - */ - public function setTimeSlotCost(int $time_slot_cost): void - { - $this->time_slot_cost = $time_slot_cost; - } - - /** - * @return ArrayCollection - */ - public function getReservations(): ArrayCollection - { - return $this->reservations; - } - - /** - * @param int $id - * @return SummitRoomReservation|null - */ - public function getReservationById(int $id):?SummitRoomReservation{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $reservation = $this->reservations->matching($criteria)->first(); - return $reservation === false ? null : $reservation; - } - - public function clearReservations(){ - $this->reservations->clear(); - } - - /** - * @return string - */ - public function getClassName() - { - return self::ClassName; - } - - /** - * @param \DateTime $day should be on local summit day - * @return array - * @throws ValidationException - */ - public function getAvailableSlots(\DateTime $day): array { - $availableSlots = []; - $summit = $this->summit; - $test_date = clone $day; - // reset time only interest the date portion - $test_date = $test_date->setTimezone($summit->getTimeZone())->setTime(0, 0,0); - - $booking_start_time = $summit->getMeetingRoomBookingStartTime(); - if(is_null($booking_start_time)) - throw new ValidationException("MeetingRoomBookingStartTime is null!"); - - $booking_end_time = $summit->getMeetingRoomBookingEndTime(); - if(is_null($booking_end_time)) - throw new ValidationException("MeetingRoomBookingEndTime is null!"); - - $booking_slot_len = $summit->getMeetingRoomBookingSlotLength(); - $local_start_datetime = clone $test_date; - $local_end_datetime = clone $test_date; - - // set the time frames - - $local_start_datetime->setTimezone($summit->getTimeZone())->setTime( - intval($booking_start_time->format("H")), - intval($booking_start_time->format("i")), - 0); - - $local_end_datetime->setTimezone($summit->getTimeZone())->setTime( - intval($booking_end_time->format("H")), - intval($booking_end_time->format("i")), - 00); - - // check if day belongs to booking period - - if(!$summit->isTimeFrameOnBookingPeriod($local_start_datetime, $local_end_datetime)) - throw new ValidationException("requested day does not belong to summit booking period"); - - // now we have the allowed time frame for that particular day - - $criteria = Criteria::create(); - - $criteria - ->where(Criteria::expr()->gte('start_datetime', $summit->convertDateFromTimeZone2UTC($local_start_datetime))) - ->andWhere(Criteria::expr()->lte('end_datetime', $summit->convertDateFromTimeZone2UTC($local_end_datetime))) - ->andWhere(Criteria::expr()->notIn("status", [ - SummitRoomReservation::RequestedRefundStatus, - SummitRoomReservation::RefundedStatus, - SummitRoomReservation::Canceled, - ])); - - $reservations = $this->reservations->matching($criteria); - // calculate all possible slots - while($local_start_datetime <= $local_end_datetime) { - $current_time_slot_end = clone $local_start_datetime; - $current_time_slot_end->add(new \DateInterval("PT" . $booking_slot_len . 'M')); - if($current_time_slot_end <= $local_end_datetime) - $availableSlots[$local_start_datetime->format('Y-m-d H:i:s').'|'.$current_time_slot_end->format('Y-m-d H:i:s')] = true; - $local_start_datetime = $current_time_slot_end; - } - - // and mark all not available slots on that time frame - foreach ($reservations as $reservation){ - if(!$reservation instanceof SummitRoomReservation) continue; - $availableSlots[ - $summit->convertDateFromUTC2TimeZone($reservation->getStartDatetime())->format("Y-m-d H:i:s") - .'|'. - $summit->convertDateFromUTC2TimeZone($reservation->getEndDatetime())->format("Y-m-d H:i:s") - ] = false; - } - - return $availableSlots; - } - - /** - * @param \DateTime $day - * @return array - * @throws ValidationException - */ - public function getFreeSlots(\DateTime $day):array{ - - $slots = $this->getAvailableSlots(clone $day); - $free_slots = []; - - foreach ($slots as $label => $status){ - if(!$status) continue; - $free_slots[] = $label; - } - return $free_slots; - } - - /** - * @return string - */ - public function getCurrency(): string - { - return $this->currency; - } - - /** - * @param string $currency - */ - public function setCurrency(string $currency): void - { - $this->currency = $currency; - } - - /** - * @return mixed - */ - public function getAttributes() - { - return $this->attributes; - } - - /** - * @param SummitBookableVenueRoomAttributeValue $attribute - */ - public function addAttribute(SummitBookableVenueRoomAttributeValue $attribute){ - if($this->attributes->contains($attribute)) return; - $this->attributes->add($attribute); - } - - /** - * @param SummitBookableVenueRoomAttributeValue $attribute - */ - public function removeAttribute(SummitBookableVenueRoomAttributeValue $attribute){ - if(!$this->attributes->contains($attribute)) return; - $this->attributes->removeElement($attribute); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAttributeType.php b/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAttributeType.php deleted file mode 100644 index a1e2f949..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAttributeType.php +++ /dev/null @@ -1,111 +0,0 @@ -values = new ArrayCollection(); - } - - /** - * @return string - */ - public function getType(): string - { - return $this->type; - } - - /** - * @param string $type - */ - public function setType(string $type): void - { - $this->type = $type; - } - - public function getValues() - { - return $this->values; - } - - public function addValue(SummitBookableVenueRoomAttributeValue $value){ - if($this->values->contains($value)) return; - $this->values->add($value); - $value->setType($this); - } - - public function removeValue(SummitBookableVenueRoomAttributeValue $value){ - if(!$this->values->contains($value)) return; - $this->values->removeElement($value); - } - - /** - * @param int $id - * @return SummitBookableVenueRoomAttributeValue|null - */ - public function getValueById(int $id):?SummitBookableVenueRoomAttributeValue - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $value = $this->values->matching($criteria)->first(); - return $value === false ? null : $value; - } - - - /** - * @param string $value - * @return SummitBookableVenueRoomAttributeValue|null - */ - public function getValueByValue(string $value):?SummitBookableVenueRoomAttributeValue - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('value', trim($value))); - $value = $this->values->matching($criteria)->first(); - return $value === false ? null : $value; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAttributeValue.php b/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAttributeValue.php deleted file mode 100644 index 05b16aa7..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAttributeValue.php +++ /dev/null @@ -1,84 +0,0 @@ -value; - } - - /** - * @param string $value - */ - public function setValue(string $value): void - { - $this->value = $value; - } - - /** - * @return SummitBookableVenueRoomAttributeType - */ - public function getType(): SummitBookableVenueRoomAttributeType - { - return $this->type; - } - - /** - * @param SummitBookableVenueRoomAttributeType $type - */ - public function setType(SummitBookableVenueRoomAttributeType $type): void - { - $this->type = $type; - } - - /** - * @return int - */ - public function getTypeId():int{ - try { - return is_null($this->type) ? 0 : $this->type->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAvailableSlot.php b/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAvailableSlot.php deleted file mode 100644 index 2b5cd660..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitBookableVenueRoomAvailableSlot.php +++ /dev/null @@ -1,104 +0,0 @@ -room = $room; - $this->start_date = $start_date; - $this->end_date = $end_date; - $this->is_free = $is_free; - } - - /** - * @return \DateTime - */ - public function getStartDate(): \DateTime - { - return $this->start_date; - } - - /** - * @return \DateTime - */ - public function getEndDate(): \DateTime - { - return $this->end_date; - } - - /** - * @return \DateTime - */ - public function getLocalStartDate(): \DateTime - { - return $this->room->getSummit()->convertDateFromUTC2TimeZone($this->start_date); - } - - /** - * @return \DateTime - */ - public function getLocalEndDate(): \DateTime - { - return $this->room->getSummit()->convertDateFromUTC2TimeZone($this->end_date); - } - - public function isFree():bool{ - return $this->is_free; - } - - /** - * @return string - */ - public function getStatus():string{ - $res = $this->is_free ? self::StatusAvailable : self::StatusBooked; - $now_utc = new \DateTime('now', new \DateTimeZone('UTC')); - // we cant choose the slots on the past or slots that are going on - if($this->is_free && (($now_utc > $this->end_date) || ( $this->start_date <= $now_utc && $now_utc <= $this->end_date ))){ - $res = self::StatusUnAvailable; - } - return $res; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitExternalLocation.php b/app/Models/Foundation/Summit/Locations/SummitExternalLocation.php deleted file mode 100644 index 6573d96a..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitExternalLocation.php +++ /dev/null @@ -1,75 +0,0 @@ -capacity; - } - - /** - * @param int $capacity - */ - public function setCapacity($capacity) - { - $this->capacity = $capacity; - } - - /** - * @ORM\Column(name="Capacity", type="integer") - */ - protected $capacity; - - public static $metadata = [ - 'class_name' => self::ClassName, - 'capacity' => 'integer', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitGeoLocatedLocation::getMetadata(), self::$metadata); - } - - public function __construct() - { - parent::__construct(); - $this->type = self::TypeExternal; - $this->capacity = 0; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitGeoLocatedLocation.php b/app/Models/Foundation/Summit/Locations/SummitGeoLocatedLocation.php deleted file mode 100644 index 39af8637..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitGeoLocatedLocation.php +++ /dev/null @@ -1,528 +0,0 @@ - 'string', - 'address_2' => 'string', - 'zip_code' => 'string', - 'city' => 'string', - 'state' => 'string', - 'country' => 'string', - 'website_url' => 'string', - 'lng' => 'string', - 'lat' => 'string', - 'display_on_site' => 'boolean', - 'details_page' => 'boolean', - 'location_message' => 'string', - 'images' => 'array', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitAbstractLocation::getMetadata(), self::$metadata); - } - - /** - * @param SummitVenueRoom|null $room - * @return string - */ - public function getFullAddress(SummitVenueRoom $room = null){ - $full_location = $this->getName().', '; - if(!is_null($room)){ - $floor = $room->getFloor(); - if(!is_null($floor)){ - $full_location .= $floor->getName().', '; - } - $full_location .= $room->getName().', '; - } - if(!empty($this->getAddress1())) - $full_location .= $this->getAddress1().', '; - if(!empty($this->getAddress2())) - $full_location .= $this->getAddress2().', '; - if(!empty($this->getCity())) - $full_location .= $this->getCity().', '; - if(!empty($this->getState())) - $full_location .= $this->getState().', '; - if(!empty($this->getZipCode())) - $full_location .= $this->getZipCode().', '; - if(!empty($this->getCountry)) - $full_location .= $this->getCountry().', '; - return rtrim($full_location, ', '); - } - /** - * @return mixed - */ - public function getAddress1() - { - return $this->address1; - } - - /** - * @param mixed $address1 - */ - public function setAddress1($address1) - { - $this->address1 = $address1; - } - - /** - * @return mixed - */ - public function getAddress2() - { - return $this->address2; - } - - /** - * @param mixed $address2 - */ - public function setAddress2($address2) - { - $this->address2 = $address2; - } - - /** - * @return mixed - */ - public function getZipCode() - { - return $this->zip_code; - } - - /** - * @param mixed $zip_code - */ - public function setZipCode($zip_code) - { - $this->zip_code = $zip_code; - } - - /** - * @return mixed - */ - public function getCity() - { - return $this->city; - } - - /** - * @param mixed $city - */ - public function setCity($city) - { - $this->city = $city; - } - - /** - * @return mixed - */ - public function getState() - { - return $this->state; - } - - /** - * @param mixed $state - */ - public function setState($state) - { - $this->state = $state; - } - - /** - * @return mixed - */ - public function getCountry() - { - return $this->country; - } - - /** - * @param mixed $country - */ - public function setCountry($country) - { - $this->country = $country; - } - - /** - * @return mixed - */ - public function getWebsiteUrl() - { - return $this->website_url; - } - - /** - * @param mixed $website_url - */ - public function setWebsiteUrl($website_url) - { - $this->website_url = $website_url; - } - - /** - * @return mixed - */ - public function getLng() - { - return $this->lng; - } - - /** - * @param mixed $lng - */ - public function setLng($lng) - { - $this->lng = $lng; - } - - /** - * @return mixed - */ - public function getLat() - { - return $this->lat; - } - - /** - * @param mixed $lat - */ - public function setLat($lat) - { - $this->lat = $lat; - } - - /** - * @return mixed - */ - public function getDisplayOnSite() - { - return $this->display_on_site; - } - - /** - * @param mixed $display_on_site - */ - public function setDisplayOnSite($display_on_site) - { - $this->display_on_site = $display_on_site; - } - - /** - * @return mixed - */ - public function getDetailsPage() - { - return $this->details_page; - } - - /** - * @param mixed $details_page - */ - public function setDetailsPage($details_page) - { - $this->details_page = $details_page; - } - - /** - * @return mixed - */ - public function getLocationMessage() - { - return $this->location_message; - } - - /** - * @param mixed $location_message - */ - public function setLocationMessage($location_message) - { - $this->location_message = $location_message; - } - - - public function __construct() - { - parent::__construct(); - $this->details_page = false; - $this->display_on_site = false; - $this->images = new ArrayCollection; - } - - /** - * @return SummitLocationImage[] - */ - public function getMaps() - { - return $this->images - ->matching - ( - Criteria::create() - ->where(Criteria::expr()->eq("class_name", SummitLocationImage::TypeMap)) - ->orderBy(["order" => Criteria::ASC]) - ); - } - - /** - * @return SummitLocationImage[] - */ - public function getImages() - { - - return $this->images - ->matching - ( - Criteria::create() - ->where(Criteria::expr()->eq("class_name", SummitLocationImage::TypeImage)) - ->orderBy(array("order" => Criteria::ASC)) - ); - } - - /** - * @param int $image_id - * @return SummitLocationImage - */ - public function getImage($image_id){ - $res = $this->images - ->matching - ( - Criteria::create() - ->where(Criteria::expr()->eq("id", $image_id)) - ->andWhere(Criteria::expr()->eq("class_name", SummitLocationImage::TypeImage)) - - )->first(); - return $res === false ? null : $res; - } - - /** - * @param int $map_id - * @return SummitLocationImage - */ - public function getMap($map_id){ - $res = $this->images - ->matching - ( - Criteria::create()->where(Criteria::expr()->eq("id", $map_id))->andWhere(Criteria::expr()->eq("class_name", SummitLocationImage::TypeMap)) - - )->first(); - return $res === false ? null : $res; - } - - - /** - * @param SummitLocationImage $map - */ - public function addMap(SummitLocationImage $map){ - $maps = $this->getMaps(); - $maps_count = count($maps); - $new_order = $maps_count > 0 ? $maps_count + 1 : 1; - $map->setOrder($new_order); - $this->images->add($map); - $map->setLocation($this); - } - - /** - * @param SummitLocationImage $map - * @return $this - */ - public function removeMap(SummitLocationImage $map){ - $this->images->removeElement($map); - $map->ClearLocation(); - return $this; - } - - /** - * @param SummitLocationImage $image - */ - public function addImage(SummitLocationImage $image){ - $images = $this->getImages(); - $images_count = count($images); - $new_order = $images_count > 0 ? $images_count + 1 : 1; - $image->setOrder($new_order); - $this->images->add($image); - $image->setLocation($this); - } - - - /** - * @param SummitLocationImage $image - * @return $this - */ - public function removeImage(SummitLocationImage $image){ - $this->images->removeElement($image); - $image->ClearLocation(); - return $this; - } - - /** - * @param SummitLocationImage $map - * @param $new_order - * @throws ValidationException - */ - public function recalculateMapOrder(SummitLocationImage $map, $new_order){ - $maps = $this->getMaps(); - $maps = array_slice($maps,0, count($maps), false); - $max_order = count($maps); - $former_order = 1; - - foreach ($maps as $m){ - if($m->getId() == $map->getId()) break; - $former_order++; - } - - if($new_order > $max_order) - throw new ValidationException(sprintf("max order is %s", $max_order)); - - unset($maps[$former_order - 1]); - - $maps = array_merge - ( - array_slice($maps, 0, $new_order -1 , true) , - [$map] , - array_slice($maps, $new_order -1 , count($maps), true) - ); - - $order = 1; - foreach($maps as $m){ - $m->setOrder($order); - $order++; - } - } - - /** - * @param SummitLocationImage $image - * @param $new_order - * @throws ValidationException - */ - public function recalculateImageOrder(SummitLocationImage $image, $new_order){ - - $images = $this->getImages(); - $images = array_slice($images,0, count($images), false); - $max_order = count($images); - $former_order = 1; - - foreach ($images as $i){ - if($i->getId() == $image->getId()) break; - $former_order++; - } - - if($new_order > $max_order) - throw new ValidationException(sprintf("max order is %s", $max_order)); - - unset($images[$former_order - 1]); - - $images = array_merge - ( - array_slice($images, 0, $new_order -1 , true) , - [$image] , - array_slice($images, $new_order -1 , count($images), true) - ); - - $order = 1; - foreach($images as $i){ - $i->setOrder($order); - $order++; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitHotel.php b/app/Models/Foundation/Summit/Locations/SummitHotel.php deleted file mode 100644 index 99e8bb71..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitHotel.php +++ /dev/null @@ -1,121 +0,0 @@ -booking_link; - } - - /** - * @param string $booking_link - */ - public function setBookingLink($booking_link) - { - $this->booking_link = $booking_link; - } - /** - * @ORM\Column(name="BookingLink", type="string") - */ - private $booking_link; - - /** - * @return bool - */ - public function getSoldOut() - { - return $this->sold_out; - } - - /** - * @param bool $sold_out - */ - public function setSoldOut($sold_out) - { - $this->sold_out = $sold_out; - } - - /** - * @return string - */ - public function getHotelType() - { - return $this->hotel_type; - } - - /** - * @param string $hotel_type - */ - public function setHotelType($hotel_type) - { - $this->hotel_type = $hotel_type; - } - - /** - * @ORM\Column(name="SoldOut", type="boolean") - */ - private $sold_out; - - /** - * @ORM\Column(name="Type", type="string") - */ - private $hotel_type; - - public static $metadata = [ - 'class_name' => self::ClassName, - 'hotel_type' => [self::HotelTypePrimary, self::HotelTypeAlternate], - 'sold_out' => 'boolean', - 'booking_link' => 'string', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitExternalLocation::getMetadata(), self::$metadata); - } - - public function __construct() - { - parent::__construct(); - $this->sold_out = false; - $this->hotel_type = self::HotelTypePrimary; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitLocationConstants.php b/app/Models/Foundation/Summit/Locations/SummitLocationConstants.php deleted file mode 100644 index d7c1377a..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitLocationConstants.php +++ /dev/null @@ -1,41 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order) - { - $this->order = $order; - } - - /** - * @return File - */ - public function getPicture() - { - return $this->picture; - } - - /** - * @param File $picture - */ - public function setPicture($picture) - { - $this->picture = $picture; - } - - /** - * @return SummitAbstractLocation - */ - public function getLocation() - { - return $this->location; - } - - /** - * @return int - */ - public function getLocationId(){ - try{ - return !is_null($this->location) ? $this->location->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @param SummitAbstractLocation $location - */ - public function setLocation($location) - { - $this->location = $location; - } - - /** - * @return string - */ - public function getClassName() - { - return $this->class_name; - } - - /** - * @param string $class_name - */ - public function setClassName($class_name) - { - $this->class_name = $class_name; - } - - /** - * @return bool - */ - public function hasPicture(){ - return $this->getPictureId() > 0; - } - - /** - * @return int - */ - public function getPictureId(){ - try{ - return !is_null($this->picture) ? $this->picture->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - public function clearLocation(){ - $this->location = null; - } - - public function clearPicture(){ - $this->picture = null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitRoomReservation.php b/app/Models/Foundation/Summit/Locations/SummitRoomReservation.php deleted file mode 100644 index ae141932..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitRoomReservation.php +++ /dev/null @@ -1,396 +0,0 @@ -start_datetime; - } - - /** - * @param int $amount - */ - public function refund(int $amount){ - $this->status = self::RefundedStatus; - $this->refunded_amount = $amount; - Event::fire(new BookableRoomReservationRefundAccepted($this->getId())); - } - - /** - * @return \DateTime - */ - public function getLocalStartDatetime(): \DateTime - { - return $this->room->getSummit()->convertDateFromUTC2TimeZone($this->start_datetime); - } - - /** - * @param \DateTime $start_datetime - */ - public function setStartDatetime(\DateTime $start_datetime): void - { - $this->start_datetime = $start_datetime; - } - - /** - * @return \DateTime - */ - public function getEndDatetime(): \DateTime - { - return $this->end_datetime; - } - - /** - * @return \DateTime - */ - public function getLocalEndDatetime(): \DateTime - { - return $this->room->getSummit()->convertDateFromUTC2TimeZone($this->end_datetime); - } - - /** - * @param \DateTime $end_datetime - */ - public function setEndDatetime(\DateTime $end_datetime): void - { - $this->end_datetime = $end_datetime; - } - - /** - * @return string - */ - public function getStatus(): string - { - return $this->status; - } - - /** - * @param string $status - */ - public function setStatus(string $status): void - { - $this->status = $status; - } - - /** - * @return Member - */ - public function getOwner(): Member - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner(Member $owner): void - { - $this->owner = $owner; - } - - /** - * @return SummitBookableVenueRoom - */ - public function getRoom(): SummitBookableVenueRoom - { - return $this->room; - } - - /** - * @param SummitBookableVenueRoom $room - */ - public function setRoom(SummitBookableVenueRoom $room): void - { - $this->room = $room; - } - - /** - * @return string - */ - public function getPaymentGatewayCartId(): string - { - return $this->payment_gateway_cart_id; - } - - /** - * @param string $payment_gateway_cart_id - */ - public function setPaymentGatewayCartId(string $payment_gateway_cart_id): void - { - $this->payment_gateway_cart_id = $payment_gateway_cart_id; - } - - /** - * @return \DateTime|null - */ - public function getApprovedPaymentDate(): ?\DateTime - { - return $this->approved_payment_date; - } - - /** - * @param \DateTime $approved_payment_date - */ - public function setApprovedPaymentDate(\DateTime $approved_payment_date): void - { - $this->approved_payment_date = $approved_payment_date; - } - - /** - * @return string - */ - public function getCurrency(): string - { - return $this->currency; - } - - /** - * @param string $currency - */ - public function setCurrency(string $currency): void - { - $this->currency = $currency; - } - - /** - * @return int - */ - public function getAmount(): int - { - return $this->amount; - } - - /** - * @param int $amount - */ - public function setAmount(int $amount): void - { - $this->amount = $amount; - } - - public function __construct() - { - parent::__construct(); - $this->amount = 0; - $this->refunded_amount = 0; - $this->status = self::ReservedStatus; - } - - /** - * @return string|null - */ - public function getPaymentGatewayClientToken(): ?string - { - return $this->payment_gateway_client_token; - } - - /** - * @param string $payment_gateway_client_token - */ - public function setPaymentGatewayClientToken(string $payment_gateway_client_token): void - { - $this->payment_gateway_client_token = $payment_gateway_client_token; - } - - /** - * @return bool - */ - public function isPaid():bool { - return $this->status == self::PaidStatus; - } - - public function setPaid():void{ - if($this->isPaid()){ - Log::warning(sprintf("SummitRoomReservation %s is already Paid", $this->getId())); - return; - } - - if($this->status != self::ReservedStatus){ - Log::warning(sprintf("setting payed status to SummitRoomReservation %s with status %s", $this->getId(), $this->status)); - } - - $this->status = self::PaidStatus; - $now = new \DateTime('now', new \DateTimeZone('UTC')); - $this->approved_payment_date = $now; - Event::fire(new PaymentBookableRoomReservationConfirmed($this->getId())); - } - - public function cancel():void{ - $this->status = self::Canceled; - Event::fire(new BookableRoomReservationCanceled($this->id)); - } - - public function requestRefund():void{ - $this->status = self::RequestedRefundStatus; - Event::fire(new RequestedBookableRoomReservationRefund($this->getId())); - } - - /** - * @param null|string $error - */ - public function setPaymentError(?string $error):void{ - if(empty($error)) return; - $this->status = self::ErrorStatus; - $this->last_error = $error; - } - - /** - * @return null|string - */ - public function getLastError():?string{ - return $this->last_error; - } - - /** - * @return int - */ - public function getOwnerId(){ - try { - return is_null($this->owner) ? 0 : $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getRoomId(){ - try { - return is_null($this->room) ? 0 : $this->room->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getRefundedAmount(): int - { - return $this->refunded_amount; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitVenue.php b/app/Models/Foundation/Summit/Locations/SummitVenue.php deleted file mode 100644 index fd286d40..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitVenue.php +++ /dev/null @@ -1,217 +0,0 @@ -is_main = false; - $this->type = self::TypeInternal; - $this->rooms = new ArrayCollection(); - $this->floors = new ArrayCollection(); - } - - /** - * @ORM\Column(name="IsMain", type="boolean") - * @var bool - */ - private $is_main; - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitVenueRoom", mappedBy="venue", cascade={"persist"}, orphanRemoval=true) - * @var SummitVenueRoom[] - */ - private $rooms; - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitVenueFloor", mappedBy="venue", cascade={"persist"}, orphanRemoval=true) - * @var SummitVenueFloor[] - */ - private $floors; - - public function addFloor(SummitVenueFloor $floor){ - $this->floors->add($floor); - $floor->setVenue($this); - } - - /** - * @param SummitVenueRoom $room - */ - public function addRoom(SummitVenueRoom $room){ - $this->rooms->add($room); - $room->setVenue($this); - if($this->hasSummit()) - $room->setSummit($this->getSummit()); - } - - use OrderableChilds; - - /** - * @param SummitVenueRoom $room - * @param int $new_order - * @throws ValidationException - */ - public function recalculateRoomsOrder(SummitVenueRoom $room, $new_order){ - self::recalculateOrderForSelectable($this->rooms, $room, $new_order); - } - - /** - * @return bool - */ - public function getIsMain() - { - return (bool)$this->is_main; - } - - /** - * @param bool $is_main - */ - public function setIsMain($is_main) - { - $this->is_main = $is_main; - } - - /** - * @return SummitVenueRoom[] - */ - public function getRooms(){ - return $this->rooms; - } - - /** - * @param int $room_id - * @return SummitVenueRoom|null - */ - public function getRoom($room_id):?SummitVenueRoom{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($room_id))); - $room = $this->rooms->matching($criteria)->first(); - return $room === false ? null : $room; - } - - - /** - * @param string $name - * @return SummitVenueRoom|null - */ - public function getRoomByName(string $name):?SummitVenueRoom{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $room = $this->rooms->matching($criteria)->first(); - return $room === false ? null : $room; - } - - /** - * @return SummitVenueFloor[] - */ - public function getFloors(){ - return $this->floors; - } - - /** - * @param int $floor_id - * @return SummitVenueFloor|null - */ - public function getFloor($floor_id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($floor_id))); - $floor = $this->floors->matching($criteria)->first(); - return $floor === false ? null:$floor; - } - - - public static $metadata = [ - 'class_name' => self::ClassName, - 'is_main' => 'boolean', - 'floors' => 'array', - 'rooms' => 'array', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitGeoLocatedLocation::getMetadata(), self::$metadata); - } - - /** - * @param string $floor_name - * @return SummitVenueFloor|null - */ - public function getFloorByName($floor_name){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($floor_name))); - $floor = $this->floors->matching($criteria)->first(); - return $floor === false ? null : $floor; - } - - /** - * @param int $floor_number - * @return SummitVenueFloor|null - */ - public function getFloorByNumber($floor_number){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('number', intval($floor_number))); - $floor = $this->floors->matching($criteria)->first(); - return $floor === false ? null:$floor; - } - - /** - * @param SummitVenueFloor $floor - * @return $this - */ - public function removeFloor(SummitVenueFloor $floor){ - $this->floors->removeElement($floor); - $floor->clearVenue(); - return $this; - } - - /** - * @param SummitVenueRoom $room - * @return $this - */ - public function removeRoom(SummitVenueRoom $room){ - $this->rooms->removeElement($room); - $room->clearVenue(); - return $this; - } - - public function hasRooms():bool{ - return $this->rooms->count() > 0; - } - - public function hasFloors():bool{ - return $this->floors->count() > 0; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitVenueFloor.php b/app/Models/Foundation/Summit/Locations/SummitVenueFloor.php deleted file mode 100644 index f4371f44..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitVenueFloor.php +++ /dev/null @@ -1,242 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return int - */ - public function getNumber() - { - return $this->number; - } - - /** - * @param int $number - */ - public function setNumber($number) - { - $this->number = $number; - } - - /** - * @return SummitVenue - */ - public function getVenue() - { - return $this->venue; - } - - /** - * @return int - */ - public function getVenueId(){ - try{ - return $this->venue->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return File - */ - public function getImage() - { - return $this->image; - } - - /** - * @return SummitVenueRoom[] - */ - public function getRooms(){ - return $this->rooms; - } - - /** - * @param int $room_id - * @return SummitVenueRoom - */ - public function getRoom($room_id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($room_id))); - $room = $this->rooms->matching($criteria)->first(); - return $room === false ? null : $room; - } - - public function __construct() - { - parent::__construct(); - $this->rooms = new ArrayCollection; - } - - /** - * @param SummitVenue|null $venue - */ - public function setVenue($venue) - { - $this->venue = $venue; - } - - public function clearVenue(){ - $this->venue = null; - } - - /** - * @param File $image - */ - public function setImage($image) - { - $this->image = $image; - } - - /** - * @return bool - */ - public function hasImage(){ - return $this->getImageId() > 0; - } - - /** - * @return int - */ - public function getImageId(){ - try{ - return !is_null($this->image) ? $this->image->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - public function clearImage(){ - $this->image = null; - } - - /** - * @param SummitVenueRoom $room - */ - public function addRoom(SummitVenueRoom $room){ - $this->rooms->add($room); - $room->setFloor($this); - } - - /** - * @param SummitVenueRoom $room - */ - public function removeRoom(SummitVenueRoom $room){ - $this->rooms->removeElement($room); - $room->clearFloor(); - } - - use OrderableChilds; - - /** - * @param SummitVenueRoom $room - * @param int $new_order - * @throws ValidationException - */ - public function recalculateRoomsOrder(SummitVenueRoom $room, $new_order){ - self::recalculateOrderForSelectable($this->rooms, $room, $new_order); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Locations/SummitVenueRoom.php b/app/Models/Foundation/Summit/Locations/SummitVenueRoom.php deleted file mode 100644 index 71c676c2..00000000 --- a/app/Models/Foundation/Summit/Locations/SummitVenueRoom.php +++ /dev/null @@ -1,242 +0,0 @@ -image; - } - - /** - * @return bool - */ - public function hasImage(){ - return $this->getImageId() > 0; - } - - /** - * @return int - */ - public function getImageId(){ - try{ - return !is_null($this->image) ? $this->image->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - public function clearImage(){ - $this->image = null; - } - - /** - * @param File $image - */ - public function setImage($image) - { - $this->image = $image; - } - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - const ClassName = 'SummitVenueRoom'; - - /** - * @return SummitVenue - */ - public function getVenue() - { - return $this->venue; - } - - /** - * @return string - */ - public function getCompleteName():string{ - $name = $this->venue->getSummit()->getName(); - $name .= ' '.$this->venue->getName(); - $name .= ' '.$this->getName(); - return $name; - } - - /** - * @return int - */ - public function getVenueId(){ - try{ - return is_null($this->venue) ? 0 : $this->venue->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasVenue(){ - return $this->getVenueId() > 0; - } - - /** - * @return SummitVenueFloor - */ - public function getFloor() - { - return $this->floor; - } - - /** - * @return int - */ - public function getFloorId(){ - try{ - return is_null($this->floor) ? 0 : $this->floor->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasFloor(){ - return $this->getFloorId() > 0; - } - - /** - * @return int - */ - public function getCapacity() - { - return $this->capacity; - } - - /** - * @param int $capacity - */ - public function setCapacity($capacity) - { - $this->capacity = $capacity; - } - - /** - * @return boolean - */ - public function isOverrideBlackouts() - { - return $this->override_blackouts; - } - - /** - * @param boolean $override_blackouts - */ - public function setOverrideBlackouts($override_blackouts) - { - $this->override_blackouts = $override_blackouts; - } - - - /** - * SummitVenueRoom constructor. - */ - public function __construct() - { - parent::__construct(); - $this->override_blackouts = false; - $this->capacity = 0; - $this->type = self::TypeInternal; - } - - - /** - * @param SummitVenue|null $venue - */ - public function setVenue(SummitVenue $venue) - { - $this->venue = $venue; - } - - public function clearVenue(){ - $this->venue = null; - } - - public function clearFloor(){ - $this->floor = null; - } - - /** - * @param SummitVenueFloor $floor - */ - public function setFloor(SummitVenueFloor $floor) - { - $this->floor = $floor; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/MediaUploads/SummitMediaFileType.php b/app/Models/Foundation/Summit/MediaUploads/SummitMediaFileType.php deleted file mode 100644 index 01db0e9a..00000000 --- a/app/Models/Foundation/Summit/MediaUploads/SummitMediaFileType.php +++ /dev/null @@ -1,118 +0,0 @@ -is_system_defined = false; - $this->description = ''; - } - - /** - * @ORM\Column(name="Name", type="string") - * @var string - */ - private $name; - - /** - * @ORM\Column(name="Description", type="string") - * @var string - */ - private $description; - - /** - * @ORM\Column(name="AllowedExtensions", type="string") - * @var string - */ - private $allowed_extensions; - - /** - * @ORM\Column(name="IsSystemDefine", type="boolean") - * @var bool - */ - private $is_system_defined; - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return string - */ - public function getAllowedExtensions(): ?string - { - return $this->allowed_extensions; - } - - /** - * @param string $allowed_extensions - */ - public function setAllowedExtensions(string $allowed_extensions): void - { - $this->allowed_extensions = strtoupper($allowed_extensions); - } - - /** - * @return bool - */ - public function IsSystemDefined(): bool - { - return $this->is_system_defined; - } - - public function markAsSystemDefined(): void { - $this->is_system_defined = true; - } - - public function markAsUserDefined(): void { - $this->is_system_defined = false; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/MediaUploads/SummitMediaUploadType.php b/app/Models/Foundation/Summit/MediaUploads/SummitMediaUploadType.php deleted file mode 100644 index 50392200..00000000 --- a/app/Models/Foundation/Summit/MediaUploads/SummitMediaUploadType.php +++ /dev/null @@ -1,298 +0,0 @@ -is_mandatory = false; - $this->max_size = 0; - $this->presentation_types = new ArrayCollection(); - $this->public_storage_type = IStorageTypesConstants::None; - $this->private_storage_type = IStorageTypesConstants::None; - } - - public function setType(SummitMediaFileType $type){ - $this->type = $type; - } - - /** - * @return SummitMediaFileType - */ - public function getType(): ?SummitMediaFileType{ - return $this->type; - } - - /** - * @return int - */ - public function getTypeId(){ - try { - return is_null($this->type) ? 0 : $this->type->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasType():bool{ - return $this->getTypeId() > 0; - } - - public function clearType(){ - $this->type = null; - } - - /** - * @return string - */ - public function getName(): string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription(): string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return int - */ - public function getMaxSize(): int - { - return $this->max_size; - } - - /** - * @return int - */ - public function getMaxSizeMB(): int - { - return $this->max_size/1024; - } - - /** - * @param int $max_size - */ - public function setMaxSize(int $max_size): void - { - $this->max_size = $max_size; - } - - /** - * @return bool - */ - public function isMandatory(): bool - { - return $this->is_mandatory; - } - - public function markAsMandatory(): void - { - $this->is_mandatory = true; - } - - public function markAsOptional():void{ - $this->is_mandatory = false; - } - - /** - * @return string - */ - public function getPrivateStorageType(): ?string - { - return $this->private_storage_type; - } - - /** - * @param string $private_storage_type - */ - public function setPrivateStorageType(string $private_storage_type): void - { - if(!in_array($private_storage_type, IStorageTypesConstants::ValidPrivateTypes)) - throw new ValidationException(sprintf("invalid private storage type %s", $private_storage_type)); - $this->private_storage_type = $private_storage_type; - } - - /** - * @return string - */ - public function getPublicStorageType(): ?string - { - return $this->public_storage_type; - } - - /** - * @param string $public_storage_type - */ - public function setPublicStorageType(string $public_storage_type): void - { - if(!in_array($public_storage_type, IStorageTypesConstants::ValidPublicTypes)) - throw new ValidationException(sprintf("invalid public storage type %s", $public_storage_type)); - - $this->public_storage_type = $public_storage_type; - } - - /** - * @param PresentationType $presentationType - */ - public function addPresentationType(PresentationType $presentationType){ - if($this->presentation_types->contains($presentationType)) return; - $this->presentation_types->add($presentationType); - $presentationType->addAllowedMediaUploadType($this); - } - - /** - * @param PresentationType $presentationType - */ - public function removePresentationType(PresentationType $presentationType){ - if(!$this->presentation_types->contains($presentationType)) return; - $this->presentation_types->removeElement($presentationType); - $presentationType->removeAllowedMediaUploadType($this); - } - - public function getPresentationTypes(){ - return $this->presentation_types; - } - - public function isPresentationTypeAllowed(SummitEventType $type):bool { - return $this->presentation_types->contains($type); - } - - public function clearPresentationTypes():void{ - $this->presentation_types->clear(); - } - - /** - * @param string $ext - * @return bool - */ - public function isValidExtension(string $ext):bool { - return in_array(strtoupper($ext), explode('|', $this->type->getAllowedExtensions())); - } - - public function getValidExtensions(){ - return $this->type->getAllowedExtensions(); - } - - public function hasStorageSet():bool { - return ($this->private_storage_type != IStorageTypesConstants::None || $this->public_storage_type != IStorageTypesConstants::None); - } - - public function isVideo():bool{ - return str_contains(strtolower($this->getType()->getName()), "video"); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Metrics/ISummitMetricType.php b/app/Models/Foundation/Summit/Metrics/ISummitMetricType.php deleted file mode 100644 index 17f459f8..00000000 --- a/app/Models/Foundation/Summit/Metrics/ISummitMetricType.php +++ /dev/null @@ -1,32 +0,0 @@ -event; - } - - /** - * @param SummitEvent $event - */ - public function setEvent(SummitEvent $event): void - { - $this->event = $event; - } - - /** - * @return int - */ - public function getEventId(){ - try { - return is_null($this->event) ? 0 : $this->event->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Metrics/SummitMetric.php b/app/Models/Foundation/Summit/Metrics/SummitMetric.php deleted file mode 100644 index 5c49a165..00000000 --- a/app/Models/Foundation/Summit/Metrics/SummitMetric.php +++ /dev/null @@ -1,257 +0,0 @@ -ingress_date; - } - - /** - * @param \DateTime $ingress_date - */ - public function setIngressDate(\DateTime $ingress_date): void - { - $this->ingress_date = $ingress_date; - } - - /** - * @return \DateTime - */ - public function getOutgressDate(): ?\DateTime - { - return $this->outgress_date; - } - - /** - * @param \DateTime $outgress_date - */ - public function setOutgressDate(\DateTime $outgress_date): void - { - $this->outgress_date = $outgress_date; - } - - /** - * @return Member - */ - public function getMember(): ?Member - { - return $this->member; - } - - /** - * @param Member $member - */ - public function setMember(Member $member): void - { - $this->member = $member; - } - - /** - * @throws ValidationException - */ - public function abandon(){ - if(is_null($this->ingress_date)) - throw new ValidationException('You must enter first.'); - $this->outgress_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - public function getMemberFirstName():?string{ - return $this->member->getFirstName(); - } - - public function getMemberLastName():?string{ - return $this->member->getLastName(); - } - - public function getMemberProfilePhotoUrl():?string{ - return $this->member->getProfilePhotoUrl(); - } - - /** - * @param Member|null $member - * @return SummitMetric - * @throws \Exception - */ - public static function build(?Member $member){ - $metric = new static(); - $metric->member = $member; - $metric->ingress_date = new \DateTime('now', new \DateTimeZone('UTC')); - $metric->ip = UserClientHelper::getUserIp(); - $metric->origin = UserClientHelper::getUserOrigin(); - $metric->browser = UserClientHelper::getUserBrowser(); - return $metric; - } - - /** - * @return int - */ - public function getMemberId(){ - try { - return is_null($this->member) ? 0 : $this->member->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasMember():bool{ - return $this->getMemberId() > 0; - } - - public function clearMember(){ - $this->member = null; - } - - /** - * @return string|null - */ - public function getType(): ?string - { - return $this->type; - } - - /** - * @param string|null $type - * @throws ValidationException - */ - public function setType(?string $type): void - { - if(!in_array($type, ISummitMetricType::ValidTypes)) - throw new ValidationException(sprintf("Type %s is not a valid one.", $type)); - $this->type = $type; - } - - /** - * @return string|null - */ - public function getIp(): ?string - { - return $this->ip; - } - - /** - * @return string|null - */ - public function getOrigin(): ?string - { - return $this->origin; - } - - /** - * @return string|null - */ - public function getBrowser(): ?string - { - return $this->browser; - } - - /** - * @return string|null - */ - public function getLocation(): ?string - { - return $this->location; - } - - /** - * @param string|null $location - */ - public function setLocation(?string $location): void - { - $this->location = $location; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Metrics/SummitSponsorMetric.php b/app/Models/Foundation/Summit/Metrics/SummitSponsorMetric.php deleted file mode 100644 index 5c895f19..00000000 --- a/app/Models/Foundation/Summit/Metrics/SummitSponsorMetric.php +++ /dev/null @@ -1,66 +0,0 @@ -sponsor) ? 0 : $this->sponsor->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasSponsor():bool{ - return $this->getSponsorId() > 0; - } - - /** - * @return Sponsor|null - */ - public function getSponsor(): ?Sponsor - { - return $this->sponsor; - } - - /** - * @param Sponsor|null $sponsor - */ - public function setSponsor(?Sponsor $sponsor): void - { - $this->sponsor = $sponsor; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Attendees/ConfirmationExternalOrderRequest.php b/app/Models/Foundation/Summit/Registration/Attendees/ConfirmationExternalOrderRequest.php deleted file mode 100644 index f27a3b97..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/ConfirmationExternalOrderRequest.php +++ /dev/null @@ -1,92 +0,0 @@ -summit; - } - - /** - * @return int - */ - public function getMemberId() - { - return $this->member_id; - } - - /** - * @return string - */ - public function getExternalOrderId() - { - return $this->external_order_id; - } - - /** - * @return string - */ - public function getExternalAttendeeId() - { - return $this->external_attendee_id; - } - - /** - * @var int - */ - private $member_id; - - /** - * @var string - */ - private $external_order_id; - - /** - * @var string - */ - private $external_attendee_id; - - /** - * ConfirmationExternalOrderRequest constructor. - * @param Summit $summit - * @param int $member_id - * @param string $external_order_id - * @param string $external_attendee_id - */ - public function __construct( - Summit $summit, - $member_id, - $external_order_id, - $external_attendee_id - ) - { - $this->summit = $summit; - $this->member_id = $member_id; - $this->external_order_id = $external_order_id; - $this->external_attendee_id = $external_attendee_id; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendee.php b/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendee.php deleted file mode 100644 index 51bdf89f..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendee.php +++ /dev/null @@ -1,718 +0,0 @@ -summit_hall_checked_in_date; - } - - /** - * @return bool - */ - public function getSummitHallCheckedIn(){ - return (bool)$this->summit_hall_checked_in; - } - - /** - * @param bool $summit_hall_checked_in - */ - public function setSummitHallCheckedIn($summit_hall_checked_in){ - $this->summit_hall_checked_in = $summit_hall_checked_in; - $this->summit_hall_checked_in_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - public function hasCheckedIn():bool{ - return (bool)$this->summit_hall_checked_in; - } - - /** - * @param \DateTime $summit_hall_checked_in_date - */ - public function setSummitHallCheckedInDate(\DateTime $summit_hall_checked_in_date){ - $this->summit_hall_checked_in_date = $summit_hall_checked_in_date; - } - - /** - * @return boolean - */ - public function getSharedContactInfo() - { - return $this->share_contact_info; - } - - /** - * @param boolean $share_contact_info - */ - public function setShareContactInfo($share_contact_info) - { - $this->share_contact_info = $share_contact_info; - } - - /** - * @return int - */ - public function getMemberId(){ - try { - return is_null($this->member) ? 0 : $this->member->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasMember(){ - return $this->getMemberId() > 0; - } - - /** - * @ORM\OneToMany(targetEntity="SummitAttendeeTicket", mappedBy="owner", cascade={"persist", "remove"}) - * @var SummitAttendeeTicket[] - */ - private $tickets; - - /** - * @return SummitAttendeeTicket[] - */ - public function getTickets(){ - return $this->tickets; - } - - /** - * @param SummitAttendeeTicket $ticket - */ - public function addTicket(SummitAttendeeTicket $ticket){ - if($this->tickets->contains($ticket)) return; - $this->tickets->add($ticket); - $ticket->setOwner($this); - } - - /** - * @return Member - */ - public function getMember():?Member{ - return $this->member; - } - - /** - * @param Member $member - */ - public function setMember(Member $member){ - $this->member = $member; - } - - public function clearMember(){ - $this->member = null; - } - - use SummitOwned; - - public function __construct() - { - parent::__construct(); - $this->share_contact_info = false; - $this->summit_hall_checked_in = false; - $this->tickets = new ArrayCollection(); - $this->extra_question_answers = new ArrayCollection(); - $this->disclaimer_accepted_date = null; - $this->status = self::StatusIncomplete; - } - - /** - * @return SummitEventFeedback[] - */ - public function getEmittedFeedback(){ - - return $this->member->getFeedback()->matching - ( - Criteria::create()->orderBy(["id" => Criteria::ASC]) - ); - } - - /** - * @param SummitEvent $event - * @throws ValidationException - * @deprecated use Member::add2Schedule instead - */ - public function add2Schedule(SummitEvent $event) - { - $this->member->add2Schedule($event); - } - - /** - * @param SummitEvent $event - * @throws ValidationException - * @deprecated use Member::removeFromSchedule instead - */ - public function removeFromSchedule(SummitEvent $event) - { - $this->member->removeFromSchedule($event); - } - - /** - * @param SummitEvent $event - * @return bool - * @deprecated use Member::isOnSchedule instead - */ - public function isOnSchedule(SummitEvent $event) - { - return $this->member->isOnSchedule($event); - } - - /** - * @param SummitEvent $event - * @return null| SummitMemberSchedule - * @deprecated use Member::getScheduleByEvent instead - */ - public function getScheduleByEvent(SummitEvent $event){ - return $this->member->getScheduleByEvent($event); - } - - /** - * @return SummitMemberSchedule[] - * @deprecated use Member::getScheduleBySummit instead - */ - public function getSchedule(){ - return $this->member->getScheduleBySummit($this->summit); - } - - /** - * @return int[] - * @deprecated use Member::getScheduledEventsIds instead - */ - public function getScheduledEventsIds(){ - return $this->member->getScheduledEventsIds($this->summit); - } - - /** - * @param int $event_id - * @return null|RSVP - * @deprecated use Member::getRsvpByEvent instead - */ - public function getRsvpByEvent($event_id){ - return $this->member->getRsvpByEvent($event_id); - } - - /** - * @param int $ticket_id - * @return SummitAttendeeTicket - */ - public function getTicketById($ticket_id){ - $ticket = $this->tickets->matching( - $criteria = Criteria::create() - ->where(Criteria::expr()->eq("id", $ticket_id)) - )->first(); - return $ticket ? $ticket : null; - } - - /** - * @param SummitAttendeeTicket $ticket - * @return $this - */ - public function removeTicket(SummitAttendeeTicket $ticket){ - $this->tickets->removeElement($ticket); - $ticket->clearOwner(); - return $this; - } - - /** - * @param SummitAttendeeTicket $ticket - */ - public function sendRevocationTicketEmail(SummitAttendeeTicket $ticket){ - if(!$ticket->hasOwner()) return; - - if($ticket->getOwner()->getId() != $this->getId()) return; - - RevocationTicketEmail::dispatch($this, $ticket); - } - - /** - * @param SummitAttendeeTicket $ticket - * @param bool $overrideTicketOwnerIsSameAsOrderOwnerRule - */ - public function sendInvitationEmail(SummitAttendeeTicket $ticket, bool $overrideTicketOwnerIsSameAsOrderOwnerRule = false){ - Log::debug(sprintf("SummitAttendee::sendInvitationEmail attendee %s", $this->getEmail())); - if($ticket->getOwnerEmail() != $this->getEmail()) return; - if(!$ticket->isActive()){ - Log::warning(sprintf("SummitAttendee::sendInvitationEmail attendee %s ticket is not active", $this->getEmail())); - return; - } - $this->updateStatus(); - if($this->isComplete()) { - Log::debug(sprintf("SummitAttendee::sendInvitationEmail attendee %s is complete", $this->getEmail())); - SummitAttendeeTicketEmail::dispatch($ticket)->delay(now()->addMinutes(5)); - return; - } - Log::debug(sprintf("SummitAttendee::sendInvitationEmail attendee %s is not complete", $this->getEmail())); - $order = $ticket->getOrder(); - // if order owner is ticket owner then dont sent this email - // buyer is presented the option to fill in the details during the checkout process. Second, buyer will - // receive daily reminder emails. So, I think that makes this email not really needed as the buyer already knows - // they bought a ticket for themselves. - if($order->getOwnerEmail() !== $ticket->getOwnerEmail() || $overrideTicketOwnerIsSameAsOrderOwnerRule) { - // no delay - InviteAttendeeTicketEditionMail::dispatch($ticket); - } - } - - /** - * @return bool - */ - public function hasTickets(){ - return $this->tickets->count() > 0; - } - - /** - * @return string - */ - public function getFirstName(): ?string - { - if($this->hasMember()){ - return $this->member->getFirstName(); - } - return $this->first_name; - } - - /** - * @param string $first_name - */ - public function setFirstName(string $first_name): void - { - $this->first_name = $first_name; - } - - /** - * @return string - */ - public function getSurname(): ?string - { - if($this->hasMember()){ - return $this->member->getLastName(); - } - return $this->surname; - } - - /** - * @param string $surname - */ - public function setSurname(string $surname): void - { - $this->surname = $surname; - } - - /** - * @return string - */ - public function getEmail(): string - { - if($this->hasMember()){ - return $this->member->getEmail(); - } - return $this->email; - } - - public function getFullName():?string{ - Log::debug(sprintf("SummitAttendee::getFullName id %s", $this->id)); - if($this->hasMember()){ - Log::debug(sprintf("SummitAttendee::getFullName id %s hasMember", $this->id)); - $fullname = $this->member->getFullName(); - Log::debug(sprintf("SummitAttendee::getFullName id %s Member Full Name %s", $this->id, $fullname)); - if(!empty($fullname)) - return $fullname; - } - - $fullname = $this->first_name; - if(!empty($this->surname)){ - if(!empty($fullname)) $fullname .= ' '; - $fullname .= $this->surname; - } - - Log::debug(sprintf("SummitAttendee::getFullName id %s Attendee Full Name %s", $this->id, $fullname)); - return $fullname; - } - - /** - * @param string $email - */ - public function setEmail(string $email): void - { - $this->email = strtolower(trim($email)); - } - - /** - * @return \DateTime - */ - public function getDisclaimerAcceptedDate(): ?\DateTime - { - return $this->disclaimer_accepted_date; - } - - /** - * @return bool - */ - public function isDisclaimerAccepted():bool{ - return !is_null($this->disclaimer_accepted_date); - } - - /** - * @param \DateTime $disclaimer_accepted_date - */ - public function setDisclaimerAcceptedDate(\DateTime $disclaimer_accepted_date): void - { - $this->disclaimer_accepted_date = $disclaimer_accepted_date; - } - - /** - * @return SummitOrderExtraQuestionAnswer[] - */ - public function getExtraQuestionAnswers() - { - return $this->extra_question_answers; - } - - /** - * @param SummitOrderExtraQuestionType $question - * @return SummitOrderExtraQuestionAnswer|null - */ - public function getExtraQuestionAnswerByQuestion(SummitOrderExtraQuestionType $question):?SummitOrderExtraQuestionAnswer{ - $answer = $this->extra_question_answers->matching( - $criteria = Criteria::create() - ->where(Criteria::expr()->eq("question", $question)) - )->first(); - return $answer ? $answer : null; - } - - public function clearExtraQuestionAnswers() - { - return $this->extra_question_answers->clear(); - } - - /** - * @param SummitOrderExtraQuestionAnswer $answer - */ - public function addExtraQuestionAnswer(SummitOrderExtraQuestionAnswer $answer){ - if($this->extra_question_answers->contains($answer)) return; - $this->extra_question_answers->add($answer); - $answer->setAttendee($this); - } - - /** - * @param SummitOrderExtraQuestionAnswer $answer - */ - public function removeExtraQuestionAnswer(SummitOrderExtraQuestionAnswer $answer){ - if(!$this->extra_question_answers->contains($answer)) return; - $this->extra_question_answers->removeElement($answer); - $answer->clearAttendee(); - } - - /** - * @return string - */ - public function getCompanyName(): ?string - { - return $this->company_name; - } - - /** - * @param string $company_name - */ - public function setCompanyName(string $company_name): void - { - $this->company_name = $company_name; - } - - /** - * @return Company - */ - public function getCompany(): ?Company - { - return $this->company; - } - - /** - * @param Company $company - */ - public function setCompany(Company $company): void - { - $this->company = $company; - } - - /** - * @return bool - */ - public function needToFillDetails():bool { - return $this->getStatus() == self::StatusIncomplete; - } - - /** - * @return bool - */ - public function isComplete():bool{ - return $this->getStatus() == self::StatusComplete; - } - - /** - * @return string - */ - public function getStatus():?string{ - return $this->status; - } - - public function updateStatus():string { - - Log::debug(sprintf("SummitAttendee::updateStatus original status %s", $this->status)); - $is_disclaimer_mandatory = $this->summit->isRegistrationDisclaimerMandatory(); - - // mandatory fields - if($is_disclaimer_mandatory && !$this->isDisclaimerAccepted()){ - $this->status = self::StatusIncomplete; - Log::debug(sprintf("SummitAttendee::updateStatus StatusIncomplete for attendee %s (disclaimer mandatory)", $this->id)); - return $this->status; - } - - if(empty($this->getFirstName())){ - $this->status = self::StatusIncomplete; - Log::debug(sprintf("SummitAttendee::updateStatus StatusIncomplete for attendee %s (first name empty)", $this->id)); - return $this->status; - } - - if(empty($this->getSurname())){ - $this->status = self::StatusIncomplete; - Log::debug(sprintf("SummitAttendee::updateStatus StatusIncomplete for attendee %s (last name empty)", $this->id)); - return $this->status; - } - - if(empty($this->getEmail())){ - $this->status = self::StatusIncomplete; - Log::debug(sprintf("SummitAttendee::updateStatus StatusIncomplete for attendee %s (email empty)", $this->id)); - return $this->status; - } - - // check mandatory questions - - // get mandatory question ids - $extra_questions_mandatory_questions = $this->summit->getMandatoryOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::TicketQuestionUsage); - $extra_questions_mandatory_questions_ids = []; - - foreach($extra_questions_mandatory_questions as $extra_mandatory_question){ - $extra_questions_mandatory_questions_ids[] = $extra_mandatory_question->getId(); - } - - // now check the answers - foreach($this->extra_question_answers as $extra_question_answer){ - if(!$extra_question_answer->hasQuestion()) continue; - $question_type = $extra_question_answer->getQuestion(); - if(in_array($question_type->getId(), $extra_questions_mandatory_questions_ids)) { - // is mandatory now check if we have value set - if(!$extra_question_answer->hasValue()) { - $this->status = self::StatusIncomplete; - Log::debug(sprintf("SummitAttendee::updateStatus StatusIncomplete for attendee %s ( mandatory extra question missing value )", $this->id)); - return $this->status; - } - // delete from ids due its already answeres - if (($key = array_search($question_type->getId(), $extra_questions_mandatory_questions_ids)) !== false) { - unset($extra_questions_mandatory_questions_ids[$key]); - } - } - } - - // if we have mandatory questions without answer ... - if(count($extra_questions_mandatory_questions_ids) > 0 ){ - $this->status = self::StatusIncomplete; - Log::debug(sprintf("SummitAttendee::updateStatus StatusIncomplete for attendee %s ( mandatory extra questions )", $this->id)); - return $this->status; - } - - $this->status = self::StatusComplete; - - return $this->status; - } - - /** - * @return \DateTime - */ - public function getLastReminderEmailSentDate(): ?\DateTime - { - $last_action_date = $this->last_reminder_email_sent_date; - - if (is_null($last_action_date)) { - $last_action_date = $this->getCreatedUTC(); - } - - return $last_action_date; - } - - /** - * @param \DateTime $last_reminder_email_sent_date - */ - public function setLastReminderEmailSentDate(\DateTime $last_reminder_email_sent_date): void - { - $this->last_reminder_email_sent_date = $last_reminder_email_sent_date; - } - - public function getExternalId(): ?string - { - return $this->external_id; - } - - /** - * @param string $external_id - */ - public function setExternalId(string $external_id): void - { - $this->external_id = $external_id; - } - - /** - * @return string - */ - public function getAdminNotes(): ?string - { - return $this->admin_notes; - } - - /** - * @param string $admin_notes - */ - public function setAdminNotes(string $admin_notes): void - { - $this->admin_notes = $admin_notes; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadge.php b/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadge.php deleted file mode 100644 index 35755c1d..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadge.php +++ /dev/null @@ -1,313 +0,0 @@ - 'ticket', - 'getTypeId' => 'type', - ]; - - protected $hasPropertyMappings = [ - 'hasTicket' => 'ticket', - 'hasType' => 'type', - ]; - - - /** - * @ORM\Column(name="IsVoid", type="boolean") - * @var boolean - */ - private $is_void; - - /** - * @ORM\Column(name="QRCode", type="string", nullable=true) - * @var string - */ - private $qr_code; - - /** - * @ORM\OneToOne(targetEntity="SummitAttendeeTicket", inversedBy="badge") - * @ORM\JoinColumn(name="TicketID", referencedColumnName="ID") - * @var SummitAttendeeTicket - */ - private $ticket; - - /** - * @ORM\ManyToOne(targetEntity="SummitBadgeType") - * @ORM\JoinColumn(name="BadgeTypeID", referencedColumnName="ID") - * @var SummitBadgeType - */ - private $type; - - /** - * @ORM\ManyToMany(targetEntity="SummitBadgeFeatureType") - * @ORM\JoinTable(name="SummitAttendeeBadge_Features", - * joinColumns={@ORM\JoinColumn(name="SummitAttendeeBadgeID", referencedColumnName="ID")}, - * inverseJoinColumns={@ORM\JoinColumn(name="SummitBadgeFeatureTypeID", referencedColumnName="ID")} - * ) - * @var SummitBadgeFeatureType[] - */ - private $features; - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitAttendeeBadgePrint", mappedBy="badge", cascade={"persist","remove"}, orphanRemoval=true) - */ - private $prints; - - /** - * SummitAttendeeBadge constructor. - */ - public function __construct() - { - parent::__construct(); - $this->features = new ArrayCollection(); - $this->prints = new ArrayCollection(); - $this->is_void = false; - } - - public function getQRCode(): ?string - { - return $this->qr_code; - } - - use QRGeneratorTrait; - - /** - * @return string - * @throws ValidationException - */ - public function generateQRCode(): string - { - $ticket = $this->getTicket(); - if(is_null($ticket)) - throw new ValidationException("ticket is not set"); - - $order = $ticket->getOrder(); - if(is_null($order)) - throw new ValidationException("order is not set"); - - $summit = $order->getSummit(); - if(is_null($summit)) - throw new ValidationException("summit is not set"); - - $this->qr_code = $this->generateQRFromFields([ - $summit->getBadgeQRPrefix(), - $ticket->getNumber(), - $ticket->getOwnerEmail(), - $ticket->getOwnerFullName(), - ]); - - return $this->qr_code; - } - - /** - * @param string $qr_code - * @return array - * @throws ValidationException - */ - static public function parseQRCode(string $qr_code):array{ - $fields = explode(IQREntity::QRRegistryFieldDelimiterChar, $qr_code); - if(count($fields) != 4) throw new ValidationException("invalid qr code"); - - return [ - 'prefix' => $fields[0], - 'ticket_number' => $fields[1], - 'owner_fullname' => $fields[3], - 'owner_email' => $fields[2], - ]; - } - /** - * @return bool - */ - public function isVoid(): bool - { - return $this->is_void; - } - - public function markVoid() - { - $this->is_void = true; - } - - /** - * @return SummitAttendeeTicket - */ - public function getTicket(): SummitAttendeeTicket - { - return $this->ticket; - } - - /** - * @param SummitAttendeeTicket $ticket - */ - public function setTicket(SummitAttendeeTicket $ticket): void - { - $this->ticket = $ticket; - } - - /** - * @return SummitBadgeType - */ - public function getType(): SummitBadgeType - { - return $this->type; - } - - /** - * @param SummitBadgeType $type - */ - public function setType(SummitBadgeType $type): void - { - $this->type = $type; - } - - /** - * @return SummitBadgeFeatureType[] - */ - public function getFeatures() - { - return $this->features; - } - - /** - * @return array - */ - public function getAllFeatures(){ - $features = $this->features->toArray(); - $inherited_features = $this->type->getBadgeFeatures(); - foreach ($inherited_features as $inherited_feature){ - if($this->features->contains($inherited_feature)) continue; - $features[] = $inherited_feature; - } - return $features; - } - - public function clearFeatures():void{ - $this->features->clear(); - } - - - public function addFeature(SummitBadgeFeatureType $feature){ - if($this->features->contains($feature)) return; - $this->features->add($feature); - } - - public function removeFeature(SummitBadgeFeatureType $feature){ - if(!$this->features->contains($feature)) return; - $this->features->removeElement($feature); - } - - /** - * @param SummitRegistrationPromoCode $promo_code - * @return $this - */ - public function applyPromoCode(SummitRegistrationPromoCode $promo_code){ - foreach ($promo_code->getBadgeFeatures() as $feature) - $this->addFeature($feature); - return $this; - } - - /** - * @param SummitTicketType $ticket_type - * @return $this - */ - public function applyTicketType(SummitTicketType $ticket_type){ - $this->setType($ticket_type->getBadgeType()); - return $this; - } - - /** - * @return bool - */ - public function isPrinted():bool { - return $this->prints->count() > 0; - } - - /** - * @param Member $requestor - * @return SummitAttendeeBadgePrint - * @throws ValidationException - */ - public function printIt(Member $requestor):SummitAttendeeBadgePrint{ - if(!$this->ticket->hasOwner()) - throw new ValidationException("badge has not owner set"); - - if($this->is_void){ - throw new ValidationException("badge is void"); - } - $this->generateQRCode(); - $print = SummitAttendeeBadgePrint::build($this, $requestor); - $this->prints->add($print); - return $print; - } - - /** - * @param Group $group - * @return int - */ - public function getPrintCountPerGroup(Group $group):int{ - if($this->prints->count() == 0) return 0; - - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute([ - 'badge_id' => $this->id, - 'group_id' => $group->getId(), - ]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - - } - return 0; - } - - public function getPrintDate():?\DateTime{ - if(!$this->isPrinted()) return null; - // get last print date - return $this->prints->last()->getPrintDate(); - } - - /** - * @return int - */ - public function getPrintedTimes(): ?int - { - return $this->prints->count(); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadgePrint.php b/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadgePrint.php deleted file mode 100644 index 9281ff0a..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadgePrint.php +++ /dev/null @@ -1,95 +0,0 @@ - 'requestor', - 'getBadgeId' => 'badge', - ]; - - protected $hasPropertyMappings = [ - 'hasRequestor' => 'requestor', - 'hasBadge' => 'badge', - ]; - - /** - * @ORM\ManyToOne(targetEntity="models\summit\SummitAttendeeBadge", inversedBy="prints") - * @ORM\JoinColumn(name="BadgeID", referencedColumnName="ID") - * @var SummitAttendeeBadge - */ - private $badge; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="RequestorID", referencedColumnName="ID") - * @var Member - */ - private $requestor; - - /** - * @ORM\Column(name="PrintDate", type="datetime", nullable=true) - * @var \DateTime - */ - private $print_date; - - /** - * @return SummitAttendeeBadge - */ - public function getBadge(): SummitAttendeeBadge - { - return $this->badge; - } - - /** - * @return Member - */ - public function getRequestor(): Member - { - return $this->requestor; - } - - /** - * @return \DateTime - */ - public function getPrintDate(): \DateTime - { - return $this->print_date; - } - - /** - * @param SummitAttendeeBadge $badge - * @param Member $requestor - * @return SummitAttendeeBadgePrint - */ - public static function build(SummitAttendeeBadge $badge, Member $requestor){ - $print = new SummitAttendeeBadgePrint(); - $print->badge = $badge; - $print->requestor = $requestor; - $print->print_date = new \DateTime('now', new \DateTimeZone('UTC')); - return $print; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadgePrintRule.php b/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadgePrintRule.php deleted file mode 100644 index 80786a8d..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeBadgePrintRule.php +++ /dev/null @@ -1,96 +0,0 @@ - 'group', - ]; - - protected $hasPropertyMappings = [ - 'hasGroup' => 'group', - ]; - - /** - * @ORM\Column(name="MaxPrintTimes", type="integer") - * @var int - */ - private $max_print_times; - - /** - * @ORM\OneToOne(targetEntity="models\main\Group") - * @ORM\JoinColumn(name="GroupID", referencedColumnName="ID") - * @var Group - */ - private $group; - - public function __construct() - { - parent::__construct(); - $this->max_print_times = 0; - } - - /** - * @return int - */ - public function getMaxPrintTimes(): int - { - return $this->max_print_times; - } - - /** - * @param int $max_print_times - */ - public function setMaxPrintTimes(int $max_print_times): void - { - $this->max_print_times = $max_print_times; - } - - /** - * @return Group - */ - public function getGroup(): Group - { - return $this->group; - } - - /** - * @param Group $group - */ - public function setGroup(Group $group): void - { - $this->group = $group; - } - - /** - * @param SummitAttendeeBadge $badge - * @return bool - */ - public function canPrintBadge(SummitAttendeeBadge $badge):bool{ - if($this->max_print_times == 0) return true; - $count = $badge->getPrintCountPerGroup($this->group); - return $count < $this->max_print_times; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicket.php b/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicket.php deleted file mode 100644 index c5fb79e0..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicket.php +++ /dev/null @@ -1,981 +0,0 @@ -status = IOrderConstants::ReservedStatus; - $this->currency = AllowedCurrencies::USD; - $this->applied_taxes = new ArrayCollection(); - $this->former_hashes = new ArrayCollection(); - $this->raw_cost = 0.0; - $this->discount = 0.0; - $this->refunded_amount = 0.0; - $this->is_active = true; - } - - /** - * @return string - */ - public function getHash(): string - { - return $this->hash; - } - - /** - * @return \DateTime - */ - public function getHashCreationDate(): \DateTime - { - return $this->hash_creation_date; - } - - /** - * @return string - */ - public function getNumber(): ?string - { - return $this->number; - } - - /** - * @param string $number - */ - public function setNumber(string $number): void - { - $this->number = $number; - } - - /** - * @return string - */ - public function getStatus(): string - { - return $this->status; - } - - /** - * @param string $status - */ - public function setStatus(string $status): void - { - $this->status = $status; - } - - /** - * @return float - */ - public function getRawCost(): ?float - { - return $this->raw_cost; - } - - /** - * @param float $raw_cost - */ - public function setRawCost(float $raw_cost): void - { - $this->raw_cost = $raw_cost; - } - - /** - * @return float - */ - public function getRefundedAmount(): ?float - { - return $this->refunded_amount; - } - - /** - * @param float $refunded_amount - */ - public function setRefundedAmount(float $refunded_amount): void - { - $this->refunded_amount = $refunded_amount; - } - - /** - * @return string - */ - public function getCurrency(): ?string - { - return $this->currency; - } - - /** - * @param string $currency - */ - public function setCurrency(string $currency): void - { - $this->currency = $currency; - } - - /** - * @return string - */ - public function getQRCode(): ?string - { - return $this->qr_code; - } - - public function generateHash():void - { - $token = $this->number; - if (!is_null($this->order)) { - $token .= $this->order->getHash(); - } - $salt = random_bytes(16); - if(!empty($this->hash)){ - $former_hash = new SummitAttendeeTicketFormerHash($this->hash, $this); - $this->former_hashes->add($former_hash); - } - $this->hash = hash('sha256', $token.$salt.time()); - $this->hash_creation_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - /** - * @throws ValidationException - */ - public function sendPublicEditEmail(){ - if (!$this->isPaid()) - throw new ValidationException("ticket is not paid"); - - if (!$this->hasOwner()) - throw new ValidationException("ticket must have an assigned owner"); - - $this->generateQRCode(); - $this->generateHash(); - - SummitAttendeeTicketRegenerateHashEmail::dispatch($this); - } - - /** - * @return bool - */ - public function hasOrder() - { - return $this->getOrderId() > 0; - } - - /** - * @return int - */ - public function getOrderId() - { - try { - return is_null($this->order) ? 0 : $this->order->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return SummitOrder - */ - public function getOrder(): SummitOrder - { - return $this->order; - } - - /** - * @param SummitOrder $order - */ - public function setOrder(SummitOrder $order): void - { - $this->order = $order; - } - - /** - * @return bool - * @throws \Exception - */ - public function canPubliclyEdit(): bool - { - if (empty($this->hash) || is_null($this->hash_creation_date)) return false; - $ttl_minutes = Config::get("registration.ticket_public_edit_ttl", 30); - $eol = new \DateTime('now', new \DateTimeZone('UTC')); - $eol->sub(new \DateInterval('PT' . $ttl_minutes . 'M')); - if ($this->hash_creation_date <= $eol) - return false; - return true; - } - - /** - * @return string - */ - public function generateNumber(): string - { - $summit = $this->getOrder()->getSummit(); - $this->number = strtoupper(str_replace(".", "", uniqid($summit->getTicketQRPrefix().'_', true))); - return $this->number; - } - - /** - * @return mixed - */ - public function getChangedDate() - { - return $this->changed_date; - } - - /** - * @param mixed $changed_date - */ - public function setChangedDate($changed_date) - { - $this->changed_date = $changed_date; - } - - /** - * @return string - */ - public function getExternalOrderId():?string - { - return $this->external_order_id; - } - - /** - * @param string $external_order_id - */ - public function setExternalOrderId($external_order_id) - { - $this->external_order_id = $external_order_id; - } - - /** - * @return string - */ - public function getExternalAttendeeId():?string - { - return $this->external_attendee_id; - } - - /** - * @param string $external_attendee_id - */ - public function setExternalAttendeeId($external_attendee_id) - { - $this->external_attendee_id = $external_attendee_id; - } - - /** - * @return \DateTime - */ - public function getBoughtDate() - { - return $this->bought_date; - } - - /** - * @param \DateTime $bought_date - */ - public function setBoughtDate($bought_date) - { - $this->bought_date = $bought_date; - } - - /** - * @return SummitTicketType - */ - public function getTicketType() - { - return $this->ticket_type; - } - - /** - * @param $ticket_type - * @return $this - */ - public function setTicketType($ticket_type) - { - $this->ticket_type = $ticket_type; - $this->raw_cost = $this->ticket_type->getCost(); - $this->currency = $this->ticket_type->getCurrency(); - return $this->ticket_type->applyTo($this); - } - - /** - * @return bool - */ - public function hasTicketType() - { - return $this->getTicketTypeId() > 0; - } - - /** - * @return int - */ - public function getTicketTypeId() - { - try { - return is_null($this->ticket_type) ? 0 : $this->ticket_type->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return SummitAttendee|null - */ - public function getOwner():?SummitAttendee - { - return $this->owner; - } - - /** - * @param SummitAttendee $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @return bool - */ - public function hasOwner() - { - return $this->getOwnerId() > 0; - } - - /** - * @return int - */ - public function getOwnerId() - { - try { - return is_null($this->owner) ? 0 : $this->owner->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return bool - */ - public function isPaid():bool { - return $this->status == IOrderConstants::PaidStatus; - } - - /** - * @return bool - */ - public function isCancelled():bool { - return $this->status == IOrderConstants::CancelledStatus; - } - - use QRGeneratorTrait; - - /** - * @return string - */ - public function generateQRCode(): string - { - if(is_null($this->order)){ - throw new ValidationException("ticket has not order set"); - } - - $this->qr_code = $this->generateQRFromFields([ - $this->order->getSummit()->getTicketQRPrefix(), - $this->number - ]); - - return $this->qr_code; - } - - /** - * @return SummitAttendeeBadge - */ - public function getBadge(): SummitAttendeeBadge - { - return $this->badge; - } - - /** - * @param SummitAttendeeBadge $badge - */ - public function setBadge(SummitAttendeeBadge $badge): void - { - $this->badge = $badge; - $badge->setTicket($this); - } - - /** - * @return bool - */ - public function hasBadge() - { - return $this->getBadgeId() > 0 || !is_null($this->badge); - } - - /** - * @return int - */ - public function getBadgeId() - { - try { - return is_null($this->badge) ? 0 : $this->badge->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - public function setPaid($set_bought_date = true) - { - $this->status = IOrderConstants::PaidStatus; - if($set_bought_date) - $this->bought_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - - public function setCancelled() - { - if ($this->status == IOrderConstants::PaidStatus) return; - $this->status = IOrderConstants::CancelledStatus; - } - - function cancelRefundRequest():void { - if(!$this->isRefundRequested()) - throw new ValidationException(sprintf("You can not cancel any refund on this ticket")); - $this->status = IOrderConstants::PaidStatus; - } - - public function setRefunded() - { - $this->status = IOrderConstants::RefundedStatus; - } - - public function setRefundRequests() - { - $this->status = IOrderConstants::RefundRequestedStatus; - } - - /** - * @return bool - */ - public function canRefund():bool{ - $validStatuses = [IOrderConstants::RefundRequestedStatus, IOrderConstants::PaidStatus]; - if(!in_array($this->status, $validStatuses)){ - return false; - } - if($this->isFree()){ - return false; - } - return true; - } - /** - * @param float $amount - * @throws ValidationException - */ - public function refund(float $amount) - { - if (!$this->canRefund()) - throw new ValidationException - ( - sprintf - ( - "can not request a refund on a %s ticket", - $this->status - ) - ); - - $this->status = IOrderConstants::RefundedStatus; - $this->refunded_amount = $amount; - - $tickets_to_return = []; - $promo_codes_to_return = []; - - if(!isset($tickets_to_return[$this->getTicketTypeId()])) - $tickets_to_return[$this->getTicketTypeId()] = 0; - $tickets_to_return[$this->getTicketTypeId()] += 1; - if($this->hasPromoCode()){ - if(!isset($promo_codes_to_return[$this->getPromoCode()->getCode()])) - $promo_codes_to_return[$this->getPromoCode()->getCode()] = 0; - $promo_codes_to_return[$this->getPromoCode()->getCode()] +=1; - } - - Event::fire(new SummitAttendeeTicketRefundAccepted($this->getId(), $tickets_to_return, $promo_codes_to_return)); - } - - /** - * @return bool - */ - public function hasPromoCode(): bool - { - return $this->getPromoCodeId() > 0; - } - - /** - * @return int - */ - public function getPromoCodeId(): int - { - try { - return is_null($this->promo_code) ? 0 : $this->promo_code->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return SummitRegistrationPromoCode - */ - public function getPromoCode(): ?SummitRegistrationPromoCode - { - return $this->promo_code; - } - - /** - * @param SummitRegistrationPromoCode $promo_code - */ - public function setPromoCode(SummitRegistrationPromoCode $promo_code): void - { - $this->promo_code = $promo_code; - } - - /** - * @return bool - */ - public function isRefundRequested():bool{ - return $this->status == IOrderConstants::RefundRequestedStatus; - } - - /** - * @return bool - */ - public function isRefunded():bool{ - return $this->status == IOrderConstants::RefundedStatus; - } - - /** - * @return bool - */ - public function isBadgePrinted():bool{ - if($this->hasBadge()){ - $badge = $this->getBadge(); - return $badge->isPrinted(); - } - return false; - } - /** - * @param bool $refund_entire_order - * @throws ValidationException - */ - public function requestRefund($refund_entire_order = false): void - { - if ($this->status != IOrderConstants::PaidStatus) - throw new ValidationException(sprintf( "you can not request a refund for this ticket %s ( invalid status %s)", $this->number, $this->status)); - - $summit = $this->getOrder()->getSummit(); - $begin_date = $summit->getBeginDate(); - if(is_null($begin_date)) return; - - if($this->isBadgePrinted()) - throw new ValidationException(sprintf( "you can not request a refund for this ticket %s ( badge already printed)", $this->number)); - - $now = new \DateTime('now', new \DateTimeZone('UTC')); - - if($now > $begin_date){ - Log::debug("SummitAttendeeTicket::requestRefund: now is greater than Summit.BeginDate"); - throw new ValidationException("you can not request a refund after summit started"); - } - - $interval = $begin_date->diff($now); - - $days_before_event_starts = intval($interval->format('%a')); - - Log::debug(sprintf("SummitAttendeeTicket::requestRefund: days_before_event_starts %s", $days_before_event_starts)); - - $this->status = IOrderConstants::RefundRequestedStatus; - - if (!$refund_entire_order) - Event::fire(new RequestedSummitAttendeeTicketRefund($this->getId(), $days_before_event_starts)); - } - - /** - * @param array $taxes - */ - public function applyTaxes(array $taxes) - { - $amount = $this->raw_cost; - $amount -= $this->discount; - foreach ($taxes as $tax) { - if (!$tax instanceof SummitTaxType) continue; - if (!$tax->mustApplyTo($this->ticket_type)) continue; - $ticketTax = new SummitAttendeeTicketTax(); - $ticketTax->setTicket($this); - $ticketTax->setTax($tax); - $ticketTax->setAmount(($amount * $tax->getRate()) / 100.00); - $this->applied_taxes->add($ticketTax); - } - } - - /** - * @return float - */ - public function getFinalAmount(): float - { - $amount = $this->raw_cost; - $amount -= $this->discount; - foreach ($this->applied_taxes as $tax) { - $amount += $tax->getAmount(); - } - return $amount; - } - - /** - * @return bool - */ - public function isFree():bool { - return $this->getFinalAmount() == 0; - } - - /** - * @return float - */ - public function getTaxesAmount(): float - { - $amount = 0.0; - foreach ($this->getAppliedTaxes() as $appliedTax) { - $amount += $appliedTax->getAmount(); - } - return $amount; - } - - /** - * @return SummitAttendeeTicketTax[] - */ - public function getAppliedTaxes() - { - return $this->applied_taxes; - } - - /** - * @return float - */ - public function getDiscount(): float - { - return $this->discount; - } - - /** - * @param float $amount - * @return $this - */ - public function setDiscount(float $amount) - { - $this->discount = $amount > $this->raw_cost ? $this->raw_cost: $amount; - return $this; - } - - public function clearOwner() - { - $this->owner = null; - } - - /** - * @return string - */ - public function getOwnerFullName():?string{ - if(is_null($this->owner)) null; - return $this->owner->getFullName(); - } - - /** - * @return string - */ - public function getOwnerFirstName():?string{ - if(is_null($this->owner)) return null; - return $this->owner->getFirstName(); - } - - /** - * @return string - */ - public function getOwnerSurname():?string{ - if(is_null($this->owner)) return null; - return $this->owner->getSurname(); - } - /** - * @return string - */ - public function getOwnerCompany():?string{ - if(is_null($this->owner)) return null; - return $this->owner->getCompanyName(); - } - - /** - * @return string - */ - public function getOwnerEmail():?string{ - try { - return is_null($this->owner)? null : $this->owner->getEmail(); - } - catch (\Exception $ex){ - return null; - } - } - - /** - * @return int|null - */ - public function getBadgeTypeId():?int{ - if(is_null($this->badge)) return 0; - return $this->badge->getType()->getId(); - } - - /** - * @return null|string - */ - public function getBadgeTypeName():?string{ - if(is_null($this->badge)) return null; - return $this->badge->getType()->getName(); - } - - /** - * @return null|string - */ - public function getTicketTypeName():?string{ - if(is_null($this->ticket_type)) return null; - return $this->ticket_type->getName(); - } - - /** - * @return array - */ - public function getBadgeFeaturesNames():array { - $res = []; - if(is_null($this->badge)) return []; - foreach ($this->badge->getFeatures() as $feature){ - $res[] = $feature->getName(); - } - foreach ($this->badge->getType()->getBadgeFeatures() as $feature){ - if(in_array($feature->getName(),$res)) continue; - $res[] = $feature->getName(); - } - - return $res; - } - - public function getBadgeFeatures():array{ - $res = []; - if(is_null($this->badge)) return []; - - foreach ($this->badge->getFeatures() as $feature){ - $res[$feature->getId()] = $feature; - } - - foreach ($this->badge->getType()->getBadgeFeatures() as $feature){ - if(key_exists($feature->getId(), $res)) continue; - $res[$feature->getId()] = $feature; - } - - return $res; - } - - /** - * @return null|string - */ - public function getPromoCodeValue():?string{ - return $this->hasPromoCode() ? $this->promo_code->getCode() : null; - } - - /** - * @param Member $member - * @return bool - */ - public function canEditTicket(Member $member):bool{ - if($member->isAdmin()) return true; - // i am ticket owner - if($this->hasOwner() && $this->owner->getEmail() == $member->getEmail()) return true; - // i am order owner - if($this->order->getOwnerEmail() == $member->getEmail()) return true; - } - - /** - * @return bool - */ - public function isActive(): bool - { - return $this->is_active; - } - - public function activate(): void - { - $this->is_active = true; - } - - public function deActivate(): void - { - $this->is_active = false; - } - -} diff --git a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicketFormerHash.php b/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicketFormerHash.php deleted file mode 100644 index 2b861858..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicketFormerHash.php +++ /dev/null @@ -1,73 +0,0 @@ -hash = $hash; - $this->ticket = $ticket; - } - - /** - * @return string - */ - public function getHash(): string - { - return $this->hash; - } - - /** - * @return SummitAttendeeTicket - */ - public function getTicket(): SummitAttendeeTicket - { - return $this->ticket; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicketTax.php b/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicketTax.php deleted file mode 100644 index 7cad934b..00000000 --- a/app/Models/Foundation/Summit/Registration/Attendees/SummitAttendeeTicketTax.php +++ /dev/null @@ -1,112 +0,0 @@ - 'ticket', - 'getTaxId' => 'tax', - ]; - - protected $hasPropertyMappings = [ - 'hasTicket' => 'ticket', - 'hasTax' => 'tax', - ]; - - /** - * @return SummitAttendeeTicket - */ - public function getTicket(): SummitAttendeeTicket - { - return $this->ticket; - } - - /** - * @param SummitAttendeeTicket $ticket - */ - public function setTicket(SummitAttendeeTicket $ticket): void - { - $this->ticket = $ticket; - } - - /** - * @return SummitTaxType - */ - public function getTax(): SummitTaxType - { - return $this->tax; - } - - /** - * @param SummitTaxType $tax - */ - public function setTax(SummitTaxType $tax): void - { - $this->tax = $tax; - } - - /** - * @return float - */ - public function getAmount(): float - { - return $this->amount; - } - - /** - * @param float $amount - */ - public function setAmount(float $amount): void - { - $this->amount = $amount; - } - - /** - * @ORM\ManyToOne(targetEntity="SummitAttendeeTicket", inversedBy="applied_taxes") - * @ORM\JoinColumn(name="SummitAttendeeTicketID", referencedColumnName="ID") - * @var SummitAttendeeTicket - */ - private $ticket; - - /** - * @ORM\ManyToOne(targetEntity="SummitTaxType") - * @ORM\JoinColumn(name="SummitTaxTypeID", referencedColumnName="ID") - * @var SummitTaxType - */ - private $tax; - - /** - * @ORM\Column(name="Amount", type="float") - * @var float - */ - private $amount; - - public function __construct() - { - - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/BuildDefaultPaymentGatewayProfileStrategy.php b/app/Models/Foundation/Summit/Registration/BuildDefaultPaymentGatewayProfileStrategy.php deleted file mode 100644 index 00dc60a9..00000000 --- a/app/Models/Foundation/Summit/Registration/BuildDefaultPaymentGatewayProfileStrategy.php +++ /dev/null @@ -1,101 +0,0 @@ - true, - 'application_type' => $application_type, - ]) - ); - } - - if ($application_type == IPaymentConstants::ApplicationTypeBookableRooms) { - $provider = Config::get('bookable_rooms.default_payment_provider'); - if(empty($provider)){ - throw new ValidationException - ( - sprintf("Missing Provider settings for application %s", $application_type) - ); - } - $config = Config::get('bookable_rooms.default_payment_provider_config'); - $provider_config = $config[$provider] ?? []; - if(!count($provider_config)){ - throw new ValidationException - ( - sprintf - ( - "Missing configuration for provider %s and application %s", - $provider, - $application_type - ) - ); - } - return PaymentGatewayProfileFactory::build - ( - $provider, - array_merge($provider_config, [ - 'active' => true, - 'application_type' => $application_type, - ]) - ); - } - } - catch (\Exception $ex){ - Log::warning($ex); - } - - return null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/ExtraQuestions/SummitOrderExtraQuestionType.php b/app/Models/Foundation/Summit/Registration/ExtraQuestions/SummitOrderExtraQuestionType.php deleted file mode 100644 index ba3f1df1..00000000 --- a/app/Models/Foundation/Summit/Registration/ExtraQuestions/SummitOrderExtraQuestionType.php +++ /dev/null @@ -1,87 +0,0 @@ -usage; - } - - /** - * @param string $usage - * @throws ValidationException - */ - public function setUsage(string $usage): void - { - if(!in_array($usage, SummitOrderExtraQuestionTypeConstants::ValidQuestionUsages)) - throw new ValidationException(sprintf("%s usage is not valid", $usage)); - $this->usage = $usage; - } - - /** - * @return bool - */ - public function isPrintable(): bool - { - return $this->printable; - } - - /** - * @param bool $printable - */ - public function setPrintable(bool $printable): void - { - $this->printable = $printable; - } - - public function __construct() - { - parent::__construct(); - $this->printable = false; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/ExtraQuestions/SummitOrderExtraQuestionTypeConstants.php b/app/Models/Foundation/Summit/Registration/ExtraQuestions/SummitOrderExtraQuestionTypeConstants.php deleted file mode 100644 index 19fbcb11..00000000 --- a/app/Models/Foundation/Summit/Registration/ExtraQuestions/SummitOrderExtraQuestionTypeConstants.php +++ /dev/null @@ -1,32 +0,0 @@ -active = false; - $this->application_type = IPaymentConstants::ApplicationTypeRegistration; - } - - /** - * @return bool - */ - public function isActive(): bool - { - return $this->active; - } - - public function activate():void{ - $this->active = true; - } - - public function disable():void{ - $this->active = false; - } - - /** - * @return string - */ - public function getApplicationType(): ?string - { - return $this->application_type; - } - - /** - * @param string $application_type - * @throws ValidationException - */ - public function setApplicationType(string $application_type): void - { - if(!in_array($application_type, IPaymentConstants::ValidApplicationTypes)) - throw new ValidationException(sprintf("Application Type %s is not valid.", $application_type)); - - $this->application_type = $application_type; - } - - /** - * @return string - */ - public function getProvider(): ?string - { - return $this->provider; - } - - /** - * @return IPaymentGatewayAPI - */ - abstract public function buildPaymentGatewayApi():IPaymentGatewayAPI; - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/Payment/StripePaymentProfile.php b/app/Models/Foundation/Summit/Registration/Payment/StripePaymentProfile.php deleted file mode 100644 index 4442a967..00000000 --- a/app/Models/Foundation/Summit/Registration/Payment/StripePaymentProfile.php +++ /dev/null @@ -1,529 +0,0 @@ -test_mode_enabled = true; - $this->send_email_receipt = false; - $this->provider = IPaymentConstants::ProviderStripe; - $this->live_webhook_id = ''; - $this->live_webhook_secret_key = ''; - $this->live_publishable_key = ''; - $this->live_secret_key = ''; - $this->test_webhook_id = ''; - $this->test_webhook_secret_key = ''; - $this->test_publishable_key = ''; - $this->test_secret_key = ''; - } - - /** - * @return bool - */ - public function isTestModeEnabled(): bool - { - return $this->test_mode_enabled; - } - - /** - * @return string - */ - public function getLiveSecretKey(): ?string - { - return $this->live_secret_key; - } - - /** - * @return string - */ - public function getLivePublishableKey(): ?string - { - return $this->live_publishable_key; - } - - /** - * @return string - */ - public function getLiveWebhookId(): ?string - { - return $this->live_webhook_id; - } - - /** - * @return string - */ - public function getLiveWebhookSecretKey(): ?string - { - return $this->live_webhook_secret_key; - } - - /** - * @return string - */ - public function getTestSecretKey(): ?string - { - return $this->test_secret_key; - } - - /** - * @return string - */ - public function getTestPublishableKey(): ?string - { - return $this->test_publishable_key; - } - - /** - * @return string - */ - public function getTestWebhookId(): ?string - { - return $this->test_webhook_id; - } - - /** - * @return string - */ - public function getTestWebhookSecretKey(): ?string - { - return $this->test_webhook_secret_key; - } - - /** - * @param array $keys - */ - public function setLiveKeys(array $keys): void - { - $this->live_publishable_key = $keys['publishable_key']; - $this->live_secret_key = $keys['secret_key']; - } - - /** - * @param string $live_secret_key - */ - public function setLiveSecretKey(string $live_secret_key): void - { - $this->live_secret_key = $live_secret_key; - } - - /** - * @param string $live_publishable_key - */ - public function setLivePublishableKey(string $live_publishable_key): void - { - $this->live_publishable_key = $live_publishable_key; - } - - /** - * @param string $test_secret_key - */ - public function setTestSecretKey(string $test_secret_key): void - { - $this->test_secret_key = $test_secret_key; - } - - /** - * @param string $test_publishable_key - */ - public function setTestPublishableKey(string $test_publishable_key): void - { - $this->test_publishable_key = $test_publishable_key; - } - - /** - * @param array $keys - */ - public function setTestKeys(array $keys): void - { - $this->test_publishable_key = $keys['publishable_key']; - $this->test_secret_key = $keys['secret_key']; - } - - public function setLiveMode(): void - { - $this->test_mode_enabled = false; - $this->buildWebHook(); - } - - public function setTestMode(): void - { - $this->test_mode_enabled = true; - $this->buildWebHook(); - } - - /** - * @param array $webhook_data - */ - public function setLiveWebHookData(array $webhook_data): void - { - $this->live_webhook_id = $webhook_data['id']; - $this->live_webhook_secret_key = $webhook_data['secret_key']; - } - - /** - * @param array $webhook_data - */ - public function setTestWebHookData(array $webhook_data): void - { - $this->test_webhook_id = $webhook_data['id']; - $this->test_webhook_secret_key = $webhook_data['secret_key']; - } - - /** - * @return array - */ - private function createConfiguration(): array - { - if ($this->test_mode_enabled) { - return $this->createTestConfiguration(); - } - return $this->createLiveConfiguration(); - } - - /** - * @return array - */ - private function createTestConfiguration(): array - { - $params = [ - 'secret_key' => $this->test_secret_key, - 'send_email_receipt' => $this->send_email_receipt - ]; - - if (!empty($this->test_webhook_secret_key)) { - $params['webhook_secret_key'] = $this->test_webhook_secret_key; - } - - return $params; - } - - /** - * @return array - */ - private function createLiveConfiguration(): array - { - $params = [ - 'secret_key' => $this->live_secret_key, - 'send_email_receipt' => $this->send_email_receipt - ]; - - if (!empty($this->live_webhook_secret_key)) { - $params['webhook_secret_key'] = $this->live_webhook_secret_key; - } - return $params; - } - - /** - * @throws ValidationException - */ - public function activate(): void - { - if (!$this->hasSecretKey()) { - throw new ValidationException("You can not activate a profile without a secret key set."); - } - - if (!$this->hasPublicKey()) { - throw new ValidationException("You can not activate a profile without a published key set."); - } - - parent::activate(); - - $this->buildWebHook(); - } - - public function disable(): void - { - parent::disable(); - $this->clearWebHooks(); - } - - /** - * @return bool - */ - public function hasSecretKey(): bool - { - if ($this->test_mode_enabled) { - return !empty($this->test_secret_key); - } - return !empty($this->live_secret_key); - } - - /** - * @return bool - */ - public function hasPublicKey(): bool - { - if ($this->test_mode_enabled) { - return !empty($this->test_publishable_key); - } - return !empty($this->live_publishable_key); - } - - /** - * @return bool - */ - public function existsWebHook(): bool - { - if ($this->test_mode_enabled) { - return !empty($this->test_webhook_id) || !empty($this->test_webhook_secret_key); - } - return !empty($this->live_webhook_id) || !empty($this->live_webhook_secret_key); - } - - /** - * @return bool - */ - public function existsWebHookTest(): bool - { - return !empty($this->test_webhook_id); - } - - /** - * @return bool - */ - public function existsWebHookLive(): bool - { - return !empty($this->live_webhook_id); - } - - /** - * @param array $info - */ - private function setWebHookInfo(array $info): void - { - if ($this->test_mode_enabled) { - $this->test_webhook_secret_key = $info['secret']; - $this->test_webhook_id = $info['id']; - return; - } - $this->live_webhook_secret_key = $info['secret']; - $this->live_webhook_id = $info['id']; - } - - /** - * @return null|string - */ - public function getWebHookSecretKey(): ?string - { - if ($this->test_mode_enabled) { - return $this->test_webhook_secret_key; - } - return $this->live_webhook_secret_key; - } - - /** - * @return null|string - */ - public function getWebHookId(): ?string - { - if ($this->test_mode_enabled) { - return $this->test_webhook_id; - } - return $this->live_webhook_id; - } - - public function buildWebHook(): void - { - try { - if (!$this->existsWebHook() && $this->hasSecretKey() && $this->hasSummit()) { - $api = new StripeApi($this->createConfiguration()); - // create it - $info = $api->createWebHook(action('PaymentGatewayWebHookController@confirm', [ - 'id' => $this->summit->getId(), - 'application_type' => $this->getApplicationType() - ])); - // and set web hook info - $this->setWebHookInfo($info); - } - } catch (\Exception $ex) { - Log::error($ex); - throw new ValidationException("Can not create the Stripe Webhook, please review your provided credentials."); - } - } - - /** - * @return IPaymentGatewayAPI - */ - public function buildPaymentGatewayApi(): IPaymentGatewayAPI - { - $api = new StripeApi($this->createConfiguration()); - if ($this->existsWebHook()) { - $api->setWebHookSecretKey($this->getWebHookSecretKey()); - } - return $api; - } - - private function clearTestWebHook(): void - { - try { - Log::debug("StripePaymentProfile::clearTestWebHook"); - if ($this->existsWebHookTest()) { - $api = new StripeApi($this->createTestConfiguration()); - // delete it - Log::debug(sprintf("StripePaymentProfile::clearTestWebHook deleting webhook %s", $this->getTestWebhookId())); - $api->deleteWebHookById($this->getTestWebhookId()); - Log::debug(sprintf("StripePaymentProfile::clearTestWebHook webhook %s deleted", $this->getTestWebhookId())); - $this->test_webhook_secret_key = $this->test_webhook_id = ''; - } - } catch (\Exception $ex) { - Log::error($ex); - } - } - - private function clearLiveWebHook(): void - { - try { - Log::debug("StripePaymentProfile::clearLiveWebHook"); - if ($this->existsWebHookLive()) { - $api = new StripeApi($this->createLiveConfiguration()); - // delete it - Log::debug(sprintf("StripePaymentProfile::clearLiveWebHook deleting webhook %s", $this->getTestWebhookId())); - $api->deleteWebHookById($this->getLiveWebhookId()); - Log::debug(sprintf("StripePaymentProfile::clearLiveWebHook webhook %s deleted", $this->getTestWebhookId())); - $this->live_webhook_secret_key = $this->live_webhook_id = ''; - - } - } catch (\Exception $ex) { - Log::error($ex); - } - } - - private function clearWebHooks(): void - { - Log::debug(sprintf("StripePaymentProfile::clearWebHooks")); - $this->clearLiveWebHook(); - $this->clearTestWebHook(); - } - - /** - * @ORM\PreRemove - */ - public function deleting($args) - { - // remove web hooks - $this->clearWebHooks(); - } - - /** - * @param string $live_webhook_secret_key - */ - public function setLiveWebhookSecretKey(string $live_webhook_secret_key): void - { - Log::debug(sprintf("StripePaymentProfile::setLiveWebhookSecretKey %s", $live_webhook_secret_key)); - $this->live_webhook_secret_key = $live_webhook_secret_key; - } - - /** - * @param string $test_webhook_secret_key - */ - public function setTestWebhookSecretKey(string $test_webhook_secret_key): void - { - Log::debug(sprintf("StripePaymentProfile::setTestWebhookSecretKey %s", $test_webhook_secret_key)); - $this->test_webhook_secret_key = $test_webhook_secret_key; - } - - /** - * @return bool - */ - public function isSendEmailReceipt(): bool - { - return $this->send_email_receipt; - } - - /** - * @param bool $send_email_receipt - */ - public function setSendEmailReceipt(bool $send_email_receipt): void - { - $this->send_email_receipt = $send_email_receipt; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/IOwnablePromoCode.php b/app/Models/Foundation/Summit/Registration/PromoCodes/IOwnablePromoCode.php deleted file mode 100644 index 6dc4f781..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/IOwnablePromoCode.php +++ /dev/null @@ -1,28 +0,0 @@ - self::ClassName, - 'first_name' => 'string', - 'last_name' => 'string', - 'email' => 'string', - 'type' => PromoCodesConstants::MemberSummitRegistrationPromoCodeTypes, - 'owner_id' => 'integer' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitRegistrationDiscountCode::getMetadata(), self::$metadata); - } - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - public function getOwnerFullname(): string - { - return $this->owner->getFullName(); - } - - public function getOwnerEmail(): string - { - return $this->owner->getEmail(); - } - - public function getOwnerType(): string - { - return "MEMBER"; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/MemberSummitRegistrationPromoCode.php b/app/Models/Foundation/Summit/Registration/PromoCodes/MemberSummitRegistrationPromoCode.php deleted file mode 100644 index dd830635..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/MemberSummitRegistrationPromoCode.php +++ /dev/null @@ -1,68 +0,0 @@ - self::ClassName, - 'first_name' => 'string', - 'last_name' => 'string', - 'email' => 'string', - 'type' => PromoCodesConstants::MemberSummitRegistrationPromoCodeTypes, - 'owner_id' => 'integer' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitRegistrationPromoCode::getMetadata(), self::$metadata); - } - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - public function getOwnerFullname(): string - { - return $this->owner->getFullName(); - } - - public function getOwnerEmail(): string - { - return $this->owner->getEmail(); - } - - public function getOwnerType(): string - { - return "MEMBER"; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/PromoCodesConstants.php b/app/Models/Foundation/Summit/Registration/PromoCodes/PromoCodesConstants.php deleted file mode 100644 index d8611add..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/PromoCodesConstants.php +++ /dev/null @@ -1,53 +0,0 @@ - self::ClassName, - 'type' => PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypes, - 'speaker_id' => 'integer' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitRegistrationDiscountCode::getMetadata(), self::$metadata); - } - - public function hasOwner(): bool - { - return $this->hasSpeaker(); - } - - public function getOwnerFullname(): string - { - return $this->getSpeaker()->getFullName(); - } - - public function getOwnerEmail(): string - { - return $this->getSpeaker()->getEmail(); - } - - public function getOwnerType(): string - { - return "SPEAKER"; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/SpeakerSummitRegistrationPromoCode.php b/app/Models/Foundation/Summit/Registration/PromoCodes/SpeakerSummitRegistrationPromoCode.php deleted file mode 100644 index eeab74fe..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/SpeakerSummitRegistrationPromoCode.php +++ /dev/null @@ -1,69 +0,0 @@ - self::ClassName, - 'type' => PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypes, - 'speaker_id' => 'integer' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(SummitRegistrationPromoCode::getMetadata(), self::$metadata); - } - - public function hasOwner(): bool - { - return $this->hasSpeaker(); - } - - public function getOwnerFullname(): string - { - return $this->getSpeaker()->getFullName(); - } - - public function getOwnerEmail(): string - { - return $this->getSpeaker()->getEmail(); - } - - public function getOwnerType(): string - { - return "SPEAKER"; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/SponsorSummitRegistrationDiscountCode.php b/app/Models/Foundation/Summit/Registration/PromoCodes/SponsorSummitRegistrationDiscountCode.php deleted file mode 100644 index a4ac0655..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/SponsorSummitRegistrationDiscountCode.php +++ /dev/null @@ -1,51 +0,0 @@ - self::ClassName, - 'sponsor_id' => 'integer', - 'type' => PromoCodesConstants::SponsorSummitRegistrationPromoCodeTypes, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(MemberSummitRegistrationDiscountCode::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/SponsorSummitRegistrationPromoCode.php b/app/Models/Foundation/Summit/Registration/PromoCodes/SponsorSummitRegistrationPromoCode.php deleted file mode 100644 index 423a1c78..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/SponsorSummitRegistrationPromoCode.php +++ /dev/null @@ -1,50 +0,0 @@ - self::ClassName, - 'sponsor_id' => 'integer', - 'type' => PromoCodesConstants::SponsorSummitRegistrationPromoCodeTypes, - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return array_merge(MemberSummitRegistrationPromoCode::getMetadata(), self::$metadata); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationDiscountCode.php b/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationDiscountCode.php deleted file mode 100644 index 5b002230..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationDiscountCode.php +++ /dev/null @@ -1,226 +0,0 @@ -rate; - } - - /** - * @param float $rate - * @throws ValidationException - */ - public function setRate(float $rate): void - { - if($this->amount > 0.0 && $rate > 0.0) - throw new ValidationException("discount amount already set"); - $this->rate = $rate; - } - - /** - * @param float $amount - * @throws ValidationException - */ - public function setAmount(float $amount): void - { - if($this->rate > 0.0 && $amount > 0.0) - throw new ValidationException("discount rate already set"); - $this->amount = $amount; - } - - /** - * @return float - */ - public function getAmount(): float - { - return $this->amount; - } - - public function __construct() - { - parent::__construct(); - $this->ticket_types_rules = new ArrayCollection(); - $this->amount = 0.0; - $this->rate = 0.0; - } - - public function getTicketTypesRules(){ - return $this->ticket_types_rules; - } - - /** - * @param SummitTicketType $ticket_type - * @return bool - */ - public function isOnRules(SummitTicketType $ticket_type) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('ticket_type', $ticket_type)); - return $this->ticket_types_rules->matching($criteria)->count() > 0; - } - - /** - * @param SummitRegistrationDiscountCodeTicketTypeRule $rule - * @throws ValidationException - */ - public function addTicketTypeRule(SummitRegistrationDiscountCodeTicketTypeRule $rule){ - $rule->setDiscountCode($this); - if($this->ticket_types_rules->contains($rule)) return; - if ($this->isOnRules($rule->getTicketType())) - throw new ValidationException - ( - sprintf('ticket type %s already belongs to discount code %s rules.', $rule->getTicketType()->getId(), $this->getId()) - ); - $this->ticket_types_rules->add($rule); - } - - /** - * @param SummitTicketType $ticket_type - * @return SummitRegistrationDiscountCodeTicketTypeRule|null - */ - public function getRuleByTicketType(SummitTicketType $ticket_type){ - try { - $query = $this->createQuery("SELECT r from models\summit\SummitRegistrationDiscountCodeTicketTypeRule r - JOIN r.discount_code d - JOIN r.ticket_type t - WHERE d.id = :discount_code_id and t.id = :ticket_type_id - "); - return $query - ->setParameter('discount_code_id', $this->getIdentifier()) - ->setParameter('ticket_type_id', $ticket_type->getIdentifier()) - ->getSingleResult(); - } - catch(NoResultException $ex1){ - return null; - } - catch(NonUniqueResultException $ex2){ - // should never happen - return null; - } - } - - - /** - * @param SummitTicketType $ticketType - * @throws ValidationException - */ - public function removeTicketTypeRuleForTicketType(SummitTicketType $ticketType){ - $rule = $this->getRuleByTicketType($ticketType); - if(is_null($rule)) - throw new ValidationException - ( - sprintf('ticket type %s does not belongs to discount code %s rules.', $ticketType->getId(), $this->getId()) - ); - $this->ticket_types_rules->removeElement($rule); - $rule->clearDiscountCode(); - } - - /** - * @param SummitRegistrationDiscountCodeTicketTypeRule $rule - */ - public function removeTicketTypeRule(SummitRegistrationDiscountCodeTicketTypeRule $rule){ - if(!$this->ticket_types_rules->contains($rule)) return; - $this->ticket_types_rules->removeElement($rule); - } - - const ClassName = 'SUMMIT_DISCOUNT_CODE'; - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - public static $metadata = [ - 'rate' => 'float', - 'amount' => 'float', - 'ticket_types_rules' => 'array' - ]; - - /** - * @return array - */ - public static function getMetadata(){ - $parent_metadata = SummitRegistrationPromoCode::getMetadata(); - $parent_metadata['class_name']= SummitRegistrationDiscountCode::ClassName; - unset($parent_metadata['allowed_ticket_types']); - return array_merge($parent_metadata, SummitRegistrationDiscountCode::$metadata); - } - - /** - * @param SummitAttendeeTicket $ticket - * @return SummitAttendeeTicket - * @throws ValidationException - */ - public function applyTo(SummitAttendeeTicket $ticket):SummitAttendeeTicket{ - $ticket = parent::applyTo($ticket); - - if(!$ticket->isFree()) { - $amount2Discount = 0.0; - - if ($this->amount > 0.0) { - $amount2Discount = $this->amount; - } else if ($this->rate > 0.0) { - $amount2Discount = ($ticket->getRawCost() * $this->rate) / 100.00; - } else { - $rule = $this->getRuleByTicketType($ticket->getTicketType()); - if (!is_null($rule) && $rule->getAmount() > 0.0) { - $amount2Discount = $rule->getAmount(); - } else if (!is_null($rule) && $rule->getRate() > 0.0) { - $amount2Discount = ($ticket->getRawCost() * $rule->getRate()) / 100.00; - } - } - - $ticket->setDiscount($amount2Discount); - } - return $ticket; - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeTicketTypeRule.php b/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeTicketTypeRule.php deleted file mode 100644 index a323a017..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationDiscountCodeTicketTypeRule.php +++ /dev/null @@ -1,148 +0,0 @@ -rate; - } - - /** - * @param float $rate - * @throws ValidationException - */ - public function setRate(float $rate): void - { - if($this->amount > 0.0 && $rate > 0.0) - throw new ValidationException("discount amount already set"); - $this->rate = $rate; - } - - /** - * @param float $amount - * @throws ValidationException - */ - public function setAmount(float $amount): void - { - if($this->rate > 0.0 && $amount > 0.0) - throw new ValidationException("discount rate already set"); - $this->amount = $amount; - } - - /** - * @return float - */ - public function getAmount(): ?float - { - return $this->amount; - } - - /** - * @return SummitTicketType - */ - public function getTicketType(): SummitTicketType - { - return $this->ticket_type; - } - - /** - * @param SummitTicketType $ticket_type - */ - public function setTicketType(SummitTicketType $ticket_type): void - { - $this->ticket_type = $ticket_type; - } - - /** - * @return SummitRegistrationDiscountCode - */ - public function getDiscountCode(): SummitRegistrationDiscountCode - { - return $this->discount_code; - } - - /** - * @param SummitRegistrationDiscountCode $discount_code - */ - public function setDiscountCode(SummitRegistrationDiscountCode $discount_code): void - { - $this->discount_code = $discount_code; - } - - public function __construct() - { - $this->amount = 0.0; - $this->rate = 0.0; - } - - public function clearDiscountCode(){ - $this->discount_code = null; - } - - public function getTicketTypeId(){ - try { - return is_null($this->ticket_type) ? 0 : $this->ticket_type->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - public function getDiscountCodeId(){ - try { - return is_null($this->discount_code) ? 0 : $this->discount_code->getId(); - } - catch(\Exception $ex){ - return 0; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationPromoCode.php b/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationPromoCode.php deleted file mode 100644 index 60e70062..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/SummitRegistrationPromoCode.php +++ /dev/null @@ -1,530 +0,0 @@ -summit = $summit; - } - - /** - * @return Summit - */ - public function getSummit(){ - return $this->summit; - } - - public function clearSummit(){ - $this->summit = null; - } - - /** - * @return int - */ - public function getSummitId(){ - try { - return $this->summit->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return string - */ - public function getCode() - { - return $this->code; - } - - /** - * @param $code - * @throws ValidationException - */ - public function setCode(string $code):void - { - $new_code = strtoupper(trim($code)); - if(empty($new_code)) - throw new ValidationException("code can not be empty!"); - $this->code = $new_code; - } - - /** - * @return bool - */ - public function isEmailSent() - { - return $this->email_sent; - } - - /** - * @param bool $email_sent - */ - public function setEmailSent($email_sent) - { - $this->email_sent = $email_sent; - } - - /** - * @return bool - */ - public function isRedeemed() - { - return $this->redeemed; - } - - /** - * @param bool $redeemed - */ - public function setRedeemed($redeemed) - { - $this->redeemed = $redeemed; - } - - /** - * @return string - */ - public function getSource() - { - return $this->source; - } - - /** - * @param string $source - */ - public function setSource($source) - { - $this->source = $source; - } - - /** - * @return Member - */ - public function getCreator() - { - return $this->creator; - } - - /** - * @param Member $creator - */ - public function setCreator($creator) - { - $this->creator = $creator; - } - - public function __construct() - { - parent::__construct(); - $this->email_sent = false; - $this->redeemed = false; - $this->quantity_available = 0; - $this->quantity_used = 0; - $this->valid_since_date = null; - $this->valid_until_date = null; - $this->badge_features = new ArrayCollection(); - $this->allowed_ticket_types = new ArrayCollection(); - } - - /** - * @return bool - */ - public function canUse():bool { - if($this->quantity_available > 0 && $this->quantity_available == $this->quantity_used) return false; - return $this->isLive(); - } - - /** - * @param string $email - * @param null|string $company - * @return bool - * @throw ValidationException - */ - public function checkSubject(string $email, ?string $company):bool{ - return true; - } - - /** - * @return bool - */ - public function isLive():bool { - // if valid period is not set , that is valid_since_date == valid_until_date == null , then promo code lives forever - $now_utc = new \DateTime('now', new \DateTimeZone('UTC')); - if(!is_null($this->valid_since_date) && !is_null($this->valid_until_date) && ($now_utc < $this->valid_since_date || $now_utc > $this->valid_until_date)){ - return false; - } - return true; - } - - /** - * @param int $usage - * @throws ValidationException - */ - public function addUsage(int $usage){ - Log::debug - ( - sprintf - ( - "SummitRegistrationPromoCode::addUsage code %s usage %s quantity_used %s quantity_available %s", - $this->code, - $usage, - $this->quantity_used, - $this->quantity_available - ) - ); - $new_value = $this->quantity_used + $usage; - if($this->quantity_available > 0 && $new_value > $this->quantity_available){ - throw new ValidationException(sprintf("promo code %s has reached max usage", $this->code)); - } - $this->quantity_used = $new_value; - } - - /** - * @param int $to_restore - * @throws ValidationException - */ - public function removeUsage(int $to_restore){ - Log::debug - ( - sprintf - ( - "SummitRegistrationPromoCode::removeUsage code %s to_restore %s quantity_used %s quantity_available %s", - $this->code, - $to_restore, - $this->quantity_used, - $this->quantity_available - ) - ); - - if(($this->quantity_used - $to_restore) < 0) - throw new ValidationException - ( - sprintf - ( - "Can not restore %s usages to promo code %s - current usages %s", $to_restore, $this->code, $this->quantity_used - ) - ); - - $this->quantity_used -= $to_restore; - - Log::info(sprintf("SummitRegistrationPromoCode::removeUsage quantity_used %s", $this->quantity_used)); - } - - public function canBeAppliedTo(SummitTicketType $ticketType):bool{ - if($this->allowed_ticket_types->count() > 0){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($ticketType->getId()))); - return $this->allowed_ticket_types->matching($criteria)->count() > 0; - } - return true; - } - - - public function setSourceAdmin(){ - $this->source = 'ADMIN'; - } - - /** - * @return int - */ - public function getCreatorId(){ - try { - return is_null($this->creator) ? 0: $this->creator->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasCreator(){ - return $this->getCreatorId() > 0; - } - - const ClassName = 'SUMMIT_PROMO_CODE'; - - /** - * @return string - */ - public function getClassName(){ - return self::ClassName; - } - - public static $metadata = [ - 'class_name' => self::ClassName, - 'code' => 'string', - 'email_sent' => 'boolean', - 'redeemed' => 'boolean', - 'quantity_available' => 'integer', - 'valid_since_date' => 'datetime', - 'valid_until_date' => 'datetime', - 'source' => ['CSV','ADMIN'], - 'summit_id' => 'integer', - 'creator_id' => 'integer', - 'allowed_ticket_types' => 'array', - ]; - - /** - * @return array - */ - public static function getMetadata(){ - return self::$metadata; - } - - /** - * @return SummitBadgeFeatureType[] - */ - public function getBadgeFeatures() - { - return $this->badge_features; - } - - /** - * @return SummitTicketType[] - */ - public function getAllowedTicketTypes() - { - return $this->allowed_ticket_types; - } - - public function getQuantityUsed():int{ - return $this->quantity_used; - } - - /** - * @return int - */ - public function getQuantityAvailable(): int - { - return $this->quantity_available; - } - - /** - * @param int $quantity_available - */ - public function setQuantityAvailable(int $quantity_available): void - { - $this->quantity_available = $quantity_available; - } - - /** - * @return \DateTime|null - */ - public function getValidSinceDate(): ?\DateTime - { - return $this->valid_since_date; - } - - /** - * @param \DateTime $valid_since_date - */ - public function setValidSinceDate(?\DateTime $valid_since_date): void - { - $this->valid_since_date = $valid_since_date; - } - - /** - * @return \DateTime|null - */ - public function getValidUntilDate(): ?\DateTime - { - return $this->valid_until_date; - } - - /** - * @param \DateTime $valid_until_date - */ - public function setValidUntilDate(?\DateTime $valid_until_date): void - { - $this->valid_until_date = $valid_until_date; - } - - /** - * @param SummitTicketType $ticket_type - */ - public function addAllowedTicketType(SummitTicketType $ticket_type){ - if($this->allowed_ticket_types->contains($ticket_type)) return; - $this->allowed_ticket_types->add($ticket_type); - } - - /** - * @param SummitTicketType $ticket_type - */ - public function removeAllowedTicketType(SummitTicketType $ticket_type){ - if(!$this->allowed_ticket_types->contains($ticket_type)) return; - $this->allowed_ticket_types->removeElement($ticket_type); - } - - /** - * @param SummitBadgeFeatureType $feature_type - */ - public function addBadgeFeatureType(SummitBadgeFeatureType $feature_type){ - if($this->badge_features->contains($feature_type)) return; - $this->badge_features->add($feature_type); - } - - /** - * @param SummitBadgeFeatureType $feature_type - */ - public function removeBadgeFeatureType(SummitBadgeFeatureType $feature_type){ - if(!$this->badge_features->contains($feature_type)) return; - $this->badge_features->removeElement($feature_type); - } - - /** - * @param SummitAttendeeTicket $ticket - * @return SummitAttendeeTicket - * @throws ValidationException - */ - public function applyTo(SummitAttendeeTicket $ticket):SummitAttendeeTicket{ - $badge = $ticket->hasBadge() ? $ticket->getBadge() : null; - if(is_null($badge)) - throw new ValidationException(sprintf("Ticket %s has not badge set.", $ticket->getId())); - // apply the promo code code to badge - $badge->applyPromoCode($this); - $ticket->setPromoCode($this); - return $ticket; - } - - /** - * @return string - */ - public function getExternalId(): ?string - { - return $this->external_id; - } - - /** - * @param string $external_id - */ - public function setExternalId(string $external_id): void - { - $this->external_id = $external_id; - } - -} diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/MemberPromoCodeTrait.php b/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/MemberPromoCodeTrait.php deleted file mode 100644 index 02ebc9ee..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/MemberPromoCodeTrait.php +++ /dev/null @@ -1,180 +0,0 @@ -first_name; - } - - /** - * @param mixed $first_name - */ - public function setFirstName($first_name) - { - $this->first_name = $first_name; - } - - /** - * @return string - */ - public function getLastName() - { - return $this->last_name; - } - - /** - * @param string $last_name - */ - public function setLastName($last_name) - { - $this->last_name = $last_name; - } - - /** - * @return string|null - */ - public function getEmail() - { - if(!empty($this->email)) return $this->email; - if($this->hasOwner()) return $this->getOwner()->getEmail(); - return null; - } - - public function getFullName(){ - $fullname = $this->first_name; - if(!empty($this->last_name)){ - if(!empty($fullname)) $fullname .= ', '; - $fullname .= $this->last_name; - } - if(!empty($fullname)) return $fullname; - if($this->hasOwner()) return $this->getOwner()->getFullName(); - return null; - } - - /** - * @param mixed $email - */ - public function setEmail($email) - { - $this->email = $email; - } - - /** - * @return mixed - */ - public function getType() - { - return $this->type; - } - - /** - * @param mixed $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return Member - */ - public function getOwner() - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner($owner) - { - $this->owner = $owner; - } - - /** - * @return int - */ - public function getOwnerId(){ - try { - return is_null($this->owner) ? 0: $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasOwner(){ - return $this->getOwnerId() > 0; - } - - /** - * @param string $email - * @param null|string $company - * @return bool - * @throw ValidationException - */ - public function checkSubject(string $email, ?string $company):bool{ - if($this->hasOwner() && $this->getOwnerEmail() != $email){ - throw new ValidationException(sprintf('The Promo Code “%s” is not valid for the %s. Promo Code restrictions are associated with the purchaser email not the attendee.', $this->getCode(), $email)); - } - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/SpeakerPromoCodeTrait.php b/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/SpeakerPromoCodeTrait.php deleted file mode 100644 index 358dbfae..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/SpeakerPromoCodeTrait.php +++ /dev/null @@ -1,101 +0,0 @@ -type; - } - - /** - * @param string $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return PresentationSpeaker - */ - public function getSpeaker() - { - return $this->speaker; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker($speaker) - { - $this->speaker = $speaker; - } - - /** - * @return int - */ - public function getSpeakerId(){ - try { - return !is_null($this->speaker) ? $this->speaker->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasSpeaker(){ - return $this->getSpeakerId() > 0; - } - - /** - * @param string $email - * @param null|string $company - * @return bool - * @throw ValidationException - */ - public function checkSubject(string $email, ?string $company):bool{ - if($this->hasOwner() && $this->getOwnerEmail() != $email){ - throw new ValidationException(sprintf('The Promo Code “%s” is not valid for the %s. Promo Code restrictions are associated with the purchaser email not the attendee.', $this->getCode(), $email)); - } - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/SponsorPromoCodeTrait.php b/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/SponsorPromoCodeTrait.php deleted file mode 100644 index ece39f12..00000000 --- a/app/Models/Foundation/Summit/Registration/PromoCodes/Traits/SponsorPromoCodeTrait.php +++ /dev/null @@ -1,93 +0,0 @@ -sponsor) ? 0: $this->sponsor->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasSponsor(){ - return $this->getSponsorId() > 0; - } - - /** - * @return Company - */ - public function getSponsor() - { - return $this->sponsor; - } - - /** - * @param Company $sponsor - */ - public function setSponsor($sponsor) - { - $this->sponsor = $sponsor; - } - - /** - * @param string $email - * @param null|string $company - * @return bool - * @throw ValidationException - */ - public function checkSubject(string $email, ?string $company):bool{ - - if($this->hasOwner() && $this->getOwnerEmail() != $email){ - throw new ValidationException(sprintf('The Promo Code “%s” is not valid for the %s. Promo Code restrictions are associated with the purchaser email not the attendee.', $this->getCode(), $email)); - } - - if(!empty($company) &&$this->hasSponsor() && $this->getSponsor()->getName() != $company){ - throw new ValidationException(sprintf("The Promo Code %s is not available for Company %s", $this->getCode(), $company)); - } - return true; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/QRGeneratorTrait.php b/app/Models/Foundation/Summit/Registration/QRGeneratorTrait.php deleted file mode 100644 index 7705e687..00000000 --- a/app/Models/Foundation/Summit/Registration/QRGeneratorTrait.php +++ /dev/null @@ -1,32 +0,0 @@ - 'user', - 'getBadgeId' => 'badge', - ]; - - protected $hasPropertyMappings = [ - 'hasUser' => 'user', - 'hasBadge' => 'badge', - ]; - - /** - * @ORM\Column(name="QRCode", type="string") - * @var string - */ - private $qr_code; - - /** - * @var \DateTime - * @ORM\Column(name="ScanDate", type="datetime") - */ - protected $scan_date; - - /** - * @ORM\ManyToOne(targetEntity="models\main\Member") - * @ORM\JoinColumn(name="UserID", referencedColumnName="ID") - * @var Member - */ - private $user; - - /** - * @ORM\ManyToOne(targetEntity="models\summit\SummitAttendeeBadge") - * @ORM\JoinColumn(name="BadgeID", referencedColumnName="ID") - * @var SummitAttendeeBadge - */ - private $badge; - - /** - * @return string - */ - public function getQRCode(): string - { - return $this->qr_code; - } - - /** - * @param string $qr_code - */ - public function setQRCode(string $qr_code): void - { - $this->qr_code = $qr_code; - } - - /** - * @return Sponsor - */ - public function getSponsor(): Sponsor - { - return $this->sponsor; - } - - /** - * @param Sponsor $sponsor - */ - public function setSponsor(Sponsor $sponsor): void - { - $this->sponsor = $sponsor; - } - - /** - * @return Member - */ - public function getUser(): Member - { - return $this->user; - } - - /** - * @param Member $user - */ - public function setUser(Member $user): void - { - $this->user = $user; - } - - /** - * @return SummitAttendeeBadge - */ - public function getBadge(): SummitAttendeeBadge - { - return $this->badge; - } - - /** - * @param SummitAttendeeBadge $badge - */ - public function setBadge(SummitAttendeeBadge $badge): void - { - $this->badge = $badge; - } - - /** - * @return \DateTime - */ - public function getScanDate(): \DateTime - { - return $this->scan_date; - } - - /** - * @param \DateTime $scan_date - */ - public function setScanDate(\DateTime $scan_date): void - { - $this->scan_date = $scan_date; - } - - public function getAttendeeFirstName():?string{ - $attendee = $this->getBadge()->getTicket()->getOwner(); - return $attendee->hasMember() ? $attendee->getMember()->getFirstName() : $attendee->getFirstName(); - } - - public function getAttendeeLastName():?string{ - $attendee = $this->getBadge()->getTicket()->getOwner(); - return $attendee->hasMember() ? $attendee->getMember()->getLastName() :$attendee->getSurname(); - } - - public function getAttendeeEmail():?string{ - $attendee = $this->getBadge()->getTicket()->getOwner(); - return $attendee->getEmail(); - } - - public function getAttendeeCompany():?string{ - $attendee = $this->getBadge()->getTicket()->getOwner(); - $attendee->getCompanyName(); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SponsorUserInfoGrant.php b/app/Models/Foundation/Summit/Registration/SponsorUserInfoGrant.php deleted file mode 100644 index 799ebce7..00000000 --- a/app/Models/Foundation/Summit/Registration/SponsorUserInfoGrant.php +++ /dev/null @@ -1,102 +0,0 @@ - 'sponsor', - 'getAllowedUserId' => 'allowed_user', - ]; - - protected $hasPropertyMappings = [ - 'hasSponsor' => 'sponsor', - 'hasAllowedUser' => 'allowed_user', - ]; - - /** - * @return Sponsor - */ - public function getSponsor(): Sponsor - { - return $this->sponsor; - } - - /** - * @param Sponsor $sponsor - */ - public function setSponsor(Sponsor $sponsor): void - { - $this->sponsor = $sponsor; - } - - /** - * @return Member|null - */ - public function getAllowedUser(): ?Member - { - return $this->allowed_user; - } - - /** - * @param Member|null $allowed_user - */ - public function setAllowedUser(?Member $allowed_user): void - { - $this->allowed_user = $allowed_user; - } - - public function getAttendeeFirstName():?string{ - return $this->allowed_user->getFirstName(); - } - - public function getAttendeeLastName():?string{ - return $this->allowed_user->getLastName(); - } - - public function getAttendeeEmail():?string{ - return $this->allowed_user->getEmail(); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitAccessLevelType.php b/app/Models/Foundation/Summit/Registration/SummitAccessLevelType.php deleted file mode 100644 index 3174f704..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitAccessLevelType.php +++ /dev/null @@ -1,129 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return string - */ - public function getTemplateContent(): ?string - { - return $this->template_content; - } - - /** - * @param string $template_content - */ - public function setTemplateContent(string $template_content): void - { - $this->template_content = $template_content; - } - - /** - * @return bool - */ - public function isDefault(): bool - { - return $this->is_default; - } - - /** - * @param bool $is_default - */ - public function setIsDefault(bool $is_default): void - { - $this->is_default = $is_default; - } - - - public function __construct() - { - parent::__construct(); - $this->template_content = ''; - $this->is_default = false; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitBadgeFeatureType.php b/app/Models/Foundation/Summit/Registration/SummitBadgeFeatureType.php deleted file mode 100644 index 5a1f52d5..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitBadgeFeatureType.php +++ /dev/null @@ -1,117 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return string - */ - public function getTemplateContent(): ?string - { - return $this->template_content; - } - - /** - * @param string $template_content - */ - public function setTemplateContent(string $template_content): void - { - $this->template_content = $template_content; - } - - public function __construct() - { - parent::__construct(); - $this->template_content = ''; - } - - use HasImageTrait; - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitBadgeType.php b/app/Models/Foundation/Summit/Registration/SummitBadgeType.php deleted file mode 100644 index 69ff4159..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitBadgeType.php +++ /dev/null @@ -1,257 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription(): string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return string - */ - public function getTemplateContent(): ?string - { - return $this->template_content; - } - - /** - * @param string $template_content - */ - public function setTemplateContent(string $template_content): void - { - $this->template_content = $template_content; - } - - /** - * @return bool - */ - public function isDefault(): bool - { - return $this->default; - } - - /** - * @param bool $is_default - */ - public function setIsDefault(bool $is_default): void - { - $this->default = $is_default; - } - - public function __construct() - { - parent::__construct(); - $this->template_content = ''; - $this->default = false; - $this->badge_features = new ArrayCollection(); - $this->access_levels = new ArrayCollection(); - } - - /** - * @return SummitAccessLevelType[] - */ - public function getAccessLevels() - { - return $this->access_levels; - } - - /** - * @return SummitBadgeFeatureType[] - */ - public function getBadgeFeatures() - { - return $this->badge_features; - } - - /** - * @param SummitBadgeFeatureType $feature_type - */ - public function addBadgeFeatureType(SummitBadgeFeatureType $feature_type){ - if($this->badge_features->contains($feature_type)) return; - $this->badge_features->add($feature_type); - } - - /** - * @param SummitBadgeFeatureType $feature_type - */ - public function removeBadgeFeatureType(SummitBadgeFeatureType $feature_type){ - if(!$this->badge_features->contains($feature_type)) return; - $this->badge_features->removeElement($feature_type); - } - - /** - * @param SummitAccessLevelType $access_level - */ - public function addAccessLevel(SummitAccessLevelType $access_level){ - if($this->access_levels->contains($access_level)) return; - $this->access_levels->add($access_level); - } - - /** - * @param SummitAccessLevelType $access_level - */ - public function removeAccessLevel(SummitAccessLevelType $access_level){ - if(!$this->access_levels->contains($access_level)) return; - $this->access_levels->removeElement($access_level); - } - - /** - * @param int $access_level_id - * @return SummitAccessLevelType|null - */ - public function getAccessLevelById(int $access_level_id):?SummitAccessLevelType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($access_level_id))); - $access_level = $this->access_levels->matching($criteria)->first(); - return $access_level === false ? null : $access_level; - } - - /** - * @param string $access_level_name - * @return SummitAccessLevelType|null - */ - public function getAccessLevelByName(string $access_level_name):?SummitAccessLevelType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', $access_level_name)); - $access_level = $this->access_levels->matching($criteria)->first(); - return $access_level === false ? null : $access_level; - } - - /** - * @param int $badge_feature_id - * @return SummitBadgeFeatureType|null - */ - public function getBadgeFeatureById(int $badge_feature_id):?SummitBadgeFeatureType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($badge_feature_id))); - $badge_feature = $this->badge_features->matching($criteria)->first(); - return $badge_feature === false ? null : $badge_feature; - } - - /** - * @param string $badge_feature_name - * @return SummitBadgeFeatureType|null - */ - public function getBadgeFeatureByName(string $badge_feature_name):?SummitBadgeFeatureType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', $badge_feature_name)); - $badge_feature = $this->badge_features->matching($criteria)->first(); - return $badge_feature === false ? null : $badge_feature; - } - - /** - * @param SummitBadgeType $type - * @return SummitAttendeeBadge - */ - public static function buildBadgeFromType(SummitBadgeType $type):SummitAttendeeBadge{ - $badge = new SummitAttendeeBadge(); - $badge->setType($type); - return $badge; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitOrder.php b/app/Models/Foundation/Summit/Registration/SummitOrder.php deleted file mode 100644 index d977b278..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitOrder.php +++ /dev/null @@ -1,1077 +0,0 @@ -tickets = new ArrayCollection(); - $this->extra_question_answers = new ArrayCollection(); - $this->status = IOrderConstants::ReservedStatus; - $this->payment_method = IOrderConstants::OnlinePaymentMethod; - $this->refunded_amount = 0.0; - } - - - public function setPaymentMethodOffline(){ - $this->payment_method = IOrderConstants::OfflinePaymentMethod; - } - - public function generateHash(){ - $email = $this->getOwnerEmail(); - if(empty($email)) - throw new ValidationException("owner email is null"); - - $fname = $this->getOwnerFirstName(); - if(empty($fname)) - throw new ValidationException("owner first name is null"); - - $lname = $this->getOwnerSurname(); - if(empty($lname)) - throw new ValidationException("owner last name is null"); - - $token = $this->number.'.'.$email.'.'.$fname.".".$lname; - $token = $token . random_bytes(16).time(); - $this->hash = hash('sha256', $token); - $this->hash_creation_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - /** - * @return bool - * @throws \Exception - */ - public function canPubliclyEdit():bool { - if(empty($this->hash) || is_null($this->hash_creation_date)) return false; - $ttl_minutes = Config::get("registration.order_public_edit_ttl", 10); - $eol = new \DateTime('now', new \DateTimeZone('UTC')); - $eol->sub(new \DateInterval('PT'.$ttl_minutes.'M')); - if($this->hash_creation_date <= $eol) - return false; - return true; - } - - /** - * @return string - */ - public function generateNumber():string{ - $this->number = strtoupper(str_replace(".","", uniqid($this->summit->getOrderQRPrefix().'_', true))); - $this->generateQRCode(); - return $this->number; - } - - /** - * @return string - */ - public function getNumber(): string - { - return $this->number; - } - - /** - * @param string $number - */ - public function setNumber(string $number): void - { - $this->number = $number; - } - - /** - * @return string - */ - public function getStatus(): string - { - return $this->status; - } - - - public function setPaidStatus(){ - $this->status = IOrderConstants::PaidStatus; - $this->approved_payment_date = new \DateTime('now', new \DateTimeZone('UTC')); - - } - - public function setPaid(){ - Log::debug(sprintf("SummitOrder::setPaid order %s", $this->id)); - if($this->isPaid()){ - Log::warning(sprintf("SummitOrder %s is already Paid.", $this->getId())); - return; - } - - $this->setPaidStatus(); - - foreach($this->tickets as $ticket){ - $ticket->setPaid(); - } - - Event::fire(new PaymentSummitRegistrationOrderConfirmed($this->getId())); - } - - /** - * @param null|string $error - */ - public function setPaymentError(?string $error):void{ - if(empty($error)) return; - $this->status = IOrderConstants::ErrorStatus; - $this->last_error = $error; - } - - public function setConfirmed(){ - if($this->status == IOrderConstants::ReservedStatus) - $this->status = IOrderConstants::ConfirmedStatus; - } - - /** - * @param bool $sendMail - */ - public function setCancelled(bool $sendMail = true):void { - $ignore_statuses = [ IOrderConstants::PaidStatus, IOrderConstants::CancelledStatus]; - - if(in_array($this->status, $ignore_statuses)) return; - $this->status = IOrderConstants::CancelledStatus; - list($tickets_to_return, $promo_codes_to_return) = $this->calculateTicketsAndPromoCodesToReturn(); - - foreach ($this->getTickets() as $ticket){ - $ticket->setCancelled(); - } - - Event::fire(new SummitOrderCanceled($this->id, $sendMail, $tickets_to_return, $promo_codes_to_return)); - } - - /** - * @return array - */ - public function calculateTicketsAndPromoCodesToReturn():array { - $tickets_to_return = []; - $promo_codes_to_return = []; - - foreach($this->tickets as $ticket){ - if($ticket->isCancelled()) continue; - if($ticket->isRefunded()) continue; - if(!isset($tickets_to_return[$ticket->getTicketTypeId()])) - $tickets_to_return[$ticket->getTicketTypeId()] = 0; - $tickets_to_return[$ticket->getTicketTypeId()] += 1; - if($ticket->hasPromoCode()){ - if(!isset($promo_codes_to_return[$ticket->getPromoCode()->getCode()])) - $promo_codes_to_return[$ticket->getPromoCode()->getCode()] = 0; - $promo_codes_to_return[$ticket->getPromoCode()->getCode()] +=1; - } - } - return [$tickets_to_return, $promo_codes_to_return]; - } - - /** - * @throws ValidationException - */ - public function requestRefund():void{ - $summit = $this->getSummit(); - - $begin_date = $summit->getBeginDate(); - if(is_null($begin_date)) return; - - // check tickets badge printings - - if($this->getRawAmount() == 0 ) - - foreach ($this->tickets as $ticket){ - if($ticket->isBadgePrinted()){ - throw new ValidationException(sprintf( "You can not request a refund for this ticket %s (badge already printed).", $ticket->getNumber())); - } - } - - $now = new \DateTime('now', new \DateTimeZone('UTC')); - - if($now > $begin_date){ - Log::debug("SummitOrder::requestRefund: now is greater than Summit.BeginDate"); - throw new ValidationException("You can not request a refund after summit started."); - } - - $interval = $begin_date->diff($now); - - $days_before_event_starts = intval($interval->format('%a')); - - Log::debug(sprintf("SummitOrder::requestRefund: days_before_event_starts %s", $days_before_event_starts)); - - if($this->status != IOrderConstants::PaidStatus){ - throw new ValidationException("You can not request a refund on this order."); - } - - $this->status = IOrderConstants::RefundRequestedStatus; - - foreach ($this->tickets as $ticket){ - $ticket->setRefundRequests(); - } - - Event::fire(new RequestedSummitOrderRefund($this->getId(), $days_before_event_starts)); - } - - function cancelRefundRequest():void { - if(!$this->isRefundRequested()) - throw new ValidationException(sprintf("You can not cancel any refund on this order")); - - $this->status = IOrderConstants::PaidStatus; - - foreach ($this->tickets as $ticket){ - $ticket->setPaid(false); - } - } - /** - * @return string - */ - public function getPaymentMethod(): string - { - return $this->payment_method; - } - - /** - * @param string $payment_method - */ - public function setPaymentMethod(string $payment_method): void - { - $this->payment_method = $payment_method; - } - - /** - * @return string - */ - public function getQRCode(): ?string - { - return $this->qr_code; - } - - /** - * @return string - */ - public function getOwnerFirstName(): ?string - { - if($this->hasOwner()){ - return $this->owner->getFirstName(); - } - return $this->owner_first_name; - } - - /** - * @param string $owner_first_name - */ - public function setOwnerFirstName(string $owner_first_name): void - { - $this->owner_first_name = $owner_first_name; - } - - /** - * @return string - */ - public function getOwnerSurname(): ?string - { - if($this->hasOwner()){ - return $this->owner->getLastName(); - } - return $this->owner_surname; - } - - /** - * @param string $owner_surname - */ - public function setOwnerSurname(string $owner_surname): void - { - $this->owner_surname = $owner_surname; - } - - /** - * @return string - */ - public function getOwnerEmail(): ?string - { - if(!is_null($this->owner)){ - return $this->owner->getEmail(); - } - return $this->owner_email; - } - - /** - * @param string $owner_email - */ - public function setOwnerEmail(string $owner_email): void - { - $this->owner_email = strtolower($owner_email); - } - - /** - * @return string - */ - public function getOwnerCompany(): ?string - { - if($this->hasCompany()) - return $this->company->getName(); - return $this->owner_company; - } - - /** - * @param string $owner_company - */ - public function setOwnerCompany(string $owner_company): void - { - $this->owner_company = $owner_company; - } - - /** - * @return Company - */ - public function getCompany(): Company - { - return $this->company; - } - - /** - * @param Company $company - */ - public function setCompany(Company $company): void - { - $this->company = $company; - } - - /** - * @return Member - */ - public function getOwner(): ?Member - { - return $this->owner; - } - - /** - * @param Member $owner - */ - public function setOwner(Member $owner): void - { - $this->owner = $owner; - } - - /** - * @return string - */ - public function getBillingAddress1(): ?string - { - return $this->billing_address_1; - } - - /** - * @param string $billing_address_1 - */ - public function setBillingAddress1(string $billing_address_1): void - { - $this->billing_address_1 = $billing_address_1; - } - - /** - * @return string - */ - public function getBillingAddress2(): ?string - { - return $this->billing_address_2; - } - - /** - * @param string $billing_address_2 - */ - public function setBillingAddress2(string $billing_address_2): void - { - $this->billing_address_2 = $billing_address_2; - } - - /** - * @return string - */ - public function getBillingAddressZipCode(): ?string - { - return $this->billing_address_zip_code; - } - - /** - * @param string $billing_address_zip_code - */ - public function setBillingAddressZipCode(string $billing_address_zip_code): void - { - $this->billing_address_zip_code = $billing_address_zip_code; - } - - /** - * @return string - */ - public function getBillingAddressCity(): ?string - { - return $this->billing_address_city; - } - - /** - * @param string $billing_address_city - */ - public function setBillingAddressCity(string $billing_address_city): void - { - $this->billing_address_city = $billing_address_city; - } - - /** - * @return string - */ - public function getBillingAddressState(): ?string - { - return $this->billing_address_state; - } - - /** - * @param string $billing_address_state - */ - public function setBillingAddressState(string $billing_address_state): void - { - $this->billing_address_state = $billing_address_state; - } - - /** - * @return string - */ - public function getBillingAddressCountryIsoCode(): ?string - { - return $this->billing_address_country_iso_code; - } - - /** - * @param string $billing_address_country_iso_code - */ - public function setBillingAddressCountryIsoCode(string $billing_address_country_iso_code): void - { - $this->billing_address_country_iso_code = $billing_address_country_iso_code; - } - - /** - * @return \DateTime - */ - public function getApprovedPaymentDate(): \DateTime - { - return $this->approved_payment_date; - } - - /** - * @param \DateTime $approved_payment_date - */ - public function setApprovedPaymentDate(\DateTime $approved_payment_date): void - { - $this->approved_payment_date = $approved_payment_date; - } - - /** - * @return string - */ - public function getLastError(): ?string - { - return $this->last_error; - } - - /** - * @param string $last_error - */ - public function setLastError(string $last_error): void - { - $this->last_error = $last_error; - } - - /** - * @return string - */ - public function getPaymentGatewayClientToken(): ?string - { - return $this->payment_gateway_client_token; - } - - /** - * @param string $payment_gateway_client_token - */ - public function setPaymentGatewayClientToken(string $payment_gateway_client_token): void - { - $this->payment_gateway_client_token = $payment_gateway_client_token; - } - - /** - * @return string - */ - public function getPaymentGatewayCartId(): ?string - { - return $this->payment_gateway_cart_id; - } - - /** - * @param string $payment_gateway_cart_id - */ - public function setPaymentGatewayCartId(string $payment_gateway_cart_id): void - { - $this->payment_gateway_cart_id = $payment_gateway_cart_id; - } - - /** - * @return string - */ - public function getHash(): ?string - { - return $this->hash; - } - - /** - * @return \DateTime - */ - public function getHashCreationDate(): ?\DateTime - { - return $this->hash_creation_date; - } - - /** - * @return ArrayCollection|SummitAttendeeTicket[] - */ - public function getTickets() - { - return $this->tickets; - } - - /** - * @param SummitAttendeeTicket $ticket - */ - public function addTicket(SummitAttendeeTicket $ticket){ - if($this->tickets->contains($ticket)) return; - $this->tickets->add($ticket); - $ticket->setOrder($this); - } - - /** - * @param int $ticket_id - * @return SummitAttendeeTicket|null - */ - public function getTicketById(int $ticket_id):?SummitAttendeeTicket{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($ticket_id))); - $ticket = $this->tickets->matching($criteria)->first(); - return $ticket === false ? null : $ticket; - } - - /** - * @return SummitOrderExtraQuestionAnswer[] - */ - public function getExtraQuestionAnswers() - { - return $this->extra_question_answers; - } - - public function clearExtraQuestionAnswers(){ - $this->extra_question_answers->clear(); - } - - public function addExtraQuestionAnswer(SummitOrderExtraQuestionAnswer $answer){ - if($this->extra_question_answers->contains($answer)) return; - $this->extra_question_answers->add($answer); - $answer->setOrder($this); - } - - public function removeExtraQuestionAnswer(SummitOrderExtraQuestionAnswer $answer){ - if(!$this->extra_question_answers->contains($answer)) return; - $this->extra_question_answers->removeElement($answer); - $answer->clearOrder(); - } - - use QRGeneratorTrait; - - public function generateQRCode(): string - { - $this->qr_code = $this->generateQRFromFields([ - $this->summit->getOrderQRPrefix(), - $this->number - ]); - - return $this->qr_code; - } - - /** - * @return int - */ - public function getOwnerId(){ - try { - return is_null($this->owner) ? 0 : $this->owner->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasCompany():bool{ - return $this->getCompanyId() > 0; - } - - /** - * @return int - */ - public function getCompanyId(){ - try { - return is_null($this->company) ? 0 : $this->company->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasOwner():bool{ - return $this->getOwnerId() > 0; - } - - /** - * @return float - */ - public function getRawAmount():float{ - $amount = 0.0; - foreach ($this->tickets as $ticket){ - $amount += $ticket->getRawCost(); - } - return $amount; - } - - /** - * @return float - */ - public function getFinalAmount():float { - $amount = 0.0; - foreach ($this->tickets as $ticket){ - $amount += $ticket->getFinalAmount(); - } - return $amount; - } - - /** - * @return bool - */ - public function isFree():bool { - return $this->getFinalAmount() == 0; - } - - /** - * @return bool - */ - public function hasPaymentInfo():bool{ - return empty($this->payment_gateway_cart_id) || empty($this->payment_gateway_client_token); - } - - /** - * @return float - */ - public function getTaxesAmount(): float{ - $amount = 0.0; - foreach ($this->tickets as $ticket){ - foreach($ticket->getAppliedTaxes() as $appliedTax){ - $amount += $appliedTax->getAmount(); - } - } - return $amount; - } - - /** - * @return float - */ - public function getDiscountAmount(): float{ - $amount = 0.0; - foreach ($this->tickets as $ticket){ - $amount += $ticket->getDiscount(); - } - return $amount; - } - - /** - * @return string - */ - public function getCurrency():string{ - $ticket = $this->tickets->first(); - return $ticket->getCurrency(); - } - - /** - * @return string - */ - public function getOwnerFullName():string { - if($this->hasOwner()){ - return $this->owner->getFullName(); - } - return sprintf("%s %s", $this->owner_first_name, $this->owner_surname); - } - - /** - * @return bool - */ - public function isPaid():bool { - return $this->status == IOrderConstants::PaidStatus; - } - - /** - * @return bool - */ - public function canRefund():bool{ - $validStatuses = [IOrderConstants::RefundRequestedStatus, IOrderConstants::PaidStatus]; - if(!in_array($this->status, $validStatuses)){ - return false; - } - if($this->isFree()){ - return false; - } - return true; - } - - /** - * @param float $amount - * @throws ValidationException - */ - public function refund(float $amount) - { - if (!$this->canRefund()) - throw new ValidationException - ( - sprintf - ( - "can not request a refund on a %s order", - $this->status - ) - ); - - $this->status = IOrderConstants::RefundedStatus; - $this->refunded_amount = $amount; - list($tickets_to_return, $promo_codes_to_return) = $this->calculateTicketsAndPromoCodesToReturn(); - - foreach ($this->tickets as $ticket){ - $ticket->setRefunded(); - } - - Event::fire(new SummitOrderRefundAccepted($this->getId(), $tickets_to_return, $promo_codes_to_return)); - } - - /** - * @return string - * - if tixs in an order are all in a combination of status refund requested or refunded, show order as refund requested. - * - if all tix in an order are in status refund requested, show order as refund requested. - * - if all tix in an order are in status refunded, show order as refunded. - */ - public function recalculateOrderStatus():string { - Log::debug(sprintf("SummitOrder::recalculateOrderStatus current status %s", $this->status)); - $request_refund_count = 0; - $refund_count = 0; - - foreach ($this->tickets as $ticket){ - $ticket_status = $ticket->getStatus(); - Log::debug(sprintf("SummitOrder::recalculateOrderStatus ticket_id %s ticket_status %s", $ticket->getId(), $ticket_status)); - if($ticket_status == IOrderConstants::RefundRequestedStatus) - ++$request_refund_count; - if($ticket_status == IOrderConstants::RefundedStatus) - ++$refund_count; - } - - $tickets_count = $this->tickets->count(); - - Log::debug(sprintf("SummitOrder::recalculateOrderStatus tickets_count %s request_refund_count %s refund_count %s", $tickets_count, $request_refund_count, $refund_count)); - - if(($request_refund_count == $tickets_count || ( $refund_count > 0 && $request_refund_count > 0 && ($refund_count + $request_refund_count) == $tickets_count))) - $this->status = IOrderConstants::RefundRequestedStatus; - - if($refund_count == $tickets_count) - $this->status = IOrderConstants::RefundedStatus; - - Log::debug(sprintf("SummitOrder::recalculateOrderStatus recalculated status %s", $this->status)); - - return $this->status; - } - - /** - * @return bool - */ - public function isRefundRequested():bool { - return $this->status == IOrderConstants::RefundRequestedStatus; - } - - /** - * @return float - */ - public function getRefundedAmount(): float - { - return $this->refunded_amount; - } - - /** - * @return \DateTime - */ - public function getLastReminderEmailSentDate(): ?\DateTime - { - $last_action_date = $this->last_reminder_email_sent_date; - - if (is_null($last_action_date)) { - $last_action_date = $this->getCreatedUTC(); - } - - return $last_action_date; - } - - /** - * @param \DateTime $last_reminder_email_sent_date - */ - public function setLastReminderEmailSentDate(\DateTime $last_reminder_email_sent_date): void - { - $this->last_reminder_email_sent_date = $last_reminder_email_sent_date; - } - - /** - * @return bool - */ - public function isSingleOrder():bool{ - if($this->tickets->count() > 1){ - return false; - } - - $ticket = $this->tickets->first(); - - if(!$ticket instanceof SummitAttendeeTicket) return false; - - if($ticket->getOwnerEmail() != $this->getOwnerEmail()) return false; - - return true; - } - - /** - * @return SummitAttendeeTicket|null - */ - public function getFirstTicket():?SummitAttendeeTicket{ - if(is_null($this->tickets)) return null; - if($this->tickets->count() == 0) return null; - return $this->tickets->first(); - } - - /* - * @return string - */ - public function getExternalId(): ?string - { - return $this->external_id; - } - - /** - * @param string $external_id - */ - public function setExternalId(string $external_id): void - { - $this->external_id = $external_id; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitOrderExtraQuestionAnswer.php b/app/Models/Foundation/Summit/Registration/SummitOrderExtraQuestionAnswer.php deleted file mode 100644 index 5e8e3320..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitOrderExtraQuestionAnswer.php +++ /dev/null @@ -1,93 +0,0 @@ - 'order', - 'getAttendeeId' => 'attendee', - 'getQuestionId' => 'question', - ]; - - protected $hasPropertyMappings = [ - 'hasOrder' => 'order', - 'hasAttendee' => 'attendee', - 'hasQuestion' => 'question', - ]; - /** - * @ORM\ManyToOne(targetEntity="models\summit\SummitOrder", inversedBy="extra_question_answers") - * @ORM\JoinColumn(name="OrderID", referencedColumnName="ID") - * @var SummitOrder - */ - private $order; - - /** - * @ORM\ManyToOne(targetEntity="models\summit\SummitAttendee", inversedBy="extra_question_answers") - * @ORM\JoinColumn(name="SummitAttendeeID", referencedColumnName="ID") - * @var SummitAttendee - */ - private $attendee; - - /** - * @return SummitOrder - */ - public function getOrder(): ?SummitOrder - { - return $this->order; - } - - /** - * @param SummitOrder $order - */ - public function setOrder(SummitOrder $order): void - { - $this->order = $order; - } - - /** - * @return SummitAttendee - */ - public function getAttendee(): ?SummitAttendee - { - return $this->attendee; - } - - /** - * @param SummitAttendee $attendee - */ - public function setAttendee(SummitAttendee $attendee): void - { - $this->attendee = $attendee; - } - - - public function clearOrder(){ - $this->order = null; - } - - public function clearAttendee(){ - $this->attendee = null; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitRefundPolicyType.php b/app/Models/Foundation/Summit/Registration/SummitRefundPolicyType.php deleted file mode 100644 index d1b79267..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitRefundPolicyType.php +++ /dev/null @@ -1,105 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return int - */ - public function getUntilXDaysBeforeEventStarts(): int - { - return $this->until_x_days_before_event_starts; - } - - /** - * @param int $until_x_days_before_event_starts - */ - public function setUntilXDaysBeforeEventStarts(int $until_x_days_before_event_starts): void - { - $this->until_x_days_before_event_starts = $until_x_days_before_event_starts; - } - - /** - * @return float - */ - public function getRefundRate(): float - { - return $this->refund_rate; - } - - /** - * @param float $refund_rate - */ - public function setRefundRate(float $refund_rate): void - { - $this->refund_rate = $refund_rate; - } - - public function __construct() - { - parent::__construct(); - $this->refund_rate = 0.0; - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitRegistrationInvitation.php b/app/Models/Foundation/Summit/Registration/SummitRegistrationInvitation.php deleted file mode 100644 index 18f49f2c..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitRegistrationInvitation.php +++ /dev/null @@ -1,292 +0,0 @@ -first_name; - } - - /** - * @param string $first_name - */ - public function setFirstName(string $first_name): void - { - $this->first_name = $first_name; - } - - /** - * @return string - */ - public function getLastName(): ?string - { - return $this->last_name; - } - - /** - * @param string $last_name - */ - public function setLastName(string $last_name): void - { - $this->last_name = $last_name; - } - - /** - * @return string - */ - public function getEmail(): string - { - return $this->email; - } - - /** - * @param string $email - */ - public function setEmail(string $email): void - { - $this->email = $email; - } - - /** - * @return string - */ - public function getHash(): ?string - { - return $this->hash; - } - - /** - * @param string $hash - */ - public function setHash(string $hash): void - { - $this->hash = $hash; - } - - /** - * @return \DateTime - */ - public function getAcceptedDate(): ?\DateTime - { - return $this->accepted_date; - } - - public function isAccepted(): bool - { - return !is_null($this->accepted_date); - } - - public function isSent(): bool - { - return !empty($this->hash); - } - - /** - * @return Member - */ - public function getMember(): ?Member - { - return $this->member; - } - - /** - * @param Member $member - */ - public function setMember(Member $member): void - { - $this->member = $member; - } - - /** - * @return int - */ - public function getMemberId() - { - try { - return is_null($this->member) ? 0 : $this->member->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return bool - */ - public function hasMember(): bool - { - return $this->getMemberId() > 0; - } - - public function clearMember() - { - $this->member = null; - } - - /** - * transient variable - * @var string - */ - private $token; - - public function getToken(): ?string - { - return $this->token; - } - - /** - * @return string - */ - public function generateConfirmationToken(): string - { - $generator = new RandomGenerator(); - $this->accepted_date = null; - $this->token = $generator->randomToken(); - $this->hash = self::HashConfirmationToken($this->token); - return $this->token; - } - - public static function HashConfirmationToken(string $token): string - { - return md5($token); - } - - /** - * @return string - */ - public function getSetPasswordLink(): ?string - { - return $this->set_password_link; - } - - /** - * @param string $set_password_link - */ - public function setSetPasswordLink(string $set_password_link): void - { - $this->set_password_link = $set_password_link; - } - - /** - * @return SummitOrder - */ - public function getOrder(): ?SummitOrder - { - return $this->order; - } - - /** - * @param SummitOrder $order - */ - public function setOrder(SummitOrder $order): void - { - $this->order = $order; - } - - public function markAsAccepted(): void - { - $this->accepted_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - /** - * @return int - */ - public function getOrderId() - { - try { - return is_null($this->order) ? 0 : $this->order->getId(); - } catch (\Exception $ex) { - return 0; - } - } - - public function clearOrder() - { - $this->order = null; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitTaxType.php b/app/Models/Foundation/Summit/Registration/SummitTaxType.php deleted file mode 100644 index b89c245a..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitTaxType.php +++ /dev/null @@ -1,150 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string|null - */ - public function getTaxId(): ?string - { - return $this->tax_id; - } - - /** - * @param string $tax_id - */ - public function setTaxId(string $tax_id): void - { - $this->tax_id = $tax_id; - } - - /** - * @return float - */ - public function getRate(): float - { - return $this->rate; - } - - /** - * @param float $rate - */ - public function setRate(float $rate): void - { - $this->rate = $rate; - } - - public function __construct() - { - parent::__construct(); - $this->ticket_types = new ArrayCollection(); - $this->tax_id = ""; - $this->rate = 0.0; - } - - /** - * @param SummitTicketType $ticketType - */ - public function addTicketType(SummitTicketType $ticketType){ - if($this->ticket_types->contains($ticketType)) return; - $this->ticket_types->add($ticketType); - } - - /** - * @param SummitTicketType $ticketType - */ - public function removeTicketType(SummitTicketType $ticketType){ - if(!$this->ticket_types->contains($ticketType)) return; - $this->ticket_types->removeElement($ticketType); - } - - /** - * @return SummitTicketType[] - */ - public function getTicketTypes() - { - return $this->ticket_types; - } - - /** - * @param SummitTicketType $ticket_type - * @return bool - */ - public function mustApplyTo(SummitTicketType $ticket_type):bool{ - if($this->ticket_types->count() == 0) return true; - return $this->ticket_types->contains($ticket_type); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Registration/SummitTicketType.php b/app/Models/Foundation/Summit/Registration/SummitTicketType.php deleted file mode 100644 index c44aa766..00000000 --- a/app/Models/Foundation/Summit/Registration/SummitTicketType.php +++ /dev/null @@ -1,495 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return string - */ - public function getExternalId():?string - { - return $this->external_id; - } - - /** - * @param string $external_id - */ - public function setExternalId($external_id) - { - $this->external_id = $external_id; - } - - public function __construct() - { - parent::__construct(); - $this->cost = 0.0; - $this->max_quantity_per_order = 0; - $this->quantity_2_sell = 0; - $this->quantity_sold = 0; - $this->currency = AllowedCurrencies::USD; - $this->applied_taxes = new ArrayCollection(); - $this->sales_start_date = null; - $this->sales_end_date = null; - } - - /** - * @ORM\PreRemove: - * @param LifecycleEventArgs $args - * @throws ValidationException - */ - public function preRemoveHandler(LifecycleEventArgs $args){ - if(Config::get('registration.validate_ticket_type_removal', true) && $this->quantity_sold > 0) - throw new ValidationException - ( - sprintf - ( - "Can not delete ticket type %s because has sold tickets.", $this->getId() - ) - ); - } - - /** - * @return ArrayCollection|SummitTaxType[] - */ - public function getAppliedTaxes() - { - return $this->applied_taxes; - } - - /** - * @param SummitTicketType $tax - */ - public function addAppliedTax(SummitTicketType $tax){ - if($this->applied_taxes->contains($tax)) return; - $this->applied_taxes->add($tax); - } - - /** - * @param SummitTicketType $tax - */ - public function removeAppliedTax(SummitTicketType $tax){ - if(!$this->applied_taxes->contains($tax)) return; - $this->applied_taxes->removeElement($tax); - } - - /** - * @return float - */ - public function getCost(): float - { - return $this->cost; - } - - /** - * @param float $cost - */ - public function setCost(float $cost): void - { - $this->cost = $cost; - } - - /** - * @return string|null - */ - public function getCurrency(): ?string - { - return $this->currency; - } - - /** - * @param string $currency - */ - public function setCurrency(string $currency): void - { - $this->currency = $currency; - } - - /** - * @return int - */ - public function getQuantity2Sell(): int - { - return $this->quantity_2_sell; - } - - /** - * @param int $quantity_2_sell - */ - public function setQuantity2Sell(int $quantity_2_sell): void - { - $this->quantity_2_sell = $quantity_2_sell; - } - - /** - * @return int - */ - public function getMaxQuantityPerOrder(): int - { - return $this->max_quantity_per_order; - } - - /** - * @param int $max_quantity_per_order - */ - public function setMaxQuantityPerOrder(int $max_quantity_per_order): void - { - $this->max_quantity_per_order = $max_quantity_per_order; - } - - /** - * @return \DateTime|null - */ - public function getSalesStartDate(): ?\DateTime - { - return $this->sales_start_date; - } - - /** - * @param \DateTime|null $sales_start_date - */ - public function setSalesStartDate(?\DateTime $sales_start_date): void - { - $this->sales_start_date = $sales_start_date; - } - - public function clearSalesStartDate():void{ - $this->sales_start_date = null; - } - - /** - * @return \DateTime|null - */ - public function getSalesEndDate(): ?\DateTime - { - return $this->sales_end_date; - } - - /** - * @param \DateTime|null $sales_end_date - */ - public function setSalesEndDate(?\DateTime $sales_end_date): void - { - $this->sales_end_date = $sales_end_date; - } - - public function clearSalesEndDate():void{ - $this->sales_end_date = null; - } - - /** - * @return \DateTime - */ - public function getLocalSalesStartDate(): \DateTime - { - return $this->getSummit()->convertDateFromUTC2TimeZone($this->sales_start_date); - } - - /** - * @return \DateTime - */ - public function getLocalSalesEndDate(): \DateTime - { - return $this->getSummit()->convertDateFromUTC2TimeZone($this->sales_end_date); - } - - /** - * @return int - */ - public function getQuantitySold(): int - { - return $this->quantity_sold; - } - - /** - * @return bool - */ - public function canSell():bool { - if($this->isSoldOut()) { - Log::warning(sprintf("SummitTicketType::canSell ticket %s is sold out", $this->id)); - return false; - } - return $this->isLive(); - } - - /** - * @return bool - */ - public function isSoldOut():bool{ - return $this->quantity_2_sell == $this->quantity_sold; - } - - /** - * @return bool - */ - public function isLive(){ - // if valid period is not set , that is valid_since_date == valid_until_date == null , then ticket code lives forever - $now_utc = new \DateTime('now', new \DateTimeZone('UTC')); - if(!is_null($this->sales_start_date) && $now_utc < $this->sales_start_date){ - Log::warning(sprintf("SummitTicketType::isLive ticket %s is not live (now_utc < sales_start_date)", $this->id)); - return false; - } - if(!is_null($this->sales_end_date) && $now_utc > $this->sales_end_date){ - Log::warning(sprintf("SummitTicketType::isLive ticket %s is not live (now_utc < sales_end_date)", $this->id)); - return false; - } - return true; - } - - /** - * @param int $qty - * @return int - * @throws ValidationException - */ - public function sell(int $qty = 1):int { - - Log::debug - ( - sprintf - ( - "SummitTicketType::sell id %s qty %s quantity_sold %s quantity_2_sell %s", - $this->id, - $qty, - $this->quantity_sold, - $this->quantity_2_sell - ) - ); - - if($qty > $this->quantity_2_sell){ - throw new ValidationException(sprintf("Can not sell more tickets than max available.")); - } - - if(($this->quantity_sold + $qty) > $this->quantity_2_sell){ - throw new ValidationException(sprintf("Can not sell more ticket than available ones.")); - } - - $this->quantity_sold = $this->quantity_sold + $qty; - - return $this->quantity_sold; - } - - /** - * @param int $qty - * @return int - * @throws ValidationException - */ - public function restore(int $qty):int{ - - Log::debug - ( - sprintf - ( - "SummitTicketType::restore qty %s ticket type %s quantity_sold %s", - $qty, - $this->id, - $this->quantity_sold - ) - ); - - if(($this->quantity_sold - $qty) < 0) - throw new ValidationException - ( - sprintf - ( - "Can not restore a greater qty than sold one quantity_sold %s qty %s id %s", - $this->quantity_sold, - $qty, - $this->id - ) - ); - - $this->quantity_sold = $this->quantity_sold - $qty; - - Log::info(sprintf("SummitTicketType::restore qty_2_restore %s final qty %s", $qty, $this->quantity_sold)); - - return $this->quantity_sold; - } - - /** - * @return int - */ - public function getBadgeTypeId(){ - $res = $this->getBadgeType(); - try { - return is_null($res) ? 0: $res->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return SummitBadgeType - */ - public function getBadgeType(): ?SummitBadgeType - { - $res = $this->badge_type; - if(is_null($res)){ - $res = $this->summit->getDefaultBadgeType(); - } - return $res; - } - - /** - * @return bool - */ - public function hasBadgeType():bool{ - return $this->getBadgeTypeId() > 0; - } - /** - * @param SummitBadgeType $badge_type - */ - public function setBadgeType(SummitBadgeType $badge_type): void - { - $this->badge_type = $badge_type; - } - - /** - * @param SummitAttendeeTicket $ticket - * @return SummitAttendeeTicket - */ - public function applyTo(SummitAttendeeTicket $ticket){ - if($this->hasBadgeType()){ - $badge = $ticket->hasBadge() ? $ticket->getBadge() : new SummitAttendeeBadge(); - $ticket->setBadge($badge->applyTicketType($this)); - } - return $ticket; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Repositories/IAbstractCalendarSyncWorkRequestRepository.php b/app/Models/Foundation/Summit/Repositories/IAbstractCalendarSyncWorkRequestRepository.php deleted file mode 100644 index 5954c677..00000000 --- a/app/Models/Foundation/Summit/Repositories/IAbstractCalendarSyncWorkRequestRepository.php +++ /dev/null @@ -1,49 +0,0 @@ -summit->getTimeZoneId(); - } - - /** - * @return DateTimeZone|null - */ - public function getTimeZone() - { - return $this->summit->getTimeZone(); - } - - /** - * @return DateTime - */ - public function getSubmissionBeginDate() - { - return $this->submission_begin_date; - } - - /** - * @param DateTime $submission_begin_date - */ - public function setSubmissionBeginDate(DateTime $submission_begin_date){ - $this->submission_begin_date = $this->convertDateFromTimeZone2UTC($submission_begin_date); - } - - /** - * @return $this - */ - public function clearSubmissionDates(){ - $this->submission_begin_date = $this->submission_end_date = null; - return $this; - } - - /** - * @return DateTime - */ - public function getSubmissionEndDate() - { - return $this->submission_end_date; - } - - public function getSubmissionEndDateLocal():?DateTime{ - return $this->convertDateFromUTC2TimeZone($this->submission_end_date); - } - - public function getSubmissionBeginDateLocal():?DateTime{ - return $this->convertDateFromUTC2TimeZone($this->submission_begin_date); - } - - /** - * @param DateTime $submission_end_date - */ - public function setSubmissionEndDate(DateTime $submission_end_date){ - $this->submission_end_date = $this->convertDateFromTimeZone2UTC($submission_end_date); - } - - /** - * @return DateTime - */ - public function getVotingBeginDate() - { - return $this->voting_begin_date; - } - - /** - * @param DateTime $voting_begin_date - */ - public function setVotingBeginDate(DateTime $voting_begin_date){ - $this->voting_begin_date = $this->convertDateFromTimeZone2UTC($voting_begin_date); - } - - /** - * @return $this - */ - public function clearVotingDates(){ - $this->voting_begin_date = $this->voting_end_date = null; - return $this; - } - - /** - * @return DateTime - */ - public function getVotingEndDate() - { - return $this->voting_end_date; - } - - /** - * @param DateTime $voting_end_date - */ - public function setVotingEndDate(DateTime $voting_end_date){ - $this->voting_end_date = $this->convertDateFromTimeZone2UTC($voting_end_date); - } - - /** - * @return DateTime - */ - public function getSelectionBeginDate() - { - return $this->selection_begin_date; - } - - /** - * @param DateTime $selection_begin_date - */ - public function setSelectionBeginDate(DateTime $selection_begin_date){ - $this->selection_begin_date = $this->convertDateFromTimeZone2UTC($selection_begin_date); - } - - /** - * @return $this - */ - public function clearSelectionDates(){ - $this->selection_begin_date = $this->selection_end_date = null; - return $this; - } - - /** - * @return DateTime - */ - public function getSelectionEndDate() - { - return $this->selection_end_date; - } - - /** - * @param DateTime $selection_end_date - */ - public function setSelectionEndDate(DateTime $selection_end_date){ - $this->selection_end_date = $this->convertDateFromTimeZone2UTC($selection_end_date); - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return bool - */ - public function IsEnabled() - { - return $this->is_enabled; - } - - /** - * @param bool $is_enabled - */ - public function setIsEnabled($is_enabled) - { - $this->is_enabled = $is_enabled; - } - - /** - * SelectionPlan constructor. - */ - public function __construct() - { - parent::__construct(); - $this->is_enabled = false; - $this->allow_new_presentations = true; - $this->category_groups = new ArrayCollection; - $this->presentations = new ArrayCollection; - $this->extra_questions = new ArrayCollection; - $this->max_submission_allowed_per_user = Summit::DefaultMaxSubmissionAllowedPerUser; - } - - /** - * @return PresentationCategoryGroup[] - */ - public function getCategoryGroups() - { - return $this->category_groups; - } - - /** - * @param PresentationCategoryGroup $track_group - */ - public function addTrackGroup(PresentationCategoryGroup $track_group){ - if($this->category_groups->contains($track_group)) return; - $this->category_groups->add($track_group); - } - - /** - * @param PresentationCategoryGroup $track_group - */ - public function removeTrackGroup(PresentationCategoryGroup $track_group){ - if(!$this->category_groups->contains($track_group)) return; - $this->category_groups->removeElement($track_group); - } - - /** - * @return int - */ - public function getMaxSubmissionAllowedPerUser() - { - return $this->max_submission_allowed_per_user; - } - - /** - * @param int $max_submission_allowed_per_user - */ - public function setMaxSubmissionAllowedPerUser($max_submission_allowed_per_user) - { - $this->max_submission_allowed_per_user = $max_submission_allowed_per_user; - } - - /** - * @return Presentation[] - */ - public function getPresentations() - { - return $this->presentations; - } - - /** - * @param Presentation $presentation - */ - public function addPresentation(Presentation $presentation){ - if($this->presentations->contains($presentation)) return; - $this->presentations->add($presentation); - $presentation->setSelectionPlan($this); - } - - public function getStageStatus($stage) { - - $getStartDate = "get{$stage}BeginDate"; - $getEndDate = "get{$stage}EndDate"; - $start_date = $this->$getStartDate(); - $end_date = $this->$getEndDate(); - - if (empty($start_date) || empty($end_date)) { - return null; - } - - $utc_time_zone = new \DateTimeZone('UTC'); - $start_date->setTimeZone($utc_time_zone); - $end_date->setTimeZone($utc_time_zone); - $now = new \DateTime('now', new \DateTimeZone( 'UTC')); - - if ($now > $end_date) { - return Summit::STAGE_FINISHED; - } else if ($now < $start_date) { - return Summit::STAGE_UNSTARTED; - } else { - return Summit::STAGE_OPEN; - } - } - - /** - * @param PresentationCategory $track - * @return bool - */ - public function hasTrack(PresentationCategory $track){ - foreach($this->category_groups as $track_group){ - if($track_group->hasCategory($track->getIdentifier())) return true; - } - return false; - } - - /** - * @return bool - */ - public function isVotingOpen() - { - return $this->getStageStatus('Voting') === Summit::STAGE_OPEN; - } - - /** - * @return bool - */ - public function isSubmissionOpen() - { - return $this->getStageStatus('Submission') === Summit::STAGE_OPEN; - } - - /** - * @return bool - */ - public function isSelectionOpen() - { - return $this->getStageStatus('Selection') === Summit::STAGE_OPEN; - } - - /** - * @return bool - */ - public function isAllowNewPresentations(): bool - { - return $this->allow_new_presentations; - } - - /** - * @param bool $allow_new_presentations - */ - public function setAllowNewPresentations(bool $allow_new_presentations): void - { - $this->allow_new_presentations = $allow_new_presentations; - } - - /** - * @param int $id - * @return Presentation|null - */ - public function getPresentation(int $id):?Presentation{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $presentation = $this->presentations->matching($criteria)->first(); - return $presentation === false ? null : $presentation; - } - - /** - * Extra Questions - */ - - - /** - * @param int $question_id - * @return SummitSelectionPlanExtraQuestionType|null - */ - public function getExtraQuestionById(int $question_id):?SummitSelectionPlanExtraQuestionType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $question_id)); - $question = $this->extra_questions->matching($criteria)->first(); - return $question === false ? null : $question; - } - - /** - * @param string $name - * @return SummitSelectionPlanExtraQuestionType|null - */ - public function getExtraQuestionByName(string $name):?SummitSelectionPlanExtraQuestionType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $question = $this->extra_questions->matching($criteria)->first(); - return $question === false ? null : $question; - } - - /** - * @param string $label - * @return SummitSelectionPlanExtraQuestionType|null - */ - public function getExtraQuestionByLabel(string $label):?SummitSelectionPlanExtraQuestionType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('label', trim($label))); - $question = $this->extra_questions->matching($criteria)->first(); - return $question === false ? null : $question; - } - - /** - * @return int - */ - private function getExtraQuestionMaxOrder():int{ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $question = $this->extra_questions->matching($criteria)->first(); - return $question === false ? 0 : $question->getOrder(); - } - - /** - * @param SummitSelectionPlanExtraQuestionType $question - * @throws ValidationException - */ - public function addExtraQuestion(SummitSelectionPlanExtraQuestionType $question){ - if($this->extra_questions->contains($question)) return; - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', $question->getName())); - $formerExtraQuestion = $this->extra_questions->matching($criteria)->first(); - if($formerExtraQuestion){ - throw new ValidationException(sprintf("Question Name %s already exists.", $question->getName())); - }; - $question->setOrder($this->getExtraQuestionMaxOrder()+1); - $this->extra_questions->add($question); - $question->setSelectionPlan($this); - } - - public function removeExtraQuestion(SummitSelectionPlanExtraQuestionType $question){ - if(!$this->extra_questions->contains($question)) return; - $this->extra_questions->removeElement($question); - $question->clearSelectionPlan(); - } - - use OrderableChilds; - - /** - * @param SummitSelectionPlanExtraQuestionType $question - * @param int $new_order - * @throws ValidationException - */ - public function recalculateQuestionOrder(SummitSelectionPlanExtraQuestionType $question, $new_order){ - self::recalculateOrderForSelectable($this->extra_questions, $question, $new_order); - } - - /** - * @return ArrayCollection|\Doctrine\Common\Collections\Collection - */ - public function getExtraQuestions(){ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'ASC']); - return $this->extra_questions->matching($criteria); - } - - /** - * @return ArrayCollection|\Doctrine\Common\Collections\Collection - */ - public function getMandatoryExtraQuestions(){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('mandatory', true)); - return $this->extra_questions->matching($criteria); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/PresentationSpeaker.php b/app/Models/Foundation/Summit/Speakers/PresentationSpeaker.php deleted file mode 100644 index 21d26e08..00000000 --- a/app/Models/Foundation/Summit/Speakers/PresentationSpeaker.php +++ /dev/null @@ -1,1780 +0,0 @@ -first_name; - } - - /** - * @param string $first_name - */ - public function setFirstName($first_name) - { - $this->first_name = $first_name; - } - - /** - * @return string - */ - public function getLastName() - { - return $this->last_name; - } - - /** - * @param string $last_name - */ - public function setLastName($last_name) - { - $this->last_name = $last_name; - } - - /** - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * @param string $title - */ - public function setTitle($title) - { - $this->title = $title; - } - - /** - * @return string - */ - public function getBio() - { - return $this->bio; - } - - /** - * @param string $bio - */ - public function setBio($bio) - { - $this->bio = $bio; - } - - /** - * @return string - */ - public function getIrcHandle() - { - return $this->irc_handle; - } - - /** - * @param string $irc_handle - */ - public function setIrcHandle($irc_handle) - { - $this->irc_handle = $irc_handle; - } - - /** - * @return string - */ - public function getTwitterName() - { - return urlencode($this->twitter_name); - } - - /** - * @param string $twitter_name - */ - public function setTwitterName($twitter_name) - { - $this->twitter_name = $twitter_name; - } - - public function __construct() - { - parent::__construct(); - $this->available_for_bureau = false; - $this->willing_to_present_video = false; - $this->willing_to_travel = false; - $this->funded_travel = false; - $this->org_has_cloud = false; - $this->created_from_api = true; - $this->presentations = new ArrayCollection; - $this->moderated_presentations = new ArrayCollection; - $this->summit_assistances = new ArrayCollection; - $this->promo_codes = new ArrayCollection; - $this->areas_of_expertise = new ArrayCollection; - $this->other_presentation_links = new ArrayCollection; - $this->travel_preferences = new ArrayCollection; - $this->languages = new ArrayCollection; - $this->organizational_roles = new ArrayCollection; - $this->active_involvements = new ArrayCollection; - $this->announcement_summit_emails = new ArrayCollection; - $this->granted_edit_permissions = new ArrayCollection; - } - - /** - * @param Presentation $presentation - */ - public function addPresentation(Presentation $presentation){ - $this->presentations->add($presentation); - } - - public function clearPresentations(){ - foreach($this->presentations as $presentation){ - $presentation->removeSpeaker($this); - } - $this->presentations->clear(); - } - /** - * @param SpeakerSummitRegistrationPromoCode $code - * @return $this - */ - public function addPromoCode(SpeakerSummitRegistrationPromoCode $code){ - $this->promo_codes->add($code); - $code->setSpeaker($this); - return $this; - } - - /** - * @param SpeakerSummitRegistrationPromoCode $code - * @return $this - */ - public function removePromoCode(SpeakerSummitRegistrationPromoCode $code){ - $this->promo_codes->removeElement($code); - $code->setSpeaker(null); - return $this; - } - - /** - * @return ArrayCollection|SpeakerSummitRegistrationPromoCode[] - */ - public function getPromoCodes(){ - return $this->promo_codes; - } - - /** - * @param Summit $summit - * @return SpeakerSummitRegistrationPromoCode - */ - public function getPromoCodeFor(Summit $summit){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('summit', $summit)); - $res = $this->promo_codes->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param null|int $summit_id - * @param bool|true $published_ones - * @return Presentation[] - */ - public function presentations($summit_id, $published_ones = true) - { - - return $this->presentations - ->filter(function($p) use($published_ones, $summit_id){ - $res = $published_ones? $p->isPublished(): true; - $res &= is_null($summit_id)? true : $p->getSummit()->getId() == $summit_id; - return $res; - }); - } - - const ROLE_SPEAKER = 'ROLE_SPEAKER'; - const ROLE_CREATOR = 'ROLE_CREATOR'; - const ROLE_MODERATOR ='ROLE_MODERATOR'; - - /** - * @param SelectionPlan $selectionPlan - * @param string $role - * @return array - */ - public function getPresentationsBySelectionPlanAndRole(SelectionPlan $selectionPlan, $role){ - - if($role == self::ROLE_SPEAKER){ - $res = $this->presentations->filter(function(Presentation $presentation) use($selectionPlan){ - if($presentation->getSelectionPlanId() != $selectionPlan->getId()) return false; - if($presentation->getSummit()->getId() != $selectionPlan->getSummitId()) return false; - if($presentation->getModeratorId() == $this->getId()) return false; - if($presentation->getCreatorId() == $this->getMemberId()) return false; - return true; - }); - return $res->toArray(); - } - - if($role == self::ROLE_CREATOR){ - return $selectionPlan->getSummit()->getCreatedPresentations($this, $selectionPlan); - } - - if($role == self::ROLE_MODERATOR){ - return $selectionPlan->getSummit()->getModeratedPresentationsBy($this, $selectionPlan); - } - - return []; - } - - /** - * @param Summit $summit - * @param string $role - * @return array - */ - public function getPresentationsBySummitAndRole(Summit $summit, $role){ - - if($role == self::ROLE_SPEAKER){ - $res = $this->presentations->filter(function(Presentation $presentation) use($summit){ - if($presentation->getSummit()->getId() != $summit->getId()) return false; - if($presentation->getModeratorId() == $this->getId()) return false; - if($presentation->getCreatorId() == $this->getMemberId()) return false; - return true; - }); - return $res->toArray(); - } - - if($role == self::ROLE_CREATOR){ - return $summit->getCreatedPresentations($this); - } - - if($role == self::ROLE_MODERATOR){ - return $summit->getModeratedPresentationsBy($this); - } - - return []; - } - - /** - * @param Summit $summit - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @return bool - */ - public function hasPublishedRegularPresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [] - ) - { - return count($this->getPublishedRegularPresentations($summit, $role, $include_sub_roles, $excluded_tracks)) > 0; - } - - - /** - * @param Summit $summit - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @return array - */ - public function getPublishedRegularPresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [] - ) - { - $list = $this->getPublishedPresentationsByType - ( - $summit, - $role, - [IPresentationType::Keynotes, IPresentationType::Panel, IPresentationType::Presentation], - true, - $excluded_tracks - ); - - if($include_sub_roles && $role == PresentationSpeaker::RoleModerator){ - $presentations = $this->getPublishedPresentationsByType - ( - $summit, - PresentationSpeaker::RoleSpeaker, - [IPresentationType::Keynotes, IPresentationType::Panel, IPresentationType::Presentation], - true, - $excluded_tracks - ); - if($presentations) { - foreach ($presentations as $speaker_presentation) - $list[] = $speaker_presentation; - } - } - - return $list; - } - - /** - * @param Summit $summit - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @return bool - */ - public function hasPublishedLightningPresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [] - ) - { - return count($this->getPublishedLightningPresentations - ( - $summit, - $role, - $include_sub_roles, - $excluded_tracks - ))> 0; - } - - /** - * @param Summit $summit - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @return array - */ - public function getPublishedLightningPresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [] - ) - { - $list = $this->getPublishedPresentationsByType($summit, $role, [IPresentationType::LightingTalks], true , $excluded_tracks); - - if($include_sub_roles && $role == PresentationSpeaker::RoleModerator){ - $presentations = $this->getPublishedPresentationsByType($summit, PresentationSpeaker::RoleSpeaker, [IPresentationType::LightingTalks], true, $excluded_tracks) ; - if($presentations) { - foreach ($presentations as $speaker_presentation) { - $list[] = $speaker_presentation; - } - } - } - - return $list; - } - - /** - * @param Summit $summit - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @param bool $published_ones - * @return bool - */ - public function hasAlternatePresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [], - $published_ones = false - ) - { - return count($this->getAlternatePresentations($summit, $role, $include_sub_roles, $excluded_tracks, $published_ones)) > 0; - } - - /** - * @param Summit $summit - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @param bool $published_ones - * @return array - */ - public function getAlternatePresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [], - $published_ones = false - ) - { - $alternate_presentations = []; - - $exclude_category_dql = ''; - if(count($excluded_tracks) > 0){ - $exclude_category_dql = ' AND p.category NOT IN (:exclude_tracks)'; - } - - if($role == PresentationSpeaker::RoleSpeaker) { - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.speakers sp - WHERE s.id = :summit_id - AND p.published = :published - AND sp.id = :speaker_id".$exclude_category_dql); - } - else{ - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.moderator m - WHERE s.id = :summit_id - AND p.published = :published - AND m.id = :speaker_id".$exclude_category_dql); - } - - $query - ->setParameter('summit_id', $summit->getId()) - ->setParameter('speaker_id', $this->id) - ->setParameter('published', $published_ones ? 1 : 0); - - if(count($excluded_tracks) > 0){ - $query->setParameter('exclude_tracks', $excluded_tracks); - } - - $presentations = $query->getResult(); - - foreach ($presentations as $p) { - if ($p->getSelectionStatus() == Presentation::SelectionStatus_Alternate) { - $alternate_presentations[] = $p; - } - } - - // if role is moderator, add also the ones that belongs to role speaker ( if $include_sub_roles is true) - if($include_sub_roles && $role == PresentationSpeaker::RoleModerator){ - $presentations = $this->getAlternatePresentations($summit,PresentationSpeaker::RoleSpeaker, $include_sub_roles, $excluded_tracks); - if($presentations) { - foreach ($presentations as $speaker_presentation) - $alternate_presentations[] = $speaker_presentation; - } - } - - return $alternate_presentations; - } - - /** - * @param Summit $summit, - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @return bool - */ - public function hasRejectedPresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [] - ) - { - return count($this->getRejectedPresentations($summit, $role, $include_sub_roles, $excluded_tracks)) > 0; - } - - /** - * @param Summit $summit, - * @param string $role - * @param bool $include_sub_roles - * @param array $excluded_tracks - * @return array - */ - public function getRejectedPresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $include_sub_roles = false, - array $excluded_tracks = [] - ){ - $list = $this->getUnacceptedPresentations($summit, $role, true, $excluded_tracks); - if($include_sub_roles && $role == PresentationSpeaker::RoleModerator){ - $presentations = $this->getUnacceptedPresentations($summit, PresentationSpeaker::RoleSpeaker, true, $excluded_tracks); - if($presentations) { - foreach ($presentations as $speaker_presentation) { - $list[] = $speaker_presentation; - } - } - } - return $list; - } - - /** - * @param Summit $summit, - * @param string $role - * @param bool $exclude_privates_tracks - * @param array $excluded_tracks - * @return array - */ - public function getUnacceptedPresentations - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - $exclude_privates_tracks = true, - array $excluded_tracks = [] - ) - { - $unaccepted_presentations = []; - $private_tracks = []; - - if($exclude_privates_tracks){ - $private_track_groups = $this->createQuery("SELECT pg from models\summit\PrivatePresentationCategoryGroup pg - JOIN pg.summit s - WHERE s.id = :summit_id") - ->setParameter('summit_id', $summit->getId()) - ->getResult(); - - foreach($private_track_groups as $private_track_group){ - $current_private_tracks = $private_track_group->getCategories(); - if(count($current_private_tracks) == 0) continue; - $private_tracks = array_merge($private_tracks, array_values($current_private_tracks)); - } - } - - if(count($private_tracks) > 0) { - $excluded_tracks = array_merge($excluded_tracks, $private_tracks); - } - - $exclude_category_dql = ''; - if(count($excluded_tracks) > 0){ - $exclude_category_dql = ' AND p.category NOT IN (:exclude_tracks)'; - } - - if($role == PresentationSpeaker::RoleSpeaker) { - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.speakers sp - WHERE s.id = :summit_id - AND p.published = 0 - AND sp.id = :speaker_id".$exclude_category_dql); - } - else{ - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.moderator m - WHERE s.id = :summit_id - AND p.published = 0 - AND m.id = :speaker_id".$exclude_category_dql); - } - - $query - ->setParameter('summit_id', $summit->getId()) - ->setParameter('speaker_id', $this->id); - - if(count($excluded_tracks) > 0){ - $query->setParameter('exclude_tracks', $excluded_tracks); - } - $presentations = $query->getResult(); - - foreach ($presentations as $p) { - if ($p->getSelectionStatus() == Presentation::SelectionStatus_Unaccepted) { - $unaccepted_presentations[] = $p; - } - } - - return $unaccepted_presentations; - } - - - /** - * @param Summit $summit - * @param string $role - * @param array $types_slugs - * @param bool $exclude_privates_tracks - * @param array $excluded_tracks - * @return array - */ - public function getPublishedPresentationsByType - ( - Summit $summit, - $role = PresentationSpeaker::RoleSpeaker, - array $types_slugs = [IPresentationType::Keynotes, IPresentationType::Panel, IPresentationType::Presentation, IPresentationType::LightingTalks], - $exclude_privates_tracks = true, - array $excluded_tracks = [] - ) - { - $query = $this->createQuery("SELECT pt from models\summit\PresentationType pt JOIN pt.summit s - WHERE s.id = :summit_id and pt.type IN (:types) "); - $types = $query - ->setParameter('summit_id', $summit->getIdentifier()) - ->setParameter('types', $types_slugs) - ->getResult(); - - if(count($types) == 0 ) return []; - - $private_tracks = []; - $exclude_privates_tracks = boolval($exclude_privates_tracks); - - if($exclude_privates_tracks){ - - $query = $this->createQuery("SELECT ppcg from models\summit\PrivatePresentationCategoryGroup ppcg JOIN ppcg.summit s - WHERE s.id = :summit_id"); - $private_track_groups = $query - ->setParameter('summit_id', $summit->getIdentifier()) - ->getResult(); - - foreach($private_track_groups as $private_track_group){ - $current_private_tracks = $private_track_group->getCategories(); - if($current_private_tracks->count() == 0) continue; - $private_tracks = array_merge($private_tracks, array_values($current_private_tracks)); - } - } - - if(count($private_tracks) > 0) { - $excluded_tracks = array_merge($excluded_tracks, $private_tracks); - } - - $exclude_category_dql = ''; - if(count($excluded_tracks) > 0){ - $exclude_category_dql = ' and p.category NOT IN (:exclude_tracks)'; - } - - if($role == PresentationSpeaker::RoleSpeaker) { - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.speakers sp - WHERE s.id = :summit_id - and sp.id = :speaker_id - and p.published = 1 and p.type IN (:types)".$exclude_category_dql); - } - else{ - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.moderator m - WHERE s.id = :summit_id - and m.id = :speaker_id - and p.published = 1 and p.type IN (:types)".$exclude_category_dql); - } - - $query - ->setParameter('summit_id', $summit->getId()) - ->setParameter('types', $types) - ->setParameter('speaker_id', $this->id); - - if(count($excluded_tracks) > 0){ - $query->setParameter('exclude_tracks', $excluded_tracks); - } - - return $query->getResult(); - } - - - /** - * @param null|int $summit_id - * @param bool|true $published_ones - * @return Presentation[] - */ - public function moderated_presentations($summit_id, $published_ones = true) - { - - return $this->moderated_presentations - ->filter(function($p) use($published_ones, $summit_id){ - $res = $published_ones? $p->isPublished(): true; - $res &= is_null($summit_id)? true : $p->getSummit()->getId() == $summit_id; - return $res; - }); - } - - /** - * @param int $presentation_id - * @return Presentation - */ - public function getPresentation($presentation_id) - { - return $this->presentations->get($presentation_id); - } - - /** - * @param null $summit_id - * @param bool|true $published_ones - * @return array - */ - public function getPresentationIds($summit_id, $published_ones = true) - { - $ids = []; - foreach ($this->presentations($summit_id, $published_ones) as $p) { - $ids[] = intval($p->getId()); - } - return $ids; - } - - /** - * @param bool|true $published_ones - * @return array - */ - public function getAllPresentationIds($published_ones = true) - { - $ids = []; - foreach ($this->presentations(null, $published_ones) as $p) { - $ids[] = intval($p->getId()); - } - return $ids; - } - - /** - * @param null $summit_id - * @param bool|true $published_ones - * @return array - */ - public function getPresentations($summit_id, $published_ones = true) - { - return $this->presentations($summit_id, $published_ones)->map(function($entity) { - return $entity; - })->toArray(); - } - - /** - * @param bool|true $published_ones - * @return array - */ - public function getAllPresentations($published_ones = true) - { - return $this->presentations(null, $published_ones)->map(function($entity) { - return $entity; - })->toArray(); - } - - - /** - * @param null $summit_id - * @param bool|true $published_ones - * @return array - */ - public function getModeratedPresentationIds($summit_id, $published_ones = true) - { - $ids = []; - foreach ($this->moderated_presentations($summit_id, $published_ones) as $p) { - $ids[] = intval($p->getId()); - } - return $ids; - } - - /** - * @param bool|true $published_ones - * @return array - */ - public function getAllModeratedPresentationIds($published_ones = true) - { - $ids = []; - foreach ($this->moderated_presentations(null, $published_ones) as $p) { - $ids[] = intval($p->getId()); - } - return $ids; - } - - /** - * @param null $summit_id - * @param bool|true $published_ones - * @return array - */ - public function getModeratedPresentations($summit_id, $published_ones = true) - { - return $this->moderated_presentations($summit_id, $published_ones)->map(function($entity) { - return $entity; - })->toArray(); - } - - /** - * @param bool|true $published_ones - * @return array - */ - public function getAllModeratedPresentations($published_ones = true) - { - return $this->moderated_presentations(null, $published_ones)->map(function($entity) { - return $entity; - })->toArray(); - } - - /** - * @return File|null - */ - public function getPhoto():?File - { - return $this->photo; - } - - /** - * @param File $photo - */ - public function setPhoto(File $photo) - { - $this->photo = $photo; - } - - /** - * @return Member - */ - public function getMember() - { - return $this->member; - } - - /** - * @param Member $member - */ - public function setMember(Member $member){ - $this->member = $member; - $member->setSpeaker($this); - } - - /** - * @return bool - */ - public function hasMember(){ - return $this->getMemberId() > 0; - } - - /** - * @return int - */ - public function getMemberId() - { - try{ - if(is_null($this->member)) return 0; - return $this->member->getId(); - } - catch(\Exception $ex){ - 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; - $registration_request->setSpeaker($this); - } - - /** - * @param string $separator - * @return string - */ - public function getFullName(string $separator=', '){ - $fullname = $this->first_name; - if(!empty($this->last_name)){ - if(!empty($fullname)) $fullname .= $separator; - $fullname .= $this->last_name; - } - return $fullname; - } - - /** - * @return PresentationSpeakerSummitAssistanceConfirmationRequest[] - */ - public function getSummitAssistances() - { - return $this->summit_assistances; - } - - /** - * @param PresentationSpeakerSummitAssistanceConfirmationRequest $assistance - * @return $this - */ - public function addSummitAssistance(PresentationSpeakerSummitAssistanceConfirmationRequest $assistance){ - if($this->summit_assistances->contains($assistance)) return $this; - $this->summit_assistances->add($assistance); - $assistance->setSpeaker($this); - return $this; - } - - /** - * @param Summit $summit - * @return PresentationSpeakerSummitAssistanceConfirmationRequest - */ - public function getAssistanceFor(Summit $summit) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('summit', $summit)); - $res = $this->summit_assistances->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param Summit $summit - * @return bool - */ - public function hasAssistanceFor(Summit $summit){ - return $this->getAssistanceFor($summit) != null; - } - - /** - * @return mixed - */ - public function getCreatedFromApi() - { - return $this->created_from_api; - } - - /** - * @param mixed $created_from_api - */ - public function setCreatedFromApi($created_from_api) - { - $this->created_from_api = $created_from_api; - } - - /** - * @param Summit $summit - * @return PresentationSpeakerSummitAssistanceConfirmationRequest - */ - public function buildAssistanceFor(Summit $summit) - { - $request = new PresentationSpeakerSummitAssistanceConfirmationRequest; - $request->setSummit($summit); - $request->setSpeaker($this); - return $request; - } - - /** - * @param Summit $summit - * @return bool - */ - public function isSpeakerOfSummit(Summit $summit){ - - $query = <<getEM()); - $rsm->addRootEntityFromClassMetadata(\models\summit\Summit::class, 's'); - - // build rsm here - $native_query = $this->getEM()->createNativeQuery($query, $rsm); - - - $native_query->setParameter("speaker_id", $this->id); - $native_query->setParameter("summit_id", $summit->getId()); - - $summits = $native_query->getResult(); - - return count($summits) > 0; - } - - /** - * @return Summit[] - */ - public function getRelatedSummits(){ - - $query = <<getEM()); - $rsm->addRootEntityFromClassMetadata(\models\summit\Summit::class, 's'); - - // build rsm here - $native_query = $this->getEM()->createNativeQuery($query, $rsm); - - $native_query->setParameter("speaker_id", $this->id); - - $summits = $native_query->getResult(); - if(count($summits) == 0){ - $assistance = $this->getLatestAssistance(); - if(!$assistance) return []; - return [ $assistance->getSummit() ]; - } - return $summits; - } - - /* - * @return null|string - */ - public function getEmail(){ - try { - if (!is_null($this->member)) { - return $this->member->getEmail(); - } - } - catch(\Exception $ex){ - Log::warning($ex); - } - try { - if (!is_null($this->registration_request)) { - return $this->registration_request->getEmail(); - } - } - catch(\Exception $ex){ - Log::warning($ex); - } - return null; - } - - /** - * @return bool - */ - public function hasRegistrationRequest(){ - return $this->getRegistrationRequestId() > 0; - } - - /** - * @return int - */ - public function getRegistrationRequestId() - { - try{ - if(is_null($this->registration_request)) return 0; - return $this->registration_request->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return PresentationSpeakerSummitAssistanceConfirmationRequest|null - */ - public function getLatestAssistance(){ - return !is_null($this->summit_assistances) ? $this->summit_assistances->last() : null; - } - - // life cycle events - - /** - * @var PreRemoveEventArgs - */ - private $pre_remove_events; - /** - * @ORM\PreRemove: - */ - public function deleting($args){ - $this->pre_remove_events = new PreRemoveEventArgs - ( - [ - 'id' => $this->id, - 'class_name' => "PresentationSpeaker", - 'summits' => $this->getRelatedSummits(), - ] - ); - } - - /** - * @ORM\PostRemove: - */ - public function deleted($args){ - - Event::fire(new PresentationSpeakerDeleted(null, $this->pre_remove_events)); - $this->pre_remove_events = null; - } - - /** - * @var PreUpdateEventArgs - */ - private $pre_update_args; - - /** - * @ORM\PreUpdate: - */ - public function updating(PreUpdateEventArgs $args){ - $this->pre_update_args = $args; - } - - /** - * @ORM\PostUpdate: - */ - public function updated($args) - { - Event::fire(new PresentationSpeakerUpdated($this, $this->pre_update_args)); - $this->pre_update_args = null; - } - - public static $bypass_events = false; - /** - * @ORM\PostPersist - */ - public function inserted($args){ - if(self::$bypass_events) return; - Event::fire(new PresentationSpeakerCreated($this, $args)); - } - - /** - * @return bool - */ - public function isAvailableForBureau() - { - return $this->available_for_bureau; - } - - /** - * @param bool $available_for_bureau - */ - public function setAvailableForBureau($available_for_bureau) - { - $this->available_for_bureau = $available_for_bureau; - } - - /** - * @return bool - */ - public function isFundedTravel() - { - return $this->funded_travel; - } - - /** - * @param bool $funded_travel - */ - public function setFundedTravel($funded_travel) - { - $this->funded_travel = $funded_travel; - } - - /** - * @return bool - */ - public function isWillingToTravel() - { - return $this->willing_to_travel; - } - - /** - * @param bool $willing_to_travel - */ - public function setWillingToTravel($willing_to_travel) - { - $this->willing_to_travel = $willing_to_travel; - } - - /** - * @return string - */ - public function getCountry() - { - return $this->country; - } - - /** - * @param string $country - */ - public function setCountry($country) - { - $this->country = $country; - } - - /** - * @return bool - */ - public function isWillingToPresentVideo() - { - return $this->willing_to_present_video; - } - - /** - * @param bool $willing_to_present_video - */ - public function setWillingToPresentVideo($willing_to_present_video) - { - $this->willing_to_present_video = $willing_to_present_video; - } - - /** - * @return string - */ - public function getNotes() - { - return $this->notes; - } - - /** - * @param string $notes - */ - public function setNotes($notes) - { - $this->notes = $notes; - } - - /** - * @return bool - */ - public function isOrgHasCloud() - { - return $this->org_has_cloud; - } - - /** - * @param bool $org_has_cloud - */ - public function setOrgHasCloud($org_has_cloud) - { - $this->org_has_cloud = $org_has_cloud; - } - - /** - * @return SpeakerExpertise[] - */ - public function getAreasOfExpertise() - { - return $this->areas_of_expertise; - } - - public function clearAreasOfExpertise(){ - $this->areas_of_expertise->clear(); - } - - /** - * @param SpeakerExpertise $area_of_expertise - */ - public function addAreaOfExpertise(SpeakerExpertise $area_of_expertise){ - $this->areas_of_expertise->add($area_of_expertise); - $area_of_expertise->setSpeaker($this); - } - - /** - * @return SpeakerPresentationLink[] - */ - public function getOtherPresentationLinks() - { - return $this->other_presentation_links; - } - - /** - * @param SpeakerPresentationLink $link - */ - public function addOtherPresentationLink(SpeakerPresentationLink $link){ - $this->other_presentation_links->add($link); - $link->setSpeaker($this); - } - - - public function clearOtherPresentationLinks(){ - $this->other_presentation_links->clear(); - } - - /** - * @return SpeakerTravelPreference[] - */ - public function getTravelPreferences() - { - return $this->travel_preferences; - } - - /** - * @param SpeakerTravelPreference $travel_preference - */ - public function addTravelPreference(SpeakerTravelPreference $travel_preference){ - $this->travel_preferences->add($travel_preference); - $travel_preference->setSpeaker($this); - } - - public function clearTravelPreferences(){ - $this->travel_preferences->clear(); - } - - /** - * @return Language[] - */ - public function getLanguages() - { - return $this->languages; - } - - /** - * @param Language $language - */ - public function addLanguage(Language $language){ - if($this->languages->contains($language)) return; - $this->languages->add($language); - } - - /** - * - */ - public function clearLanguages(){ - $this->languages->clear(); - } - - /** - * @return SpeakerOrganizationalRole[] - */ - public function getOrganizationalRoles() - { - return $this->organizational_roles; - } - - public function clearOrganizationalRoles(){ - $this->organizational_roles->clear(); - } - - public function addOrganizationalRole(SpeakerOrganizationalRole $role){ - $this->organizational_roles->add($role); - } - - /** - * @return SpeakerActiveInvolvement[] - */ - public function getActiveInvolvements() - { - return $this->active_involvements; - } - - public function clearActiveInvolvements(){ - $this->active_involvements->clear(); - } - - /** - * @param SpeakerActiveInvolvement $active_involvement - */ - public function addActiveInvolvement(SpeakerActiveInvolvement $active_involvement){ - $this->active_involvements->add($active_involvement); - } - - /** - * @param Presentation $presentation - */ - public function addModeratedPresentation(Presentation $presentation){ - $this->moderated_presentations->add($presentation); - $presentation->setModerator($this); - } - - /** - * @param Summit $summit - * @return bool - */ - public function isModeratorFor(Summit $summit){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('summit', $summit)); - return $this->moderated_presentations->matching($criteria)->count() > 0; - } - - /** - * @param Summit $summit - * @return bool - */ - public function announcementEmailAlreadySent(Summit $summit) - { - $email_type = $this->getAnnouncementEmailTypeSent($summit); - return !is_null($email_type) && $email_type !== SpeakerAnnouncementSummitEmail::TypeNone; - } - - /** - * @param Summit $summit - * @return string|null - */ - public function getAnnouncementEmailTypeSent(Summit $summit) - { - $criteria = Criteria::create(); - - $criteria - ->where(Criteria::expr()->eq('summit', $summit)) - ->andWhere(Criteria::expr()->notIn('type', [ - SpeakerAnnouncementSummitEmail::TypeCreateMembership, - SpeakerAnnouncementSummitEmail::TypeSecondBreakoutRegister, - SpeakerAnnouncementSummitEmail::TypeSecondBreakoutReminder, - ])); - - $email = $this->announcement_summit_emails->matching($criteria)->first(); - - return $email ? $email->getType() : null; - } - - /** - * @return bool - */ - public function hasPhoto(){ - return $this->getPhotoId() > 0; - } - - /** - * @return int - */ - public function getPhotoId() - { - try{ - if(is_null($this->photo)) return 0; - return $this->photo->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return string|null - */ - public function getProfilePhotoUrl():?string{ - $photoUrl = null; - if($this->hasPhoto() && $photo = $this->getPhoto()){ - $photoUrl = $photo->getUrl(); - } - if(empty($photoUrl) && $this->hasMember() && $this->member->hasPhoto() && $photo = $this->member->getPhoto()){ - $photoUrl = $photo->getUrl(); - } - if(empty($photoUrl) && !empty($this->getTwitterName()) ){ - $twitterName = $this->getTwitterName(); - $photoUrl = sprintf("https://avatars.io/twitter/%s", trim(trim($twitterName, '@'))); - } - if(empty($photoUrl)){ - $photoUrl = File::getCloudLinkForImages("generic-speaker-icon.png"); - } - return $photoUrl; - } - - /** - * @param Member $member - * @return bool - */ - public function canBeEditedBy(Member $member):bool{ - Log::debug(sprintf("PresentationSpeaker::canBeEditedBy member %s speaker member id %s", $member->getId(), $this->getMemberId())); - if($member->isAdmin()) return true; - if($this->getMemberId() == $member->getId()) return true; - $criteria = Criteria::create(); - $criteria - ->where(Criteria::expr()->eq('requested_by', $member)) - ->andWhere(Criteria::expr()->eq('approved', true)); - return $this->granted_edit_permissions->matching($criteria)->count() > 0 ; - } - - /** - * @return bool - */ - public function hasBigPhoto(){ - return $this->getBigPhotoId() > 0; - } - - /** - * @return int - */ - public function getBigPhotoId() - { - try{ - if(is_null($this->big_photo)) return 0; - return $this->big_photo->getId(); - } - catch(\Exception $ex){ - Log::warning($ex); - return 0; - } - } - - public function getBigPhoto():?File{ - return $this->big_photo; - } - - /** - * @return string|null - */ - public function getBigProfilePhotoUrl():?string{ - $photoUrl = null; - if($this->hasBigPhoto() && $photo = $this->getBigPhoto()){ - $photoUrl = $photo->getUrl(); - } - if(empty($photoUrl)){ - $photoUrl = File::getCloudLinkForImages("generic-speaker-icon.png"); - } - return $photoUrl; - } - - /** - * @param File $big_photo - */ - public function setBigPhoto(File $big_photo): void - { - $this->big_photo = $big_photo; - } - - public function clearBigPhoto():void{ - $this->big_photo = null; - } - - public function clearPhoto():void{ - $this->photo = null; - } - - /** - * @return string|null - */ - public function getCompany():?string - { - return $this->company; - } - - /** - * @param string $company - */ - public function setCompany(string $company): void - { - $this->company = $company; - } - - /** - * @return mixed - */ - public function getPhoneNumber() - { - return $this->phone_number; - } - - /** - * @param mixed $phoner_number - */ - public function setPhoneNumber($phone_number): void - { - $this->phone_number = $phone_number; - } - - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/PresentationSpeakerSummitAssistanceConfirmationRequest.php b/app/Models/Foundation/Summit/Speakers/PresentationSpeakerSummitAssistanceConfirmationRequest.php deleted file mode 100644 index 2b14edd4..00000000 --- a/app/Models/Foundation/Summit/Speakers/PresentationSpeakerSummitAssistanceConfirmationRequest.php +++ /dev/null @@ -1,223 +0,0 @@ -on_site_phone; - } - - /** - * @param string $on_site_phone - */ - public function setOnSitePhone($on_site_phone) - { - $this->on_site_phone = $on_site_phone; - } - - /** - * @return bool - */ - public function isRegistered() - { - return $this->registered; - } - - /** - * @param bool $registered - */ - public function setRegistered($registered) - { - $this->registered = $registered; - } - - /** - * @return bool - */ - public function isConfirmed() - { - return $this->is_confirmed; - } - - /** - * @param bool $is_confirmed - */ - public function setIsConfirmed($is_confirmed) - { - $this->is_confirmed = $is_confirmed; - $this->confirmation_date = new \DateTime('now', new \DateTimeZone(self::DefaultTimeZone)); - } - - /** - * @return bool - */ - public function isCheckedIn() - { - return $this->checked_in; - } - - /** - * @param bool $checked_in - */ - public function setCheckedIn($checked_in) - { - $this->checked_in = $checked_in; - } - - /** - * @return PresentationSpeaker - */ - public function getSpeaker() - { - return $this->speaker; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker($speaker) - { - $this->speaker = $speaker; - } - - use SummitOwned; - - /** - * @return int - */ - public function getSpeakerId(){ - try { - return !is_null($this->speaker) ? $this->speaker->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return \DateTime - */ - public function getConfirmationDate() - { - return $this->confirmation_date; - } - - /** - * @param \DateTime $confirmation_date - */ - public function setConfirmationDate(\DateTime $confirmation_date) - { - $this->confirmation_date = $confirmation_date; - } - - - /** - * @var string - */ - private $token; - - /** - * @return string - */ - public function generateConfirmationToken() { - $generator = new RandomGenerator(); - $this->token = $generator->randomToken(); - $this->confirmation_hash = self::HashConfirmationToken($this->token); - return $this->token; - } - - /** - * @param string $token - * @return string - */ - public static function HashConfirmationToken($token){ - return md5($token); - } - - public function getConfirmationHash():?string{ - return $this->confirmation_hash; - } - - public function getToken():?string{ - return $this->token; - } - - public function __construct() - { - $this->registered = false; - $this->is_confirmed = false; - $this->checked_in = false; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerActiveInvolvement.php b/app/Models/Foundation/Summit/Speakers/SpeakerActiveInvolvement.php deleted file mode 100644 index 650dc927..00000000 --- a/app/Models/Foundation/Summit/Speakers/SpeakerActiveInvolvement.php +++ /dev/null @@ -1,65 +0,0 @@ -involvement; - } - - /** - * @param mixed $involvement - */ - public function setInvolvement($involvement) - { - $this->involvement = $involvement; - } - - /** - * @return bool - */ - public function isDefault() - { - return $this->is_default; - } - - /** - * @param bool $is_default - */ - public function setIsDefault($is_default) - { - $this->is_default = $is_default; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerAnnouncementSummitEmail.php b/app/Models/Foundation/Summit/Speakers/SpeakerAnnouncementSummitEmail.php deleted file mode 100644 index 7102680f..00000000 --- a/app/Models/Foundation/Summit/Speakers/SpeakerAnnouncementSummitEmail.php +++ /dev/null @@ -1,108 +0,0 @@ -type; - } - - /** - * @param string $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return DateTime - */ - public function getSendDate() - { - return $this->send_date; - } - - /** - * @param DateTime $send_date - */ - public function setSendDate(DateTime $send_date) - { - $this->send_date = $send_date; - } - - /** - * @return PresentationSpeaker - */ - public function getSpeaker() - { - return $this->speaker; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker($speaker) - { - $this->speaker = $speaker; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerEditPermissionRequest.php b/app/Models/Foundation/Summit/Speakers/SpeakerEditPermissionRequest.php deleted file mode 100644 index a0f783fe..00000000 --- a/app/Models/Foundation/Summit/Speakers/SpeakerEditPermissionRequest.php +++ /dev/null @@ -1,207 +0,0 @@ -approved = false; - $this->hash = ""; - } - - /** - * @return PresentationSpeaker - */ - public function getSpeaker(): PresentationSpeaker - { - return $this->speaker; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker(PresentationSpeaker $speaker): void - { - $this->speaker = $speaker; - } - - /** - * @return Member - */ - public function getRequestedBy(): Member - { - return $this->requested_by; - } - - /** - * @param Member $requested_by - */ - public function setRequestedBy(Member $requested_by): void - { - $this->requested_by = $requested_by; - } - - /** - * @return bool - */ - public function isApproved():bool - { - return $this->approved; - } - - /** - * @param mixed $approved - */ - public function setApproved($approved): void - { - $this->approved = $approved; - } - - /** - * @return ?DateTime - */ - public function getApprovedDate():?DateTime - { - return $this->approved_date; - } - - /** - * @param DateTime $approved_date - */ - public function setApprovedDate($approved_date): void - { - $this->approved_date = $approved_date; - } - - /** - * @return string - */ - public function getHash():string - { - return $this->hash; - } - - /** - * @return string - */ - public function generateConfirmationToken() { - $generator = new RandomGenerator(); - $token = sprintf("%s.%s.%s",$generator->randomToken(), $this->speaker->getId() , $this->requested_by->getId()); - $this->hash = self::HashConfirmationToken($token); - return $token; - } - - /** - * @param string $token - * @return string - */ - public static function HashConfirmationToken(string $token){ - return md5($token); - } - - public function approve():void{ - $this->approved = true; - $this->approved_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - public function reject():void{ - $this->approved = false; - $this->approved_date = new \DateTime('now', new \DateTimeZone('UTC')); - } - - /** - * @return bool - */ - public function isActionTaken():bool - { - return !is_null( $this->approved_date ); - } - - /** - * @param int $speaker_id - * @param string $token - * @return string - */ - public function getConfirmationLink(int $speaker_id, string $token): string{ - return sprintf("%s/api/public/v1/speakers/%s/edit-permission/%s/approve", Config::get("app.url", '#'), $speaker_id, $token); - } - - /** - * @return int - */ - public function getSpeakerId():int { - try { - return !is_null($this->speaker) ? $this->speaker->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getRequestedById():int { - try { - return !is_null($this->requested_by) ? $this->requested_by->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerExpertise.php b/app/Models/Foundation/Summit/Speakers/SpeakerExpertise.php deleted file mode 100644 index 9aa23670..00000000 --- a/app/Models/Foundation/Summit/Speakers/SpeakerExpertise.php +++ /dev/null @@ -1,89 +0,0 @@ -expertise = $expertise; - } - - /** - * @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="areas_of_expertise") - * @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID") - * @var PresentationSpeaker - */ - private $speaker; - - /** - * @return string - */ - public function getExpertise() - { - return $this->expertise; - } - - /** - * @param string $expertise - */ - public function setExpertise($expertise) - { - $this->expertise = $expertise; - } - - /** - * @return PresentationSpeaker - */ - public function getSpeaker() - { - return $this->speaker; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker($speaker) - { - $this->speaker = $speaker; - } - - /** - * @return int - */ - public function getSpeakerId(){ - try { - return !is_null($this->speaker) ? $this->speaker->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerOrganizationalRole.php b/app/Models/Foundation/Summit/Speakers/SpeakerOrganizationalRole.php deleted file mode 100644 index 0ee4084f..00000000 --- a/app/Models/Foundation/Summit/Speakers/SpeakerOrganizationalRole.php +++ /dev/null @@ -1,78 +0,0 @@ -role = $role; - $this->is_default = $is_default; - } - - /** - * @return mixed - */ - public function getRole() - { - return $this->role; - } - - /** - * @param mixed $role - */ - public function setRole($role) - { - $this->role = $role; - } - - /** - * @return bool - */ - public function isDefault() - { - return $this->is_default; - } - - /** - * @param bool $is_default - */ - public function setIsDefault($is_default) - { - $this->is_default = $is_default; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerRegistrationRequest.php b/app/Models/Foundation/Summit/Speakers/SpeakerRegistrationRequest.php deleted file mode 100644 index 9f2b7b91..00000000 --- a/app/Models/Foundation/Summit/Speakers/SpeakerRegistrationRequest.php +++ /dev/null @@ -1,218 +0,0 @@ -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 getSpeaker() - { - return $this->speaker; - } - - /** - * @return int - */ - public function getSpeakerId(){ - try { - return is_null($this->speaker) ? 0 : $this->speaker->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasSpeaker():bool{ - return $this->getSpeakerId() > 0; - } - - public function clearSpeaker(){ - $this->speaker = null; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker($speaker) - { - $this->speaker = $speaker; - } - - /** - * @return Member - */ - public function getProposer() - { - return $this->proposer; - } - - /** - * @param Member $proposer - */ - public function setProposer($proposer) - { - $this->proposer = $proposer; - } - - /** - * @return string - */ - public function generateConfirmationToken() { - $generator = new RandomGenerator(); - $this->is_confirmed = false; - $this->confirmation_date = null; - $this->token = $generator->randomToken(); - $this->confirmation_hash = self::HashConfirmationToken($this->token); - return $this->token; - } - - public static function HashConfirmationToken($token){ - return md5($token); - } - - /** - * @return string - */ - public function getConfirmationHash() - { - return $this->confirmation_hash; - } - - /** - * @return string - */ - public function getToken() - { - return $this->token; - } - - public function confirm():void{ - $this->confirmation_date = new \DateTime('now', new \DateTimeZone('UTC')); - $this->is_confirmed = true; - } - - public function __construct() - { - parent::__construct(); - $this->is_confirmed = false; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Speakers/SpeakerTravelPreference.php b/app/Models/Foundation/Summit/Speakers/SpeakerTravelPreference.php deleted file mode 100644 index dc55bbfc..00000000 --- a/app/Models/Foundation/Summit/Speakers/SpeakerTravelPreference.php +++ /dev/null @@ -1,100 +0,0 @@ -country = $country; - } - - /** - * @return int - */ - public function getSpeakerId(){ - try { - return !is_null($this->speaker) ? $this->speaker->getId() : 0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return string - */ - public function getCountry() - { - return $this->country; - } - - /** - * @return string - */ - public function getCountryName(){ - if(isset(CountryCodes::$iso_3166_countryCodes[$this->country])) - return CountryCodes::$iso_3166_countryCodes[$this->country]; - return ''; - } - - /** - * @param string $country - */ - public function setCountry($country) - { - $this->country = $country; - } - - /** - * @return PresentationSpeaker - */ - public function getSpeaker() - { - return $this->speaker; - } - - /** - * @param PresentationSpeaker $speaker - */ - public function setSpeaker($speaker) - { - $this->speaker = $speaker; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Sponsor.php b/app/Models/Foundation/Summit/Sponsor.php deleted file mode 100644 index 758cac92..00000000 --- a/app/Models/Foundation/Summit/Sponsor.php +++ /dev/null @@ -1,211 +0,0 @@ -members = new ArrayCollection(); - $this->user_info_grants = new ArrayCollection(); - } - - /** - * @return int - */ - public function getOrder(): ?int - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order): void - { - $this->order = $order; - } - - /** - * @return Company - */ - public function getCompany(): ?Company - { - return $this->company; - } - - /** - * @param Company $company - */ - public function setCompany(Company $company): void - { - $this->company = $company; - } - - /** - * @return SponsorshipType - */ - public function getSponsorship():?SponsorshipType - { - return $this->sponsorship; - } - - /** - * @param SponsorshipType $sponsorship - */ - public function setSponsorship(SponsorshipType $sponsorship): void - { - $this->sponsorship = $sponsorship; - } - - /** - * @return Member[] - */ - public function getMembers() - { - return $this->members; - } - - public function hasSponsorship():bool{ - return $this->getSponsorshipId() > 0; - } - - /** - * @return int - */ - public function getSponsorshipId(){ - try { - return is_null($this->sponsorship) ? 0 : $this->sponsorship->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getCompanyId(){ - try { - return is_null($this->company) ? 0 : $this->company->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @param SponsorUserInfoGrant $grant - */ - public function addUserInfoGrant(SponsorUserInfoGrant $grant){ - if($this->user_info_grants->contains($grant)) return; - $this->user_info_grants->add($grant); - $grant->setSponsor($this); - } - - public function getUserInfoGrants(){ - return $this->user_info_grants; - } - - /** - * @param Member $member - * @return bool - */ - public function hasGrant(Member $member):bool { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('allowed_user', $member)); - $grant = $this->user_info_grants->matching($criteria)->first(); - return $grant !== false; - } - - public function hasCompany():bool{ - return $this->getCompanyId() > 0; - } - - /** - * @param Member $user - */ - public function addUser(Member $user){ - if($this->members->contains($user)) return; - $this->members->add($user); - } - - /** - * @param Member $user - */ - public function removeUser(Member $user){ - if(!$this->members->contains($user)) return; - $this->members->removeElement($user); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/SponsorshipType.php b/app/Models/Foundation/Summit/SponsorshipType.php deleted file mode 100644 index a6ce1624..00000000 --- a/app/Models/Foundation/Summit/SponsorshipType.php +++ /dev/null @@ -1,123 +0,0 @@ -name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getLabel(): string - { - return $this->label; - } - - /** - * @param string $label - */ - public function setLabel(string $label): void - { - $this->label = $label; - } - - /** - * @return int - */ - public function getOrder(): int - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order): void - { - $this->order = $order; - } - - /** - * @return string - */ - public function getSize(): string - { - return $this->size; - } - - /** - * @param string $size - * @throws ValidationException - */ - public function setSize(string $size): void - { - if(!in_array($size, ISponsorshipTypeConstants::AllowedSizes)) - throw new ValidationException("invalid size"); - $this->size = $size; - } - - public function __construct() - { - parent::__construct(); - $this->order = 1; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/Summit.php b/app/Models/Foundation/Summit/Summit.php deleted file mode 100644 index 89e9e193..00000000 --- a/app/Models/Foundation/Summit/Summit.php +++ /dev/null @@ -1,5325 +0,0 @@ -dates_label; - } - - /** - * @param string $dates_label - */ - public function setDatesLabel($dates_label) - { - $this->dates_label = $dates_label; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return mixed - */ - public function getWifiConnections() - { - return $this->wifi_connections; - } - - /** - * @param mixed $wifi_connections - */ - public function setWifiConnections($wifi_connections) - { - $this->wifi_connections = $wifi_connections; - } - - /** - * @return string - */ - public function getExternalSummitId():?string - { - return $this->external_summit_id; - } - - /** - * @param string $external_summit_id - */ - public function setExternalSummitId($external_summit_id) - { - $this->external_summit_id = $external_summit_id; - } - - /** - * @return \DateTime - */ - public function getScheduleDefaultStartDate() - { - return $this->schedule_default_start_date; - } - - /** - * @param \DateTime $schedule_default_start_date - */ - public function setScheduleDefaultStartDate($schedule_default_start_date) - { - $this->schedule_default_start_date = $this->convertDateFromTimeZone2UTC($schedule_default_start_date); - } - - /** - * @param \DateTime $schedule_default_start_date - */ - public function setRawScheduleDefaultStartDate($schedule_default_start_date) - { - $this->schedule_default_start_date = $schedule_default_start_date; - } - - public function clearScheduleDefaultStartDate(){ - $this->schedule_default_start_date = null; - } - - /** - * @return DateTime|null - */ - public function getBeginDate():?DateTime - { - return $this->begin_date; - } - - /** - * @param \DateTime $begin_date - */ - public function setBeginDate($begin_date) - { - $this->begin_date = $this->convertDateFromTimeZone2UTC($begin_date); - } - - public function setRawBeginDate($begin_date){ - $this->begin_date = $begin_date; - } - - /** - * @return $this - */ - public function clearBeginEndDates(){ - $this->begin_date = $this->end_date = null; - return $this; - } - - /** - * @return \DateTime|null - */ - public function getEndDate():?\DateTime - { - return $this->end_date; - } - - /** - * @param \DateTime $end_date - */ - public function setEndDate($end_date) - { - $this->end_date = $this->convertDateFromTimeZone2UTC($end_date); - } - - public function setRawEndDate($end_date){ - $this->end_date = $end_date; - } - - /** - * @return bool - */ - public function getActive() - { - return $this->active; - } - - /** - * @param bool $active - */ - public function setActive($active) - { - $this->active = $active; - } - - /** - * @return \DateTime - */ - public function getStartShowingVenuesDate() - { - return $this->start_showing_venues_date; - } - - /** - * @param \DateTime $start_showing_venues_date - */ - public function setStartShowingVenuesDate($start_showing_venues_date) - { - $this->start_showing_venues_date = $this->convertDateFromTimeZone2UTC($start_showing_venues_date); - } - - /** - * @param \DateTime $start_showing_venues_date - */ - public function setRawStartShowingVenuesDate($start_showing_venues_date) - { - $this->start_showing_venues_date = $start_showing_venues_date; - } - - public function clearStartShowingVenuesDate(){ - $this->start_showing_venues_date = null; - } - - public function clearReassignTicketTillDate(){ - $this->reassign_ticket_till_date = null; - } - - /** - * @return boolean - */ - public function isAvailableOnApi() - { - return $this->available_on_api; - } - - /** - * @param boolean $available_on_api - */ - public function setAvailableOnApi($available_on_api) - { - $this->available_on_api = $available_on_api; - } - - /** - * @return SummitType - */ - public function getType() - { - try { - return $this->type; - } catch (\Exception $ex) { - return null; - } - } - - /** - * @param SummitType $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return int - */ - public function getTypeId() - { - try { - return !is_null($this->type) ? $this->type->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @return bool - */ - public function hasType() - { - return $this->getTypeId() > 0; - } - - /** - * @return string - */ - public function getSummitExternalId() - { - return $this->external_summit_id; - } - - /** - * @return bool - */ - public function isActive() - { - return $this->active; - } - - - const DefaultMaxSubmissionAllowedPerUser = 3; - /** - * Summit constructor. - */ - public function __construct() - { - parent::__construct(); - // default values - $this->active = false; - $this->available_on_api = false; - $this->max_submission_allowed_per_user = self::DefaultMaxSubmissionAllowedPerUser; - $this->meeting_room_booking_slot_length = 60; - $this->meeting_room_booking_max_allowed = 2; - $this->locations = new ArrayCollection; - $this->events = new ArrayCollection; - $this->event_types = new ArrayCollection; - $this->ticket_types = new ArrayCollection; - $this->presentation_categories = new ArrayCollection; - $this->category_groups = new ArrayCollection; - $this->attendees = new ArrayCollection; - $this->entity_events = new ArrayCollection; - $this->wifi_connections = new ArrayCollection; - $this->promo_codes = new ArrayCollection; - $this->speaker_assistances = new ArrayCollection; - $this->excluded_categories_for_accepted_presentations = new ArrayCollection; - $this->excluded_categories_for_alternate_presentations = new ArrayCollection; - $this->excluded_categories_for_rejected_presentations = new ArrayCollection; - $this->excluded_categories_for_upload_slide_decks = new ArrayCollection; - $this->rsvp_templates = new ArrayCollection; - $this->track_tag_groups = new ArrayCollection; - $this->notifications = new ArrayCollection; - $this->selection_plans = new ArrayCollection; - $this->meeting_booking_room_allowed_attributes = new ArrayCollection(); - $this->badge_access_level_types = new ArrayCollection(); - $this->tax_types = new ArrayCollection(); - $this->badge_features_types = new ArrayCollection(); - $this->badge_types = new ArrayCollection(); - $this->summit_sponsors = new ArrayCollection(); - $this->refund_policies = new ArrayCollection(); - $this->order_extra_questions = new ArrayCollection(); - $this->payment_profiles = new ArrayCollection(); - $this->orders = new ArrayCollection(); - $this->registration_disclaimer_mandatory = false; - $this->reassign_ticket_till_date = null; - $this->begin_date = null; - $this->end_date = null; - $this->registration_begin_date = null; - $this->registration_end_date = null; - $this->schedule_shareable_links = new ArrayCollection(); - $this->mark_as_deleted = false; - $this->schedule_og_image_width = 0; - $this->schedule_og_image_height = 0; - $this->email_flows_events = new ArrayCollection(); - $this->summit_documents = new ArrayCollection(); - $this->registration_invitations = new ArrayCollection(); - $this->permission_groups = new ArrayCollection(); - $this->media_upload_types = new ArrayCollection(); - $this->featured_speakers = new ArrayCollection(); - $this->metrics = new ArrayCollection(); - $this->track_chairs = new ArrayCollection(); - $this->presentation_action_types = new ArrayCollection(); - } - - /** - * @param int $assistance_id - * @return PresentationSpeakerSummitAssistanceConfirmationRequest|null - */ - public function getSpeakerAssistanceById($assistance_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($assistance_id))); - $speaker_assistance = $this->speaker_assistances->matching($criteria)->first(); - return $speaker_assistance === false ? null : $speaker_assistance; - } - - /** - * @return DateTime|null - */ - public function getLocalBeginDate():?DateTime - { - return $this->convertDateFromUTC2TimeZone($this->begin_date); - } - - - /** - * @return DateTime|null - */ - public function getLocalBeginAllowBookingDate():?DateTime - { - if(is_null($this->begin_allow_booking_date)) return null; - return $this->convertDateFromUTC2TimeZone($this->begin_allow_booking_date); - } - - /** - * @return DateTime|null - */ - public function getLocalEndAllowBookingDate():?DateTime - { - if(is_null($this->end_allow_booking_date)) return null; - return $this->convertDateFromUTC2TimeZone($this->end_allow_booking_date); - } - - - /** - * @return DateTime - */ - public function getLocalEndDate() - { - return $this->convertDateFromUTC2TimeZone($this->end_date); - } - - /** - * @param SummitAbstractLocation $location - * @return $this - */ - public function addLocation(SummitAbstractLocation $location) - { - if($this->locations->contains($location)) return; - $location->setOrder($this->getLocationMaxOrder() + 1); - $this->locations->add($location); - $location->setSummit($this); - return $this; - } - - /** - * @return int - */ - private function getLocationMaxOrder(){ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $location = $this->locations->matching($criteria)->first(); - return $location === false ? 0 : $location->getOrder(); - } - - /** - * @return ArrayCollection - */ - public function getLocations() - { - return $this->locations; - } - - /** - * @return SummitVenue[] - */ - public function getVenues() - { - return $this->locations->filter(function ($e) { - return $e instanceof SummitVenue; - }); - } - - /** - * @return SummitVenue[] - */ - public function getMainVenues() - { - return $this->locations->filter(function ($e) { - return $e instanceof SummitVenue && $e->getIsMain(); - }); - } - - /** - * @param string $name - * @return SummitAbstractLocation|null - */ - public function getLocationByName($name){ - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $location = $this->locations->matching($criteria)->first(); - return $location === false ? null : $location; - } - - /** - * @return SummitHotel[] - */ - public function getHotels() - { - return $this->locations->filter(function ($e) { - return $e instanceof SummitHotel; - }); - } - - /** - * @return SummitBookableVenueRoom[] - */ - public function getBookableRooms() - { - return $this->locations->filter(function ($e) { - return $e instanceof SummitBookableVenueRoom; - }); - } - - - /** - * @return SummitAirport[] - */ - public function getAirports() - { - return $this->locations->filter(function ($e) { - return $e instanceof SummitAirport; - }); - } - - /** - * @return SummitExternalLocation[] - */ - public function getExternalLocations() - { - return $this->locations->filter(function ($e) { - return $e->getClassName() == 'SummitExternalLocation'; - }); - } - - /** - * @return ArrayCollection - */ - public function getEvents() - { - return $this->events; - } - - /** - * @param string $externalId - * @return SummitEvent|null - */ - public function getEventByExternalId(string $externalId):?SummitEvent{ - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('external_id', trim($externalId))); - $event = $this->events->matching($criteria)->first(); - return $event === false ? null : $event; - } - - /** - * @param int $id - * @return SummitEvent|null - */ - public function getEventById(int $id):?SummitEvent{ - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $event = $this->events->matching($criteria)->first(); - return $event === false ? null : $event; - } - - /** - * @param SummitEvent $event - */ - public function addEvent(SummitEvent $event) - { - if($this->events->contains($event)) return; - $this->events->add($event); - $event->setSummit($this); - } - - public function removeEvent(SummitEvent $event){ - if(!$this->events->contains($event)) return; - $this->events->removeElement($event); - $event->clearSummit(); - } - - /** - * @return File - */ - public function getLogo() - { - return $this->logo; - } - - /** - * @param File $logo - */ - public function setLogo(File $logo):void{ - $this->logo = $logo; - } - - public function clearLogo():void{ - $this->logo = null; - } - - /** - * @return bool - */ - public function hasLogo() - { - return $this->getLogoId() > 0; - } - - /** - * @return int - */ - public function getLogoId() - { - try { - return !is_null($this->logo) ? $this->logo->getId() : 0; - } catch (\Exception $ex) { - return 0; - } - } - - /** - * @param int $location_id - * @return SummitAbstractLocation - */ - public function getLocation($location_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($location_id))); - $location = $this->locations->matching($criteria)->first(); - return $location === false ? null : $location; - } - - /** - * @param SummitAbstractLocation $location - * @return bool - */ - static public function isPrimaryLocation(SummitAbstractLocation $location){ - return ($location instanceof SummitVenue - || $location instanceof SummitHotel - || $location instanceof SummitAirport - || $location instanceof SummitExternalLocation); - } - - /** - * @return ArrayCollection - */ - public function getEventTypes() - { - return $this->event_types; - } - - /** - * @param int $event_type_id - * @return SummitEventType|null - */ - public function getEventType($event_type_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($event_type_id))); - $event_type = $this->event_types->matching($criteria)->first(); - return $event_type === false ? null : $event_type; - } - - /** - * @param string $type - * @return bool - */ - public function hasEventType($type) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('type', $type)); - return $this->event_types->matching($criteria)->count() > 0; - } - - /** - * @param string $type - * @return SummitEventType|null - */ - public function getEventTypeByType($type) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('type', $type)); - $event_type = $this->event_types->matching($criteria)->first(); - return $event_type === false ? null : $event_type; - } - - /** - * @param int $wifi_connection_id - * @return SummitWIFIConnection|null - */ - public function getWifiConnection($wifi_connection_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($wifi_connection_id))); - $wifi_conn = $this->wifi_connections->matching($criteria)->first(); - return $wifi_conn === false ? null : $wifi_conn; - } - - /** - * @return ArrayCollection - */ - public function getTicketTypes() - { - return $this->ticket_types; - } - - /** - * @param string $ticket_type_external_id - * @return SummitTicketType|null - */ - public function getTicketTypeByExternalId($ticket_type_external_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('external_id', $ticket_type_external_id)); - $ticket_type = $this->ticket_types->matching($criteria)->first(); - return $ticket_type === false ? null : $ticket_type; - } - - /** - * @param int $event_id - * @return null|SummitEvent - */ - public function getScheduleEvent($event_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('published', 1)); - $criteria->andWhere(Criteria::expr()->eq('id', intval($event_id))); - $event = $this->events->matching($criteria)->first(); - return $event === false ? null : $event; - } - - /** - * @param int $event_id - * @return bool - */ - public function isEventOnSchedule($event_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('published', 1)); - $criteria->andWhere(Criteria::expr()->eq('id', intval($event_id))); - return $this->events->matching($criteria)->count() > 0; - } - - public function getScheduleEvents() - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('published', 1)); - $criteria->orderBy(["start_date" => Criteria::ASC, "end_date" => Criteria::ASC]); - return $this->events->matching($criteria); - } - - /** - * @return Presentation[] - */ - public function getPresentations() - { - $query = $this->createQuery("SELECT p from models\summit\Presentation p JOIN p.summit s WHERE s.id = :summit_id"); - return $query->setParameter('summit_id', $this->getIdentifier())->getResult(); - } - - - public function getPublishedPresentations() - { - $query = $this->createQuery("SELECT p from models\summit\Presentation p JOIN p.summit s WHERE s.id = :summit_id and p.published = 1"); - return $query->setParameter('summit_id', $this->getIdentifier())->getResult(); - } - - public function getPublishedEvents() - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('published', 1)); - return $this->events->matching($criteria); - } - - /** - * @param PresentationSpeaker $speaker - * @param SelectionPlan|null $selectionPlan - * @return array - */ - public function getModeratedPresentationsBy(PresentationSpeaker $speaker, SelectionPlan $selectionPlan = null){ - $selection_plan_cond = ""; - if(!is_null($selectionPlan)){ - $selection_plan_cond = " and sp.id = :selection_plan_id"; - } - - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.moderator m - JOIN p.selection_plan sp - WHERE s.id = :summit_id and m.id = :moderator_id".$selection_plan_cond); - - $query = $query - ->setParameter('summit_id', $this->getIdentifier()) - ->setParameter('moderator_id', $speaker->getIdentifier()); - - if(!is_null($selectionPlan)){ - $query = $query->setParameter('selection_plan_id', $selectionPlan->getIdentifier()); - } - return $query->getResult(); - } - - /** - * @param PresentationSpeaker $speaker - * @param SelectionPlan|null $selectionPlan - * @return array - */ - public function getCreatedPresentations(PresentationSpeaker $speaker, SelectionPlan $selectionPlan = null){ - $selection_plan_cond = ""; - - if(!is_null($selectionPlan)){ - $selection_plan_cond = " and sp.id = :selection_plan_id"; - } - - $query = $this->createQuery("SELECT p from models\summit\Presentation p - JOIN p.summit s - JOIN p.created_by c - JOIN p.selection_plan sp - WHERE s.id = :summit_id and c.id = :creator_id".$selection_plan_cond); - - $query = $query - ->setParameter('summit_id', $this->getIdentifier()) - ->setParameter('creator_id', $speaker->getMemberId()); - - if(!is_null($selectionPlan)){ - $query = $query->setParameter('selection_plan_id', $selectionPlan->getIdentifier()); - } - - return $query->getResult(); - } - - /** - * @param int $event_id - * @return null|SummitEvent - */ - public function getEvent($event_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($event_id))); - $event = $this->events->matching($criteria)->first(); - return $event === false ? null : $event; - } - - - /** - * @return PresentationCategory[] - */ - public function getPresentationCategories() - { - return $this->presentation_categories; - } - - /** - * @param PresentationCategory $track - * @return $this - */ - public function addPresentationCategory(PresentationCategory $track) - { - $this->presentation_categories->add($track); - $track->setSummit($this); - return $this; - } - - /** - * @param int $category_id - * @return PresentationCategory - */ - public function getPresentationCategory($category_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($category_id))); - $category = $this->presentation_categories->matching($criteria)->first(); - return $category === false ? null : $category; - } - - /** - * @param string $category_title - * @return PresentationCategory - */ - public function getPresentationCategoryByTitle($category_title) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('title', trim($category_title))); - $category = $this->presentation_categories->matching($criteria)->first(); - return $category === false ? null : $category; - } - - /** - * @param string $category_code - * @return PresentationCategory - */ - public function getPresentationCategoryByCode($category_code) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('code', trim($category_code))); - $category = $this->presentation_categories->matching($criteria)->first(); - return $category === false ? null : $category; - } - - /** - * @return PresentationCategoryGroup[] - */ - public function getCategoryGroups() - { - return $this->category_groups; - } - - /** - * @param int $group_id - * @return null|PresentationCategoryGroup - */ - public function getCategoryGroupById($group_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($group_id))); - $group = $this->category_groups->matching($criteria)->first(); - return $group === false ? null : $group; - } - - /** - * @param string $name - * @return null|PresentationCategoryGroup - */ - public function getCategoryGroupByName($name) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $group = $this->category_groups->matching($criteria)->first(); - return $group === false ? null : $group; - } - - /** - * @param PresentationCategoryGroup $track_group - */ - public function addCategoryGroup(PresentationCategoryGroup $track_group){ - if($this->category_groups->contains($track_group)) return; - $this->category_groups->add($track_group); - $track_group->setSummit($this); - } - - /** - * @param PresentationCategoryGroup $track_group - */ - public function removeCategoryGroup(PresentationCategoryGroup $track_group){ - if(!$this->category_groups->contains($track_group)) return; - $this->category_groups->removeElement($track_group); - $track_group->clearSummit(); - } - - /** - * @param int $member_id - * @return SummitAttendee|null - */ - public function getAttendeeByMemberId($member_id):?SummitAttendee - { - $builder = $this->createQueryBuilder(); - $members = $builder - ->select('a') - ->from('models\summit\SummitAttendee', 'a') - ->join('a.member', 'm') - ->join('a.summit', 's') - ->where('s.id = :summit_id and m.id = :member_id') - ->setParameter('summit_id', $this->getId()) - ->setParameter('member_id', intval($member_id)) - ->getQuery()->getResult(); - return count($members) > 0 ? $members[0] : null; - } - - /** - * @param Member $member - * @return SummitAttendee|null - */ - public function getAttendeeByMember(Member $member):?SummitAttendee - { - return $this->getAttendeeByMemberId($member->getId()); - } - - /** - * @param SummitAttendee $attendee - */ - public function addAttendee(SummitAttendee $attendee){ - if($this->attendees->contains($attendee)) return; - $this->attendees->add($attendee); - $attendee->setSummit($this); - } - - /** - * @param int $attendee_id - * @return SummitAttendee|null - */ - public function getAttendeeById($attendee_id):?SummitAttendee - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($attendee_id))); - $attendee = $this->attendees->matching($criteria)->first(); - return $attendee === false ? null : $attendee; - } - - /** - * @param string $email - * @return SummitAttendee|null - */ - public function getAttendeeByEmail(string $email):?SummitAttendee - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('email', strtolower(trim($email)))); - $attendee = $this->attendees->matching($criteria)->first(); - return $attendee === false ? null : $attendee; - } - - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitEntityEvent", mappedBy="summit", cascade={"persist"}, orphanRemoval=true) - * @var SummitEntityEvent[] - */ - private $entity_events; - - /** - * @ORM\OneToMany(targetEntity="models\summit\SummitPushNotification", mappedBy="summit", cascade={"persist"}, orphanRemoval=true) - * @var SummitPushNotification[] - */ - private $notifications; - - /** - * @param SummitEvent $summit_event - * @return bool - */ - public function isEventInsideSummitDuration(SummitEvent $summit_event) - { - return $this->isTimeFrameInsideSummitDuration($summit_event->getLocalStartDate(), $summit_event->getLocalEndDate()); - } - - /** - * @param DateTime $start_date - * @param DateTime $end_date - * @return bool - */ - public function isTimeFrameInsideSummitDuration(DateTime $start_date, DateTime $end_date ) - { - $summit_start_date = $this->getLocalBeginDate(); - $summit_end_date = $this->getLocalEndDate(); - - return $start_date >= $summit_start_date && $start_date <= $summit_end_date && - $end_date <= $summit_end_date && $end_date >= $start_date; - } - - /** - * @param DateTime $start_date - * @param DateTime $end_date - * @return bool - */ - public function isTimeFrameOnBookingPeriod(DateTime $start_date, DateTime $end_date):bool - { - if(is_null($this->begin_allow_booking_date)) return false; - if(is_null($this->end_allow_booking_date)) return false; - - return $start_date >= $this->convertDateFromUTC2TimeZone($this->begin_allow_booking_date) && $start_date <= $this->convertDateFromUTC2TimeZone($this->end_allow_booking_date) && - $end_date <= $this->convertDateFromUTC2TimeZone($this->end_allow_booking_date) && $end_date >= $start_date; - } - - /** - * @param bool $filter_published_events - * @return \Doctrine\ORM\QueryBuilder - */ - private function buildModeratorsQuery($filter_published_events = true) - { - $query = $this->createQueryBuilder() - ->select('distinct ps') - ->from('models\summit\PresentationSpeaker', 'ps') - ->join('ps.moderated_presentations', 'p') - ->join('p.summit', 's') - ->where("s.id = :summit_id"); - if ($filter_published_events) - $query = $query->andWhere("p.published = 1"); - return $query->setParameter('summit_id', $this->getId()); - } - - /** - * @param bool $filter_published_events - * @return \Doctrine\ORM\QueryBuilder - */ - private function buildSpeakersQuery($filter_published_events = true) - { - $query = $this->createQueryBuilder() - ->select('distinct ps') - ->from('models\summit\PresentationSpeaker', 'ps') - ->join('ps.presentations', 'p') - ->join('p.summit', 's') - ->where("s.id = :summit_id"); - - if ($filter_published_events) - $query = $query->andWhere("p.published = 1"); - return $query->setParameter('summit_id', $this->getId()); - } - - /** - * @return \Doctrine\ORM\QueryBuilder - */ - private function buildSpeakerSummitAttendanceQuery() - { - return $this->createQueryBuilder() - ->select('distinct ps') - ->from('models\summit\PresentationSpeaker', 'ps') - ->join('ps.summit_assistances', 'a') - ->join('a.summit', 's') - ->where("s.id = :summit_id") - ->setParameter('summit_id', $this->getId()); - } - - /** - * @return PresentationSpeaker[] - */ - public function getSpeakers() - { - // moderators - $moderators = $this->buildModeratorsQuery()->getQuery()->getResult(); - // get moderators ids to exclude from speakers - $moderators_ids = array(); - foreach ($moderators as $m) { - $moderators_ids[] = $m->getId(); - } - - // speakers - $sbuilder = $this->buildSpeakersQuery(); - - if (count($moderators_ids) > 0) { - $moderators_ids = implode(', ', $moderators_ids); - $sbuilder = $sbuilder->andWhere("ps.id not in ({$moderators_ids})"); - } - - $speakers = $sbuilder->getQuery()->getResult(); - - return array_merge($speakers, $moderators); - } - - /** - * @param Member $member - * @return PresentationSpeaker|null - */ - public function getSpeakerByMember(Member $member) - { - return $this->getSpeakerByMemberId($member->getId()); - } - - /**` - * @param int $member_id - * @param bool $filter_published_events - * @return PresentationSpeaker|null - */ - public function getSpeakerByMemberId($member_id, $filter_published_events = true) - { - // moderators - $moderator = $this->buildModeratorsQuery($filter_published_events) - ->join('ps.member', 'mb') - ->andWhere('mb.id = :member_id') - ->setParameter('member_id', $member_id) - ->getQuery()->getOneOrNullResult(); - - if (!is_null($moderator)) return $moderator; - - // speakers - $speaker = $this->buildSpeakersQuery($filter_published_events) - ->join('ps.member', 'mb') - ->andWhere('mb.id = :member_id') - ->setParameter('member_id', $member_id) - ->getQuery()->getOneOrNullResult(); - - if (!is_null($speaker)) return $speaker; - - // assistance - $speaker = $this->buildSpeakerSummitAttendanceQuery() - ->join('ps.member', 'mb') - ->andWhere('mb.id = :member_id') - ->setParameter('member_id', $member_id) - ->getQuery()->getOneOrNullResult(); - - if (!is_null($speaker)) return $speaker; - - return null; - } - - /** - * @param int $speaker_id - * @param bool $filter_published_events - * @return PresentationSpeaker|null - */ - public function getSpeaker($speaker_id, $filter_published_events = true) - { - // moderators - $moderator = $this->buildModeratorsQuery($filter_published_events) - ->andWhere('ps.id = :speaker_id') - ->setParameter('speaker_id', $speaker_id) - ->getQuery()->getOneOrNullResult(); - - if (!is_null($moderator)) return $moderator; - - // speakers - $speaker = $this->buildSpeakersQuery($filter_published_events) - ->andWhere('ps.id = :speaker_id') - ->setParameter('speaker_id', $speaker_id) - ->getQuery()->getOneOrNullResult(); - - if (!is_null($speaker)) return $speaker; - - // attendance - $speaker = $this->buildSpeakerSummitAttendanceQuery() - ->andWhere('ps.id = :speaker_id') - ->setParameter('speaker_id', $speaker_id) - ->getQuery()->getOneOrNullResult(); - - if (!is_null($speaker)) return $speaker; - - return null; - } - - /** - * @return Company[] - */ - public function getEventSponsors() - { - $builder = $this->createQueryBuilder(); - return $builder - ->select('distinct c') - ->from('models\main\Company', 'c') - ->join('c.sponsorships', 'sp') - ->join('sp.summit', 's') - ->where('s.id = :summit_id and sp.published = 1') - ->setParameter('summit_id', $this->getId())->getQuery()->getResult(); - } - - /** - * @return string - */ - public function getMainPage() - { - $path = $this->getSchedulePage(); - if(empty($path)) return ''; - $paths = explode("/", $path); - array_pop($paths); - return join("/", $paths); - } - - /** - * @return string - */ - public function getSchedulePage() - { - $paths = []; - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute(['summit_id' => $this->id]); - $res = $stmt->fetchAll(); - if(count($res) == 0 ) return ''; - $segment = $res[0]['URLSegment']; - $parent_id = intval($res[0]['ParentID']); - - $paths[] = $segment; - do{ - $sql = <<prepareRawSQL($sql); - $stmt->execute(['parent_id' => $parent_id]); - $res = $stmt->fetchAll(); - if(count($res) == 0 ) break; - $segment = $res[0]['URLSegment']; - $parent_id = intval($res[0]['ParentID']); - $paths[] = $segment; - } while($parent_id > 0); - - } catch (\Exception $ex) { - return ''; - } - return join("/", array_reverse($paths)); - } - - /** - * @param SummitEvent $summit_event - * @param Member|null $member - * @return bool - * @throws ValidationException - */ - static public function allowToSee(SummitEvent $summit_event, Member $member = null) - { - - $event_type = $summit_event->getType(); - - if (is_null($event_type)) - throw new ValidationException(sprintf("event type is null for event id %s", $summit_event->getId())); - - if (!$event_type->isPrivate()) return true; - - if (is_null($member)) return false; - - if ($member->isAdmin()) return true; - - // i am logged, check if i have permissions - if ($summit_event instanceof SummitGroupEvent) { - - $member_groups_code = []; - $event_groups_code = []; - - foreach ($member->getGroups() as $member_group) { - $member_groups_code[] = $member_group->getCode(); - } - - foreach ($summit_event->getGroups() as $event_group) { - $event_groups_code[] = $event_group->getCode(); - } - - return count(array_intersect($event_groups_code, $member_groups_code)) > 0; - } - return true; - } - - /** - * @param Member $member - * @return SummitGroupEvent[] - */ - public function getGroupEventsFor(Member $member) - { - $builder = $this->createQueryBuilder() - ->select('distinct eg') - ->from('models\summit\SummitGroupEvent', 'eg') - ->join('eg.groups', 'g') - ->join('eg.summit', 's') - ->where("s.id = :summit_id and eg.published = 1") - ->setParameter('summit_id', $this->getId()); - - if (!$member->isAdmin()) { - $groups_ids = $member->getGroupsIds(); - if (count($groups_ids) == 0) return []; - $groups_ids = implode(",", $groups_ids); - $builder->andWhere("g.id in ({$groups_ids})"); - } - - return $builder->getQuery()->getResult(); - } - - /** - * @param string $suffix - * @return string - */ - public function getSlug($suffix='-summit') - { - $res = $this->name; - - if(!is_null($this->begin_date)) { - $res .= $this->begin_date->format('Y') . $suffix; - } - - return strtolower(preg_replace('/[^a-zA-Z0-9\-]/', '', $res)); - } - - - public function generateRegistrationSlugPrefix():void{ - $newSlug = $this->getSlug(""); - if(empty($this->registration_slug_prefix) || $this->registration_slug_prefix != $newSlug){ - $this->registration_slug_prefix = $newSlug; - } - } - /** - * @return string - */ - public function getRegistrationSlugPrefix():string{ - $this->generateRegistrationSlugPrefix(); - return $this->registration_slug_prefix; - } - - /** - * @return string - */ - public function getOrderQRPrefix():string{ - return strtoupper('ORDER_'.$this->getRegistrationSlugPrefix()); - } - - /** - * @return string - */ - public function getTicketQRPrefix():string{ - return strtoupper('TICKET_'.$this->getRegistrationSlugPrefix()); - } - - /** - * @return string - */ - public function getBadgeQRPrefix():string{ - return strtoupper('BADGE_'.$this->getRegistrationSlugPrefix()); - } - - /** - * @return int - */ - public function getPresentationVotesCount() - { - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute(['summit_id' => $this->id]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - - } - return 0; - } - - /** - * @return int - */ - public function getPresentationVotersCount() - { - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute(['summit_id' => $this->id]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - - } - return 0; - } - - /** - * @return int - */ - public function getAttendeesCount() - { - return $this->attendees->count(); - } - - public function getAttendees(){ - return $this->attendees; - } - - /** - * @return int - */ - public function getPaidTicketsCount():int{ - return $this->geTicketsCountByStatus(IOrderConstants::PaidStatus); - } - /** - * @param string $status - * @return int - */ - public function geTicketsCountByStatus(string $status):int - { - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute([ - 'summit_id' => $this->id, - 'status' => $status - ]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - - } - return 0; - } - - /** - * @return int - */ - public function getSpeakersCount() - { - return count($this->getSpeakers()); - } - - /** - * @return int - */ - public function getPresentationsSubmittedCount() - { - - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute(['summit_id' => $this->id, 'status' => Presentation::STATUS_RECEIVED]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - - } - return 0; - } - - /** - * @return int - */ - public function getPublishedEventsCount() - { - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute(['summit_id' => $this->id]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - - } - return 0; - } - - // speakers emails info - - /** - * @param strign $type - * @return int - */ - public function getSpeakerAnnouncementEmailCount($type) - { - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute(['summit_id' => $this->id, 'type' => $type]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - return count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - - } - return 0; - } - - /** - * @return int - */ - public function getSpeakerAnnouncementEmailAcceptedCount() - { - return $this->getSpeakerAnnouncementEmailCount('ACCEPTED'); - } - - /** - * @return int - */ - public function getSpeakerAnnouncementEmailRejectedCount() - { - return $this->getSpeakerAnnouncementEmailCount('REJECTED'); - } - - /** - * @return int - */ - public function getSpeakerAnnouncementEmailAlternateCount() - { - return $this->getSpeakerAnnouncementEmailCount('ALTERNATE'); - } - - /** - * @return int - */ - public function getSpeakerAnnouncementEmailAcceptedAlternateCount() - { - return $this->getSpeakerAnnouncementEmailCount('ACCEPTED_ALTERNATE'); - } - - /** - * @return int - */ - public function getSpeakerAnnouncementEmailAcceptedRejectedCount() - { - return $this->getSpeakerAnnouncementEmailCount('ACCEPTED_REJECTED'); - } - - /** - * @return int - */ - public function getSpeakerAnnouncementEmailAlternateRejectedCount() - { - return $this->getSpeakerAnnouncementEmailCount('ALTERNATE_REJECTED'); - } - - /** - * @param SummitRegistrationPromoCode $promo_code - */ - public function addPromoCode(SummitRegistrationPromoCode $promo_code) - { - $this->promo_codes->add($promo_code); - $promo_code->setSummit($this); - } - - /** - * @param string $code - * @return SummitRegistrationPromoCode|null - */ - public function getPromoCodeByCode($code) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('code', trim($code))); - $promo_code = $this->promo_codes->matching($criteria)->first(); - return $promo_code === false ? null : $promo_code; - } - - /** - * @param int $promo_code_id - * @return SummitRegistrationPromoCode|null - */ - public function getPromoCodeById($promo_code_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $promo_code_id)); - $promo_code = $this->promo_codes->matching($criteria)->first(); - return $promo_code === false ? null : $promo_code; - } - - /** - * @param SummitRegistrationPromoCode $promo_code - * @return $this - */ - public function removePromoCode(SummitRegistrationPromoCode $promo_code) - { - $this->promo_codes->removeElement($promo_code); - $promo_code->clearSummit(); - return $this; - } - - /** - * @param SummitEventType $event_type - * @return $this - */ - public function removeEventType(SummitEventType $event_type) - { - $this->event_types->removeElement($event_type); - $event_type->clearSummit(); - return $this; - } - - /** - * @return PresentationCategory[] - */ - public function getExcludedCategoriesForAcceptedPresentations() - { - return $this->excluded_categories_for_accepted_presentations->toArray(); - } - - /** - * @return PresentationCategory[] - */ - public function getExcludedCategoriesForAlternatePresentations() - { - return $this->excluded_categories_for_alternate_presentations->toArray(); - } - - /** - * @return PresentationCategory[] - */ - public function getExcludedCategoriesForRejectedPresentations() - { - return $this->excluded_categories_for_rejected_presentations->toArray(); - } - - /** - * @return PresentationCategory[] - */ - public function getExcludedCategoriesForUploadSlideDecks() - { - return $this->excluded_categories_for_upload_slide_decks->toArray(); - } - - /** - * @param SummitEventType $event_type - * @return $this - */ - public function addEventType(SummitEventType $event_type) - { - $this->event_types->add($event_type); - $event_type->setSummit($this); - return $this; - } - - /** - * @param SummitTicketType $ticket_type - * @return $this - */ - public function addTicketType(SummitTicketType $ticket_type) - { - $this->ticket_types->add($ticket_type); - $ticket_type->setSummit($this); - return $this; - } - - /** - * @return int - */ - public function getTicketTypesCount():int{ - return $this->ticket_types->count(); - } - - /** - * @return bool - */ - public function hasTicketTypes():bool { - return $this->getTicketTypesCount() > 0; - } - - - /** - * @return null|string - * @throws ValidationException - */ - public function getDefaultTicketTypeCurrency():?string{ - $default_currency = null; - foreach ($this->ticket_types as $ticket_type){ - $ticket_type_currency = $ticket_type->getCurrency(); - if(empty($ticket_type_currency)) continue; - if(empty($default_currency)) { $default_currency = $ticket_type_currency; continue;} - if($ticket_type_currency != $default_currency) - throw new ValidationException(sprintf("all ticket types for summit %s should have same currency", $this->getId())); - } - return $default_currency; - } - /** - * @param SummitTicketType $ticket_type - * @return $this - */ - public function removeTicketType(SummitTicketType $ticket_type) - { - $this->ticket_types->removeElement($ticket_type); - $ticket_type->clearSummit(); - return $this; - } - - /** - * @param string $name - * @return SummitTicketType|null - */ - public function getTicketTypeByName($name){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $res = $this->ticket_types->matching($criteria)->first(); - return $res === false ? null : $res; - } - - - /** - * @param int $id - * @return SummitTicketType|null - */ - public function getTicketTypeById($id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $res = $this->ticket_types->matching($criteria)->first(); - return $res === false ? null : $res; - } - - /** - * @param int $rsvp_template_id - * @return RSVPTemplate|null - */ - public function getRSVPTemplateById($rsvp_template_id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($rsvp_template_id))); - $rsvp_template = $this->rsvp_templates->matching($criteria)->first(); - return $rsvp_template === false ? null : $rsvp_template; - } - - /** - * @param string $rsvp_template_title - * @return RSVPTemplate|null - */ - public function getRSVPTemplateByTitle($rsvp_template_title){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('title', trim($rsvp_template_title))); - $rsvp_template = $this->rsvp_templates->matching($criteria)->first(); - return $rsvp_template === false ? null : $rsvp_template; - } - - /** - * @param RSVPTemplate $template - * @return $this - */ - public function addRSVPTemplate(RSVPTemplate $template){ - if($this->rsvp_templates->contains($template)) return; - $this->rsvp_templates->add($template); - $template->setSummit($this); - return $this; - } - - /** - * @param RSVPTemplate $template - * @return $this - */ - public function removeRSVPTemplate(RSVPTemplate $template){ - if(!$this->rsvp_templates->contains($template)) return; - $this->rsvp_templates->removeElement($template); - $template->clearSummit(); - return $this; - } - - use OrderableChilds; - - /** - * @param SummitAbstractLocation $location - * @param int $new_order - * @throws ValidationException - */ - public function recalculateLocationOrder(SummitAbstractLocation $location, $new_order){ - - $criteria = Criteria::create(); - $criteria->orderBy(['order'=> 'ASC']); - $filtered_locations = []; - - foreach($this->locations->matching($criteria)->toArray() as $l){ - if(Summit::isPrimaryLocation($l)) - $filtered_locations[] = $l; - } - - self::recalculateOrderForCollection($filtered_locations, $location, $new_order); - } - - /** - * @return int[] - */ - public function getScheduleEventsIds():array{ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this); - - return $native_query->getResult(); - } - - /** - * @param SummitAbstractLocation $location - * @return int[] - */ - public function getScheduleEventsIdsPerLocation(SummitAbstractLocation $location){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this); - $native_query->setParameter("location", $location); - - $res = $native_query->getResult(); - - return $res; - } - - /** - * @param SummitAbstractLocation $location - * @return $this - */ - public function removeLocation(SummitAbstractLocation $location){ - $this->locations->removeElement($location); - $location->setSummit(null); - return $this; - } - - /** - * @param string $calendar_sync_name - */ - public function setCalendarSyncName($calendar_sync_name) - { - $this->calendar_sync_name = $calendar_sync_name; - } - - /** - * @param string $calendar_sync_desc - */ - public function setCalendarSyncDesc($calendar_sync_desc) - { - $this->calendar_sync_desc = $calendar_sync_desc; - } - - /** - * @return string - */ - public function getLink() - { - return $this->link; - } - - /** - * @param string $link - */ - public function setLink($link) - { - $this->link = $link; - } - - /** - * @return string - */ - public function getRegistrationLink() - { - return $this->registration_link; - } - - /** - * @param string $registration_link - */ - public function setRegistrationLink($registration_link) - { - $this->registration_link = $registration_link; - } - - /** - * @return int - */ - public function getMaxSubmissionAllowedPerUser() - { - return $this->max_submission_allowed_per_user; - } - - /** - * @param int $max_submission_allowed_per_user - */ - public function setMaxSubmissionAllowedPerUser($max_submission_allowed_per_user) - { - $this->max_submission_allowed_per_user = $max_submission_allowed_per_user; - } - - /** - * @param SummitPushNotification $notification - * @return $this - */ - public function addNotification(SummitPushNotification $notification){ - $this->notifications->add($notification); - $notification->setSummit($this); - return $this; - } - - /** - * @return string - */ - public function getTimeZoneId() - { - return $this->time_zone_id; - } - - /** - * @param string $time_zone_id - */ - public function setTimeZoneId($time_zone_id) - { - $this->time_zone_id = $time_zone_id; - } - - /** - * @return string - */ - public function getSecondaryRegistrationLink() - { - return $this->secondary_registration_link; - } - - /** - * @param string $secondary_registration_link - */ - public function setSecondaryRegistrationLink($secondary_registration_link) - { - $this->secondary_registration_link = $secondary_registration_link; - } - - /** - * @return string - */ - public function getSecondaryRegistrationLabel() - { - return $this->secondary_registration_label; - } - - /** - * @param string $secondary_registration_label - */ - public function setSecondaryRegistrationLabel($secondary_registration_label) - { - $this->secondary_registration_label = $secondary_registration_label; - } - - /** - * @param int $notification_id - * @return SummitPushNotification|null - */ - public function getNotificationById($notification_id){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($notification_id))); - $notification = $this->notifications->matching($criteria)->first(); - return $notification === false ? null : $notification; - } - - /** - * @param SummitPushNotification $notification - * @return $this - */ - public function removeNotification(SummitPushNotification $notification){ - $this->notifications->removeElement($notification); - $notification->clearSummit(); - return $this; - } - - /** - * @return string - */ - public function getCalendarSyncName() - { - return $this->calendar_sync_name; - } - - /** - * @return string - */ - public function getCalendarSyncDesc() - { - return $this->calendar_sync_desc; - } - - /** - * @return DateTime - */ - public function getRegistrationBeginDate():?DateTime - { - return $this->registration_begin_date; - } - - /** - * @return bool - * @throws \Exception - */ - public function isRegistrationPeriodOpen():bool { - return $this->isDateOnRegistrationPeriod(new \DateTime('now', new \DateTimeZone('UTC'))); - } - - /** - * @param DateTime $date - * @return bool - */ - public function isDateOnRegistrationPeriod(DateTime $date):bool{ - if (!is_null($this->registration_begin_date) && !is_null($this->registration_end_date)) { - return $date >= $this->registration_begin_date && $date <= $this->registration_end_date; - } - return false; - } - - public function isRegistrationPeriodDefined():bool{ - return !is_null($this->registration_begin_date) && !is_null($this->registration_end_date); - } - - /** - * @param DateTime $registration_begin_date - */ - public function setRegistrationBeginDate(DateTime $registration_begin_date){ - $this->registration_begin_date = $this->convertDateFromTimeZone2UTC($registration_begin_date); - } - - public function setRawRegistrationBeginDate(DateTime $registration_begin_date){ - $this->registration_begin_date = $registration_begin_date; - } - - public function setRawRegistrationEndDate(DateTime $registration_end_date){ - $this->registration_end_date = $registration_end_date; - } - - /** - * @return $this - */ - public function clearRegistrationDates(){ - $this->registration_begin_date = $this->registration_end_date = null; - return $this; - } - - /** - * @return DateTime - */ - public function getRegistrationEndDate():?DateTime - { - return $this->registration_end_date; - } - - /** - * @param DateTime $registration_end_date - */ - public function setRegistrationEndDate(DateTime $registration_end_date){ - $this->registration_end_date = $this->convertDateFromTimeZone2UTC($registration_end_date); - } - - /** - * @return SelectionPlan[] - */ - public function getSelectionPlans() - { - return $this->selection_plans; - } - - /** - * @param SelectionPlan $selection_plan - * @throws ValidationException - * @return bool - */ - public function checkSelectionPlanConflicts(SelectionPlan $selection_plan){ - if(!$selection_plan->IsEnabled()) return true; - foreach ($this->selection_plans as $sp){ - if(!$sp->IsEnabled()) continue; - if($sp->getId() == $selection_plan->getId()) continue; - - $start1 = $selection_plan->getSelectionBeginDate(); - $end1 = $selection_plan->getSelectionEndDate(); - $start2 = $sp->getSelectionBeginDate(); - $end2 = $sp->getSelectionEndDate(); - - if(!is_null($start1) && !is_null($end1) && - !is_null($start2) && !is_null($end2) - && DateUtils::checkTimeFramesOverlap - ( - $start1, - $end1, - $start2, - $end2 - ) - ) - throw new ValidationException(trans( - 'validation_errors.Summit.checkSelectionPlanConflicts.conflictOnSelectionWorkflow', - [ - 'selection_plan_id' => $sp->getId(), - 'summit_id' => $this->getId() - ] - )); - - $start1 = $selection_plan->getSubmissionBeginDate(); - $end1 = $selection_plan->getSubmissionEndDate(); - $start2 = $sp->getSubmissionBeginDate(); - $end2 = $sp->getSubmissionEndDate(); - - if(!is_null($start1) && !is_null($end1) && - !is_null($start2) && !is_null($end2) && - DateUtils::checkTimeFramesOverlap - ( - $start1, - $end1, - $start2, - $end2 - - ) - ) - throw new ValidationException(trans( - 'validation_errors.Summit.checkSelectionPlanConflicts.conflictOnSubmissionWorkflow', - [ - 'selection_plan_id' => $sp->getId(), - 'summit_id' => $this->getId() - ] - )); - - $start1 = $selection_plan->getVotingBeginDate(); - $end1 = $selection_plan->getVotingEndDate(); - $start2 = $sp->getVotingBeginDate(); - $end2 = $sp->getVotingEndDate(); - - if(!is_null($start1) && !is_null($end1) && - !is_null($start2) && !is_null($end2) && - DateUtils::checkTimeFramesOverlap - ( - $start1, - $end1, - $start2, - $end2 - ) - ) - throw new ValidationException(trans( - 'validation_errors.Summit.checkSelectionPlanConflicts.conflictOnVotingWorkflow', - [ - 'selection_plan_id' => $sp->getId(), - 'summit_id' => $this->getId() - ] - )); - } - - return true; - } - - /** - * @param string $name - * @return null|SelectionPlan - */ - public function getSelectionPlanByName($name){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $selection_plan = $this->selection_plans->matching($criteria)->first(); - return $selection_plan === false ? null : $selection_plan; - } - - /** - * @param string $status - * @return null|SelectionPlan - */ - public function getCurrentSelectionPlanByStatus($status){ - $now_utc = new \DateTime('now', new \DateTimeZone('UTC')); - $criteria = Criteria::create(); - switch (strtoupper($status)){ - case SelectionPlan::STATUS_SUBMISSION:{ - $criteria->where(Criteria::expr()->lte('submission_begin_date', $now_utc))->andWhere(Criteria::expr()->gte('submission_end_date', $now_utc)); - } - break; - case SelectionPlan::STATUS_VOTING:{ - $criteria->where(Criteria::expr()->lte('voting_begin_date', $now_utc))->andWhere(Criteria::expr()->gte('voting_end_date', $now_utc)); - } - break; - case SelectionPlan::STATUS_SELECTION:{ - $criteria->where(Criteria::expr()->lte('selection_begin_date', $now_utc))->andWhere(Criteria::expr()->gte('selection_end_date', $now_utc)); - } - break; - } - $selection_plan = $this->selection_plans->matching($criteria)->first(); - return $selection_plan === false ? null : $selection_plan; - } - - /** - * @param int $id - * @return null|SelectionPlan - */ - public function getSelectionPlanById($id):?SelectionPlan{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $selection_plan = $this->selection_plans->matching($criteria)->first(); - return $selection_plan === false ? null : $selection_plan; - } - - /** - * @param SelectionPlan $selection_plan - * @return $this - */ - public function addSelectionPlan(SelectionPlan $selection_plan){ - $this->selection_plans->add($selection_plan); - $selection_plan->setSummit($this); - return $this; - } - - /** - * @param SelectionPlan $selection_plan - * @return $this - */ - public function removeSelectionSelectionPlan(SelectionPlan $selection_plan){ - $this->selection_plans->removeElement($selection_plan); - $selection_plan->clearSummit(); - return $this; - } - - /** - * @return SelectionPlan[] - */ - public function getActiveSelectionPlans() { - return $this->selection_plans->filter(function ($e){ return $e->IsEnabled();} )->toArray(); - } - - /** - * @return bool - */ - public function isSubmissionOpen() - { - foreach ($this->getActiveSelectionPlans() as $plan) { - if ($plan->isSubmissionOpen()) - return true; - } - return false; - } - - /** - * @return bool - */ - public function isPresentationEditionAllowed() - { - return $this->isSubmissionOpen() || $this->isVotingOpen(); - } - - /** - * @return bool - */ - public function isVotingOpen() - { - foreach ($this->getActiveSelectionPlans() as $plan) { - if ($plan->isVotingOpen()) { - return true; - } - } - return false; - } - - const STAGE_UNSTARTED = -1; - const STAGE_OPEN = 0; - const STAGE_FINISHED = 1; - - /** - * @param Tag $tag - * @return TrackTagGroup|null - */ - public function getTrackTagGroupForTag(Tag $tag){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this); - $native_query->setParameter("tag", $tag); - - $res = $native_query->getResult(); - return count($res) > 0 ? $res[0] : null; - } - - /** - * @param string $tag_value - * @return bool - * @throws \Doctrine\ORM\NoResultException - * @throws \Doctrine\ORM\NonUniqueResultException - */ - public function isTagValueAllowedOnTrackTagGroups($tag_value){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this); - $native_query->setParameter("tag_value", $tag_value); - - $res = $native_query->getSingleScalarResult(); - return $res > 0; - } - - /** - * @param string $tag_value - * @return null|TrackTagGroupAllowedTag - */ - public function getAllowedTagOnTagTrackGroup($tag_value){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this); - $native_query->setParameter("tag_value", $tag_value); - - $res = $native_query->getResult(); - return count($res) > 0 ? $res[0] : null; - } - - /** - * @param int $tag_id - * @return TrackTagGroup|null - */ - public function getTrackTagGroupForTagId($tag_id){ - $query = <<getEM()->createQuery($query); - - $native_query->setParameter("summit", $this); - $native_query->setParameter("tag_id", $tag_id); - - $res = $native_query->getResult(); - return count($res) > 0 ? $res[0] : null; - } - - /** - * @param string $name - * @return null|TrackTagGroup - */ - public function getTrackTagGroupByName($name){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', $name)); - $track_tag_group = $this->track_tag_groups->matching($criteria)->first(); - return !$track_tag_group ? null : $track_tag_group; - } - - /** - * @return TrackTagGroup[]|ArrayCollection - */ - public function getTrackTagGroups(){ - return $this->track_tag_groups; - } - - /** - * @param string $label - * @return null|TrackTagGroup - */ - public function getTrackTagGroupByLabel($label){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('label', $label)); - $track_tag_group = $this->track_tag_groups->matching($criteria)->first(); - return !$track_tag_group ? null : $track_tag_group; - } - - /** - * @param TrackTagGroup $track_tag_group - * @return $this - */ - public function addTrackTagGroup(TrackTagGroup $track_tag_group) - { - if($this->track_tag_groups->contains($track_tag_group)) return $this; - $track_tag_group->setOrder($this->getTrackTagGroupMaxOrder() + 1); - $this->track_tag_groups->add($track_tag_group); - $track_tag_group->setSummit($this); - return $this; - } - - /** - * @param TrackTagGroup $track_tag_group - * @return $this - */ - public function removeTrackTagGroup(TrackTagGroup $track_tag_group){ - if(!$this->track_tag_groups->contains($track_tag_group)) return $this; - $this->track_tag_groups->removeElement($track_tag_group); - return $this; - } - - /** - * @return int - */ - private function getTrackTagGroupMaxOrder(){ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $group = $this->track_tag_groups->matching($criteria)->first(); - return $group === false ? 0 : $group->getOrder(); - } - - /** - * @param TrackTagGroup $track_tag_group - * @param int $new_order - * @throws ValidationException - */ - public function recalculateTrackTagGroupOrder(TrackTagGroup $track_tag_group, $new_order){ - self::recalculateOrderForSelectable($this->track_tag_groups, $track_tag_group, $new_order); - } - - /** - * @param int $track_tag_group_id - * @return TrackTagGroup|null - */ - public function getTrackTagGroup($track_tag_group_id) - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($track_tag_group_id))); - $track_tag_group = $this->track_tag_groups->matching($criteria)->first(); - return $track_tag_group === false ? null : $track_tag_group; - } - - /** - * @return string|null - */ - public function getRawSlug():?string{ - return $this->slug; - } - - /** - * @param string $slug - */ - public function setRawSlug(string $slug):void { - $slugify = new Slugify(); - $this->slug = $slugify->slugify($slug); - } - /** - * @return DateTime - */ - public function getMeetingRoomBookingStartTime():?DateTime - { - return $this->meeting_room_booking_start_time; - } - - /** - * @param DateTime $meeting_room_booking_start_time - */ - public function setMeetingRoomBookingStartTime(DateTime $meeting_room_booking_start_time): void - { - $this->meeting_room_booking_start_time = $meeting_room_booking_start_time; - } - - /** - * @return DateTime - */ - public function getMeetingRoomBookingEndTime():?DateTime - { - return $this->meeting_room_booking_end_time; - } - - /** - * @param DateTime $meeting_room_booking_end_time - */ - public function setMeetingRoomBookingEndTime(DateTime $meeting_room_booking_end_time): void - { - $this->meeting_room_booking_end_time = $meeting_room_booking_end_time; - } - - /** - * @return int - */ - public function getMeetingRoomBookingSlotLength(): int - { - return $this->meeting_room_booking_slot_length; - } - - /** - * @param int $meeting_room_booking_slot_length - */ - public function setMeetingRoomBookingSlotLength(int $meeting_room_booking_slot_length): void - { - if($meeting_room_booking_slot_length <= 0) - throw new ValidationException("meeting_room_booking_slot_length should be greather than zero"); - - if($this->meeting_room_booking_slot_length != $meeting_room_booking_slot_length){ - // only allow to change if we dont have any reservation - $sql = <<prepareRawSQL($sql); - $stmt->execute( - [ - 'summit_id' => $this->getId(), - ] - ); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - $reservation_count = count($res) > 0 ? $res[0] : 0; - if($reservation_count > 0) - { - throw new ValidationException("summit already has reservations with that slot len!"); - } - } - - $this->meeting_room_booking_slot_length = $meeting_room_booking_slot_length; - } - - /** - * @return int - */ - public function getMeetingRoomBookingMaxAllowed(): int - { - return $this->meeting_room_booking_max_allowed; - } - - /** - * @param int $meeting_room_booking_max_allowed - */ - public function setMeetingRoomBookingMaxAllowed(int $meeting_room_booking_max_allowed): void - { - $this->meeting_room_booking_max_allowed = $meeting_room_booking_max_allowed; - } - - /** - * @return mixed - */ - public function getMeetingBookingRoomAllowedAttributes() - { - return $this->meeting_booking_room_allowed_attributes; - } - - /** - * @param SummitBookableVenueRoomAttributeType $type - */ - public function addMeetingBookingRoomAllowedAttribute(SummitBookableVenueRoomAttributeType $type){ - if($this->meeting_booking_room_allowed_attributes->contains($type)) return; - $this->meeting_booking_room_allowed_attributes->add($type); - $type->setSummit($this); - } - - /** - * @param SummitBookableVenueRoomAttributeType $type - */ - public function removeMeetingBookingRoomAllowedAttribute(SummitBookableVenueRoomAttributeType $type){ - if(!$this->meeting_booking_room_allowed_attributes->contains($type)) return; - $this->meeting_booking_room_allowed_attributes->removeElement($type); - } - - /** - * @param int $id - * @return SummitBookableVenueRoomAttributeType|null - */ - public function getBookableAttributeTypeById(int $id):?SummitBookableVenueRoomAttributeType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $attr = $this->meeting_booking_room_allowed_attributes->matching($criteria)->first(); - return $attr === false ? null : $attr; - } - - /** - * @param string $type - * @return SummitBookableVenueRoomAttributeType|null - */ - public function getBookableAttributeTypeByTypeName(string $type):?SummitBookableVenueRoomAttributeType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('type', trim($type))); - $attr = $this->meeting_booking_room_allowed_attributes->matching($criteria)->first(); - return $attr === false ? null : $attr; - } - - public function getMaxReservationsPerDay():int { - $interval = $this->meeting_room_booking_end_time->diff( $this->meeting_room_booking_start_time); - $minutes = $interval->days * 24 * 60; - $minutes += $interval->h * 60; - $minutes += $interval->i; - return intval ($minutes / $this->meeting_room_booking_slot_length); - } - - /** - * @param int $id - * @return SummitBookableVenueRoomAttributeValue|null - */ - public function getMeetingBookingRoomAllowedAttributeValueById(int $id):?SummitBookableVenueRoomAttributeValue{ - foreach($this->meeting_booking_room_allowed_attributes as $attribute_type){ - $value = $attribute_type->getValueById($id); - if(!is_null($value)) return $value; - } - return null; - } - - - /** - * @return string|null - */ - public function getApiFeedType(): ?string - { - return $this->api_feed_type; - } - - /** - * @param string $api_feed_type - * @throws ValidationException - */ - public function setApiFeedType(string $api_feed_type): void - { - if(!empty($api_feed_type) && !in_array($api_feed_type, ISummitExternalScheduleFeedType::ValidFeedTypes)) - throw new ValidationException(sprintf("feed type %s is not valid!", $api_feed_type)); - $this->api_feed_type = $api_feed_type; - } - - /** - * @return string|null - */ - public function getApiFeedUrl(): ?string - { - return $this->api_feed_url; - } - - /** - * @param string $api_feed_url - */ - public function setApiFeedUrl(string $api_feed_url): void - { - $this->api_feed_url = $api_feed_url; - } - - /** - * @return string|null - */ - public function getApiFeedKey(): ?string - { - return $this->api_feed_key; - } - - /** - * @param string $api_feed_key - */ - public function setApiFeedKey(string $api_feed_key): void - { - $this->api_feed_key = $api_feed_key; - } - - /** - * @return DateTime - */ - public function getBeginAllowBookingDate(): ?DateTime - { - return $this->begin_allow_booking_date; - } - - /** - * @param DateTime $begin_allow_booking_date - */ - public function setBeginAllowBookingDate(DateTime $begin_allow_booking_date): void - { - $this->begin_allow_booking_date = $this->convertDateFromTimeZone2UTC($begin_allow_booking_date); - } - - /** - * @param DateTime $begin_allow_booking_date - */ - public function setRawBeginAllowBookingDate(DateTime $begin_allow_booking_date): void - { - $this->begin_allow_booking_date = $begin_allow_booking_date; - } - - /* - * @return SummitAccessLevelType[] - */ - public function getBadgeAccessLevelTypes(): array - { - return $this->badge_access_level_types; - } - - /** - * @param SummitAccessLevelType $access_level - */ - public function addBadgeAccessLevelType(SummitAccessLevelType $access_level):void{ - if($this->badge_access_level_types->contains($access_level)) return; - $this->badge_access_level_types->add($access_level); - $access_level->setSummit($this); - } - - /** - * @param SummitAccessLevelType $access_level - */ - public function removeBadgeAccessLevelType(SummitAccessLevelType $access_level):void{ - if(!$this->badge_access_level_types->contains($access_level)) return; - $this->badge_access_level_types->removeElement($access_level); - $access_level->clearSummit(); - } - - /** - * @param int $levelId - * @return SummitAccessLevelType|null - */ - public function getBadgeAccessLevelTypeById(int $levelId):?SummitAccessLevelType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($levelId))); - $attr = $this->badge_access_level_types->matching($criteria)->first(); - return $attr === false ? null : $attr; - } - - - - public function getDefaultBadgeAccessLevelTypes(){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('is_default', true)); - return $this->badge_access_level_types->matching($criteria); - } - - /** - * @param string $level_name - * @return SummitAccessLevelType|null - */ - public function getBadgeAccessLevelTypeByName(string $level_name):?SummitAccessLevelType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($level_name))); - $attr = $this->badge_access_level_types->matching($criteria)->first(); - return $attr === false ? null : $attr; - } - - /** - * @return SummitTaxType[] - */ - public function getTaxTypes() - { - return $this->tax_types; - } - - /** - * @param SummitTaxType $tax_type - */ - public function addTaxType(SummitTaxType $tax_type):void{ - if($this->tax_types->contains($tax_type)) return; - $this->tax_types->add($tax_type); - $tax_type->setSummit($this); - } - - /** - * @param SummitTaxType $tax_type - */ - public function removeTaxType(SummitTaxType $tax_type):void{ - if(!$this->tax_types->contains($tax_type)) return; - $this->tax_types->removeElement($tax_type); - $tax_type->clearSummit(); - } - - /** - * @param int $tax_id - * @return SummitTaxType|null - */ - public function getTaxTypeById(int $tax_id):?SummitTaxType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($tax_id))); - $attr = $this->tax_types->matching($criteria)->first(); - return $attr === false ? null : $attr; - } - - /** - * @param string $tax_name - * @return SummitTaxType|null - */ - public function getTaxTypeByName(string $tax_name):?SummitTaxType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($tax_name))); - $attr = $this->tax_types->matching($criteria)->first(); - return $attr === false ? null : $attr; - } - - /** - * @return SummitBadgeFeatureType[]|ArrayCollection - */ - public function getBadgeFeaturesTypes() - { - return $this->badge_features_types; - } - - /** - * @param SummitBadgeFeatureType $feature_type - */ - public function addFeatureType(SummitBadgeFeatureType $feature_type):void{ - if($this->badge_features_types->contains($feature_type)) return; - $this->badge_features_types->add($feature_type); - $feature_type->setSummit($this); - } - - /** - * @param SummitBadgeFeatureType $feature_type - */ - public function removeFeatureType(SummitBadgeFeatureType $feature_type):void{ - if(!$this->badge_features_types->contains($feature_type)) return; - $this->badge_features_types->removeElement($feature_type); - $feature_type->clearSummit(); - } - - - /** - * @param int $feature_id - * @return SummitBadgeFeatureType|null - */ - public function getFeatureTypeById(int $feature_id):?SummitBadgeFeatureType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($feature_id))); - $feature = $this->badge_features_types->matching($criteria)->first(); - return $feature === false ? null : $feature; - } - - /** - * @param string $feature_name - * @return SummitBadgeFeatureType|null - */ - public function getFeatureTypeByName(string $feature_name):?SummitBadgeFeatureType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($feature_name))); - $feature = $this->badge_features_types->matching($criteria)->first(); - return $feature === false ? null : $feature; - } - - /** - * @return SummitBadgeType[] - */ - public function getBadgeTypes(): array - { - return $this->badge_types; - } - - /** - * @param SummitBadgeType $badge_type - */ - public function addBadgeType(SummitBadgeType $badge_type){ - if($this->badge_types->contains($badge_type)) return; - $this->badge_types->add($badge_type); - $badge_type->setSummit($this); - } - - /** - * @param SummitBadgeType $badge_type - */ - public function removeBadgeType(SummitBadgeType $badge_type):void{ - if(!$this->badge_types->contains($badge_type)) return; - $this->badge_types->removeElement($badge_type); - $badge_type->clearSummit(); - } - - /** - * @param int $badge_type_id - * @return SummitBadgeType|null - */ - public function getBadgeTypeById(int $badge_type_id): ?SummitBadgeType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($badge_type_id))); - $badge_type = $this->badge_types->matching($criteria)->first(); - return $badge_type === false ? null : $badge_type; - } - - /** - * @param string $badge_type_name - * @return SummitBadgeType|null - */ - public function getBadgeTypeByName(string $badge_type_name): ?SummitBadgeType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($badge_type_name))); - $badge_type = $this->badge_types->matching($criteria)->first(); - return $badge_type === false ? null : $badge_type; - } - - /** - * @return bool - */ - public function hasDefaultBadgeType():bool { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('default', true)); - return $this->badge_types->matching($criteria)->count() > 0; - } - - /** - * @return bool - */ - public function getDefaultBadgeType():?SummitBadgeType { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('default', true)); - $badge_type = $this->badge_types->matching($criteria)->first(); - return $badge_type === false ? null : $badge_type; - } - - /** - * @return DateTime - */ - public function getEndAllowBookingDate(): ?DateTime - { - return $this->end_allow_booking_date; - } - - /** - * @param DateTime $end_allow_booking_date - */ - public function setEndAllowBookingDate(DateTime $end_allow_booking_date): void - { - $this->end_allow_booking_date = $this->convertDateFromTimeZone2UTC($end_allow_booking_date); - } - - /** - * @param DateTime $end_allow_booking_date - */ - public function setRawEndAllowBookingDate(DateTime $end_allow_booking_date): void - { - $this->end_allow_booking_date = $end_allow_booking_date; - } - - public function clearAllowBookingDates():void{ - $this->begin_allow_booking_date = $this->end_allow_booking_date = null; - } - - /** - * @return bool - */ - public function isBookingPeriodOpen():bool - { - $now_utc = new \DateTime('now', new \DateTimeZone('UTC')); - if (!is_null($this->begin_allow_booking_date) && !is_null($this->end_allow_booking_date)) { - return $now_utc >= $this->begin_allow_booking_date && $now_utc <= $this->end_allow_booking_date; - } - - return false; - } - - public function getMonthYear():?string{ - if(is_null($this->end_date)) return ""; - return $this->convertDateFromUTC2TimeZone($this->end_date)->format("M Y"); - } - /** - * @return string - */ - public function getLogoUrl():?string - { - $logoUrl = null; - if ($this->hasLogo() && $logo = $this->getLogo()) { - $logoUrl = $logo->getUrl(); - } - return $logoUrl; - } - - public function getReassignTicketTillDate(): ?DateTime - { - return $this->reassign_ticket_till_date; - } - - public function getReassignTicketTillDateLocal(): ?DateTime - { - return $this->convertDateFromUTC2TimeZone($this->reassign_ticket_till_date); - } - - - /** - * @return bool - */ - public function hasReassignTicketLimit():bool { - return !is_null($this->reassign_ticket_till_date); - } - - /** - * @param DateTime $reassign_ticket_till_date - */ - public function setReassignTicketTillDate(DateTime $reassign_ticket_till_date): void - { - $this->reassign_ticket_till_date = $this->convertDateFromTimeZone2UTC($reassign_ticket_till_date); - } - - /** - * @param DateTime $reassign_ticket_till_date - */ - public function setRawReassignTicketTillDate(DateTime $reassign_ticket_till_date): void - { - $this->reassign_ticket_till_date = $reassign_ticket_till_date; - } - - /** - * @return string - */ - public function getRegistrationDisclaimerContent(): ?string - { - return $this->registration_disclaimer_content; - } - - /** - * @param string $registration_disclaimer_content - */ - public function setRegistrationDisclaimerContent(string $registration_disclaimer_content): void - { - $this->registration_disclaimer_content = $registration_disclaimer_content; - } - - /** - * @return bool - */ - public function isRegistrationDisclaimerMandatory(): bool - { - return $this->registration_disclaimer_mandatory; - } - - /** - * @param bool $registration_disclaimer_mandatory - */ - public function setRegistrationDisclaimerMandatory(bool $registration_disclaimer_mandatory): void - { - $this->registration_disclaimer_mandatory = $registration_disclaimer_mandatory; - } - - /** - * @return array - */ - public function getSupportedCurrencies():array{ - return [AllowedCurrencies::USD, AllowedCurrencies::GBP, AllowedCurrencies::EUR]; - } - - /** - * @return Sponsor[] - */ - public function getSummitSponsors(){ - return $this->summit_sponsors; - } - - /** - * @param Company $company - * @return Sponsor|null - */ - public function getSummitSponsorByCompany(Company $company):?Sponsor{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('company', $company)); - $sponsor = $this->summit_sponsors->matching($criteria)->first(); - return $sponsor === false ? null : $sponsor; - } - - /** - * @param string $badge_type_name - * @return Sponsor|null - */ - public function getSummitSponsorById(int $id): ?Sponsor - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $sponsor = $this->summit_sponsors->matching($criteria)->first(); - return $sponsor === false ? null : $sponsor; - } - - /** - * @param Sponsor $sponsor - */ - public function addSummitSponsor(Sponsor $sponsor){ - if($this->summit_sponsors->contains($sponsor)) return; - $sponsor->setOrder($this->getSummitSponsorMaxOrder()+1); - $this->summit_sponsors->add($sponsor); - $sponsor->setSummit($this); - - } - - /** - * @return int - */ - private function getSummitSponsorMaxOrder(){ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $sponsor = $this->summit_sponsors->matching($criteria)->first(); - $res = $sponsor === false ? 0 : $sponsor->getOrder(); - return is_null($res) ? 0 : $res; - } - - - /** - * @param Sponsor $sponsor - */ - public function removeSummitSponsor(Sponsor $sponsor){ - if(!$this->summit_sponsors->contains($sponsor)) return; - $this->summit_sponsors->removeElement($sponsor); - $sponsor->clearSummit(); - } - - /** - * @return SummitRefundPolicyType[] - */ - public function getRefundPolicies(): array - { - return $this->refund_policies; - } - - /** - * @param SummitRefundPolicyType $policy - */ - public function addRefundPolicy(SummitRefundPolicyType $policy){ - if($this->refund_policies->contains($policy)) return; - $this->refund_policies->add($policy); - $policy->setSummit($this); - } - - /** - * @param SummitRefundPolicyType $policy - */ - public function removeRefundPolicy(SummitRefundPolicyType $policy){ - if(!$this->refund_policies->contains($policy)) return; - $this->refund_policies->removeElement($policy); - $policy->clearSummit(); - } - - /** - * @param string $policy_name - * @return SummitBadgeType|null - */ - public function getRefundPolicyByName(string $policy_name): ?SummitRefundPolicyType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($policy_name))); - $policy = $this->refund_policies->matching($criteria)->first(); - return $policy === false ? null : $policy; - } - - /** - * @param int $until_x_days_before_event_starts - * @return SummitBadgeType|null - */ - public function getRefundPolicyByDays(int $until_x_days_before_event_starts): ?SummitRefundPolicyType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('until_x_days_before_event_starts', intval($until_x_days_before_event_starts))); - $policy = $this->refund_policies->matching($criteria)->first(); - return $policy === false ? null : $policy; - } - - /** - * @param int $performed_n_days_before_event_starts - * @return SummitRefundPolicyType|null - */ - public function getRefundPolicyForRefundRequest(int $performed_n_days_before_event_starts):?SummitRefundPolicyType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->lte('until_x_days_before_event_starts', intval($performed_n_days_before_event_starts))); - $criteria->orderBy(['until_x_days_before_event_starts' => 'DESC']); - $policy = $this->refund_policies->matching($criteria)->first(); - return $policy === false ? null : $policy; - } - - /** - * @param int $id - * @return SummitBadgeType|null - */ - public function getRefundPolicyById(int $id): ?SummitRefundPolicyType - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $policy = $this->refund_policies->matching($criteria)->first(); - return $policy === false ? null : $policy; - } - - /** - * @return SummitOrderExtraQuestionType[] - */ - public function getOrderExtraQuestions() - { - return $this->order_extra_questions; - } - - /** - * @param string $usage - * @return ArrayCollection|\Doctrine\Common\Collections\Collection - */ - public function getMandatoryOrderExtraQuestionsByUsage(string $usage){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('mandatory', true)); - $criteria->andWhere(Criteria::expr()->in('usage', [$usage, SummitOrderExtraQuestionTypeConstants::BothQuestionUsage])); - return $this->order_extra_questions->matching($criteria); - } - - /** - * @param string $usage - * @return ArrayCollection|\Doctrine\Common\Collections\Collection - */ - public function getOrderExtraQuestionsByUsage(string $usage){ - $criteria = Criteria::create(); - $criteria->andWhere(Criteria::expr()->in('usage', [$usage, SummitOrderExtraQuestionTypeConstants::BothQuestionUsage])); - return $this->order_extra_questions->matching($criteria); - } - - /** - * @param int $question_id - * @return SummitOrderExtraQuestionType|null - */ - public function getOrderExtraQuestionById(int $question_id):?SummitOrderExtraQuestionType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $question_id)); - $question = $this->order_extra_questions->matching($criteria)->first(); - return $question === false ? null : $question; - } - - /** - * @param string $name - * @return SummitOrderExtraQuestionType|null - */ - public function getOrderExtraQuestionByName(string $name):?SummitOrderExtraQuestionType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $question = $this->order_extra_questions->matching($criteria)->first(); - return $question === false ? null : $question; - } - - /** - * @param string $label - * @return SummitOrderExtraQuestionType|null - */ - public function getOrderExtraQuestionByLabel(string $label):?SummitOrderExtraQuestionType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('label', trim($label))); - $question = $this->order_extra_questions->matching($criteria)->first(); - return $question === false ? null : $question; - } - - /** - * @return int - */ - private function getOrderExtraQuestionMaxOrder():int{ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $question = $this->order_extra_questions->matching($criteria)->first(); - return $question === false ? 0 : $question->getOrder(); - } - - /** - * @param SummitOrderExtraQuestionType $extra_question - */ - public function addOrderExtraQuestion(SummitOrderExtraQuestionType $extra_question){ - - if($this->order_extra_questions->contains($extra_question)) return; - $extra_question->setOrder($this->getOrderExtraQuestionMaxOrder() +1); - $this->order_extra_questions->add($extra_question); - $extra_question->setSummit($this); - } - - /** - * @param SummitOrderExtraQuestionType $extra_question - */ - public function removeOrderExtraQuestion(SummitOrderExtraQuestionType $extra_question){ - - if(!$this->order_extra_questions->contains($extra_question)) return; - $this->order_extra_questions->removeElement($extra_question); - $extra_question->clearSummit(); - } - - /** - * @param SummitOrderExtraQuestionType $question - * @param int $new_order - * @throws ValidationException - */ - public function recalculateQuestionOrder(SummitOrderExtraQuestionType $question, $new_order){ - self::recalculateOrderForSelectable($this->order_extra_questions, $question, $new_order); - } - - /** - * @param Sponsor $sponsor - * @param int $new_order - * @throws ValidationException - */ - public function recalculateSummitSponsorOrder(Sponsor $sponsor, $new_order){ - self::recalculateOrderForSelectable($this->summit_sponsors, $sponsor, $new_order); - } - - /** - * @return SummitOrder[] - */ - public function getOrders() - { - return $this->orders; - } - - /** - * @param int $id - * @return SummitOrder|null - */ - public function getOrderById(int $id):?SummitOrder{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $order = $this->orders->matching($criteria)->first(); - return $order === false ? null : $order; - } - - /** - * @param SummitOrder $order - */ - public function addOrder(SummitOrder $order){ - if($this->orders->contains($order)) return; - $this->orders->add($order); - $order->setSummit($this); - } - - /** - * @param SummitOrder $order - */ - public function removeOrder(SummitOrder $order){ - if(!$this->orders->contains($order)) return; - $this->orders->removeElement($order); - $order->clearSummit(); - } - - /** - * @param string $number - * @return bool - */ - public function existOrderNumber(string $number):bool - { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('number', trim($number))); - return $this->orders->matching($criteria)->count() > 0; - } - - /** - * @var bool - */ - private $mark_as_deleted; - - public function markAsDeleted(){ - $this->mark_as_deleted = true; - } - - /** - * @return bool - */ - public function isDeleting():bool{ - return is_null($this->mark_as_deleted) ? false : $this->mark_as_deleted; - } - - /** - * @return string - */ - public function getQRRegistryFieldDelimiter():string { - return IQREntity::QRRegistryFieldDelimiterChar; - } - - /** - * @return int - */ - public function getRegistrationReminderEmailDaysInterval(): ?int - { - $days_interval = $this->registration_reminder_email_days_interval; - - if (is_null($days_interval)) { - $days_interval = intval(Config::get('registration.reminder_email_days_interval', 0)); - } - - return $days_interval; - } - - /** - * @param int $registration_reminder_email_days_interval - */ - public function setRegistrationReminderEmailDaysInterval(int $registration_reminder_email_days_interval): void - { - $this->registration_reminder_email_days_interval = $registration_reminder_email_days_interval; - } - - /** - * @return bool - */ - public function isEnded():bool{ - $utc_now = new \DateTime('now', new \DateTimeZone('UTC')); - $end_date = $this->getEndDate(); - if(is_null($end_date)) return false; - return $end_date < $utc_now; - } - - - /** - * @param DateTime $day - * @param bool $omit_time_check - * @return bool - */ - public function dayIsOnSummitPeriod(\DateTime $day, $omit_time_check = true):bool{ - if(is_null($this->begin_date)) return false; - if(is_null($this->end_date)) return false; - - $dt = clone $day; - $dt = $dt->setTimezone(new \DateTimeZone('UTC')); - - if($omit_time_check) - $dt= $dt->setTime(0, 0,0); - - $dt = $dt->getTimestamp(); - - $bd = clone $this->begin_date; - - if($omit_time_check) - $bd = $bd->setTime(0,0,0,0); - - $bd = $bd->getTimestamp(); - - $ed = clone $this->end_date; - - if($omit_time_check) - $ed = $ed->setTime(0,0,0,0); - - $ed = $ed->getTimestamp(); - - return $bd <= $dt && $dt <= $ed; - } - - /* - * @return string - */ - public function getExternalRegistrationFeedType(): ?string - { - return $this->external_registration_feed_type; - } - - /** - * @return string - */ - public function getExternalRegistrationFeedApiKey(): ?string - { - return $this->external_registration_feed_api_key; - } - - /** - * @param string $external_registration_feed_type - * @throws ValidationException - */ - public function setExternalRegistrationFeedType(string $external_registration_feed_type): void - { - if(!empty($external_registration_feed_type) && !in_array($external_registration_feed_type, ISummitExternalRegistrationFeedType::ValidFeedTypes)) - throw new ValidationException(sprintf("feed type %s is not valid!", $external_registration_feed_type)); - $this->external_registration_feed_type = $external_registration_feed_type; - } - - /** - * @param string $external_registration_feed_api_key - */ - public function setExternalRegistrationFeedApiKey(string $external_registration_feed_api_key): void - { - $this->external_registration_feed_api_key = $external_registration_feed_api_key; - } - - // schedule - - /** - * @return string - */ - public function getScheduleDefaultPageUrl(): ?string - { - return $this->schedule_default_page_url; - } - - /** - * @param string $schedule_default_page_url - */ - public function setScheduleDefaultPageUrl(string $schedule_default_page_url): void - { - $this->schedule_default_page_url = $schedule_default_page_url; - } - - /** - * @return string - */ - public function getScheduleDefaultEventDetailUrl(): ?string - { - return $this->schedule_default_event_detail_url; - } - - /** - * @param string $schedule_default_event_detail_url - * @throws ValidationException - */ - public function setScheduleDefaultEventDetailUrl(string $schedule_default_event_detail_url): void - { - if(!empty($schedule_default_event_detail_url) && !str_contains($schedule_default_event_detail_url,':event_id')){ - throw new ValidationException("Property schedule_default_event_detail_url must contains at least replacement variable :event_id."); - } - - $this->schedule_default_event_detail_url = $schedule_default_event_detail_url; - } - - /** - * @return string - */ - public function getScheduleOgSiteName(): ?string - { - return self::_get($this->schedule_og_site_name, "schedule.og_site_name"); - } - - /** - * @param string $schedule_og_site_name - */ - public function setScheduleOgSiteName(string $schedule_og_site_name): void - { - $this->schedule_og_site_name = $schedule_og_site_name; - } - - /** - * @return string - */ - public function getScheduleOgImageUrl(): ?string - { - return self::_get($this->schedule_og_image_url,"schedule.og_image_url"); - } - - /** - * @param string $schedule_og_image_url - */ - public function setScheduleOgImageUrl(string $schedule_og_image_url): void - { - $this->schedule_og_image_url = $schedule_og_image_url; - } - - /** - * @return string - */ - public function getScheduleOgImageSecureUrl(): ?string - { - return self::_get($this->schedule_og_image_secure_url,"schedule.og_image_secure_url"); - } - - /** - * @param string $schedule_og_image_secure_url - */ - public function setScheduleOgImageSecureUrl(string $schedule_og_image_secure_url): void - { - $this->schedule_og_image_secure_url = $schedule_og_image_secure_url; - } - - /** - * @return int - */ - public function getScheduleOgImageWidth(): int - { - return self::_get($this->schedule_og_image_width,"schedule.og_image_width"); - } - - /** - * @param int $schedule_og_image_width - */ - public function setScheduleOgImageWidth(int $schedule_og_image_width): void - { - $this->schedule_og_image_width = $schedule_og_image_width; - } - - /** - * @return int - */ - public function getScheduleOgImageHeight(): int - { - return self::_get($this->schedule_og_image_height,"schedule.og_image_height"); - } - - /** - * @param int $schedule_og_image_height - */ - public function setScheduleOgImageHeight(int $schedule_og_image_height): void - { - $this->schedule_og_image_height = $schedule_og_image_height; - } - - /** - * @return string - */ - public function getScheduleFacebookAppId(): ?string - { - return self::_get($this->schedule_facebook_app_id,"schedule.facebook_app_id"); - } - - /** - * @param string $schedule_facebook_app_id - */ - public function setScheduleFacebookAppId(string $schedule_facebook_app_id): void - { - $this->schedule_facebook_app_id = $schedule_facebook_app_id; - } - - /** - * @return string - */ - public function getScheduleIosAppName(): ?string - { - return self::_get($this->schedule_ios_app_name,"schedule.ios_app_name"); - } - - /** - * @param string $schedule_ios_app_name - */ - public function setScheduleIosAppName(string $schedule_ios_app_name): void - { - $this->schedule_ios_app_name = $schedule_ios_app_name; - } - - /** - * @return string - */ - public function getScheduleIosAppStoreId(): ?string - { - return self::_get($this->schedule_ios_app_store_id,"schedule.ios_app_store_id"); - } - - /** - * @param string $schedule_ios_app_store_id - */ - public function setScheduleIosAppStoreId(string $schedule_ios_app_store_id): void - { - $this->schedule_ios_app_store_id = $schedule_ios_app_store_id; - } - - /** - * @return string - */ - public function getScheduleIosAppCustomSchema(): ?string - { - return self::_get($this->schedule_ios_app_custom_schema,"schedule.ios_app_custom_schema"); - } - - /** - * @param string $schedule_ios_app_custom_schema - */ - public function setScheduleIosAppCustomSchema(string $schedule_ios_app_custom_schema): void - { - $this->schedule_ios_app_custom_schema = $schedule_ios_app_custom_schema; - } - - /** - * @return string - */ - public function getScheduleAndroidAppName(): ?string - { - return self::_get($this->schedule_android_app_name,"schedule.android_app_name"); - } - - /** - * @param string $schedule_android_app_name - */ - public function setScheduleAndroidAppName(string $schedule_android_app_name): void - { - $this->schedule_android_app_name = $schedule_android_app_name; - } - - /** - * @return string - */ - public function getScheduleAndroidAppPackage(): ?string - { - return self::_get($this->schedule_android_app_package,"schedule.android_app_package"); - } - - /** - * @param string $schedule_android_app_package - */ - public function setScheduleAndroidAppPackage(string $schedule_android_app_package): void - { - $this->schedule_android_app_package = $schedule_android_app_package; - } - - /** - * @return string - */ - public function getScheduleAndroidCustomSchema(): ?string - { - return self::_get($this->schedule_android_custom_schema,"schedule.android_custom_schema"); - } - - /** - * @param string $schedule_android_custom_schema - */ - public function setScheduleAndroidCustomSchema(string $schedule_android_custom_schema): void - { - $this->schedule_android_custom_schema = $schedule_android_custom_schema; - } - - /** - * @return string - */ - public function getScheduleTwitterAppName(): ?string - { - return self::_get($this->schedule_twitter_app_name,"schedule.twitter_app_name"); - } - - /** - * @param string $schedule_twitter_app_name - */ - public function setScheduleTwitterAppName(string $schedule_twitter_app_name): void - { - $this->schedule_twitter_app_name = $schedule_twitter_app_name; - } - - /** - * @return string - */ - public function getScheduleTwitterText(): ?string - { - return self::_get($this->schedule_twitter_text,"schedule.twitter_text"); - } - - /** - * @param string $schedule_twitter_text - */ - public function setScheduleTwitterText(string $schedule_twitter_text): void - { - $this->schedule_twitter_text = $schedule_twitter_text; - } - - /** - * @param string $sid - * @return PersonalCalendarShareInfo|null - */ - public function getScheduleShareableLinkById(string $sid):?PersonalCalendarShareInfo{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('cid', trim($sid))); - $criteria->andWhere(Criteria::expr()->eq('revoked', 0)); - $link = $this->schedule_shareable_links->matching($criteria)->first(); - return $link === false ? null : $link; - } - - /** - * @param PersonalCalendarShareInfo $link - */ - public function addScheduleShareableLink(PersonalCalendarShareInfo $link){ - if($this->schedule_shareable_links->contains($link)) return; - $this->schedule_shareable_links->add($link); - $link->setSummit($this); - } - - /** - * @param PersonalCalendarShareInfo $link - */ - public function removeScheduleShareableLink(PersonalCalendarShareInfo $link) - { - if (!$this->schedule_shareable_links->contains($link)) return; - $this->schedule_shareable_links->removeElement($link); - $link->clearSummit(); - } - - /** - * @param PaymentGatewayProfile $payment_profile - */ - public function addPaymentProfile(PaymentGatewayProfile $payment_profile){ - if($this->payment_profiles->contains($payment_profile)) - return; - $this->payment_profiles->add($payment_profile); - $payment_profile->setSummit($this); - } - - /** - * @param PaymentGatewayProfile $payment_profile - */ - public function removePaymentProfile(PaymentGatewayProfile $payment_profile){ - if(!$this->payment_profiles->contains($payment_profile)) - return; - $this->payment_profiles->removeElement($payment_profile); - $payment_profile->clearSummit(); - } - - /** - * @param string $application_type - * @param IBuildDefaultPaymentGatewayProfileStrategy|null $build_default_payment_gateway_profile_strategy - * @return IPaymentGatewayAPI|null - * @throws ValidationException - */ - public function getPaymentGateWayPerApp - ( - string $application_type, - ?IBuildDefaultPaymentGatewayProfileStrategy $build_default_payment_gateway_profile_strategy = null - ):?IPaymentGatewayAPI { - - Log::debug(sprintf("Summit::getPaymentGateWayPerApp id %s application_type %s", $this->id, $application_type)); - - if(!in_array($application_type, IPaymentConstants::ValidApplicationTypes)) - throw new ValidationException(sprintf("Application Type %s is not valid.", $application_type)); - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('active', true)); - $criteria->andWhere(Criteria::expr()->eq('application_type', trim($application_type))); - $payment_profile = $this->payment_profiles->matching($criteria)->first(); - - if(!$payment_profile && !is_null($build_default_payment_gateway_profile_strategy)){ - // try to build default one - Log::debug(sprintf("Summit::getPaymentGateWayPerApp id %s application_type %s trying to get default settings", $this->id, $application_type)); - $payment_profile = $build_default_payment_gateway_profile_strategy->build($application_type); - } - - if(!$payment_profile) return null; - - return $payment_profile->buildPaymentGatewayApi(); - } - - - /** - * @return ArrayCollection|\Doctrine\Common\Collections\Collection - */ - public function getActivePaymentGateWayProfiles(){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('active', true)); - return $this->payment_profiles->matching($criteria); - } - - /** - * @param string $application_type - * @return PaymentGatewayProfile|null - * @throws ValidationException - */ - public function getPaymentGateWayProfilePerApp(string $application_type):?PaymentGatewayProfile { - - if(!in_array($application_type, IPaymentConstants::ValidApplicationTypes)) - throw new ValidationException(sprintf("Application Type %s is not valid.", $application_type)); - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('active', true)); - $criteria->andWhere(Criteria::expr()->eq('application_type', trim($application_type))); - - $payment_profile = $this->payment_profiles->matching($criteria)->first(); - return (!$payment_profile) ? null : $payment_profile; - } - - /** - * @param int $profileId - * @return PaymentGatewayProfile|null - */ - public function getPaymentProfileById(int $profileId):?PaymentGatewayProfile{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($profileId))); - $profile = $this->payment_profiles->matching($criteria)->first(); - return $profile === false ? null : $profile; - } - - public function addEmailEventFlow(SummitEmailEventFlow $email_event_flow){ - if($this->email_flows_events->contains($email_event_flow)) return; - $this->email_flows_events->add($email_event_flow); - $email_event_flow->setSummit($this); - } - - public function removeEmailEventFlow(SummitEmailEventFlow $email_event_flow){ - if(!$this->email_flows_events->contains($email_event_flow)) return; - $this->email_flows_events->removeElement($email_event_flow); - } - - public function clearEmailEventFlow(){ - $this->email_flows_events->clear(); - } - - /** - * @param string $eventSlug - * @return string|null - */ - public function getEmailIdentifierPerEmailEventFlowSlug(string $eventSlug):?string{ - Log::debug(sprintf("Summit::getEmailIdentifierPerEmailEventFlowSlug id %s slug %s", $this->id, $eventSlug)); - // first check if we have an override - $email_event = $this->createQueryBuilder() - ->select('distinct ef') - ->from('App\Models\Foundation\Summit\EmailFlows\SummitEmailEventFlow', 'ef') - ->join('ef.summit', 's') - ->join('ef.event_type', 'et') - ->where("s.id = :summit_id and et.slug = :slug") - ->setParameter('summit_id', $this->getId()) - ->setParameter('slug', trim($eventSlug)) - ->setMaxResults(1) - ->setCacheable(false) - ->getQuery() - ->setCacheable(false) - ->useQueryCache(false) - ->getOneOrNullResult(); - - if(!is_null($email_event) && $email_event instanceof SummitEmailEventFlow) { - Log::debug - ( - sprintf - ( - "Summit::getEmailIdentifierPerEmailEventFlowSlug id %s slug %s got override email event id %s template %s", - $this->id, - $eventSlug, - $email_event->id, - $email_event->getEmailTemplateIdentifier() - ) - ); - return $email_event->getEmailTemplateIdentifier(); - } - - Log::debug(sprintf("Summit::getEmailIdentifierPerEmailEventFlowSlug id %s slug %s trying to get default one", $this->id, $eventSlug)); - // then check default - $email_event_type = $this->createQueryBuilder() - ->select('distinct eft') - ->from('App\Models\Foundation\Summit\EmailFlows\SummitEmailEventFlowType', 'eft') - ->where("eft.slug = :slug") - ->setParameter('slug', trim($eventSlug)) - ->setMaxResults(1) - ->setCacheable(false) - ->getQuery() - ->setCacheable(false) - ->useQueryCache(false) - ->getOneOrNullResult(); - - if(!is_null($email_event_type) && $email_event_type instanceof SummitEmailEventFlowType) - return $email_event_type->getDefaultEmailTemplate(); - - return null; - } - - /** - * @param SummitEmailEventFlowType $type - * @return SummitEmailEventFlow|null - */ - public function getEmailEventByType(SummitEmailEventFlowType $type):?SummitEmailEventFlow{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('event_type', $type)); - $event = $this->email_flows_events->matching($criteria)->first(); - return $event === false ? null : $event; - } - - public function getEmailEventById(int $id):?SummitEmailEventFlow { - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $event = $this->email_flows_events->matching($criteria)->first(); - return $event === false ? null : $event; - } - - /** - * @return array|SummitEmailEventFlow[] - */ - public function getAllEmailFlowsEvents(){ - return $this->seedDefaultEmailFlowEvents(); - } - - public function seedDefaultEmailFlowEvents(){ - $builder = $this->createQueryBuilder() - ->select('distinct ft') - ->from('App\Models\Foundation\Summit\EmailFlows\SummitEmailFlowType', 'ft') - ->orderBy("ft.id"); - - $res = $builder->getQuery()->getResult(); - $list = []; - foreach($res as $flow_type){ - foreach ($flow_type->getEventTypes() as $event_type){ - // check if we have an override - $email_event_flow = $this->getEmailEventByType($event_type); - if(is_null($email_event_flow)){ - $email_event_flow = new SummitEmailEventFlow(); - $email_event_flow->setEventType($event_type); - $email_event_flow->setEmailTemplateIdentifier($event_type->getDefaultEmailTemplate()); - $this->addEmailEventFlow($email_event_flow); - } - $list[] = $email_event_flow; - } - } - return $list; - } - - /** - * this define the default access level types - * that need to be seeded when a new show is created - */ - public function seedDefaultAccessLevelTypes():void{ - - $defaults = [ - [ - 'name' => 'CHAT', - 'description'=> 'Enables Chat Feature.' - ], - [ - 'name' => 'IN_PERSON', - 'description'=> 'Allows in person show access.' - ], - [ - 'name' => 'VIRTUAL', - 'description'=> 'Allows virtual show access.' - ] - ]; - - foreach($defaults as $default) { - if(!is_null($this->getBadgeAccessLevelTypeByName($default['name']))) continue; - $a = new SummitAccessLevelType(); - $a->setName($default['name']); - $a->setDescription($default['description']); - $a->setIsDefault(true); - $this->addBadgeAccessLevelType($a); - } - } - - /** - * @return string - */ - public function getDefaultPageUrl(): ?string - { - return $this->default_page_url; - } - - /** - * @param string $default_page_url - */ - public function setDefaultPageUrl(string $default_page_url): void - { - $this->default_page_url = $default_page_url; - } - - /** - * @return string - */ - public function getSpeakerConfirmationDefaultPageUrl(): ?string - { - return $this->speaker_confirmation_default_page_url; - } - - /** - * @param string $speaker_confirmation_default_page_url - */ - public function setSpeakerConfirmationDefaultPageUrl(string $speaker_confirmation_default_page_url): void - { - $this->speaker_confirmation_default_page_url = $speaker_confirmation_default_page_url; - } - - public function getSummitDocuments(){ - return $this->summit_documents; - } - - /** - * @param SummitDocument $doc - */ - public function addSummitDocument(SummitDocument $doc){ - if($this->summit_documents->contains($doc)) return; - $this->summit_documents->add($doc); - $doc->setSummit($this); - } - - /** - * @param SummitDocument $doc - */ - public function removeSummitDocument(SummitDocument $doc){ - if(!$this->summit_documents->contains($doc)) return; - $this->summit_documents->removeElement($doc); - $doc->clearSummit(); - } - - public function clearSummitDocuments(){ - $this->summit_documents->clear(); - } - - /** - * @param int $document_id - * @return SummitDocument|null - */ - public function getSummitDocumentById(int $document_id):?SummitDocument{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($document_id))); - $document = $this->summit_documents->matching($criteria)->first(); - return $document === false ? null : $document; - } - - /** - * @param string $name - * @return SummitDocument|null - */ - public function getSummitDocumentByName(string $name):?SummitDocument{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $document = $this->summit_documents->matching($criteria)->first(); - return $document === false ? null : $document; - } - - /** - * @param string $label - * @return SummitDocument|null - */ - public function getSummitDocumentByLabel(string $label):?SummitDocument{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('label', trim($label))); - $document = $this->summit_documents->matching($criteria)->first(); - return $document === false ? null : $document; - } - - /** - * @param string $email - * @return SummitRegistrationInvitation|null - */ - public function getSummitRegistrationInvitationByEmail(string $email):?SummitRegistrationInvitation{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('email', trim($email))); - $invitation = $this->registration_invitations->matching($criteria)->first(); - return $invitation === false ? null : $invitation; - } - - /** - * @param int $invitation_id - * @return SummitRegistrationInvitation|null - */ - public function getSummitRegistrationInvitationById(int $invitation_id):?SummitRegistrationInvitation{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($invitation_id))); - $invitation = $this->registration_invitations->matching($criteria)->first(); - return $invitation === false ? null : $invitation; - } - - /** - * @param string $hash - * @return SummitRegistrationInvitation|null - */ - public function getSummitRegistrationInvitationByHash(string $hash):?SummitRegistrationInvitation{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('hash', trim($hash))); - $invitation = $this->registration_invitations->matching($criteria)->first(); - return $invitation === false ? null : $invitation; - } - - /** - * @return bool - */ - public function isInviteOnlyRegistration():bool{ - return $this->registration_invitations->count() > 0; - } - - /** - * @param string $email - * @return bool - */ - public function canBuyRegistrationTickets(string $email):bool { - if(!$this->isInviteOnlyRegistration()) return true; - return $this->getSummitRegistrationInvitationByEmail($email) !== null; - } - - /** - * @param SummitRegistrationInvitation $invitation - */ - public function addRegistrationInvitation(SummitRegistrationInvitation $invitation){ - if($this->registration_invitations->contains($invitation)) return; - $this->registration_invitations->add($invitation); - $invitation->setSummit($this); - } - - /** - * @param SummitRegistrationInvitation $invitation - */ - public function removeRegistrationInvitation(SummitRegistrationInvitation $invitation){ - if(!$this->registration_invitations->contains($invitation)) return; - $this->registration_invitations->removeElement($invitation); - $invitation->clearSummit(); - } - - /** - * @return ArrayCollection|SummitRegistrationInvitation[] - */ - public function getRegistrationInvitations(){ - return $this->registration_invitations; - } - - public function clearRegistrationInvitations():void{ - $this->registration_invitations->clear(); - } - - /** - * @param SummitAdministratorPermissionGroup $group - */ - public function add2SummitAdministratorPermissionGroup(SummitAdministratorPermissionGroup $group){ - if($this->permission_groups->contains($group)) return; - $this->permission_groups->add($group); - } - - public function removeFromSummitAdministratorPermissionGroup(SummitAdministratorPermissionGroup $group){ - if(!$this->permission_groups->contains($group)) return; - $this->permission_groups->removeElement($group); - } - - public function getSummitAdministratorPermissionGroup(){ - return $this->permission_groups; - } - - /** - * @param SummitMediaUploadType $type - */ - public function addMediaUploadType(SummitMediaUploadType $type){ - if($this->media_upload_types->contains($type)) return; - $this->media_upload_types->add($type); - $type->setSummit($this); - } - - /** - * @param SummitMediaUploadType $type - */ - public function removeMediaUploadType(SummitMediaUploadType $type){ - if(!$this->media_upload_types->contains($type)) return; - $this->media_upload_types->removeElement($type); - $type->clearSummit(); - } - - public function clearMediaUploadType(){ - $this->media_upload_types->clear(); - } - - public function getMediaUploadTypes(){ - return $this->media_upload_types; - } - - /** - * @param int $id - * @return SummitMediaUploadType|null - */ - public function getMediaUploadTypeById(int $id):?SummitMediaUploadType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', intval($id))); - $type = $this->media_upload_types->matching($criteria)->first(); - return $type === false ? null : $type; - } - - - public function getMediaUploadsMandatoryCount():int { - try { - $sql = <<prepareRawSQL($sql); - $stmt->execute([ - 'summit_id' => $this->id, - ]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - $count = count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - $count = 0; - } - - return $count; - } - - /** - * @param string $name - * @return SummitMediaUploadType|null - */ - public function getMediaUploadTypeByName(string $name):?SummitMediaUploadType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('name', trim($name))); - $type = $this->media_upload_types->matching($criteria)->first(); - return $type === false ? null : $type; - } - - /** - * @return string|null - */ - public function getVirtualSiteUrl(): ?string - { - return $this->virtual_site_url; - } - - /** - * @param string $virtual_site_url - */ - public function setVirtualSiteUrl(?string $virtual_site_url): void - { - $this->virtual_site_url = $virtual_site_url; - } - - /** - * @return string|null - */ - public function getMarketingSiteUrl(): ?string - { - return $this->marketing_site_url; - } - - /** - * @param string $marketing_site_url - */ - public function setMarketingSiteUrl(?string $marketing_site_url): void - { - $this->marketing_site_url = $marketing_site_url; - } - - /** - * @return string - */ - public function getVirtualSiteOAuth2ClientId(): ?string - { - return $this->virtual_site_oauth2_client_id; - } - - /** - * @param string $virtual_site_oauth2_client_id - */ - public function setVirtualSiteOAuth2ClientId(?string $virtual_site_oauth2_client_id): void - { - $this->virtual_site_oauth2_client_id = $virtual_site_oauth2_client_id; - } - - /** - * @return string - */ - public function getMarketingSiteOAuth2ClientId(): ?string - { - return $this->marketing_site_oauth2_client_id; - } - - /** - * @param string $marketing_site_oauth2_client_id - */ - public function setMarketingSiteOAuth2ClientId(?string $marketing_site_oauth2_client_id): void - { - $this->marketing_site_oauth2_client_id = $marketing_site_oauth2_client_id; - } - - /** - * @return string|null - */ - public function getSupportEmail(): ?string - { - return $this->support_email; - } - - /** - * @param string $support_email - */ - public function setSupportEmail(?string $support_email): void - { - $this->support_email = $support_email; - } - - /** - * @return ArrayCollection|PresentationSpeaker[] - */ - public function getFeaturesSpeakers(){ - return $this->featured_speakers; - } - - public function clearFeaturedSpeakers(){ - $this->featured_speakers->clear(); - } - - /** - * @param PresentationSpeaker $speaker - */ - public function addFeaturedSpeaker(PresentationSpeaker $speaker){ - if($this->featured_speakers->contains($speaker)) return; - $this->featured_speakers->add($speaker); - } - - /** - * @param PresentationSpeaker $speaker - */ - public function removeFeaturedSpeaker(PresentationSpeaker $speaker){ - if(!$this->featured_speakers->contains($speaker)) return; - $this->featured_speakers->removeElement($speaker); - } - - /** - * @return array|DateTime[] - */ - public function getSummitDays():array { - $beginDate = $this->getLocalBeginDate(); - $endDate = $this->getLocalEndDate(); - if(is_null($beginDate)) return []; - if(is_null($endDate)) return []; - $beginDate = $beginDate->setTime(0,0,0); - $endDate = $endDate->setTime(0,0,0); - $res = []; - $res[] = clone $beginDate; - while($beginDate < $endDate){ - $res[] = clone($beginDate->modify('+1 day')); - } - return $res; - } - - /** - * @return array|DateTime[] - */ - public function getSummitDaysWithEvents():array { - $days = $this->getSummitDays(); - $list = []; - foreach ($days as $day){ - Log::debug(sprintf("Summit::getSummitDaysWithEvents day %s", $day->format('Y-m-d H:i:s'))); - $begin = clone($day); - $begin = $begin->setTime(0,0,0)->setTimezone(new \DateTimeZone('UTC')); - $end = clone($day); - $end = $end->setTime(23,59,59)->setTimezone(new \DateTimeZone('UTC')); - - Log::debug(sprintf("Summit::getSummitDaysWithEvents UTC begin date %s UTC end date %s", $begin->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); - $count = 0; - try { - $sql = <<= :begin) -SQL; - $stmt = $this->prepareRawSQL($sql); - $stmt->execute([ - 'summit_id' => $this->id, - 'begin' => $begin->format("Y-m-d H:i:s"), - 'end' => $end->format('Y-m-d H:i:s'), - ]); - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - $count = count($res) > 0 ? $res[0] : 0; - } catch (\Exception $ex) { - $count = 0; - } - if($count > 0){ - Log::debug(sprintf("Summit::getSummitDaysWithEvents UTC begin date %s UTC end date %s count %s", $begin->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'), $count)); - $list[] = $day; - } - } - - return $list; - } - - /** - * @return SummitMetric[] - */ - public function getMetrics(): array - { - return $this->metrics; - } - - /** - * @param SummitMetric $metric - */ - public function addMetric(SummitMetric $metric){ - if($this->metrics->contains($metric)) return; - $this->metrics->add($metric); - $metric->setSummit($this); - } - - public function isPubliclyOpen():bool{ - return $this->ticket_types->count() == 0; - } - - /** - * @return SummitTrackChair[] - */ - public function getTrackChairs(): array - { - return $this->track_chairs; - } - - /** - * @param Member $member - * @return SummitTrackChair|null - */ - public function getTrackChairByMember(Member $member):?SummitTrackChair{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('member', $member)); - $res = $this->track_chairs->matching($criteria)->first(); - return !$res ? null : $res; - } - - /** - * @param int $id - * @return SummitTrackChair|null - */ - public function getTrackChair(int $id):?SummitTrackChair{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $id)); - $res = $this->track_chairs->matching($criteria)->first(); - return !$res ? null : $res; - } - - /** - * @param Member $member - * @param array|PresentationCategory[] $categories - * @return SummitTrackChair|null - * @throws ValidationException - */ - public function addTrackChair(Member $member, array $categories):?SummitTrackChair{ - - if(!$member->isOnGroup(IGroup::TrackChairs)){ - throw new ValidationException(sprintf("Member %s does not belong to group %s", $member->getId(), IGroup::TrackChairs)); - } - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('member', $member)); - $trackChair = $this->track_chairs->matching($criteria)->first(); - - if(!$trackChair) { - $trackChair = new SummitTrackChair(); - $member->addTrackChair($trackChair); - $trackChair->setSummit($this); - } - - foreach ($categories as $category) { - - if(!$category->isChairVisible()) - throw new ValidationException - ( - sprintf("Category %s is not visible for track chairs.", $category->getId()) - ); - - if ($trackChair->isCategoryAllowed($category)) - throw new ValidationException - ( - sprintf("Category %s is already allowed for member %s", $category->getId(), $member->getId()) - ); - - $trackChair->addCategory($category); - } - - if($this->track_chairs->contains($trackChair)) return null; - $this->track_chairs->add($trackChair); - - return $trackChair; - } - - /** - * @param SummitTrackChair $trackChair - */ - public function removeTrackChair(SummitTrackChair $trackChair){ - if(!$this->track_chairs->contains($trackChair)) return; - $this->track_chairs->removeElement($trackChair); - } - - /** - * @param Member $member - * @param PresentationCategory|null $category - * @return bool - */ - public function isTrackChair(Member $member, PresentationCategory $category = null):bool{ - if($member->isAdmin()) return true; - - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('member', $member)); - $isOnGroup = $member->isOnGroup(IGroup::TrackChairs); - $isTrackChair = $this->track_chairs->matching($criteria)->count() > 0; - if(!is_null($category)){ - $isTrackChair = $this->track_chairs->matching($criteria)->filter(function($track_chair) use ($category){ - return $track_chair->isCategoryAllowed($category); - })->count() > 0; - } - - return ($isOnGroup && $isTrackChair); - } - - public function hasPermissionOnSummit(Member $member):bool{ - return $this->permission_groups->filter(function($group) use ($member){ - if(!$group instanceof SummitAdministratorPermissionGroup) return false; - return $group->hasMember($member); - })->count() > 0; - } - - /** - * @param Member $member - * @return bool - */ - public function isTrackChairAdmin(Member $member):bool{ - if($member->isAdmin()) return true; - if($this->isSummitAdmin($member)) return true; - return $this->hasPermissionOnSummit($member) && $member->isOnGroup(IGroup::TrackChairsAdmins); - } - - /** - * @param Member $member - * @return bool - */ - public function isSummitAdmin(Member $member):bool{ - if($member->isAdmin()) return true; - return $this->hasPermissionOnSummit($member) && $member->isOnGroup(IGroup::SummitAdministrators); - } - - /** - * @param PresentationActionType $presentation_action_type - * @return $this - */ - public function addPresentationActionType(PresentationActionType $presentation_action_type) - { - if($this->presentation_action_types->contains($presentation_action_type)) return $this; - $presentation_action_type->setOrder($this->getPresentationActionTypeMaxOrder() + 1); - $this->presentation_action_types->add($presentation_action_type); - $presentation_action_type->setSummit($this); - return $this; - } - - /** - * @return int - */ - public function getPresentationActionTypeMaxOrder():int{ - $criteria = Criteria::create(); - $criteria->orderBy(['order' => 'DESC']); - $action = $this->presentation_action_types->matching($criteria)->first(); - return $action === false ? 0 : $action->getOrder(); - } - - /** - * @return ArrayCollection|\Doctrine\Common\Collections\Collection - */ - public function getPresentationActionTypes(){ - $criteria = Criteria::create(); - $criteria->orderBy(["order" => Criteria::ASC ]); - return $this->presentation_action_types->matching($criteria); - } - - /** - * @param PresentationActionType $presentation_action_type - * @return $this - */ - public function removePresentationActionType(PresentationActionType $presentation_action_type){ - if(!$this->presentation_action_types->contains($presentation_action_type)) return $this; - $this->presentation_action_types->removeElement($presentation_action_type); - $presentation_action_type->setSummit(null); - return $this; - } - - /** - * @param int $action_id - * @return PresentationActionType|null - */ - public function getPresentationActionTypeById(int $action_id):?PresentationActionType{ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('id', $action_id)); - $action = $this->presentation_action_types->matching($criteria)->first(); - return $action === false ? null: $action; - } - - public function synchAllPresentationActions():void{ - foreach ($this->getPresentations() as $presentation){ - $presentation->initializeActions(); - } - } - - public function synchAllAttendeesStatus():void{ - foreach($this->attendees as $attendee){ - $attendee->updateStatus(); - } - } - - public function synchPresentationAction(Presentation $presentation):void{ - $presentation->initializeActions(); - } -} diff --git a/app/Models/Foundation/Summit/SummitDocument.php b/app/Models/Foundation/Summit/SummitDocument.php deleted file mode 100644 index a777374e..00000000 --- a/app/Models/Foundation/Summit/SummitDocument.php +++ /dev/null @@ -1,225 +0,0 @@ -event_types = new ArrayCollection(); - $this->file = null; - $this->label = ''; - $this->description = ''; - $this->name = ''; - $this->show_always = false; - } - - /** - * @return bool - */ - public function hasFile(){ - return $this->getFileId() > 0; - } - - /** - * @return int - */ - public function getFileId(){ - try{ - return !is_null($this->file) ? $this->file->getId():0; - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return File - */ - public function getFile():?File - { - return $this->file; - } - - public function clearFile(){ - $this->file = null; - } - - /** - * @param File $file - */ - public function setFile(File $file) - { - $this->file = $file; - } - - /** - * @return string - */ - public function getName(): ?string - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName(string $name): void - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription(): ?string - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription(string $description): void - { - $this->description = $description; - } - - /** - * @return string - */ - public function getLabel(): ?string - { - return $this->label; - } - - /** - * @param string $label - */ - public function setLabel(string $label): void - { - $this->label = $label; - } - - public function getEventTypes(){ - return $this->event_types; - } - - public function addEventType(SummitEventType $eventType){ - if($this->event_types->contains($eventType)) return; - $this->event_types->add($eventType); - } - - public function removeEventType(SummitEventType $eventType){ - if(!$this->event_types->contains($eventType)) return; - $this->event_types->removeElement($eventType); - } - - public function clearEventTypes(){ - $this->event_types->clear(); - } - - /** - * @return string|null - */ - public function getFileUrl():?string{ - $fileUrl = null; - if($this->hasFile() && $file = $this->getFile()){ - $fileUrl = $file->getUrl(); - } - return $fileUrl; - } - - /** - * @return bool - */ - public function isShowAlways(): bool - { - return $this->show_always; - } - - /** - * @param bool $show_always - */ - public function setShowAlways(bool $show_always): void - { - $this->show_always = $show_always; - if($this->show_always){ - $this->clearEventTypes(); - } - } - - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/SummitOwned.php b/app/Models/Foundation/Summit/SummitOwned.php deleted file mode 100644 index 910d60eb..00000000 --- a/app/Models/Foundation/Summit/SummitOwned.php +++ /dev/null @@ -1,63 +0,0 @@ -summit = $summit; - } - - /** - * @return Summit - */ - public function getSummit(){ - return $this->summit; - } - - /** - * @return int - */ - public function getSummitId(){ - try { - return is_null($this->summit) ? 0 : $this->summit->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return bool - */ - public function hasSummit():bool{ - return $this->getSummitId() > 0; - } - - public function clearSummit(){ - $this->summit = null; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/SummitPushNotification.php b/app/Models/Foundation/Summit/SummitPushNotification.php deleted file mode 100644 index ba268579..00000000 --- a/app/Models/Foundation/Summit/SummitPushNotification.php +++ /dev/null @@ -1,166 +0,0 @@ -channel; - } - - /** - * @param string $channel - */ - public function setChannel($channel) - { - $this->channel = $channel; - } - - /** - * @return SummitEvent - */ - public function getSummitEvent() - { - return $this->summit_event; - } - - /** - * @param SummitEvent $summit_event - */ - public function setSummitEvent($summit_event) - { - $this->summit_event = $summit_event; - } - - /** - * @return Group - */ - public function getGroup() - { - return $this->group; - } - - /** - * @param Group $group - */ - public function setGroup($group) - { - $this->group = $group; - } - - /** - * @return ArrayCollection - */ - public function getRecipients() - { - return $this->recipients; - } - - /** - * SummitPushNotification constructor. - */ - public function __construct() - { - parent::__construct(); - $this->recipients = new ArrayCollection; - } - - /** - * @param Member $member - * @return $this - */ - public function addRecipient(Member $member){ - $this->recipients->add($member); - return $this; - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/SummitScheduleEmptySpot.php b/app/Models/Foundation/Summit/SummitScheduleEmptySpot.php deleted file mode 100644 index 3652314d..00000000 --- a/app/Models/Foundation/Summit/SummitScheduleEmptySpot.php +++ /dev/null @@ -1,83 +0,0 @@ -location_id = $location_id; - $this->start_date_time = $start_date_time; - $this->end_date_time = $end_date_time; - } - - /** - * @return int - */ - public function getLocationId() - { - return $this->location_id; - } - - /** - * @return DateTime - */ - public function getStartDateTime() - { - return $this->start_date_time; - } - - /** - * @return DateTime - */ - public function getEndDateTime() - { - return $this->end_date_time; - } - - /** - * @return int - */ - public function getTotalMinutes(){ - $interval = $this->end_date_time->diff($this->start_date_time); - $total_minutes = $interval->days * 24 * 60; - $total_minutes += $interval->h * 60; - $total_minutes += $interval->i; - return intval($total_minutes); - } -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/SummitType.php b/app/Models/Foundation/Summit/SummitType.php deleted file mode 100644 index c2789f94..00000000 --- a/app/Models/Foundation/Summit/SummitType.php +++ /dev/null @@ -1,130 +0,0 @@ -friendly_name; - } - - /** - * @param mixed $friendly_name - */ - public function setFriendlyName($friendly_name) - { - $this->friendly_name = $friendly_name; - } - - /** - * @return mixed - */ - public function getColor() - { - return $this->color; - } - - /** - * @param mixed $color - */ - public function setColor($color) - { - $this->color = $color; - } - - /** - * @return mixed - */ - public function getType() - { - return $this->type; - } - - /** - * @param mixed $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * @return mixed - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param mixed $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return mixed - */ - public function getAudience() - { - return $this->audience; - } - - /** - * @param mixed $audience - */ - public function setAudience($audience) - { - $this->audience = $audience; - } - - /** - * @ORM\Column(name="Color", type="string") - */ - private $color; - - /** - * @ORM\Column(name="Type", type="string") - */ - private $type; - - /** - * @ORM\Column(name="Description", type="string") - */ - private $description; - - /** - * @ORM\Column(name="Audience", type="string") - */ - private $audience; -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/SummitWIFIConnection.php b/app/Models/Foundation/Summit/SummitWIFIConnection.php deleted file mode 100644 index 86f6f8f8..00000000 --- a/app/Models/Foundation/Summit/SummitWIFIConnection.php +++ /dev/null @@ -1,99 +0,0 @@ -ssid; - } - - /** - * @param string $ssid - */ - public function setSsid($ssid) - { - $this->ssid = $ssid; - } - - /** - * @return string - */ - public function getPassword() - { - return $this->password; - } - - /** - * @param string $password - */ - public function setPassword($password) - { - $this->password = $password; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/TrackTagGroup.php b/app/Models/Foundation/Summit/TrackTagGroup.php deleted file mode 100644 index 28b58a32..00000000 --- a/app/Models/Foundation/Summit/TrackTagGroup.php +++ /dev/null @@ -1,171 +0,0 @@ -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 int - */ - public function getOrder() - { - return $this->order; - } - - /** - * @param int $order - */ - public function setOrder($order) - { - $this->order = $order; - } - - /** - * @return bool - */ - public function isMandatory() - { - return $this->is_mandatory; - } - - /** - * @param bool $is_mandatory - */ - public function setIsMandatory($is_mandatory) - { - $this->is_mandatory = $is_mandatory; - } - - /** - * @return TrackTagGroupAllowedTag[] - */ - public function getAllowedTags() - { - return $this->allowed_tags; - } - - /** - * @param TrackTagGroupAllowedTag[] $allowed_tags - */ - public function setAllowedTags($allowed_tags) - { - $this->allowed_tags = $allowed_tags; - } - - public function __construct() - { - parent::__construct(); - $this->allowed_tags = new ArrayCollection; - $this->is_mandatory = false; - } - - public function clearAllowedTags() - { - $this->allowed_tags->clear(); - } - - /** - * @param Tag $tag - * @param bool $is_default - */ - public function addTag(Tag $tag, $is_default = false) - { - $allowed_tag = new TrackTagGroupAllowedTag(); - $allowed_tag->setTag($tag); - $allowed_tag->setTrackTagGroup($this); - $allowed_tag->setIsDefault($is_default); - $this->allowed_tags->add($allowed_tag); - } - -} \ No newline at end of file diff --git a/app/Models/Foundation/Summit/TrackTagGroupAllowedTag.php b/app/Models/Foundation/Summit/TrackTagGroupAllowedTag.php deleted file mode 100644 index 9564a67a..00000000 --- a/app/Models/Foundation/Summit/TrackTagGroupAllowedTag.php +++ /dev/null @@ -1,132 +0,0 @@ -track_tag_group) ? 0 : $this->track_tag_group->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getSummitId(){ - try { - return is_null($this->track_tag_group) ? 0 : $this->track_tag_group->getSummitId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @return int - */ - public function getTagId(){ - try { - return is_null($this->tag) ? 0 : $this->tag->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - - /** - * @return bool - */ - public function isDefault() - { - return $this->is_default; - } - - /** - * @param bool $is_default - */ - public function setIsDefault($is_default) - { - $this->is_default = $is_default; - } - - /** - * @return Tag - */ - public function getTag() - { - return $this->tag; - } - - /** - * @param Tag $tag - */ - public function setTag(Tag $tag) - { - $this->tag = $tag; - } - - /** - * @return TrackTagGroup - */ - public function getTrackTagGroup() - { - return $this->track_tag_group; - } - - /** - * @param TrackTagGroup $track_tag_group - */ - public function setTrackTagGroup(TrackTagGroup $track_tag_group) - { - $this->track_tag_group = $track_tag_group; - } -} \ No newline at end of file diff --git a/app/Models/OAuth2/AccessToken.php b/app/Models/OAuth2/AccessToken.php deleted file mode 100644 index 077f2e64..00000000 --- a/app/Models/OAuth2/AccessToken.php +++ /dev/null @@ -1,216 +0,0 @@ -value = $token_info['access_token']; - $instance->scope = $token_info['scope']; - $instance->client_id = $token_info['client_id']; - $instance->user_id = self::getValueFromInfo('user_id', $token_info); - $instance->user_external_id = self::getValueFromInfo('user_external_id', $token_info); - $instance->user_identifier = self::getValueFromInfo('user_identifier', $token_info); - $instance->user_email = self::getValueFromInfo('user_email', $token_info); - $instance->user_email_verified = boolval(self::getValueFromInfo('user_email_verified', $token_info)); - $instance->user_first_name = self::getValueFromInfo('user_first_name', $token_info); - $instance->user_last_name = self::getValueFromInfo('user_last_name', $token_info); - $instance->auth_code = null; - $instance->audience = $token_info['audience']; - $instance->refresh_token = null; - $instance->lifetime = intval($token_info['expires_in']); - $instance->is_hashed = false; - $instance->allowed_return_uris = self::getValueFromInfo('allowed_return_uris', $token_info); - $instance->application_type = $token_info['application_type']; - $instance->allowed_origins = self::getValueFromInfo('allowed_origins', $token_info); - $instance->user_groups = self::getValueFromInfo('user_groups', $token_info); - if(!empty($instance->user_groups)) { - if(is_string($instance->user_groups)) - $instance->user_groups = json_decode($instance->user_groups, true); - } - else - { - $instance->user_groups = []; - } - return $instance; - } - - public function getAuthCode() - { - return $this->auth_code; - } - - public function getRefreshToken() - { - return $this->refresh_token; - } - - public function getApplicationType() - { - return $this->application_type; - } - - public function getAllowedOrigins():?string - { - return $this->allowed_origins; - } - - public function getAllowedReturnUris() - { - return $this->allowed_return_uris; - } - - /** - * @return int|null - */ - public function getUserExternalId() - { - return $this->user_external_id; - } - - public function toJSON() - { - return '{}'; - } - - public function fromJSON($json) - { - - } - - /** - * @return null|string - */ - public function getUserIdentifier(): ?string - { - return $this->user_identifier; - } - - /** - * @return null|string - */ - public function getUserEmail(): ?string - { - return $this->user_email; - } - - /** - * @return null|string - */ - public function getUserFirstName(): ?string - { - return $this->user_first_name; - } - - /** - * @return null|string - */ - public function getUserLastName(): ?string - { - return $this->user_last_name; - } - - /** - * @return array - */ - public function getUserGroups():array { - return $this->user_groups; - } - - /** - * @return bool - */ - public function isUserEmailVerified(): bool - { - return $this->user_email_verified; - } - -} \ No newline at end of file diff --git a/app/Models/OAuth2/IResourceServerContext.php b/app/Models/OAuth2/IResourceServerContext.php deleted file mode 100644 index 299191aa..00000000 --- a/app/Models/OAuth2/IResourceServerContext.php +++ /dev/null @@ -1,90 +0,0 @@ -member_repository = $member_repository; - $this->member_service = $member_service; - $this->tx_service = $tx_service; - } - - /** - * @var array - */ - private $auth_context; - - /** - * @return array - */ - public function getCurrentScope() - { - return isset($this->auth_context['scope']) ? explode(' ', $this->auth_context['scope']) : []; - } - - /** - * @return null|string - */ - public function getCurrentAccessToken() - { - return $this->getAuthContextVar('access_token'); - } - - /** - * @return null|string - */ - public function getAllowedOrigins() - { - return $this->getAuthContextVar('allowed_origins'); - } - - /** - * @return null|string - */ - public function getAllowedReturnUris() - { - return $this->getAuthContextVar('allowed_return_uris'); - } - - /** - * @return null|string - */ - public function getCurrentAccessTokenLifetime() - { - return $this->getAuthContextVar('expires_in'); - } - - /** - * @return null|string - */ - public function getCurrentClientId() - { - return $this->getAuthContextVar('client_id'); - } - - /** - * @return null|int - */ - public function getCurrentUserId() - { - return $this->getAuthContextVar('user_id'); - } - - /** - * @param array $auth_context - * @return void - */ - public function setAuthorizationContext(array $auth_context) - { - $this->auth_context = $auth_context; - } - - /** - * @return int|null - */ - public function getCurrentUserExternalId() - { - return $this->getAuthContextVar('user_external_id'); - } - - /** - * @return string - */ - public function getApplicationType() - { - return $this->getAuthContextVar('application_type'); - } - - private function getAuthContextVar(string $varName) - { - return isset($this->auth_context[$varName]) ? $this->auth_context[$varName] : null; - } - - - public function getCurrentUser(bool $synch_groups = true): ?Member - { - $member = null; - - // try to get by external id - $user_external_id = $this->getAuthContextVar('user_id'); - $user_first_name = $this->getAuthContextVar('user_first_name'); - $user_last_name = $this->getAuthContextVar('user_last_name'); - $user_email = $this->getAuthContextVar('user_email'); - $user_email_verified = boolval($this->getAuthContextVar('user_email_verified')); - - if (is_null($user_external_id)) { - return null; - } - - // first we check by external id - $member = $this->tx_service->transaction(function () use ($user_external_id) { - return $this->member_repository->getByExternalIdExclusiveLock(intval($user_external_id)); - }); - - if (is_null($member)) { - // then by primary email - $member = $this->tx_service->transaction(function () use ($user_email) { - // we assume that is new idp version and claims already exists on context - $user_email = $this->getAuthContextVar('user_email'); - // at last resort try to get by email - Log::debug(sprintf("ResourceServerContext::getCurrentUser getting user by email %s", $user_email)); - return $this->member_repository->getByEmailExclusiveLock($user_email); - }); - } - - if (is_null($member)) {// user exist on IDP but not in our local DB, proceed to create it - Log::debug - ( - sprintf - ( - "ResourceServerContext::getCurrentUser creating user email %s user_external_id %s fname %s lname %s", - $user_email, - $user_external_id, - $user_first_name, - $user_last_name - ) - ); - try { - $member = $this->member_service->registerExternalUser - ( - new ExternalUserDTO - ( - $user_external_id, - $user_email, - $user_first_name, - $user_last_name, - true, - $user_email_verified - ) - ); - } catch (\Exception $ex) { - Log::warning($ex); - // race condition lost - $member = $this->tx_service->transaction(function () use ($user_external_id) { - return $this->member_repository->getByExternalIdExclusiveLock(intval($user_external_id)); - }); - } - } - - if (is_null($member)) { - Log::warning(sprintf("ResourceServerContext::getCurrentUser user not found %s (%s).", $user_external_id, $user_email)); - return null; - } - - return $this->tx_service->transaction(function () use - ( - $member, - $user_email, - $user_first_name, - $user_last_name, - $user_external_id, - $user_email_verified, - $synch_groups - ) { - // update member fields - if (!empty($user_email)) - $member->setEmail($user_email); - if (!empty($user_first_name)) - $member->setFirstName($user_first_name); - if (!empty($user_last_name)) - $member->setLastName($user_last_name); - - $member->setUserExternalId($user_external_id); - $member->setEmailVerified($user_email_verified); - - return $synch_groups ? $this->checkGroups($member) : $member; - }); - } - - /** - * @param Member $member - * @return Member - */ - private function checkGroups(Member $member): Member - { - Log::debug(sprintf("ResourceServerContext::checkGroups member %s %s", $member->getId(), $member->getEmail())); - // check groups - $groups = []; - foreach ($this->getCurrentUserGroups() as $idpGroup) { - Log::debug(sprintf("ResourceServerContext::checkGroups member %s %s group %s", $member->getId(), $member->getEmail(), json_encode($idpGroup))); - $slug = $idpGroup['slug'] ?? ''; - Log::debug(sprintf("ResourceServerContext::checkGroups member %s %s group slug %s", $member->getId(), $member->getEmail(), $slug)); - if (empty($slug)) { - continue; - } - $groups[] = trim($slug); - Log::debug(sprintf("ResourceServerContext::checkGroups member %s %s slug %s", $member->getId(), $member->getEmail(), trim($idpGroup['slug']))); - } - return $this->member_service->synchronizeGroups($member, $groups); - } - - /** - * @return array - */ - public function getCurrentUserGroups(): array - { - $res = $this->getAuthContextVar('user_groups'); - if (is_null($res)) { - Log::debug("ResourceServerContext::getCurrentUserGroups is null"); - return []; - } - return $res; - } -} \ No newline at end of file diff --git a/app/Models/OAuth2/Token.php b/app/Models/OAuth2/Token.php deleted file mode 100644 index 252024e5..00000000 --- a/app/Models/OAuth2/Token.php +++ /dev/null @@ -1,93 +0,0 @@ -len = $len; - $this->is_hashed = false; - } - - public function getValue() - { - return $this->value; - } - - public function getLifetime() - { - return intval($this->lifetime); - } - - public function getScope() - { - return $this->scope; - } - - public function getClientId() - { - return $this->client_id; - } - - public function getAudience() - { - return $this->audience; - } - - public function getFromIp() - { - return $this->from_ip; - } - - /** - * @return null|int - */ - public function getUserId() - { - return $this->user_id; - } - - public function isHashed() - { - return $this->is_hashed; - } - - public abstract function toJSON(); - - - public abstract function fromJSON($json); -} \ No newline at end of file diff --git a/app/Models/ResourceServer/AccessTokenService.php b/app/Models/ResourceServer/AccessTokenService.php deleted file mode 100644 index c39af4a6..00000000 --- a/app/Models/ResourceServer/AccessTokenService.php +++ /dev/null @@ -1,258 +0,0 @@ -cache_service = $cache_service; - } - - /** - * @param string $token_value - * @return AccessToken - * @throws \Exception - */ - public function get($token_value) - { - $token = null; - $cache_lifetime = intval(Config::get('server.access_token_cache_lifetime', 300)); - - if($this->cache_service->exists(md5($token_value).'.revoked')) - { - Log::debug(sprintf('token marked as revoked on cache (%s)',md5($token_value) )); - throw new InvalidGrantTypeException(OAuth2Protocol::OAuth2Protocol_Error_InvalidToken); - } - - $token_info = $this->cache_service->getHash(md5($token_value), self::$access_token_keys); - - if (count($token_info) === 0) - { - $token_info = $this->doIntrospection($token_value); - } - else - { - $cache_remaining_lifetime = intval($this->cache_service->ttl(md5($token_value))); - $expires_in = intval($token_info['expires_in']); - $token_info['expires_in'] = $expires_in - ( $cache_lifetime - $cache_remaining_lifetime); - Log::debug - ( - sprintf - ( - "original token life time %s - current token life time %s - token cache remaining lifetime %s", - $expires_in, - $token_info['expires_in'], - $cache_remaining_lifetime - ) - ); - } - - $token = $this->unSerializeToken($token_info); - - if($token->getLifetime() <= 0) - { - Log::debug("token lifetime is <= 0 ... retrieving from IDP"); - $this->cache_service->delete(md5($token_value)); - $token_info = $this->doIntrospection($token_value); - $token = $this->unSerializeToken($token_info); - } - return $token; - } - - /** - * @param array $token_info - * @return AccessToken - */ - private function unSerializeToken(array $token_info){ - - $token = AccessToken::createFromParams($token_info); - - $str_token_info = ""; - foreach($token_info as $k => $v){ - $str_token_info .= sprintf("-%s=%s-", $k, $v); - } - - Log::debug("token info : ". $str_token_info); - - return $token; - } - /** - * @param string $token_value - * @return array - */ - private function doIntrospection($token_value){ - Log::debug("getting token from remote call ..."); - $cache_lifetime = intval(Config::get('server.access_token_cache_lifetime', 300)); - $token_info = $this->doIntrospectionRequest($token_value); - - // legacy fix - if(!array_key_exists("user_external_id" , $token_info)){ - $token_info['user_external_id'] = null; - } - - if(!array_key_exists("user_identifier" , $token_info)){ - $token_info['user_identifier'] = null; - } - - if(!array_key_exists("user_email" , $token_info)){ - $token_info['user_email'] = null; - } - - if(!array_key_exists("user_email_verified" , $token_info)){ - $token_info['user_email_verified'] = false; - } - - if(!array_key_exists("user_first_name" , $token_info)){ - $token_info['user_first_name'] = null; - } - - if(!array_key_exists("user_last_name" , $token_info)){ - $token_info['user_last_name'] = null; - } - - if(array_key_exists("user_groups" , $token_info)){ - $token_info['user_groups'] = json_encode($token_info['user_groups']); - } - - $this->cache_service->storeHash(md5($token_value), $token_info, $cache_lifetime); - return $token_info; - } - - /** - * @param $token_value - * @return mixed - * @throws ConfigurationException - * @throws InvalidGrantTypeException - * @throws OAuth2InvalidIntrospectionResponse - * @throws \Exception - */ - private function doIntrospectionRequest($token_value) - { - - try { - $client = new Client([ - 'timeout' => Config::get('curl.timeout', 60), - 'allow_redirects' => Config::get('curl.allow_redirects', false), - 'verify' => Config::get('curl.verify_ssl_cert', true) - ]); - - $client_id = Config::get('app.openstackid_client_id', ''); - $client_secret = Config::get('app.openstackid_client_secret', ''); - $auth_server_url = Config::get('app.openstackid_base_url', ''); - - if (empty($client_id)) { - throw new ConfigurationException('app.openstackid_client_id param is missing!'); - } - - if (empty($client_secret)) { - throw new ConfigurationException('app.openstackid_client_secret param is missing!'); - } - - if (empty($auth_server_url)) { - throw new ConfigurationException('app.openstackid_base_url param is missing!'); - } - // http://docs.guzzlephp.org/en/stable/request-options.html - $response = $client->request('POST', - "{$auth_server_url}/oauth2/token/introspection", - [ - 'form_params' => ['token' => $token_value], - 'auth' => [$client_id, $client_secret], - 'timeout' => 120, - 'http_errors' => true - ] - ); - - $content_type = $response->getHeaderLine('content-type'); - if(!str_contains($content_type, 'application/json')) - { - // invalid content type - throw new \Exception($response->getBody()); - } - return json_decode($response->getBody()->getContents(), true); - } - catch (RequestException $ex) { - - Log::warning($ex->getMessage()); - $response = $ex->getResponse(); - - if(is_null($response)) - throw new OAuth2InvalidIntrospectionResponse(sprintf('http code %s', $ex->getCode())); - - $content_type = $response->getHeaderLine('content-type'); - $is_json = str_contains($content_type, 'application/json'); - $body = $response->getBody()->getContents(); - $body = $is_json ? json_decode($body, true): $body; - $code = $response->getStatusCode(); - - if ($code === 400 && $is_json && isset($body['error']) - && ( - $body['error'] === OAuth2Protocol::OAuth2Protocol_Error_InvalidToken || - $body['error'] === OAuth2Protocol::OAuth2Protocol_Error_InvalidGrant - )) - { - $this->cache_service->setSingleValue(md5($token_value).'.revoked', md5($token_value)); - throw new InvalidGrantTypeException($body['error']); - } - if($code == 503 ){ - // service went online temporally ... revoke token - $this->cache_service->setSingleValue(md5($token_value).'.revoked', md5($token_value)); - throw new InvalidGrantTypeException(OAuth2Protocol::OAuth2Protocol_Error_InvalidToken); - } - throw new OAuth2InvalidIntrospectionResponse(sprintf('http code %s - body %s', $ex->getCode(), $body)); - } - } -} \ No newline at end of file diff --git a/app/Models/ResourceServer/Api.php b/app/Models/ResourceServer/Api.php deleted file mode 100644 index 259a1301..00000000 --- a/app/Models/ResourceServer/Api.php +++ /dev/null @@ -1,183 +0,0 @@ -scopes = new ArrayCollection(); - $this->endpoints = new ArrayCollection(); - } - - /** - * @return ApiScope[] - */ - public function getScopes() - { - return $this->scopes; - } - - /** - * @param mixed $scopes - */ - public function setScopes($scopes) - { - $this->scopes = $scopes; - } - - /** - * @return ApiEndpoint[] - */ - public function getEndpoints() - { - return $this->endpoints; - } - - /** - * @param mixed $endpoints - */ - public function setEndpoints($endpoints) - { - $this->endpoints = $endpoints; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return boolean - */ - public function isActive() - { - return $this->active; - } - - /** - * @param boolean $active - */ - public function setActive($active) - { - $this->active = $active; - } - - /** - * @return string - */ - public function getScope() - { - $scope = ''; - foreach ($this->getScopes() as $s) - { - if (!$s->isActive()) - { - continue; - } - $scope = $scope .$s->getName().' '; - } - $scope = trim($scope); - return $scope; - } - - /** - * @return int[] - */ - public function getScopeIds():array { - $ids = []; - foreach ($this->getScopes() as $e) { - $ids[] = intval($e->getId()); - } - return $ids; - } - - /** - * @return int[] - */ - public function getEndpointsIds():array { - $ids = []; - foreach ($this->getEndpoints() as $e) { - $ids[] = intval($e->getId()); - } - return $ids; - } -} \ No newline at end of file diff --git a/app/Models/ResourceServer/ApiEndpoint.php b/app/Models/ResourceServer/ApiEndpoint.php deleted file mode 100644 index 1deae801..00000000 --- a/app/Models/ResourceServer/ApiEndpoint.php +++ /dev/null @@ -1,367 +0,0 @@ -api; - } - - /** - * @param Api $api - */ - public function setApi($api) - { - $this->api = $api; - } - - /** - * @return ApiScope[] - */ - public function getScopes() - { - return $this->scopes; - } - - /** - * @param ApiScope[] $scopes - */ - public function setScopes($scopes) - { - $this->scopes = $scopes; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return boolean - */ - public function isActive() - { - return $this->active; - } - - /** - * @param boolean $active - */ - public function setActive($active) - { - $this->active = $active; - } - - /** - * @return boolean - */ - public function isAllowCors() - { - return $this->allow_cors; - } - - /** - * @param boolean $allow_cors - */ - public function setAllowCors($allow_cors) - { - $this->allow_cors = $allow_cors; - } - - /** - * @return boolean - */ - public function isAllowCredentials() - { - return $this->allow_credentials; - } - - /** - * @param boolean $allow_credentials - */ - public function setAllowCredentials($allow_credentials) - { - $this->allow_credentials = $allow_credentials; - } - - /** - * @return string - */ - public function getRoute() - { - return $this->route; - } - - /** - * @param string $route - */ - public function setRoute($route) - { - $this->route = $route; - } - - /** - * @return string - */ - public function getHttpMethod() - { - return $this->http_method; - } - - /** - * @param string $http_method - */ - public function setHttpMethod($http_method) - { - $this->http_method = $http_method; - } - /** - * @ORM\ManyToOne(targetEntity="Api", cascade={"persist"}, inversedBy="endpoints") - * @ORM\JoinColumn(name="api_id", referencedColumnName="id") - * @var Api - */ - private $api; - - /** - * @ORM\ManyToMany(targetEntity="ApiScope") - * @ORM\JoinTable(name="endpoint_api_scopes", - * joinColumns={@ORM\JoinColumn(name="api_endpoint_id", referencedColumnName="id")}, - * inverseJoinColumns={@ORM\JoinColumn(name="scope_id", referencedColumnName="id")} - * ) - * @var ApiScope[] - */ - private $scopes; - - /** - * @ORM\OneToMany(targetEntity="ApiEndpointAuthzGroup", mappedBy="api_endpoint", cascade={"persist"}) - */ - private $authz_groups; - - /** - * @ORM\Column(name="name", type="string") - * @var string - */ - private $name; - - /** - * @ORM\Column(name="description", type="string") - * @var string - */ - private $description; - - /** - * @ORM\Column(name="active", type="boolean") - * @var bool - */ - private $active; - - /** - * @ORM\Column(name="allow_cors", type="boolean") - * @var bool - */ - private $allow_cors; - - /** - * @ORM\Column(name="allow_credentials", type="boolean") - * @var bool - */ - private $allow_credentials; - - /** - * @ORM\Column(name="route", type="string") - * @var string - */ - private $route; - - /** - * @ORM\Column(name="http_method", type="string") - * @var string - */ - private $http_method; - - /** - * @ORM\Column(name="rate_limit", type="integer") - * @var int - */ - private $rate_limit; - - /** - * @ORM\Column(name="rate_limit_decay", type="integer") - * @var int - */ - private $rate_limit_decay; - - /** - * ApiEndpoint constructor. - */ - public function __construct() - { - parent::__construct(); - $this->rate_limit = 0; - $this->rate_limit_decay = 0; - $this->scopes = new ArrayCollection(); - $this->authz_groups = new ArrayCollection(); - } - - /** - * @return string - */ - public function getFriendlyScopes():string - { - $scopes = $this->getScopesNames(); - return implode(' ', $scopes); - } - - /** - * @return string[] - */ - public function getScopesNames(): array { - $scopes = []; - - foreach ($this->scopes as $s) { - if (!$s->isActive()) { - continue; - } - $scopes[] = $s->getName(); - } - - return $scopes; - } - - /** - * @param IApiScope $scope - */ - public function addScope(IApiScope $scope){ - $this->scopes->add($scope); - } - - /** - * @return int - */ - public function getRateLimit() - { - return $this->rate_limit; - } - - /** - * @param int $rate_limit - */ - public function setRateLimit($rate_limit) - { - $this->rate_limit = $rate_limit; - } - - /** - * @return int - */ - public function getRateLimitDecay() - { - return $this->rate_limit_decay; - } - - /** - * @param int $rate_limit_decay - */ - public function setRateLimitDecay($rate_limit_decay) - { - $this->rate_limit_decay = $rate_limit_decay; - } - - /** - * @return mixed - */ - public function getAuthzGroups() - { - return $this->authz_groups; - } - - /** - * @param string $slug - * @return ApiEndpointAuthzGroup - */ - public function addAuthGroup(string $slug):ApiEndpointAuthzGroup{ - $authz_group = new ApiEndpointAuthzGroup(); - $authz_group->setSlug(trim($slug)); - $authz_group->setApiEndpoint($this); - $this->authz_groups->add($authz_group); - return $authz_group; - } - - - /** - * @return int[] - */ - public function getScopeIds():array { - $ids = []; - foreach ($this->getScopes() as $e) { - $ids[] = intval($e->getId()); - } - return $ids; - } - - /** - * @return int[] - */ - public function getAuthGroupIds():array { - $ids = []; - foreach ($this->getAuthzGroups() as $e) { - $ids[] = intval($e->getId()); - } - return $ids; - } -} \ No newline at end of file diff --git a/app/Models/ResourceServer/ApiEndpointAuthzGroup.php b/app/Models/ResourceServer/ApiEndpointAuthzGroup.php deleted file mode 100644 index bd82d069..00000000 --- a/app/Models/ResourceServer/ApiEndpointAuthzGroup.php +++ /dev/null @@ -1,68 +0,0 @@ -api_endpoint; - } - - /** - * @param ApiEndpoint $api_endpoint - */ - public function setApiEndpoint(ApiEndpoint $api_endpoint): void - { - $this->api_endpoint = $api_endpoint; - } - - /** - * @return string - */ - public function getSlug(): string - { - return $this->slug; - } - - /** - * @param string $slug - */ - public function setSlug(string $slug): void - { - $this->slug = $slug; - } -} \ No newline at end of file diff --git a/app/Models/ResourceServer/ApiScope.php b/app/Models/ResourceServer/ApiScope.php deleted file mode 100644 index 8206467b..00000000 --- a/app/Models/ResourceServer/ApiScope.php +++ /dev/null @@ -1,165 +0,0 @@ -api; - } - - /** - * @param Api $api - */ - public function setApi(Api $api) - { - $this->api = $api; - } - - /** - * @ORM\ManyToOne(targetEntity="Api", inversedBy="scopes") - * @ORM\JoinColumn(name="api_id", referencedColumnName="id") - * @var Api - */ - private $api; - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param string $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return string - */ - public function getShortDescription() - { - return $this->short_description; - } - - /** - * @param string $short_description - */ - public function setShortDescription($short_description) - { - $this->short_description = $short_description; - } - - /** - * @return boolean - */ - public function isActive() - { - return $this->active; - } - - /** - * @param boolean $active - */ - public function setActive($active) - { - $this->active = $active; - } - - /** - * @ORM\Column(name="name", type="string") - * @var string - */ - private $name; - - /** - * @ORM\Column(name="description", type="string") - * @var string - */ - private $description; - - /** - * @return boolean - */ - public function isDefault() - { - return $this->default; - } - - /** - * @param boolean $default - */ - public function setDefault($default) - { - $this->default = $default; - } - - /** - * @ORM\Column(name="short_description", type="string") - * @var string - */ - private $short_description; - - /** - * @ORM\Column(name="active", type="boolean") - * @var bool - */ - private $active; - - /** - * @ORM\Column(name="`default`", type="boolean") - * @var bool - */ - private $default; - - public function __construct() - { - parent::__construct(); - $this->active = false; - $this->default = false; - } -} \ No newline at end of file diff --git a/app/Models/ResourceServer/EndpointRateLimitByIP.php b/app/Models/ResourceServer/EndpointRateLimitByIP.php deleted file mode 100644 index 007f99b5..00000000 --- a/app/Models/ResourceServer/EndpointRateLimitByIP.php +++ /dev/null @@ -1,161 +0,0 @@ -ip; - } - - /** - * @param string $ip - */ - public function setIp($ip) - { - $this->ip = $ip; - } - - /** - * @return bool - */ - public function isActive() - { - return $this->active; - } - - /** - * @param bool $active - */ - public function setActive($active) - { - $this->active = $active; - } - - /** - * @return string - */ - public function getRoute() - { - return $this->route; - } - - /** - * @param string $route - */ - public function setRoute($route) - { - $this->route = $route; - } - - /** - * @return string - */ - public function getHttpMethod() - { - return $this->http_method; - } - - /** - * @param string $http_method - */ - public function setHttpMethod($http_method) - { - $this->http_method = $http_method; - } - - /** - * @return int - */ - public function getRateLimit() - { - return $this->rate_limit; - } - - /** - * @param int $rate_limit - */ - public function setRateLimit($rate_limit) - { - $this->rate_limit = $rate_limit; - } - - /** - * @return int - */ - public function getRateLimitDecay() - { - return $this->rate_limit_decay; - } - - /** - * @param int $rate_limit_decay - */ - public function setRateLimitDecay($rate_limit_decay) - { - $this->rate_limit_decay = $rate_limit_decay; - } - - /** - * @ORM\Column(name="active", type="boolean") - * @var bool - */ - private $active; - - /** - * @ORM\Column(name="route", type="string") - * @var string - */ - private $route; - - /** - * @ORM\Column(name="http_method", type="string") - * @var string - */ - private $http_method; - - /** - * @ORM\Column(name="rate_limit", type="integer") - * @var int - */ - private $rate_limit; - - /** - * @ORM\Column(name="rate_limit_decay", type="integer") - * @var int - */ - private $rate_limit_decay; - -} \ No newline at end of file diff --git a/app/Models/ResourceServer/IAccessTokenService.php b/app/Models/ResourceServer/IAccessTokenService.php deleted file mode 100644 index 2dd2eb73..00000000 --- a/app/Models/ResourceServer/IAccessTokenService.php +++ /dev/null @@ -1,31 +0,0 @@ -id; - } - - public function getId(){ - return $this->getIdentifier(); - } - - /** - * @return \DateTime - */ - public function getCreated() - { - return $this->created; - } - - /** - * @param \DateTime $created - */ - public function setCreated($created) - { - $this->created = $created; - } - - /** - * @return \DateTime - */ - public function getLastEdited() - { - return $this->last_edited; - } - - /** - * @param \DateTime $last_edited - */ - public function setLastEdited($last_edited) - { - $this->last_edited = $last_edited; - } - - public function __construct() - { - $now = new \DateTime('now', new \DateTimeZone(self::DefaultTimeZone)); - $this->created = $now; - $this->last_edited = $now; - } -} \ No newline at end of file diff --git a/app/Models/Utils/BaseEntity.php b/app/Models/Utils/BaseEntity.php deleted file mode 100644 index 1b1a5c01..00000000 --- a/app/Models/Utils/BaseEntity.php +++ /dev/null @@ -1,52 +0,0 @@ -id); - } - - /** - * @return int - */ - public function getIdentifier() - { - return (int)$this->id; - } - - /** - * @return int - */ - public function getId() - { - return $this->getIdentifier(); - } -} \ No newline at end of file diff --git a/app/Models/Utils/GetDefaultValueFromConfig.php b/app/Models/Utils/GetDefaultValueFromConfig.php deleted file mode 100644 index ad7c7d93..00000000 --- a/app/Models/Utils/GetDefaultValueFromConfig.php +++ /dev/null @@ -1,32 +0,0 @@ -format('h')); - $start_min = intval($from->format('i')); - - do{ - $aux_to = clone $aux_from; - $aux_to->setTime(23, 59, 59); - - if($aux_to > $to){ - $aux_to = clone $to; - } - $intervals[] = [ - $aux_from, - $aux_to - ]; - $aux_from = clone $aux_from; - $aux_from->add(new \DateInterval('P1D')); - - } while($aux_to < $to); - - return $intervals; - } -} \ No newline at end of file diff --git a/app/Models/Utils/One2ManyPropertyTrait.php b/app/Models/Utils/One2ManyPropertyTrait.php deleted file mode 100644 index cd47e7e1..00000000 --- a/app/Models/Utils/One2ManyPropertyTrait.php +++ /dev/null @@ -1,59 +0,0 @@ -getIdMappings[$name] ?? null; - if(!is_null($property)) { - return $this->getPropertyId($property); - } - $property = $this->hasPropertyMappings[$name] ?? null; - if(!is_null($property)) { - return $this->hasPropertySet($property); - } - return null; - } - - /** - * @param string $property_name - * @return int - */ - public function getPropertyId(string $property_name){ - try { - return is_null($this->{$property_name}) ? 0 : $this->{$property_name}->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - /** - * @param string $property_name - * @return bool - */ - public function hasPropertySet(string $property_name):bool{ - return $this->getPropertyId($property_name) > 0; - } -} \ No newline at end of file diff --git a/app/Models/Utils/PreRemoveEventArgs.php b/app/Models/Utils/PreRemoveEventArgs.php deleted file mode 100644 index 7c1d86f9..00000000 --- a/app/Models/Utils/PreRemoveEventArgs.php +++ /dev/null @@ -1,42 +0,0 @@ -params = $params; - } - - /** - * @return array - */ - public function getParams() - { - return $this->params; - } - -} \ No newline at end of file diff --git a/app/Models/Utils/RandomGenerator.php b/app/Models/Utils/RandomGenerator.php deleted file mode 100644 index d10a7eda..00000000 --- a/app/Models/Utils/RandomGenerator.php +++ /dev/null @@ -1,84 +0,0 @@ -GetRandom(64, 0)); - } - } catch (Exception $ex) { - } - } - - // Fallback to good old mt_rand() - return uniqid(mt_rand(), true); - } - - /** - * Generates a random token that can be used for session IDs, CSRF tokens etc., based on - * hash algorithms. - * - * If you are using it as a password equivalent (e.g. autologin token) do NOT store it - * in the database as a plain text but encrypt it with Member::encryptWithUserSettings. - * - * @param String $algorithm Any identifier listed in hash_algos() (Default: whirlpool) - * - * @return String Returned length will depend on the used $algorithm - */ - public function randomToken($algorithm = 'whirlpool') { - return hash($algorithm, $this->generateEntropy()); - } -} diff --git a/app/Models/Utils/SilverstripeBaseModel.php b/app/Models/Utils/SilverstripeBaseModel.php deleted file mode 100644 index 4ddfbd3c..00000000 --- a/app/Models/Utils/SilverstripeBaseModel.php +++ /dev/null @@ -1,156 +0,0 @@ -created; - } - - /** - * @return \DateTime|null - */ - public function getCreatedUTC(){ - if(is_null($this->created)) return null; - return $this->getDateFromLocalToUTC($this->created); - } - - /** - * @param \DateTime $created - */ - public function setCreated($created) - { - $this->created = $created; - } - - /** - * @return \DateTime - */ - public function getLastEdited() - { - return $this->last_edited; - } - - /** - * @return \DateTime|null - */ - public function getLastEditedUTC(){ - if(is_null($this->last_edited)) return null; - return $this->getDateFromLocalToUTC($this->last_edited); - } - - /** - * @param \DateTime $value - * @return \DateTime|null - */ - protected function getDateFromLocalToUTC(\DateTime $value){ - if(is_null($value)) return null; - $default_timezone = new \DateTimeZone(self::DefaultTimeZone); - $utc_timezone = new \DateTimeZone("UTC"); - $timestamp = $value->format('Y-m-d H:i:s'); - $local_date = new \DateTime($timestamp, $default_timezone); - return $local_date->setTimezone($utc_timezone); - } - - /** - * @param \DateTime $last_edited - */ - public function setLastEdited($last_edited) - { - $this->last_edited = $last_edited; - } - - - public function __construct() - { - $now = new \DateTime('now', new \DateTimeZone(self::DefaultTimeZone)); - $this->created = $now; - $this->last_edited = $now; - } - - /** - * @return QueryBuilder - */ - protected function createQueryBuilder(){ - return Registry::getManager(self::EntityManager)->createQueryBuilder(); - } - - /** - * @param string $dql - * @return Query - */ - protected function createQuery($dql){ - return Registry::getManager(self::EntityManager)->createQuery($dql); - } - - /** - * @param string $sql - * @return mixed - */ - protected function prepareRawSQL($sql){ - return Registry::getManager(self::EntityManager)->getConnection()->prepare($sql); - } - - /** - * @param string $sql - * @return mixed - */ - protected static function prepareRawSQLStatic($sql){ - return Registry::getManager(self::EntityManager)->getConnection()->prepare($sql); - } - - /** - * @return EntityManager - */ - protected function getEM(){ - return Registry::getManager(self::EntityManager); - } - - /** - * @return EntityManager - */ - protected static function getEMStatic(){ - return Registry::getManager(self::EntityManager); - } - - const EntityManager = 'model'; -} \ No newline at end of file diff --git a/app/Models/Utils/TimeZoneEntity.php b/app/Models/Utils/TimeZoneEntity.php deleted file mode 100644 index 39f78407..00000000 --- a/app/Models/Utils/TimeZoneEntity.php +++ /dev/null @@ -1,96 +0,0 @@ -time_zone_id; - } - - /** - * @param string $time_zone_id - */ - public function setTimeZoneId($time_zone_id) - { - $this->time_zone_id = $time_zone_id; - } - - /** - * @return DateTimeZone|null - */ - public function getTimeZone() - { - try { - return new DateTimeZone($this->getTimeZoneId()); - } catch (\Exception $ex) { - return null; - } - } - - /** - * @param DateTime $value - * @return null|DateTime - */ - public function convertDateFromUTC2TimeZone(?DateTime $value) - { - if(is_null($value)) return null; - $time_zone = $this->getTimeZone(); - if (is_null($time_zone)) return null; - - $utc_timezone = new DateTimeZone("UTC"); - $timestamp = $value->format('Y-m-d H:i:s'); - $utc_date = new DateTime($timestamp, $utc_timezone); - - return $utc_date->setTimezone($time_zone); - } - - /** - * @param DateTime $value - * @return null|DateTime - */ - public function convertDateFromTimeZone2UTC(?DateTime $value) - { - if(is_null($value)) return null; - $time_zone = $this->getTimeZone(); - if (is_null($time_zone)) return null; - - $utc_timezone = new DateTimeZone("UTC"); - $timestamp = $value->format('Y-m-d H:i:s'); - $local_date = new DateTime($timestamp, $time_zone); - return $local_date->setTimezone($utc_timezone); - } - - /** - * @return array - */ - public function getTimezones() - { - $timezones_list = []; - foreach (DateTimeZone::listIdentifiers() as $timezone_identifier) { - $timezones_list[$timezone_identifier] = $timezone_identifier; - } - return $timezones_list; - } -} \ No newline at end of file diff --git a/app/Models/Utils/Traits/HasImageTrait.php b/app/Models/Utils/Traits/HasImageTrait.php deleted file mode 100644 index 41f8b5f5..00000000 --- a/app/Models/Utils/Traits/HasImageTrait.php +++ /dev/null @@ -1,68 +0,0 @@ -image = $image; - } - - public function clearImage():void{ - $this->image = null; - } - - /** - * @return bool - */ - public function hasImage():bool{ - return $this->getImageId() > 0; - } - - /** - * @return int - */ - public function getImageId():int - { - try{ - if(is_null($this->image)) return 0; - return $this->image->getId(); - } - catch(\Exception $ex){ - return 0; - } - } - - public function getImage():?File{ - return $this->image; - } - - /** - * @return string|null - */ - public function getImageUrl():?string{ - $photoUrl = null; - if($this->hasImage() && $photo = $this->getImage()){ - $photoUrl = $photo->getUrl(); - } - return $photoUrl; - } -} \ No newline at end of file diff --git a/app/Permissions/IPermissionsManager.php b/app/Permissions/IPermissionsManager.php deleted file mode 100644 index f2dc0f92..00000000 --- a/app/Permissions/IPermissionsManager.php +++ /dev/null @@ -1,28 +0,0 @@ -config) > 0 ) return; - - $path = sprintf("%s/permissions.yml", dirname(__FILE__)); - $yaml = Yaml::parse(file_get_contents($path)); - if(!is_null($yaml) && count($yaml)) - { - foreach($yaml as $entities => $entity){ - foreach ($entity as $permissions_per_role){ - $entity_name = array_keys($entity)[0]; - $entity_config = []; - foreach ($permissions_per_role as $permission_per_role){ - $role = array_keys($permission_per_role)[0]; - $entity_config[$role] = []; - foreach($permission_per_role as $permissions){ - foreach($permissions as $permission) - $entity_config[$role][] = $permission; - } - } - $this->config[$entity_name] = $entity_config; - } - }} - - } - /** - * @param Member $current_user - * @param string $entity_name - * @param array $data - * @return bool - */ - public function canEditFields(Member $current_user, $entity_name, array $data){ - $this->loadConfiguration(); - $groups = $current_user->getGroupsCodes(); - - if(!isset($this->config[$entity_name])) - throw new \InvalidArgumentException(sprintf("entity %s does not has a configuration set", $entity_name)); - - $entity_config = $this->config[$entity_name]; - - foreach($groups as $group_code) { - if(!isset($entity_config[$group_code])) continue; - $allowed_fields = $entity_config[$group_code]; - if(count($allowed_fields) == 0) return false; - if(in_array(self::AllFieldsWillCard, $allowed_fields)) return true; - $fields = array_keys($data); - $diff = array_diff($fields, $allowed_fields); - if(count($diff) > 0) - return false; - return true; - } - return false; - } -} \ No newline at end of file diff --git a/app/Permissions/permissions.yml b/app/Permissions/permissions.yml deleted file mode 100644 index 2b386af0..00000000 --- a/app/Permissions/permissions.yml +++ /dev/null @@ -1,17 +0,0 @@ -# here you define per Entity ClassName allowed fields to edit per user role -- SummitEvent: - - super-admins: - - __all__ - - administrators: - - __all__ - - summit-front-end-administrators: - - __all__ - - summit-room-administrators: - - occupancy -- Presentation: - - super-admins: - - __all__ - - administrators: - - __all__ - - summit-front-end-administrators: - - __all__ diff --git a/app/Policies/.gitkeep b/app/Policies/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/app/Policies/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php deleted file mode 100644 index 64ef1314..00000000 --- a/app/Providers/AppServiceProvider.php +++ /dev/null @@ -1,559 +0,0 @@ - 'sometimes|int', - 'type_id' => 'sometimes|int', - 'promo_code' => 'nullable|string|max:255', - 'attendee_first_name' => 'nullable|string|max:255', - 'attendee_last_name' => 'nullable|string|max:255', - 'attendee_company' => 'nullable|string|max:255', - 'attendee_email' => 'nullable|string|max:255|email', - 'disclaimer_accepted' => 'nullable|boolean', - 'share_contact_info' => 'nullable|boolean', - 'extra_questions' => 'sometimes|extra_question_dto_array' - ]; - - static $extra_question_dto_fields = [ - 'question_id', - 'answer', - ]; - - static $extra_question_dto_validation_rules = [ - 'question_id' => 'required|int', - 'answer' => 'nullable|string|max:512', - ]; - - const DefaultSchema = 'https://'; - - static $event_dto_fields = [ - 'id', - 'title', - 'start_date', - 'end_date', - 'type_id', - 'track_id', - 'location_id', - 'description', - 'rsvp_link', - 'head_count', - 'social_description', - 'allow_feedback', - 'tags', - 'sponsors', - 'attendees_expected_learnt', - 'level', - 'feature_cloud', - 'to_record', - 'speakers', - 'moderator_speaker_id', - 'groups' - ]; - - static $event_dto_fields_publish = [ - 'id', - 'start_date', - 'end_date', - 'location_id', - ]; - - static $event_dto_publish_validation_rules = [ - 'id' => 'required|integer', - 'location_id' => 'required|integer', - 'start_date' => 'required|date_format:U', - 'end_date' => 'required_with:start_date|date_format:U|after:start_date', - ]; - - static $event_dto_validation_rules = [ - // summit event rules - 'id' => 'required|integer', - 'title' => 'sometimes|string|max:100', - 'description' => 'sometimes|string', - 'rsvp_link' => 'sometimes|url', - 'head_count' => 'sometimes|integer', - 'social_description' => 'sometimes|string|max:100', - 'location_id' => 'sometimes|integer', - 'start_date' => 'sometimes|date_format:U', - 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date', - 'allow_feedback' => 'sometimes|boolean', - 'type_id' => 'sometimes|required|integer', - 'track_id' => 'sometimes|required|integer', - 'tags' => 'sometimes|string_array', - 'sponsors' => 'sometimes|int_array', - // presentation rules - 'attendees_expected_learnt' => 'sometimes|string|max:100', - 'feature_cloud' => 'sometimes|boolean', - 'to_record' => 'sometimes|boolean', - 'speakers' => 'sometimes|int_array', - 'moderator_speaker_id' => 'sometimes|integer', - // group event - 'groups' => 'sometimes|int_array', - ]; - - - static $rsvp_answer_dto_fields = [ - 'question_id', - 'value', - ]; - - static $rsvp_answer_validation_rules = [ - 'question_id' => 'required|integer', - 'value' => 'sometimes|string_or_string_array', - ]; - - /** - * Bootstrap any application services. - * @return void - */ - public function boot() - { - URL::forceScheme('https'); - - $logger = Log::getLogger(); - foreach($logger->getHandlers() as $handler) { - $handler->setLevel(Config::get('log.level', 'debug')); - } - - //set email log - $to = Config::get('log.to_email', ''); - $from = Config::get('log.from_email', ''); - - if (!empty($to) && !empty($from)) { - $subject = Config::get('log.email_subject', 'openstackid-resource-server error'); - $cacheService = App::make(ICacheService::class); - $handler = new LaravelMailerHandler($cacheService, $to, $subject, $from); - $handler->setLevel(Config::get('log.email_level', 'error')); - $logger->pushHandler($handler); - } - - Validator::extend('int_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('int_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be an array of integers", $attribute); - }); - if(!is_array($value)) return false; - foreach($value as $element) - { - if(!is_numeric($element)) return false; - } - return true; - }); - - Validator::extend('event_dto_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('event_dto_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf - ( - "%s should be an array of event data {id : int, location_id: int, start_date: int (epoch), end_date: int (epoch)}", - $attribute); - }); - if(!is_array($value)) return false; - foreach($value as $element) - { - foreach($element as $key => $element_val){ - if(!in_array($key, self::$event_dto_fields)) return false; - } - - // Creates a Validator instance and validates the data. - $validation = Validator::make($element, self::$event_dto_validation_rules); - - if($validation->fails()) return false; - } - return true; - }); - - Validator::extend('extra_question_dto_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('extra_question_dto_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf - ( - "%s should be an array of extra question data {question_id : int, answer: string}", - $attribute); - }); - - if(!is_array($value)) return false; - - foreach($value as $element) - { - foreach($element as $key => $element_val){ - if(!in_array($key, self::$extra_question_dto_fields)) return false; - } - - // Creates a Validator instance and validates the data. - $validation = Validator::make($element, self::$extra_question_dto_validation_rules); - - if($validation->fails()) return false; - } - return true; - }); - - Validator::extend('ticket_dto_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('ticket_dto_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf - ( - "%s should be an array of ticket data {id: int|optional, type_id: int|optional, promo_code:string|optional, attendee_first_name:string|optional, attendee_last_name:string|optional, attendee_email:string|optional, extra_questions:array|optional }", - $attribute - ); - }); - if(!is_array($value)) return false; - foreach($value as $element) - { - foreach($element as $key => $element_val){ - if(!in_array($key, self::$ticket_dto_fields)) return false; - } - - // Creates a Validator instance and validates the data. - $validation = Validator::make($element, self::$ticket_dto_validation_rules); - - if($validation->fails()) return false; - } - return true; - }); - - Validator::extend('event_dto_publish_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('event_dto_publish_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf - ( - "%s should be an array of event data {id : int, location_id: int, start_date: int (epoch), end_date: int (epoch)}", - $attribute); - }); - if(!is_array($value)) return false; - foreach($value as $element) - { - foreach($element as $key => $element_val){ - if(!in_array($key, self::$event_dto_fields_publish)) return false; - } - - // Creates a Validator instance and validates the data. - $validation = Validator::make($element, self::$event_dto_publish_validation_rules); - - if($validation->fails()) return false; - } - return true; - }); - - Validator::extend('text', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('text', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid text", $attribute); - }); - - return preg_match('/^[^<>\"\']+$/u', $value); - }); - - Validator::extend('string_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('string_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be an array of strings", $attribute); - }); - if(!is_array($value)) - return false; - foreach($value as $element) - { - if(!is_string($element)) - return false; - } - return true; - }); - - Validator::extend('string_or_string_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('string_or_string_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a string or an array of strings", $attribute); - }); - - if(is_string($value)) - return true; - - if(!is_array($value)) - return false; - - foreach($value as $element) - { - if(!is_string($element)) - return false; - } - return true; - }); - - Validator::extend('url_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('url_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should a list of valid urls.", $attribute); - }); - if(!is_array($value)) return false; - foreach($value as $element) - { - if(!filter_var($element, FILTER_VALIDATE_URL)){ - // try to add the default schema in front of the url to valiate - $element = self::DefaultSchema.$element; - if(!filter_var($element, FILTER_VALIDATE_URL)) - return false; - } - } - return true; - }); - - Validator::extend('entity_value_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('entity_value_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be an array of {id,value} tuple", $attribute); - }); - if(!is_array($value)) return false; - foreach($value as $element) - { - if(!isset($element['id'])) return false; - if(!isset($element['value'])) return false; - } - return true; - }); - - Validator::extend('link_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('link_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be an array of {title,link} tuple", $attribute); - }); - - if(!is_array($value)) return false; - foreach($value as $element) - { - // Creates a Validator instance and validates the data. - $validation = Validator::make($element, [ - 'title' => 'required|string|max:255', - 'link' => 'required|url', - ]); - - if($validation->fails()) return false; - } - return true; - }); - - Validator::extend('team_permission', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('team_permission', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid permission value (ADMIN, WRITE, READ)", $attribute); - }); - return in_array($value, [ChatTeamPermission::Read, ChatTeamPermission::Write, ChatTeamPermission::Admin]); - }); - - Validator::extend('chat_message_priority', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('chat_message_priority', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid message priority value (NORMAL, HIGH)", $attribute); - }); - return in_array($value, [ PushNotificationMessagePriority::Normal, PushNotificationMessagePriority::High]); - }); - - Validator::extend('after_or_null_epoch', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('after_or_null_epoch', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be zero or after %s", $attribute, $parameters[0]); - }); - $data = $validator->getData(); - if(is_null($value) || intval($value) == 0 ) return true; - if(isset($data[$parameters[0]])){ - $compare_to = $data[$parameters[0]]; - $parsed = date_parse_from_format('U', $value); - $valid = $parsed['error_count'] === 0 && $parsed['warning_count'] === 0; - return $valid && intval($compare_to) < intval($value); - } - return true; - }); - - Validator::extend('greater_than_field', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('greater_than_field', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be greather than %s", $attribute, $parameters[0]); - }); - $data = $validator->getData(); - if(is_null($value) || intval($value) == 0 ) return true; - if(isset($data[$parameters[0]])){ - $compare_to = $data[$parameters[0]]; - return intval($compare_to) < intval($value); - } - return true; - }); - - Validator::extend('valid_epoch', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('valid_epoch', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid epoch value", $attribute); - }); - return intval($value) > 0; - }); - - Validator::extend('hex_color', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('hex_color', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid hex color value", $attribute); - }); - if(strlen($value) != 6) return false; - if(!ctype_xdigit($value)) return false; - return true; - }); - - Validator::extend('geo_latitude', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('geo_latitude', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid coordinate value (-90.00,+90.00)", $attribute); - }); - - $value = floatval($value); - return !($value < -90.00 || $value > 90.00); - - }); - - Validator::extend('geo_longitude', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('geo_longitude', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid coordinate value (-180.00,+180.00)", $attribute); - }); - - $value = floatval($value); - return !($value < -180.00 || $value > 180.00); - }); - - Validator::extend('country_iso_alpha2_code', function($attribute, $value, $parameters, $validator){ - $validator->addReplacer('country_iso_alpha2_code', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid country iso code", $attribute); - }); - if(!is_string($value)) return false; - $value = trim($value); - - $isoCodes = new IsoCodesFactory(); - $countries = $isoCodes->getCountries(); - $country = $countries->getByAlpha2($value); - - return !is_null($country); - }); - - Validator::extend('currency_iso', function($attribute, $value, $parameters, $validator) - { - - $validator->addReplacer('currency_iso', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be a valid currency iso 4217 code", $attribute); - }); - if(!is_string($value)) return false; - $value = trim($value); - - $isoCodes = new IsoCodesFactory(); - - $currencies = $isoCodes->getCurrencies(); - - $currency = $currencies->getByLetterCode($value); - - return !is_null($currency); - - }); - - Validator::extend('greater_than', function ($attribute, $value, $otherValue) { - return intval($value) > intval($otherValue[0]); - }); - - Validator::extend('greater_than_or_equal', function ($attribute, $value, $otherValue) { - return intval($value) >= intval($otherValue[0]); - }); - - Validator::extend('rsvp_answer_dto_array', function($attribute, $value, $parameters, $validator) - { - $validator->addReplacer('rsvp_answer_dto_array', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf - ( - "%s should be an array of rsvp answer data {question_id : int, value: string, values: string array}", - $attribute); - }); - if(!is_array($value)) return false; - foreach($value as $element) - { - foreach($element as $key => $element_val){ - if(!in_array($key, self::$rsvp_answer_dto_fields)) - return false; - } - - // Creates a Validator instance and validates the data. - $validation = Validator::make($element, self::$rsvp_answer_validation_rules); - - if($validation->fails()) - return false; - } - return true; - }); - - Validator::extend('megabyte_aligned', function($attribute, $value, $parameters, $validator){ - $validator->addReplacer('megabyte_aligned', function($message, $attribute, $rule, $parameters) use ($validator) { - return sprintf("%s should be aligned to 1024 KB", $attribute); - }); - - $value = intval($value); - - if($value <= 0) return false; - - return ($value % 1024 == 0); - }); - } - - /** - * Register any application services. - * @return void - */ - public function register() - { - - App::singleton(IResourceServerContext::class, ResourceServerContext::class); - - App::bind('resource_server_context',function($app){ - // bind facade accesor with singleton instance - return $app->make(IResourceServerContext::class); - }); - - App::singleton('App\Models\ResourceServer\IAccessTokenService', 'App\Models\ResourceServer\AccessTokenService'); - App::singleton('App\Models\ResourceServer\IApi', 'models\\resource_server\\Api'); - App::singleton('App\Models\ResourceServer\IApiEndpoint', 'models\\resource_server\\ApiEndpoint'); - App::singleton('App\Models\ResourceServer\IApiScope', 'models\\resource_server\\ApiScope'); - } -} diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php deleted file mode 100644 index 588786c1..00000000 --- a/app/Providers/AuthServiceProvider.php +++ /dev/null @@ -1,42 +0,0 @@ - 'App\Policies\ModelPolicy', - ]; - - /** - * Register any application authentication / authorization services. - * - * @return void - */ - public function boot() - { - $this->registerPolicies(); - - // - } -} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php deleted file mode 100644 index 3d77401e..00000000 --- a/app/Providers/EventServiceProvider.php +++ /dev/null @@ -1,620 +0,0 @@ - [ - 'App\Listeners\QueryExecutedListener', - ], - ]; - - /** - * Register any other events for your application. - * @return void - */ - public function boot() - { - parent::boot(); - - Event::listen(\App\Events\MyScheduleAdd::class, function($event) - { - EntityEventPersister::persist(MyScheduleAddEntityEventFactory::build($event)); - }); - - Event::listen(\Illuminate\Mail\Events\MessageSending::class, function($event){ - $devEmail = env('DEV_EMAIL_TO'); - if(in_array(App::environment(), ['local','dev','testing']) && !empty($devEmail)){ - $event->message->setTo(explode(",", $devEmail)); - } - return true; - }); - - Event::listen(\App\Events\MyFavoritesAdd::class, function($event) - { - EntityEventPersister::persist(MyFavoritesAddEntityEventFactory::build($event)); - }); - - Event::listen(\App\Events\MyScheduleRemove::class, function($event) - { - EntityEventPersister::persist(MyScheduleRemoveEntityEventFactory::build($event)); - }); - - Event::listen(\App\Events\MyFavoritesRemove::class, function($event) - { - EntityEventPersister::persist(MyFavoritesRemoveEntityEventFactory::build($event)); - }); - - Event::listen(\App\Events\SummitEventCreated::class, function($event) - { - EntityEventPersister::persist(SummitEventCreatedEntityEventFactory::build($event)); - - SynchPresentationActions::dispatch($event->getSummitEvent()->getId()); - - }); - - Event::listen(\App\Events\SummitEventUpdated::class, function($event) - { - EntityEventPersister::persist(SummitEventUpdatedEntityEventFactory::build($event)); - //AdminSummitEventActionSyncWorkRequestPersister::persist(SummitEventUpdatedCalendarSyncWorkRequestFactory::build($event)); - }); - - Event::listen(\App\Events\SummitEventDeleted::class, function($event) - { - EntityEventPersister::persist(SummitEventDeletedEntityEventFactory::build($event)); - - /*$request = SummitEventDeletedCalendarSyncWorkRequestFactory::build($event); - if(!is_null($request)) - AdminSummitEventActionSyncWorkRequestPersister::persist($request);*/ - }); - - Event::listen(\App\Events\PresentationMaterialCreated::class, function($event) - { - EntityEventPersister::persist(PresentationMaterialCreatedEntityEventFactory::build($event)); - }); - - Event::listen(\App\Events\PresentationMaterialUpdated::class, function($event) - { - EntityEventPersister::persist(PresentationMaterialUpdatedEntityEventFactory::build(($event))); - }); - - Event::listen(\App\Events\PresentationMaterialDeleted::class, function($event) - { - EntityEventPersister::persist(PresentationMaterialDeletedEntityEventFactory::build($event)); - }); - - Event::listen(\App\Events\PresentationSpeakerCreated::class, function($event) - { - EntityEventPersister::persist_list(PresentationSpeakerCreatedEntityEventFactory::build($event)); - }); - - Event::listen(\App\Events\PresentationSpeakerUpdated::class, function($event) - { - EntityEventPersister::persist_list(PresentationSpeakerUpdatedEntityEventFactory::build($event)); - }); - - Event::listen(\App\Events\PresentationSpeakerDeleted::class, function($event) - { - EntityEventPersister::persist_list(PresentationSpeakerDeletedEntityEventFactory::build($event)); - }); - - // event types - - Event::listen(\App\Events\SummitEventTypeInserted::class, function($event) - { - EntityEventPersister::persist(SummitEventTypeActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\SummitEventTypeUpdated::class, function($event) - { - EntityEventPersister::persist(SummitEventTypeActionEntityEventFactory::build($event, 'UPDATE')); - }); - - Event::listen(\App\Events\SummitEventTypeDeleted::class, function($event) - { - EntityEventPersister::persist(SummitEventTypeActionEntityEventFactory::build($event, 'DELETE')); - }); - - // tracks - - Event::listen(\App\Events\TrackInserted::class, function($event) - { - EntityEventPersister::persist(TrackActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\TrackUpdated::class, function($event) - { - EntityEventPersister::persist(TrackActionEntityEventFactory::build($event, 'UPDATE')); - }); - - Event::listen(\App\Events\TrackDeleted::class, function($event) - { - EntityEventPersister::persist(TrackActionEntityEventFactory::build($event, 'DELETE')); - }); - - // locations events - - - Event::listen(\App\Events\SummitVenueRoomInserted::class, function($event) - { - EntityEventPersister::persist(LocationActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\SummitVenueRoomUpdated::class, function($event) - { - EntityEventPersister::persist(LocationActionEntityEventFactory::build($event, 'UPDATE')); - /*$published_events = $event->getRelatedEventIds(); - if(count($published_events) > 0){ - AdminSummitLocationActionSyncWorkRequestPersister::persist - ( - AdminSummitLocationActionSyncWorkRequestFactory::build($event, 'UPDATE') - ); - }*/ - }); - - Event::listen(\App\Events\SummitVenueRoomDeleted::class, function($event) - { - EntityEventPersister::persist(LocationActionEntityEventFactory::build($event, 'DELETE')); - /*$published_events = $event->getRelatedEventIds(); - if(count($published_events) > 0){ - AdminSummitLocationActionSyncWorkRequestPersister::persist - ( - AdminSummitLocationActionSyncWorkRequestFactory::build($event, 'REMOVE') - ); - }*/ - }); - - Event::listen(\App\Events\LocationInserted::class, function($event) - { - EntityEventPersister::persist(LocationActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\LocationUpdated::class, function($event) - { - EntityEventPersister::persist(LocationActionEntityEventFactory::build($event, 'UPDATE')); - /*$published_events = $event->getRelatedEventIds(); - if(count($published_events) > 0){ - AdminSummitLocationActionSyncWorkRequestPersister::persist - ( - AdminSummitLocationActionSyncWorkRequestFactory::build($event, 'UPDATE') - ); - }*/ - }); - - Event::listen(\App\Events\LocationDeleted::class, function($event) - { - EntityEventPersister::persist(LocationActionEntityEventFactory::build($event, 'DELETE')); - /*$published_events = $event->getRelatedEventIds(); - if(count($published_events) > 0){ - AdminSummitLocationActionSyncWorkRequestPersister::persist - ( - AdminSummitLocationActionSyncWorkRequestFactory::build($event, 'REMOVE') - ); - }*/ - }); - - Event::listen(\App\Events\FloorInserted::class, function($event) - { - EntityEventPersister::persist(FloorActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\FloorUpdated::class, function($event) - { - EntityEventPersister::persist(FloorActionEntityEventFactory::build($event, 'UPDATE')); - }); - - Event::listen(\App\Events\FloorDeleted::class, function($event) - { - EntityEventPersister::persist(FloorActionEntityEventFactory::build($event, 'DELETE')); - }); - - // location images - - Event::listen(\App\Events\LocationImageInserted::class, function($event) - { - EntityEventPersister::persist(LocationImageActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\LocationImageUpdated::class, function($event) - { - EntityEventPersister::persist(LocationImageActionEntityEventFactory::build($event, 'UPDATE')); - }); - - Event::listen(\App\Events\LocationImageDeleted::class, function($event) - { - EntityEventPersister::persist(LocationImageActionEntityEventFactory::build($event, 'DELETE')); - }); - - // ticket types - - Event::listen(\App\Events\SummitTicketTypeInserted::class, function($event) - { - EntityEventPersister::persist(SummitTicketTypeActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\SummitTicketTypeUpdated::class, function($event) - { - EntityEventPersister::persist(SummitTicketTypeActionEntityEventFactory::build($event, 'UPDATE')); - }); - - Event::listen(\App\Events\SummitTicketTypeDeleted::class, function($event) - { - EntityEventPersister::persist(SummitTicketTypeActionEntityEventFactory::build($event, 'DELETE')); - }); - - // track groups - - Event::listen(\App\Events\TrackGroupInserted::class, function($event) - { - EntityEventPersister::persist(TrackGroupActionActionEntityEventFactory::build($event, 'INSERT')); - }); - - Event::listen(\App\Events\TrackGroupUpdated::class, function($event) - { - EntityEventPersister::persist(TrackGroupActionActionEntityEventFactory::build($event, 'UPDATE')); - }); - - Event::listen(\App\Events\TrackGroupDeleted::class, function($event) - { - EntityEventPersister::persist(TrackGroupActionActionEntityEventFactory::build($event, 'DELETE')); - }); - - // summits - - Event::listen(\App\Events\SummitUpdated::class, function($event) - { - EntityEventPersister::persist(SummitActionEntityEventFactory::build($event, 'UPDATE')); - }); - - Event::listen(\App\Events\SummitDeleted::class, function($event) - { - EntityEventPersister::persist(SummitActionEntityEventFactory::build($event, 'DELETE')); - }); - - // bookable rooms events - - Event::listen(\App\Events\BookableRoomReservationRefundAccepted::class, function($event) - { - $repository = EntityManager::getRepository(SummitRoomReservation::class); - $reservation = $repository->find($event->getReservationId()); - if(is_null($reservation) || ! $reservation instanceof SummitRoomReservation) return; - - Mail::queue(new BookableRoomReservationRefundAcceptedEmail($reservation)); - - }); - - Event::listen(\App\Events\CreatedBookableRoomReservation::class, function($event) - { - $repository = EntityManager::getRepository(SummitRoomReservation::class); - $reservation = $repository->find($event->getReservationId()); - if(is_null($reservation) || ! $reservation instanceof SummitRoomReservation) return; - - BookableRoomReservationCreatedEmail::dispatch($reservation); - - }); - - Event::listen(\App\Events\PaymentBookableRoomReservationConfirmed::class, function($event) - { - $repository = EntityManager::getRepository(SummitRoomReservation::class); - $reservation = $repository->find($event->getReservationId()); - if(is_null($reservation) || ! $reservation instanceof SummitRoomReservation) return; - - BookableRoomReservationPaymentConfirmedEmail::dispatch($reservation); - }); - - Event::listen(\App\Events\RequestedBookableRoomReservationRefund::class, function($event) - { - $repository = EntityManager::getRepository(SummitRoomReservation::class); - $reservation = $repository->find($event->getReservationId()); - if(is_null($reservation) || ! $reservation instanceof SummitRoomReservation) return; - - BookableRoomReservationRefundRequestedAdminEmail::dispatch($reservation); - BookableRoomReservationRefundRequestedOwnerEmail::dispatch($reservation); - }); - - Event::listen(\App\Events\BookableRoomReservationCanceled::class, function($event) - { - $repository = EntityManager::getRepository(SummitRoomReservation::class); - $reservation = $repository->find($event->getReservationId()); - if(is_null($reservation) || ! $reservation instanceof SummitRoomReservation) return; - BookableRoomReservationCanceledEmail::dispatch($reservation); - }); - - // registration - - Event::listen(SummitOrderCanceled::class, function($event){ - if(!$event instanceof SummitOrderCanceled) return; - - $repository = EntityManager::getRepository(SummitOrder::class); - $order = $repository->find($event->getOrderId()); - if(is_null($order) || ! $order instanceof SummitOrder) return; - - Log::debug(sprintf("EventServiceProvider::SummitOrderCanceled order id %s", $order->getId())); - /* - * removed for now - * if($event->shouldSendEmail()) - Mail::queue(new SummitOrderCanceledEmail($order)); - */ - // compensate tickets types qty - - foreach ($event->getTicketsToReturn() as $ticket_type_id => $qty){ - Log::debug(sprintf("EventServiceProvider::SummitOrderCanceled: firing CompensateTickets ticket_type_id %s qty %s", $ticket_type_id, $qty)); - CompensateTickets::dispatch($ticket_type_id, $qty); - } - // compensate promo codes usages - - foreach ($event->getPromoCodesToReturn() as $code => $qty){ - Log::debug(sprintf("EventServiceProvider::SummitOrderCanceled: firing CompensatePromoCodes code %s qty %s", $code, $qty)); - CompensatePromoCodes::dispatch($order->getSummit(), $code, $qty); - } - }); - - Event::listen(OrderDeleted::class, function($event){ - if(!$event instanceof OrderDeleted) return; - - // compensate tickets types qty - - Log::debug(sprintf("EventServiceProvider::OrderDeleted id %s", $event->getOrderId())); - - $repository = EntityManager::getRepository(Summit::class); - $summit = $repository->find($event->getSummitId()); - if(is_null($summit) || ! $summit instanceof Summit) return; - - foreach ($event->getTicketsToReturn() as $ticket_type_id => $qty){ - Log::debug(sprintf("EventServiceProvider::OrderDeleted: firing CompensateTickets ticket_type_id %s qty %s", $ticket_type_id, $qty)); - CompensateTickets::dispatch($ticket_type_id, $qty); - } - // compensate promo codes usages - - foreach ($event->getPromoCodesToReturn() as $code => $qty){ - Log::debug(sprintf("EventServiceProvider::OrderDeleted: firing CompensatePromoCodes code %s qty %s", $code, $qty)); - CompensatePromoCodes::dispatch($summit, $code, $qty); - } - }); - - Event::listen(PaymentSummitRegistrationOrderConfirmed::class, function($event){ - if(!$event instanceof PaymentSummitRegistrationOrderConfirmed) return; - $order_id = $event->getOrderId(); - Log::debug(sprintf("EventServiceProvider::PaymentSummitRegistrationOrderConfirmed: firing ProcessSummitOrderPaymentConfirmation for order id %s", $order_id)); - ProcessSummitOrderPaymentConfirmation::dispatch($order_id)->delay(now()->addSecond(10)); - }); - - Event::listen(NewMember::class, function($event){ - if(!$event instanceof NewMember) return; - Log::debug(sprintf("EventServiceProvider::NewMember - firing NewMemberAssocSummitOrders member id %s", $event->getMemberId())); - NewMemberAssocSummitOrders::dispatchNow($event->getMemberId()); - }); - - Event::Listen(RequestedSummitOrderRefund::class, function($event){ - - if(!$event instanceof RequestedSummitOrderRefund) return; - - $repository = EntityManager::getRepository(SummitOrder::class); - $order = $repository->find($event->getOrderId()); - if(is_null($order) || ! $order instanceof SummitOrder) return; - - Log::debug(sprintf("EventServiceProvider::RequestedSummitOrderRefund: dispatching job ProcessOrderRefundRequest for order id %s", $event->getOrderId())); - - SummitOrderRefundRequestAdmin::dispatch($order); - SummitOrderRefundRequestOwner::dispatch($order); - - ProcessOrderRefundRequest::dispatch( - $event->getOrderId(), - $event->getDaysBeforeEventStarts() - ); - }); - - Event::listen(RSVPCreated::class, function($event){ - if(!$event instanceof RSVPCreated) return; - - $rsvp_id = $event->getRsvpId(); - - $rsvp_repository = EntityManager::getRepository(RSVP::class); - - $rsvp = $rsvp_repository->find($rsvp_id); - if(is_null($rsvp) || ! $rsvp instanceof RSVP) return; - - if($rsvp->getSeatType() == RSVP::SeatTypeRegular) - RSVPRegularSeatMail::dispatch($rsvp); - - if($rsvp->getSeatType() == RSVP::SeatTypeWaitList) - RSVPWaitListSeatMail::dispatch($rsvp); - }); - - Event::listen(RSVPUpdated::class, function($event){ - if(!$event instanceof RSVPUpdated) return; - - $rsvp_id = $event->getRsvpId(); - - $rsvp_repository = EntityManager::getRepository(RSVP::class); - - $rsvp = $rsvp_repository->find($rsvp_id); - if(is_null($rsvp) || ! $rsvp instanceof RSVP) return; - - if($rsvp->getSeatType() == RSVP::SeatTypeRegular) - RSVPRegularSeatMail::dispatch($rsvp); - - if($rsvp->getSeatType() == RSVP::SeatTypeWaitList) - RSVPWaitListSeatMail::dispatch($rsvp); - }); - - Event::Listen(RequestedSummitAttendeeTicketRefund::class, function($event){ - if(!$event instanceof RequestedSummitAttendeeTicketRefund) return; - - $repository = EntityManager::getRepository(SummitAttendeeTicket::class); - $ticket = $repository->find($event->getTicketId()); - if(is_null($ticket) || ! $ticket instanceof SummitAttendeeTicket) return; - - Log::debug(sprintf("EventServiceProvider::RequestedSummitAttendeeTicketRefund: dispatching job ProcessOrderRefundRequest for ticket id %s", $event->getTicketId())); - - SummitTicketRefundRequestAdmin::dispatch($ticket); - SummitTicketRefundRequestOwner::dispatch($ticket); - - ProcessTicketRefundRequest::dispatch($event->getTicketId(), $event->getDaysBeforeEventStarts()); - }); - - Event::listen(SummitAttendeeTicketRefundAccepted::class, function($event){ - // send email to owner and compensate tickets types qty/ promo codes - if(!$event instanceof SummitAttendeeTicketRefundAccepted) return; - - $repository = EntityManager::getRepository(SummitAttendeeTicket::class); - $ticket = $repository->find($event->getTicketId()); - if(is_null($ticket) || ! $ticket instanceof SummitAttendeeTicket) return; - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - Log::debug(sprintf("EventServiceProvider::SummitAttendeeTicketRefundAccepted order id %s ticket number %s", $order->getId(), $ticket->getNumber())); - - SummitTicketRefundAccepted::dispatch($ticket); - - if($ticket->hasOwner()) { - RevocationTicketEmail::dispatch($ticket->getOwner(), $ticket); - } - - // compensate tickets types qty - - foreach ($event->getTicketsToReturn() as $ticket_type_id => $qty){ - Log::debug(sprintf("EventServiceProvider::SummitAttendeeTicketRefundAccepted: firing CompensateTickets ticket_type_id %s qty %s", $ticket_type_id, $qty)); - CompensateTickets::dispatch($ticket_type_id, $qty); - } - // compensate promo codes usages - - foreach ($event->getPromoCodesToReturn() as $code => $qty){ - Log::debug(sprintf("EventServiceProvider::SummitAttendeeTicketRefundAccepted: firing CompensatePromoCodes code %s qty %s", $code, $qty)); - CompensatePromoCodes::dispatch($summit, $code, $qty); - } - }); - - Event::listen(SummitOrderRefundAccepted::class, function($event){ - // send email to owner and compensate tickets types qty/ promo codes - if(!$event instanceof SummitOrderRefundAccepted) return; - - $repository = EntityManager::getRepository(SummitOrder::class); - $order = $repository->find($event->getOrderId()); - - if(is_null($order) || ! $order instanceof SummitOrder) return; - - Log::debug(sprintf("EventServiceProvider::SummitOrderRefundAccepted order id %s", $order->getId())); - - \App\Jobs\Emails\Registration\Refunds\SummitOrderRefundAccepted::dispatch($order); - - foreach ($order->getTickets() as $ticket) { - if ($ticket->hasOwner()) { - RevocationTicketEmail::dispatch($ticket->getOwner(), $ticket); - } - } - - // compensate tickets types qty - - foreach ($event->getTicketsToReturn() as $ticket_type_id => $qty){ - Log::debug(sprintf("EventServiceProvider::SummitOrderRefundAccepted: firing CompensateTickets ticket_type_id %ss qty %s", $ticket_type_id, $qty)); - CompensateTickets::dispatch($ticket_type_id, $qty); - } - - // compensate promo codes usages - - foreach ($event->getPromoCodesToReturn() as $code => $qty){ - Log::debug(sprintf("EventServiceProvider::SummitOrderRefundAccepted: firing CompensatePromoCodes code %s qty %s", $code, $qty)); - CompensatePromoCodes::dispatch($order->getSummit(), $code, $qty); - } - - }); - - Event::listen(PresentationActionTypeCreated::class, function($event){ - - if(!$event instanceof PresentationActionTypeCreated) return; - - $summit = $event->getActionType()->getSummit(); - - SynchAllPresentationActions::dispatch($summit->getId()); - }); - } -} diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php deleted file mode 100644 index 0513bea8..00000000 --- a/app/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,67 +0,0 @@ -mapWebRoutes($router); - - // - } - - /** - * Define the "web" routes for the application. - * - * These routes all receive session state, CSRF protection, etc. - * - * @param \Illuminate\Routing\Router $router - * @return void - */ - protected function mapWebRoutes(Router $router) - { - require app_path('Http/routes.php'); - } -} diff --git a/app/Queue/RabbitMQ/RabbitMQConnector.php b/app/Queue/RabbitMQ/RabbitMQConnector.php deleted file mode 100644 index 012c094a..00000000 --- a/app/Queue/RabbitMQ/RabbitMQConnector.php +++ /dev/null @@ -1,133 +0,0 @@ -dispatcher = $dispatcher; - } - - /** - * Establish a queue connection. - * - * @param array $config - * - * @return RabbitMQQueue - * @throws Exception - */ - public function connect(array $config): Queue - { - $connection = $this->createConnection(Arr::except($config, 'options.queue')); - - $queue = $this->createQueue( - Arr::get($config, 'worker', 'default'), - $connection, - $config['queue'], - Arr::get($config, 'options.queue', []) - ); - - if (! $queue instanceof RabbitMQQueue) { - throw new InvalidArgumentException('Invalid worker.'); - } - - $this->dispatcher->listen(WorkerStopping::class, static function () use ($queue): void { - $queue->close(); - }); - - return $queue; - } - - /** - * @param array $config - * @return AbstractConnection - * @throws Exception - */ - protected function createConnection(array $config): AbstractConnection - { - /** @var AbstractConnection $connection */ - $connection = Arr::get($config, 'connection', AMQPLazyConnection::class); - - // manually disable heartbeat so long-running tasks will not fail - Arr::add($config, 'options.heartbeat', 0); - - return $connection::create_connection( - Arr::shuffle(Arr::get($config, 'hosts', [])), - $this->filter(Arr::get($config, 'options', [])) - ); - } - - /** - * Create a queue for the worker. - * - * @param string $worker - * @param AbstractConnection $connection - * @param string $queue - * @param array $options - * @return RabbitMQQueue|Queue - */ - protected function createQueue(string $worker, AbstractConnection $connection, string $queue, array $options = []) - { - switch ($worker) { - case 'default': - return new RabbitMQQueue($connection, $queue, $options); - default: - return new $worker($connection, $queue, $options); - } - } - - /** - * Recursively filter only null values. - * - * @param array $array - * @return array - */ - private function filter(array $array): array - { - foreach ($array as $index => &$value) { - if (is_array($value)) { - $value = $this->filter($value); - continue; - } - - // If the value is null then remove it. - if ($value === null) { - unset($array[$index]); - continue; - } - } - - return $array; - } -} diff --git a/app/Queue/RabbitMQ/RabbitMQJob.php b/app/Queue/RabbitMQ/RabbitMQJob.php deleted file mode 100644 index 9bc96d9f..00000000 --- a/app/Queue/RabbitMQ/RabbitMQJob.php +++ /dev/null @@ -1,176 +0,0 @@ -container = $container; - $this->rabbitmq = $rabbitmq; - $this->message = $message; - $this->connectionName = $connectionName; - $this->queue = $queue; - $this->decoded = $this->payload(); - } - - /** - * {@inheritdoc} - */ - public function getJobId() - { - return $this->decoded['id'] ?? null; - } - - /** - * {@inheritdoc} - */ - public function getRawBody(): string - { - return $this->message->getBody(); - } - - /** - * {@inheritdoc} - */ - public function attempts(): int - { - if (! $data = $this->getRabbitMQMessageHeaders()) { - return 1; - } - - $laravelAttempts = (int) Arr::get($data, 'laravel.attempts', 0); - - return $laravelAttempts + 1; - } - - /** - * {@inheritdoc} - */ - public function markAsFailed(): void - { - parent::markAsFailed(); - - // We must tel rabbitMQ this Job is failed - // The message must be rejected when the Job marked as failed, in case rabbitMQ wants to do some extra magic. - // like: Death lettering the message to an other exchange/routing-key. - $this->rabbitmq->reject($this); - } - - /** - * {@inheritdoc} - * - * @throws BindingResolutionException - */ - public function delete(): void - { - parent::delete(); - - // When delete is called and the Job was not failed, the message must be acknowledged. - // This is because this is a controlled call by a developer. So the message was handled correct. - if (! $this->failed) { - $this->rabbitmq->ack($this); - } - } - - /** - * Release the job back into the queue. - * - * @param int $delay - * @throws AMQPProtocolChannelException - */ - public function release($delay = 0): void - { - parent::release(); - - // Always create a new message when this Job is released - $this->rabbitmq->laterRaw($delay, $this->message->getBody(), $this->queue, $this->attempts()); - - // Releasing a Job means the message was failed to process. - // Because this Job message is always recreated and pushed as new message, this Job message is correctly handled. - // We must tell rabbitMQ this job message can be removed by acknowledging the message. - $this->rabbitmq->ack($this); - } - - /** - * Get the underlying RabbitMQ connection. - * - * @return RabbitMQQueue - */ - public function getRabbitMQ(): RabbitMQQueue - { - return $this->rabbitmq; - } - - /** - * Get the underlying RabbitMQ message. - * - * @return AMQPMessage - */ - public function getRabbitMQMessage(): AMQPMessage - { - return $this->message; - } - - /** - * Get the headers from the rabbitMQ message. - * - * @return array|null - */ - protected function getRabbitMQMessageHeaders(): ?array - { - /** @var AMQPTable|null $headers */ - if (! $headers = Arr::get($this->message->get_properties(), 'application_headers')) { - return null; - } - - return $headers->getNativeData(); - } -} diff --git a/app/Queue/RabbitMQ/RabbitMQQueue.php b/app/Queue/RabbitMQ/RabbitMQQueue.php deleted file mode 100644 index 05f431f2..00000000 --- a/app/Queue/RabbitMQ/RabbitMQQueue.php +++ /dev/null @@ -1,803 +0,0 @@ -connection = $connection; - $this->channel = $connection->channel(); - $this->default = $default; - $this->options = $options; - } - - /** - * {@inheritdoc} - * - * @throws AMQPProtocolChannelException - */ - public function size($queue = null): int - { - $queue = $this->getQueue($queue); - - if (! $this->isQueueExists($queue)) { - return 0; - } - - // create a temporary channel, so the main channel will not be closed on exception - $channel = $this->connection->channel(); - [, $size] = $channel->queue_declare($queue, true); - $channel->close(); - - return $size; - } - - /** - * {@inheritdoc} - * - * @throws AMQPProtocolChannelException - */ - public function push($job, $data = '', $queue = null) - { - return $this->pushRaw($this->createPayload($job, $data), $queue, []); - } - - /** - * {@inheritdoc} - * - * @throws AMQPProtocolChannelException - */ - public function pushRaw($payload, $queue = null, array $options = []) - { - [$destination, $exchange, $exchangeType, $attempts] = $this->publishProperties($queue, $options); - - $this->declareDestination($destination, $exchange, $exchangeType); - - [$message, $correlationId] = $this->createMessage($payload, $attempts); - - $this->channel->basic_publish($message, $exchange, $destination, true, false); - - return $correlationId; - } - - /** - * {@inheritdoc} - * - * @throws AMQPProtocolChannelException - */ - public function later($delay, $job, $data = '', $queue = null) - { - return $this->laterRaw( - $delay, - $this->createPayload($job, $data), - $queue - ); - } - - /** - * @param $delay - * @param $payload - * @param null $queue - * @param int $attempts - * @return mixed - * @throws AMQPProtocolChannelException - */ - public function laterRaw($delay, $payload, $queue = null, $attempts = 0) - { - $ttl = $this->secondsUntil($delay) * 1000; - - // When no ttl just publish a new message to the exchange or queue - if ($ttl <= 0) { - return $this->pushRaw($payload, $queue, ['delay' => $delay, 'attempts' => $attempts]); - } - - $destination = $this->getQueue($queue).'.delay.'.$ttl; - - $this->declareQueue($destination, true, false, $this->getDelayQueueArguments($this->getQueue($queue), $ttl)); - - [$message, $correlationId] = $this->createMessage($payload, $attempts); - - // Publish directly on the delayQueue, no need to publish trough an exchange. - $this->channel->basic_publish($message, null, $destination, true, false); - - return $correlationId; - } - - /** - * {@inheritdoc} - * - * @throws AMQPProtocolChannelException - */ - public function bulk($jobs, $data = '', $queue = null): void - { - foreach ((array) $jobs as $job) { - $this->bulkRaw($this->createPayload($job, $data), $queue, ['job' => $job]); - } - - $this->channel->publish_batch(); - } - - /** - * @param string $payload - * @param null $queue - * @param array $options - * @return mixed - * @throws AMQPProtocolChannelException - */ - public function bulkRaw(string $payload, $queue = null, array $options = []) - { - [$destination, $exchange, $exchangeType, $attempts] = $this->publishProperties($queue, $options); - - $this->declareDestination($destination, $exchange, $exchangeType); - - [$message, $correlationId] = $this->createMessage($payload, $attempts); - - $this->channel->batch_basic_publish($message, $exchange, $destination); - - return $correlationId; - } - - /** - * {@inheritdoc} - * - * @throws Exception - */ - public function pop($queue = null) - { - try { - $queue = $this->getQueue($queue); - - /** @var AMQPMessage|null $message */ - if ($message = $this->channel->basic_get($queue)) { - return $this->currentJob = new RabbitMQJob( - $this->container, - $this, - $message, - $this->connectionName, - $queue - ); - } - } - catch(AMQPConnectionClosedException $ex){ - // recovery from closed connection - Log::warning($ex); - try { - usleep(RabbitMQQueue::RECONNECT_WAIT); - $this->connection->reconnect(); - $this->channel = $this->connection->channel(); - } - catch (Exception $ex){ - Log::warning($ex); - } - return null; - } - catch (AMQPProtocolChannelException $exception) { - // If there is not exchange or queue AMQP will throw exception with code 404 - // We need to catch it and return null - - Log::warning($exception); - - if ($exception->amqp_reply_code === 404) { - - Log::warning(sprintf("RabbitMQQueue::pop amqp_reply_code 404 trying reconnect ...")); - // Because of the channel exception the channel was closed and removed. - // We have to open a new channel. Because else the worker(s) are stuck in a loop, without processing. - $this->channel = $this->connection->channel(); - - return null; - } - - throw $exception; - } - - return null; - } - - /** - * @return AbstractConnection - */ - public function getConnection(): AbstractConnection - { - return $this->connection; - } - - /** - * @return AMQPChannel - */ - public function getChannel(): AMQPChannel - { - return $this->channel; - } - - /** - * Gets a queue/destination, by default the queue option set on the connection. - * - * @param null $queue - * @return string - */ - public function getQueue($queue = null) - { - return $queue ?: $this->default; - } - - /** - * Checks if the given exchange already present/defined in RabbitMQ. - * Returns false when when the exchange is missing. - * - * @param string $exchange - * @return bool - * @throws AMQPProtocolChannelException - */ - public function isExchangeExists(string $exchange): bool - { - try { - // create a temporary channel, so the main channel will not be closed on exception - $channel = $this->connection->channel(); - $channel->exchange_declare($exchange, '', true); - $channel->close(); - - return true; - } catch (AMQPProtocolChannelException $exception) { - if ($exception->amqp_reply_code === 404) { - return false; - } - - throw $exception; - } - } - - /** - * Declare a exchange in rabbitMQ, when not already declared. - * - * @param string $name - * @param string $type - * @param bool $durable - * @param bool $autoDelete - * @param array $arguments - * @return void - */ - public function declareExchange(string $name, string $type = AMQPExchangeType::DIRECT, bool $durable = true, bool $autoDelete = false, array $arguments = []): void - { - if ($this->isExchangeDeclared($name)) { - return; - } - - $this->channel->exchange_declare( - $name, - $type, - false, - $durable, - $autoDelete, - false, - true, - new AMQPTable($arguments) - ); - } - - /** - * Delete a exchange from rabbitMQ, only when present in RabbitMQ. - * - * @param string $name - * @param bool $unused - * @return void - * @throws AMQPProtocolChannelException - */ - public function deleteExchange(string $name, bool $unused = false): void - { - if (! $this->isExchangeExists($name)) { - return; - } - - $this->channel->exchange_delete( - $name, - $unused - ); - } - - /** - * Checks if the given queue already present/defined in RabbitMQ. - * Returns false when when the queue is missing. - * - * @param string $name - * @return bool - * @throws AMQPProtocolChannelException - */ - public function isQueueExists(string $name = null): bool - { - try { - Log::debug(sprintf("RabbitMQQueue::isQueueExists %s", $name)); - // create a temporary channel, so the main channel will not be closed on exception - $channel = $this->connection->channel(); - $channel->queue_declare($this->getQueue($name), true); - $channel->close(); - Log::debug(sprintf("RabbitMQQueue::isQueueExists %s exists", $name)); - return true; - } catch (AMQPProtocolChannelException $exception) { - if ($exception->amqp_reply_code === 404) { - Log::debug(sprintf("RabbitMQQueue::isQueueExists %s not found", $name)); - return false; - } - - throw $exception; - } - } - - /** - * Declare a queue in rabbitMQ, when not already declared. - * - * @param string $name - * @param bool $durable - * @param bool $autoDelete - * @param array $arguments - * @return void - */ - public function declareQueue(string $name, bool $durable = true, bool $autoDelete = false, array $arguments = []): void - { - Log::debug(sprintf("RabbitMQQueue::declareQueue %s ", $name)); - if ($this->isQueueDeclared($name)) { - return; - } - - $this->channel->queue_declare( - $name, - false, - $durable, - false, - $autoDelete, - false, - new AMQPTable($arguments) - ); - } - - /** - * Delete a queue from rabbitMQ, only when present in RabbitMQ. - * - * @param string $name - * @param bool $if_unused - * @param bool $if_empty - * @return void - * @throws AMQPProtocolChannelException - */ - public function deleteQueue(string $name, bool $if_unused = false, bool $if_empty = false): void - { - if (! $this->isQueueExists($name)) { - return; - } - - $this->channel->queue_delete($name, $if_unused, $if_empty); - } - - /** - * Bind a queue to an exchange. - * - * @param string $queue - * @param string $exchange - * @param string $routingKey - * @return void - */ - public function bindQueue(string $queue, string $exchange, string $routingKey = ''): void - { - if (in_array( - implode('', compact('queue', 'exchange', 'routingKey')), - $this->boundQueues, - true - )) { - return; - } - - $this->channel->queue_bind($queue, $exchange, $routingKey); - } - - /** - * Purge the queue of messages. - * - * @param string $queue - * @return void - */ - public function purge(string $queue = null): void - { - // create a temporary channel, so the main channel will not be closed on exception - $channel = $this->connection->channel(); - $channel->queue_purge($this->getQueue($queue)); - $channel->close(); - } - - /** - * Acknowledge the message. - * - * @param RabbitMQJob $job - * @return void - */ - public function ack(RabbitMQJob $job): void - { - $this->channel->basic_ack($job->getRabbitMQMessage()->getDeliveryTag()); - } - - /** - * Reject the message. - * - * @param RabbitMQJob $job - * @param bool $requeue - * - * @return void - */ - public function reject(RabbitMQJob $job, bool $requeue = false): void - { - $this->channel->basic_reject($job->getRabbitMQMessage()->getDeliveryTag(), $requeue); - } - - /** - * Create a AMQP message. - * - * @param $payload - * @param int $attempts - * @return array - */ - protected function createMessage($payload, int $attempts = 0): array - { - $properties = [ - 'content_type' => 'application/json', - 'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT, - ]; - - if ($correlationId = json_decode($payload, true)['id'] ?? null) { - $properties['correlation_id'] = $correlationId; - } - - if ($this->isPrioritizeDelayed()) { - $properties['priority'] = $attempts; - } - - $message = new AMQPMessage($payload, $properties); - - $message->set('application_headers', new AMQPTable([ - 'laravel' => [ - 'attempts' => $attempts, - ], - ])); - - return [ - $message, - $correlationId, - ]; - } - - /** - * Create a payload array from the given job and data. - * - * @param object|string $job - * @param string $data - * @return array - */ - protected function createPayloadArray($job, $data = '') - { - return array_merge(parent::createPayloadArray($job, $data), [ - 'id' => $this->getRandomId(), - ]); - } - - /** - * Get a random ID string. - * - * @return string - */ - protected function getRandomId(): string - { - return Str::random(32); - } - - /** - * Close the connection to RabbitMQ. - * - * @return void - * @throws Exception - */ - public function close(): void - { - if ($this->currentJob && ! $this->currentJob->isDeletedOrReleased()) { - $this->reject($this->currentJob, true); - } - - try { - $this->connection->close(); - } catch (ErrorException $exception) { - // Ignore the exception - } - } - - /** - * Get the Queue arguments. - * - * @param string $destination - * @return array - */ - protected function getQueueArguments(string $destination): array - { - $arguments = []; - - // Messages without a priority property are treated as if their priority were 0. - // Messages with a priority which is higher than the queue's maximum, are treated as if they were - // published with the maximum priority. - if ($this->isPrioritizeDelayed()) { - $arguments['x-max-priority'] = $this->getQueueMaxPriority(); - } - - if ($this->isRerouteFailed()) { - $arguments['x-dead-letter-exchange'] = $this->getFailedExchange() ?? ''; - $arguments['x-dead-letter-routing-key'] = $this->getFailedRoutingKey($destination); - } - - return $arguments; - } - - /** - * Get the Delay queue arguments. - * - * @param string $destination - * @param int $ttl - * @return array - */ - protected function getDelayQueueArguments(string $destination, int $ttl): array - { - return [ - 'x-dead-letter-exchange' => $this->getExchange() ?? '', - 'x-dead-letter-routing-key' => $this->getRoutingKey($destination), - 'x-message-ttl' => $ttl, - 'x-expires' => $ttl * 2, - ]; - } - - /** - * Returns &true;, if delayed messages should be prioritized. - * - * @return bool - */ - protected function isPrioritizeDelayed(): bool - { - return boolval(Arr::get($this->options, 'prioritize_delayed') ?: false); - } - - /** - * Returns a integer with a default of '2' for when using prioritization on delayed messages. - * If priority queues are desired, we recommend using between 1 and 10. - * Using more priority layers, will consume more CPU resources and would affect runtimes. - * - * @see https://www.rabbitmq.com/priority.html - * @return int - */ - protected function getQueueMaxPriority(): int - { - return intval(Arr::get($this->options, 'queue_max_priority') ?: 2); - } - - /** - * Get the exchange name, or &null; as default value. - * - * @param string $exchange - * @return string|null - */ - protected function getExchange(string $exchange = null): ?string - { - return $exchange ?: Arr::get($this->options, 'exchange') ?: null; - } - - /** - * Get the routing-key for when you use exchanges - * The default routing-key is the given destination. - * - * @param string $destination - * @return string - */ - protected function getRoutingKey(string $destination): string - { - return ltrim(sprintf(Arr::get($this->options, 'exchange_routing_key') ?: '%s', $destination), '.'); - } - - /** - * Get the exchangeType, or AMQPExchangeType::DIRECT as default. - * - * @param string|null $type - * @return string - */ - protected function getExchangeType(?string $type = null): string - { - return @constant(AMQPExchangeType::class.'::'.Str::upper($type ?: Arr::get($this->options, 'exchange_type') ?: 'direct')) ?: AMQPExchangeType::DIRECT; - } - - /** - * Returns &true;, if failed messages should be rerouted. - * - * @return bool - */ - protected function isRerouteFailed(): bool - { - return boolval(Arr::get($this->options, 'reroute_failed') ?: false); - } - - /** - * Get the exchange for failed messages. - * - * @param string|null $exchange - * @return string|null - */ - protected function getFailedExchange(string $exchange = null): ?string - { - return $exchange ?: Arr::get($this->options, 'failed_exchange') ?: null; - } - - /** - * Get the routing-key for failed messages - * The default routing-key is the given destination substituted by '.failed'. - * - * @param string $destination - * @return string - */ - protected function getFailedRoutingKey(string $destination): string - { - return ltrim(sprintf(Arr::get($this->options, 'failed_routing_key') ?: '%s.failed', $destination), '.'); - } - - /** - * Checks if the exchange was already declared. - * - * @param string $name - * @return bool - */ - protected function isExchangeDeclared(string $name): bool - { - return in_array($name, $this->exchanges, true); - } - - /** - * Checks if the queue was already declared. - * - * @param string $name - * @return bool - */ - protected function isQueueDeclared(string $name): bool - { - return in_array($name, $this->queues, true); - } - - /** - * Declare the destination when necessary. - * - * @param string $destination - * @param string|null $exchange - * @param string|null $exchangeType - * @return void - * @throws AMQPProtocolChannelException - */ - protected function declareDestination(string $destination, ?string $exchange = null, string $exchangeType = AMQPExchangeType::DIRECT): void - { - // When a exchange is provided and no exchange is present in RabbitMQ, create an exchange. - if ($exchange && ! $this->isExchangeExists($exchange)) { - $this->declareExchange($exchange, $exchangeType); - } - - // When a exchange is provided, just return. - if ($exchange) { - return; - } - - // When the queue already exists, just return. - if ($this->isQueueExists($destination)) { - return; - } - - // Create a queue for amq.direct publishing. - $this->declareQueue($destination, true, false, $this->getQueueArguments($destination)); - } - - /** - * Determine all publish properties. - * - * @param $queue - * @param array $options - * @return array - */ - protected function publishProperties($queue, array $options = []): array - { - $queue = $this->getQueue($queue); - $attempts = Arr::get($options, 'attempts') ?: 0; - - $destination = $this->getRoutingKey($queue); - $exchange = $this->getExchange(); - $exchangeType = $this->getExchangeType(); - - return [$destination, $exchange, $exchangeType, $attempts]; - } -} diff --git a/app/Queue/RabbitMQServiceProvider.php b/app/Queue/RabbitMQServiceProvider.php deleted file mode 100644 index 3903f8a6..00000000 --- a/app/Queue/RabbitMQServiceProvider.php +++ /dev/null @@ -1,48 +0,0 @@ -app['queue']; - - $queue->addConnector('rabbitmq', function () { - return new RabbitMQConnector($this->app['events']); - }); - } -} \ No newline at end of file diff --git a/app/Repositories/ConfigDoctrineRepository.php b/app/Repositories/ConfigDoctrineRepository.php deleted file mode 100644 index 0e144794..00000000 --- a/app/Repositories/ConfigDoctrineRepository.php +++ /dev/null @@ -1,54 +0,0 @@ -EntityRepository. - * - * @param EntityManager $em The EntityManager to use. - * @param ClassMetadata $class The class descriptor. - */ - public function __construct($em, ClassMetadata $class) - { - $this->manager_name = ResourceServerEntity::EntityManager; - parent::__construct(Registry::getManager($this->manager_name), $class); - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraFilters(QueryBuilder $query) - { - return $query; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query) - { - return $query; - } -} \ No newline at end of file diff --git a/app/Repositories/DoctrineRepository.php b/app/Repositories/DoctrineRepository.php deleted file mode 100644 index e3f2d1b3..00000000 --- a/app/Repositories/DoctrineRepository.php +++ /dev/null @@ -1,346 +0,0 @@ -manager_name); - } - - public function getById($id) - { - return $this->find($id); - } - - /** - * @param int $id - * @return IEntity|null|object - */ - public function getByIdExclusiveLock($id){ - return $this->find($id, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE); - } - - /** - * @param $entity - * @param bool $sync - * @return mixed|void - * @throws \Doctrine\ORM\ORMException - * @throws \Doctrine\ORM\OptimisticLockException - */ - public function add($entity, $sync = false) - { - $this->getEntityManager()->persist($entity); - if($sync) - $this->getEntityManager()->flush($entity); - } - - /** - * @param IEntity $entity - * @return void - */ - public function delete($entity) - { - $this->getEntityManager()->remove($entity); - } - - /** - * @return IEntity[] - */ - public function getAll() - { - return $this->findAll(); - } - - /** - * @return string - */ - protected abstract function getBaseEntity(); - - /** - * @return array - */ - protected abstract function getFilterMappings(); - - /** - * @return array - */ - protected abstract function getOrderMappings(); - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected abstract function applyExtraFilters(QueryBuilder $query); - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected abstract function applyExtraJoins(QueryBuilder $query); - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null){ - - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e"); - - $query = $this->applyExtraJoins($query); - - $query = $this->applyExtraFilters($query); - - if(!is_null($filter)){ - $filter->apply2Query($query, $this->getFilterMappings()); - } - - if(!is_null($order)){ - $order->apply2Query($query, $this->getOrderMappings()); - } - - $query= $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query, $fetchJoinCollection = true); - $total = $paginator->count(); - $data = array(); - - foreach($paginator as $entity) - array_push($data, $entity); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return array - */ - public function getAllIdsByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null):array { - - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e.id") - ->from($this->getBaseEntity(), "e"); - - $query = $this->applyExtraJoins($query); - - $query = $this->applyExtraFilters($query); - - if(!is_null($filter)){ - $filter->apply2Query($query, $this->getFilterMappings()); - } - - if(!is_null($order)){ - $order->apply2Query($query, $this->getOrderMappings()); - } - - $query = $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $res = $query->getQuery()->getArrayResult(); - return array_column($res, 'id'); - } - - /** - * Creates a new QueryBuilder instance that is prepopulated for this entity name. - * - * @param string $alias - * @param string $indexBy The index for the from. - * - * @return QueryBuilder - */ - public function createQueryBuilder($alias, $indexBy = null) - { - return $this->getEntityManager()->createQueryBuilder() - ->select($alias) - ->from($this->_entityName, $alias, $indexBy); - } - - /** - * Creates a new result set mapping builder for this entity. - * - * The column naming strategy is "INCREMENT". - * - * @param string $alias - * - * @return ResultSetMappingBuilder - */ - public function createResultSetMappingBuilder($alias) - { - $rsm = new ResultSetMappingBuilder($this->getEntityManager(), ResultSetMappingBuilder::COLUMN_RENAMING_INCREMENT); - $rsm->addRootEntityFromClassMetadata($this->_entityName, $alias); - - return $rsm; - } - - /** - * Creates a new Query instance based on a predefined metadata named query. - * - * @param string $queryName - * - * @return Query - */ - public function createNamedQuery($queryName) - { - return $this->getEntityManager()->createQuery($this->_class->getNamedQuery($queryName)); - } - - /** - * Creates a native SQL query. - * - * @param string $queryName - * - * @return NativeQuery - */ - public function createNativeNamedQuery($queryName) - { - $queryMapping = $this->_class->getNamedNativeQuery($queryName); - $rsm = new Query\ResultSetMappingBuilder($this->getEntityManager()); - $rsm->addNamedNativeQueryMapping($this->_class, $queryMapping); - - return $this->getEntityManager()->createNativeQuery($queryMapping['query'], $rsm); - } - - /** - * Clears the repository, causing all managed entities to become detached. - * - * @return void - */ - public function clear() - { - $this->getEntityManager()->clear($this->_class->rootEntityName); - } - - /** - * Finds an entity by its primary key / identifier. - * - * @param mixed $id The identifier. - * @param int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants - * or NULL if no specific lock mode should be used - * during the search. - * @param int|null $lockVersion The lock version. - * - * @return object|null The entity instance or NULL if the entity can not be found. - */ - public function find($id, $lockMode = null, $lockVersion = null) - { - return $this->getEntityManager()->find($this->_entityName, $id, $lockMode, $lockVersion); - } - - /** - * Finds entities by a set of criteria. - * - * @param array $criteria - * @param array|null $orderBy - * @param int|null $limit - * @param int|null $offset - * - * @return array The objects. - */ - public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) - { - $persister = $this->getEntityManager()->getUnitOfWork()->getEntityPersister($this->_entityName); - - return $persister->loadAll($criteria, $orderBy, $limit, $offset); - } - - /** - * Finds a single entity by a set of criteria. - * - * @param array $criteria - * @param array|null $orderBy - * - * @return object|null The entity instance or NULL if the entity can not be found. - */ - public function findOneBy(array $criteria, array $orderBy = null) - { - $persister = $this->getEntityManager()->getUnitOfWork()->getEntityPersister($this->_entityName); - - return $persister->load($criteria, null, null, [], null, 1, $orderBy); - } - - /** - * Counts entities by a set of criteria. - * - * @todo Add this method to `ObjectRepository` interface in the next major release - * - * @param array $criteria - * - * @return int The cardinality of the objects that match the given criteria. - */ - public function count(array $criteria) - { - return $this->getEntityManager()->getUnitOfWork()->getEntityPersister($this->_entityName)->count($criteria); - } - - /** - * Select all elements from a selectable that match the expression and - * return a new collection containing these elements. - * - * @param \Doctrine\Common\Collections\Criteria $criteria - * - * @return \Doctrine\Common\Collections\Collection - */ - public function matching(Criteria $criteria) - { - $persister = $this->getEntityManager()->getUnitOfWork()->getEntityPersister($this->_entityName); - - return new LazyCriteriaCollection($persister, $criteria); - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineAssetsSyncRequestRepository.php b/app/Repositories/Main/DoctrineAssetsSyncRequestRepository.php deleted file mode 100644 index 3d3ae50d..00000000 --- a/app/Repositories/Main/DoctrineAssetsSyncRequestRepository.php +++ /dev/null @@ -1,36 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("i") - ->from(\models\main\ChatTeamInvitation::class, "i") - ->innerJoin('i.invitee', 'm', Join::WITH, " m.id = :member_id") - ->setParameter('member_id', $invitee_id)->getQuery()->getResult(); - } - - /** - * @param int $invitee_id - * @return ChatTeamInvitation[] - */ - function getPendingInvitationsByInvitee($invitee_id) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("i") - ->from(\models\main\ChatTeamInvitation::class, "i") - ->innerJoin('i.invitee', 'm', Join::WITH, " m.id = :member_id") - ->where('i.is_accepted = false') - ->setParameter('member_id', $invitee_id)->getQuery()->getResult(); - } - - /** - * @param int $invitee_id - * @return ChatTeamInvitation[] - */ - function getAcceptedInvitationsByInvitee($invitee_id) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("i") - ->from(\models\main\ChatTeamInvitation::class, "i") - ->innerJoin('i.invitee', 'm', Join::WITH, " m.id = :member_id") - ->where('i.is_accepted = true') - ->setParameter('member_id', $invitee_id)->getQuery()->getResult(); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return ChatTeamInvitation::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineChatTeamPushNotificationMessageRepository.php b/app/Repositories/Main/DoctrineChatTeamPushNotificationMessageRepository.php deleted file mode 100644 index 4e254047..00000000 --- a/app/Repositories/Main/DoctrineChatTeamPushNotificationMessageRepository.php +++ /dev/null @@ -1,146 +0,0 @@ -getEntityManager()->createQueryBuilder() - ->select("m") - ->from(\models\main\ChatTeamPushNotificationMessage::class, "m") - ->join('m.team', 't') - ->where('m.is_sent = 1') - ->andWhere('t.id = :team_id') - ->setParameter('team_id', $team_id); - - if(!is_null($filter)){ - - $filter->apply2Query($query, array - ( - 'sent_date' => 'm.sent_date:datetime_epoch', - 'owner_id' => new DoctrineJoinFilterMapping - ( - 'm.owner', - 'mb', - "mb.id :operator :value" - ), - )); - } - - if (!is_null($order)) { - - $order->apply2Query($query, array - ( - 'sent_date' => 'm.sent_date', - 'id' => 'm.id', - )); - } else { - //default order - $query = $query->addOrderBy("m.sent_date",'ASC'); - $query = $query->addOrderBy("m.id", 'ASC'); - } - - $query = - $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query, $fetchJoinCollection = true); - $total = $paginator->count(); - $data = array(); - - foreach($paginator as $entity) - array_push($data, $entity); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @param int $team_id - * @param PagingInfo $paging_info - * @return PagingResponse - */ - function getAllNotSentByTeamPaginated - ( - $team_id, - PagingInfo $paging_info - ) - { - $query = $this->getEntityManager()->createQueryBuilder() - ->select("m") - ->from(\models\main\ChatTeamPushNotificationMessage::class, "m") - ->join('m.team', 't') - ->where('m.is_sent = 0') - ->andWhere('t.id = :team_id') - ->setParameter('team_id', $team_id); - - $query = - $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query, $fetchJoinCollection = true); - $total = $paginator->count(); - $data = array(); - - foreach($paginator as $entity) - array_push($data, $entity); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return ChatTeamPushNotificationMessage::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineChatTeamRepository.php b/app/Repositories/Main/DoctrineChatTeamRepository.php deleted file mode 100644 index 2aea8f71..00000000 --- a/app/Repositories/Main/DoctrineChatTeamRepository.php +++ /dev/null @@ -1,61 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("t") - ->from(\models\main\ChatTeam::class, "t") - ->innerJoin('t.members', 'tm') - ->innerJoin('tm.member', 'm', Join::WITH, "m.id = :member_id") - ->setParameter('member_id', $member->getId())->getQuery()->getResult(); - } - - /** - * @return int[] - */ - function getAllTeamsIdsWithPendingMessages2Sent() - { - $result = $this - ->getEntityManager() - ->createQuery("select distinct t.id from \models\main\ChatTeam t join t.messages m where exists (select m2.id from \models\main\ChatTeamPushNotificationMessage m2 where m2.id = m.id and m2.is_sent = 0 )") - ->getScalarResult(); - $ids = array_map('current', $result); - return $ids; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return ChatTeam::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineCompanyRepository.php b/app/Repositories/Main/DoctrineCompanyRepository.php deleted file mode 100644 index 3ccd5a22..00000000 --- a/app/Repositories/Main/DoctrineCompanyRepository.php +++ /dev/null @@ -1,64 +0,0 @@ - 'e.name:json_string' - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return Company::class; - } - - /** - * @param string $name - * @return Company|null - */ - public function getByName(string $name): ?Company - { - return $this->findOneBy(['name' => trim($name)]); - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineExtraQuestionTypeRepository.php b/app/Repositories/Main/DoctrineExtraQuestionTypeRepository.php deleted file mode 100644 index 771c1062..00000000 --- a/app/Repositories/Main/DoctrineExtraQuestionTypeRepository.php +++ /dev/null @@ -1,125 +0,0 @@ - 'e.name:json_string', - 'type' => 'e.type:json_string', - 'label' => 'e.label:json_string', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - 'label' => 'e.label', - 'order' => 'e.order', - ]; - } - - /** - * @return array - */ - public function getQuestionsMetadata() - { - return [ - [ - 'type' => 'TextArea', - ], - [ - 'type' => 'Text', - ], - [ - 'type' => 'CheckBox', - ], - [ - 'type' => 'ComboBox', - 'values' => 'array', - ], - [ - 'type' => 'CheckBoxList', - 'values' => 'array', - ], - [ - 'type' => 'RadioButtonList', - 'values' => 'array', - ], - - ]; - } - - /** - * @param ExtraQuestionType $questionType - * @return bool - */ - public function hasAnswers(ExtraQuestionType $questionType): bool - { - try { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("count(e.id)") - ->from(ExtraQuestionAnswer::class, "e")->join("e.question", "q") - ->where("q = :question")->setParameter("question", $questionType); - - return $query->getQuery()->getSingleScalarResult() > 0; - } - catch (\Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param ExtraQuestionType $questionType - */ - public function deleteAnswersFrom(ExtraQuestionType $questionType):void{ - try { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->delete(ExtraQuestionAnswer::class, "e") - ->where("e.question = :question") - ->setParameter("question", $questionType); - - $query->getQuery()->execute(); - } - catch (\Exception $ex){ - Log::error($ex); - } - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineFolderRepository.php b/app/Repositories/Main/DoctrineFolderRepository.php deleted file mode 100644 index f2fb43bc..00000000 --- a/app/Repositories/Main/DoctrineFolderRepository.php +++ /dev/null @@ -1,107 +0,0 @@ -getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\main\File::class, 'f'); - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - $native_query->setParameter("folder_name", $folder_name); - - return $native_query->getOneOrNullResult(); - } - - /** - * @param string $file_name - * @return File - */ - public function getFolderByFileName($file_name) - { - - $query = <<getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\main\File::class, 'f'); - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - $native_query->setParameter("file_name", $file_name); - - return $native_query->getOneOrNullResult(); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return File::class; - } - - /** - * @param string $folder_name - * @param File $parent - * @return File - */ - public function getFolderByNameAndParent($folder_name, File $parent) - { - $query = <<getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\main\File::class, 'f'); - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - $native_query->setParameter("folder_name", $folder_name); - $native_query->setParameter("parent_id", $parent->getId()); - - return $native_query->getOneOrNullResult(); - } - - /** - * @param string $name - * @return bool - */ - public function existByName(string $name): bool - { - return $this->count(['name'=> trim($name)]) > 0; - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineGroupRepository.php b/app/Repositories/Main/DoctrineGroupRepository.php deleted file mode 100644 index b2e1fe3d..00000000 --- a/app/Repositories/Main/DoctrineGroupRepository.php +++ /dev/null @@ -1,65 +0,0 @@ - 'e.code:json_string', - 'title' => 'e.title:json_string', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'code' => 'e.code', - 'title' => 'e.title', - ]; - } - /** - * @return string - */ - protected function getBaseEntity() - { - return Group::class; - } - - /** - * @param string $slug - * @return Group|null - */ - public function getBySlug(string $slug): ?Group - { - return $this->findOneBy(['code'=>trim($slug)]); - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineLanguageRepository.php b/app/Repositories/Main/DoctrineLanguageRepository.php deleted file mode 100644 index 391053bb..00000000 --- a/app/Repositories/Main/DoctrineLanguageRepository.php +++ /dev/null @@ -1,33 +0,0 @@ -getConnection()->prepare($sql); - $stmt->execute([ - 'url_segment' => trim($slug), - 'class_name' => "LegalDocumentPage" - ]); - $res = $stmt->fetchAll(); - if(count($res) == 0 ) return null; - return new LegalDocument( - $res[0]['ID'], - trim($res[0]['Title']), - trim($res[0]['URLSegment']), - trim($res[0]['Content']) - ); - } catch (\Exception $ex) { - return null; - } - return null; - } - - /** - * @param int $id - * @return LegalDocument|null - */ - public function getById(int $id): ?LegalDocument - { - try { - $sql = <<getConnection()->prepare($sql); - $stmt->execute([ - 'id' => $id, - 'class_name' => "LegalDocumentPage" - ]); - $res = $stmt->fetchAll(); - if(count($res) == 0 ) return null; - return new LegalDocument( - $res[0]['ID'], - trim($res[0]['Title']), - trim($res[0]['URLSegment']), - trim($res[0]['Content']) - ); - } catch (\Exception $ex) { - return null; - } - return null; - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineOrganizationRepository.php b/app/Repositories/Main/DoctrineOrganizationRepository.php deleted file mode 100644 index f815654e..00000000 --- a/app/Repositories/Main/DoctrineOrganizationRepository.php +++ /dev/null @@ -1,73 +0,0 @@ - 'e.name:json_string' - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } - - /** - * @param string $name - * @return Organization|null - */ - public function getByName($name) - { - try { - return $this->getEntityManager()->createQueryBuilder() - ->select("o") - ->from(\models\main\Organization::class, "o") - ->where('UPPER(TRIM(o.name)) = UPPER(TRIM(:name))') - ->setParameter('name', $name) - ->getQuery()->getOneOrNullResult(); - } - catch(\Exception $ex){ - return null; - } - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineProjectSponsorshipTypeRepository.php b/app/Repositories/Main/DoctrineProjectSponsorshipTypeRepository.php deleted file mode 100644 index a75a244d..00000000 --- a/app/Repositories/Main/DoctrineProjectSponsorshipTypeRepository.php +++ /dev/null @@ -1,71 +0,0 @@ - 'e.name:json_string', - 'slug' => 'e.slug:json_string', - 'is_active' => 'e.is_active:json_int', - 'sponsored_project_slug' => 'sp.slug:json_string', - 'sponsored_project_id' => 'sp.id:json_int' - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query){ - $query = $query->innerJoin("e.sponsored_project", "sp"); - return $query; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - 'order'=> 'e.order', - ]; - } - - - /** - * @inheritDoc - */ - protected function getBaseEntity() - { - return ProjectSponsorshipType::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineSponsoredProjectRepository.php b/app/Repositories/Main/DoctrineSponsoredProjectRepository.php deleted file mode 100644 index 2d495532..00000000 --- a/app/Repositories/Main/DoctrineSponsoredProjectRepository.php +++ /dev/null @@ -1,61 +0,0 @@ - 'e.name:json_string', - 'slug' => 'e.slug:json_string', - 'is_active' => 'e.is_active:json_int', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } - - /** - * @inheritDoc - */ - protected function getBaseEntity() - { - return SponsoredProject::class; - } - - public function getByName(string $name): ?SponsoredProject - { - return $this->findOneBy(['name' => trim($name)]); - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineSummitAdministratorPermissionGroupRepository.php b/app/Repositories/Main/DoctrineSummitAdministratorPermissionGroupRepository.php deleted file mode 100644 index a88bca31..00000000 --- a/app/Repositories/Main/DoctrineSummitAdministratorPermissionGroupRepository.php +++ /dev/null @@ -1,81 +0,0 @@ - 'e.title', - 'member_id' => "m.id :operator :value", - 'summit_id' => "s.id :operator :value", - 'member_first_name' => "m.first_name :operator :value", - 'member_last_name' => "m.last_name :operator :value", - 'member_full_name' => "concat(m.first_name, ' ', m.last_name) :operator :value", - 'member_email' => "m.email :operator :value", - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'created' => 'e.created', - 'title' => "e.title", - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query) - { - $query = $query->join('e.summits', 's') - ->join('e.members', 'm'); - return $query; - } - - /** - * @inheritDoc - */ - protected function getBaseEntity() - { - return SummitAdministratorPermissionGroup::class; - } - - /** - * @inheritDoc - */ - public function getByTitle(string $title): ?SummitAdministratorPermissionGroup - { - return $this->findOneBy(['title' => trim($title)]); - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineSupportingCompanyRepository.php b/app/Repositories/Main/DoctrineSupportingCompanyRepository.php deleted file mode 100644 index 4b4a952d..00000000 --- a/app/Repositories/Main/DoctrineSupportingCompanyRepository.php +++ /dev/null @@ -1,73 +0,0 @@ - 'c.name', - 'sponsorship_type_id' => 'st.id', - 'sponsorship_type_slug' => 'st.slug', - 'sponsored_project_id' => 'sp.id', - 'sponsored_project_slug' => 'sp.slug', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'name' => 'c.name', - 'order' => 'e.order', - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query) - { - $query = $query->innerJoin("e.sponsorship_type", "st"); - $query = $query->innerJoin("e.company", "c"); - $query = $query->innerJoin("st.sponsored_project", "sp"); - return $query; - } - - /** - * @inheritDoc - */ - protected function getBaseEntity() - { - return SupportingCompany::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Main/DoctrineTagRepository.php b/app/Repositories/Main/DoctrineTagRepository.php deleted file mode 100644 index aebbd399..00000000 --- a/app/Repositories/Main/DoctrineTagRepository.php +++ /dev/null @@ -1,77 +0,0 @@ - 'e.tag:json_string', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'tag' => 'e.tag', - ]; - } - - /** - * @param string $tag - * @return Tag - */ - public function getByTag($tag) - { - try { - return $this->getEntityManager()->createQueryBuilder() - ->select("t") - ->from(\models\main\Tag::class, "t") - ->where('UPPER(TRIM(t.tag)) = UPPER(TRIM(:tag))') - ->setParameter('tag', $tag) - ->setMaxResults(1) - ->getQuery()->getOneOrNullResult(); - } - catch(NoResultException $e){ - return null; - } - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return Tag::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Marketplace/DoctrineApplianceRepository.php b/app/Repositories/Marketplace/DoctrineApplianceRepository.php deleted file mode 100644 index b7216f66..00000000 --- a/app/Repositories/Marketplace/DoctrineApplianceRepository.php +++ /dev/null @@ -1,31 +0,0 @@ -where('e.is_active = 1'); - return $query; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'name' => 'e.name', - 'company' => new DoctrineJoinFilterMapping - ( - 'e.company', - 'c', - "c.name :operator :value" - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Marketplace/DoctrineConsultantRepository.php b/app/Repositories/Marketplace/DoctrineConsultantRepository.php deleted file mode 100644 index 535fa215..00000000 --- a/app/Repositories/Marketplace/DoctrineConsultantRepository.php +++ /dev/null @@ -1,31 +0,0 @@ -getEntityManager()->createQueryBuilder() - ->select("e") - ->from(\App\Models\ResourceServer\ApiEndpoint::class, "e") - ->where('e.route = :route') - ->andWhere('e.http_method = :http_method') - ->setParameter('route', trim($url)) - ->setParameter('http_method', trim($http_method)) - ->setCacheable(true) - ->setCacheRegion('resource_server_region') - ->getQuery() - ->getOneOrNullResult(); - } - catch(\Exception $ex){ - Log::error($ex); - return null; - } - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return ApiEndpoint::class; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return []; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return []; - } - -} \ No newline at end of file diff --git a/app/Repositories/ResourceServer/DoctrineApiRepository.php b/app/Repositories/ResourceServer/DoctrineApiRepository.php deleted file mode 100644 index 99c7cab4..00000000 --- a/app/Repositories/ResourceServer/DoctrineApiRepository.php +++ /dev/null @@ -1,57 +0,0 @@ -getEntityManager()->createQueryBuilder() - ->select("c") - ->from(\App\Models\ResourceServer\EndPointRateLimitByIP::class, "c") - ->where('c.route = :route') - ->andWhere('c.http_method = :http_method') - ->andWhere('c.ip = :ip') - ->andWhere('c.active = 1') - ->setParameter('ip', trim($ip)) - ->setParameter('route', trim($route)) - ->setParameter('http_method', trim($http_method)) - ->getQuery() - ->getOneOrNullResult(); - } - catch(\Exception $ex){ - Log::error($ex); - return null; - } - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return EndPointRateLimitByIP::class; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return []; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return []; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraFilters(QueryBuilder $query) - { - return $query; - } - - /** - * @param int $id - * @return IEntity - */ - public function getById($id) - { - // TODO: Implement getById() method. - } - - - /** - * @param IEntity $entity - * @return void - */ - public function delete($entity) - { - // TODO: Implement delete() method. - } - - /** - * @return IEntity[] - */ - public function getAll() - { - // TODO: Implement getAll() method. - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - // TODO: Implement getAllByPage() method. - } -} \ No newline at end of file diff --git a/app/Repositories/SilverStripeDoctrineRepository.php b/app/Repositories/SilverStripeDoctrineRepository.php deleted file mode 100644 index 5d2f9ee8..00000000 --- a/app/Repositories/SilverStripeDoctrineRepository.php +++ /dev/null @@ -1,87 +0,0 @@ -EntityRepository. - * - * @param EntityManager $em The EntityManager to use. - * @param ClassMetadata $class The class descriptor. - */ - public function __construct($em, ClassMetadata $class) - { - $this->manager_name = SilverstripeBaseModel::EntityManager; - parent::__construct(Registry::getManager(SilverstripeBaseModel::EntityManager), $class); - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return []; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return []; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraFilters(QueryBuilder $query){ - return $query; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query){ - return $query; - } - - /** - * @param string $group_code - * @return bool - */ - protected static function isCurrentMemberOnGroup($group_code){ - $resource_server_ctx = App::make(\models\oauth2\IResourceServerContext::class); - $member = $resource_server_ctx->getCurrentUser(); - if(is_null($member)) return false; - return $member->isOnGroup($group_code); - } - - public function deleteAll():void{ - foreach ($this->getAll() as $entity){ - $this->delete($entity); - } - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineAbstractCalendarSyncWorkRequestRepository.php b/app/Repositories/Summit/DoctrineAbstractCalendarSyncWorkRequestRepository.php deleted file mode 100644 index 56d1a235..00000000 --- a/app/Repositories/Summit/DoctrineAbstractCalendarSyncWorkRequestRepository.php +++ /dev/null @@ -1,157 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(MemberEventScheduleSummitActionSyncWorkRequest::class, "r") - ->join('r.summit_event', 'e', Join::WITH, " e.id = :event_id") - ->join('r.owner', 'o', Join::WITH, " o.id = :member_id") - ->join('r.calendar_sync_info', 'si', Join::WITH, " si.id = :calendar_sync_info_id"); - if(!empty($type)){ - $query = $query - ->where('r.type = :type') - ->setParameter('type', $type)->getQuery(); - } - - $query - ->setParameter('event_id', $event->getId()) - ->setParameter('member_id', $member->getId()) - ->setParameter('calendar_sync_info_id', $calendar_sync_info->getId()); - - return $query->getSingleResult(); - } - - /** - * @param string $provider - * @param PagingInfo $paging_info - * @return PagingResponse - */ - public function getUnprocessedMemberScheduleWorkRequestActionByPage($provider = 'ALL', PagingInfo $paging_info){ - - log::debug(sprintf("DoctrineAbstractCalendarSyncWorkRequestRepository::getUnprocessedMemberScheduleWorkRequestActionByPage: provider %s",$provider)); - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(MemberScheduleSummitActionSyncWorkRequest::class, "r") - ->where('(r.type = :type_add or r.type = :type_remove or r.type = :type_update) and r.is_processed = 0') - ->orderBy('r.id', 'ASC') - ->setParameter('type_add',AbstractCalendarSyncWorkRequest::TypeAdd ) - ->setParameter('type_update',AbstractCalendarSyncWorkRequest::TypeUpdate ) - ->setParameter('type_remove',AbstractCalendarSyncWorkRequest::TypeRemove); - - if(CalendarSyncInfo::isValidProvider($provider)){ - log::debug(sprintf("provider %s is valid",$provider)); - $query = $query - ->join('r.calendar_sync_info', 'si', Join::WITH, " si.provider = :provider") - ->setParameter('provider', $provider); - } - $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 - ); - } - - /** - * @param PagingInfo $paging_info - * @return PagingResponse - */ - public function getUnprocessedAdminScheduleWorkRequestActionByPage(PagingInfo $paging_info){ - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(AdminScheduleSummitActionSyncWorkRequest::class, "r") - ->where('(r.type = :type_add or r.type = :type_remove or r.type = :type_update) and r.is_processed = 0') - ->orderBy('r.id', 'ASC') - ->setParameter('type_add',AbstractCalendarSyncWorkRequest::TypeAdd ) - ->setParameter('type_update',AbstractCalendarSyncWorkRequest::TypeUpdate ) - ->setParameter('type_remove',AbstractCalendarSyncWorkRequest::TypeRemove); - - $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 - ); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return MemberEventScheduleSummitActionSyncWorkRequest::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineCalendarSyncInfoRepository.php b/app/Repositories/Summit/DoctrineCalendarSyncInfoRepository.php deleted file mode 100644 index 12903b8f..00000000 --- a/app/Repositories/Summit/DoctrineCalendarSyncInfoRepository.php +++ /dev/null @@ -1,35 +0,0 @@ -findOneBy(['type' => $type]); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineDefaultTrackTagGroupRepository.php b/app/Repositories/Summit/DoctrineDefaultTrackTagGroupRepository.php deleted file mode 100644 index 453f2e0f..00000000 --- a/app/Repositories/Summit/DoctrineDefaultTrackTagGroupRepository.php +++ /dev/null @@ -1,32 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("f") - ->from(\models\summit\SummitEventFeedback::class, "f") - ->join('f.event', 'e', Join::WITH, " e.id = :event_id") - ->join('f.owner', 'o') - ->setParameter('event_id', $event->getId()); - - if(!is_null($filter)){ - - $filter->apply2Query($query, array - ( - 'owner_id' => 'o.id', - )); - } - - if(!is_null($order)) - { - - $order->apply2Query($query, array - ( - 'created_date' => 'f.created', - 'owner_id' => 'o.id', - 'rate' => 'f.rate', - 'id' => 'f.id', - )); - } - else - { - //default order - $query = $query->orderBy('f.created' , Criteria::DESC); - } - - $query= $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query, $fetchJoinCollection = true); - $total = $paginator->count(); - $data = array(); - - foreach($paginator as $entity) - array_push($data, $entity); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitEventFeedback::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineMemberRepository.php b/app/Repositories/Summit/DoctrineMemberRepository.php deleted file mode 100644 index bdc00e91..00000000 --- a/app/Repositories/Summit/DoctrineMemberRepository.php +++ /dev/null @@ -1,207 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.email = :email") - ->setParameter("email", strtolower(trim($email))) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("m") - ->from($this->getBaseEntity(), "m") - ->andWhere("m.first_name is not null") - ->andWhere("m.last_name is not null"); - - - if($filter->hasFilter("summit_id") || $filter->hasFilter("schedule_event_id")){ - $query = $query - ->leftJoin("m.schedule","sch") - ->leftJoin("sch.event", "evt") - ->leftJoin("evt.summit", "s"); - } - - if(!is_null($filter)){ - - $filter->apply2Query($query, [ - 'irc' => 'm.irc_handle:json_string', - 'created' => 'm.created:datetime_epoch', - 'last_edited' => 'm.last_edited:datetime_epoch', - 'twitter' => 'm.twitter_handle:json_string', - 'first_name' => 'm.first_name:json_string', - 'last_name' => 'm.last_name:json_string', - 'github_user' => 'm.github_user:json_string', - 'schedule_event_id' => 'evt.id', - 'summit_id' => 's.id', - 'full_name' => new DoctrineFilterMapping("concat(m.first_name, ' ', m.last_name) :operator :value"), - 'email' => ['m.email:json_string', 'm.second_email:json_string', 'm.third_email:json_string'], - 'group_slug' => new DoctrineJoinFilterMapping - ( - 'm.groups', - 'g', - "g.code :operator :value" - ), - 'group_id' => new DoctrineJoinFilterMapping - ( - 'm.groups', - 'g', - "g.id :operator :value" - ), - 'email_verified' => 'm.email_verified:json_int', - 'active' => 'm.active:json_int', - ]); - } - - if (!is_null($order)) { - - $order->apply2Query($query, [ - 'id' => 'm.id', - 'first_name' => 'm.first_name', - 'last_name' => 'm.last_name', - 'created' => 'm.created', - 'last_edited' => 'm.last_edited', - ]); - } else { - //default order - $query = $query->addOrderBy("m.first_name",'ASC'); - $query = $query->addOrderBy("m.last_name", 'ASC'); - } - - $query = $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query, $fetchJoinCollection = true); - $total = $paginator->count(); - $data = array(); - - foreach($paginator as $entity) - array_push($data, $entity); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return Member::class; - } - - /** - * @param string $fullname - * @return Member|null - */ - public function getByFullName(string $fullname): ?Member - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("concat(e.first_name, ' ', e.last_name) like :full_name") - ->setParameter("full_name", '%'.trim($fullname).'%') - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param int $external_id - * @return Member|null - */ - public function getByExternalId(int $external_id): ?Member - { - return $this->findOneBy([ - 'user_external_id' => $external_id - ]); - } - - public function getByExternalIdExclusiveLock(int $external_id): ?Member{ - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.user_external_id = :user_external_id"); - - $query->setParameter("user_external_id", $external_id); - - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->getOneOrNullResult(); - } - - /** - * @inheritDoc - */ - public function getByEmailExclusiveLock($email): ?Member - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.email = :email"); - - $query->setParameter("email", $email); - - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrinePaymentGatewayProfileRepository.php b/app/Repositories/Summit/DoctrinePaymentGatewayProfileRepository.php deleted file mode 100644 index a08d7a12..00000000 --- a/app/Repositories/Summit/DoctrinePaymentGatewayProfileRepository.php +++ /dev/null @@ -1,57 +0,0 @@ - 'e.application_type:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'application_type' => 'e.application_type', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrinePresentationActionTypeRepository.php b/app/Repositories/Summit/DoctrinePresentationActionTypeRepository.php deleted file mode 100644 index 1776b028..00000000 --- a/app/Repositories/Summit/DoctrinePresentationActionTypeRepository.php +++ /dev/null @@ -1,59 +0,0 @@ - 'e.label:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'order' => 'e.order', - 'label' => 'e.label', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrinePresentationCategoryGroupRepository.php b/app/Repositories/Summit/DoctrinePresentationCategoryGroupRepository.php deleted file mode 100644 index ba139e2f..00000000 --- a/app/Repositories/Summit/DoctrinePresentationCategoryGroupRepository.php +++ /dev/null @@ -1,160 +0,0 @@ - 'pcg.name:json_string', - 'description' => 'pcg.description:json_string', - 'slug' => 'pcg.slug:json_string', - 'submission_begin_date' => 'ppcg.submission_begin_date:datetime_epoch', - 'submission_end_date' => 'ppcg.submission_begin_date:datetime_epoch', - 'class_name' => new DoctrineInstanceOfFilterMapping - ( - "pcg", - [ - PresentationCategoryGroup::ClassName => PresentationCategoryGroup::class, - PrivatePresentationCategoryGroup::ClassName => PrivatePresentationCategoryGroup::class, - ] - ), - 'track_title' => new DoctrineFilterMapping - ( - "(cat.title :operator :value)" - ), - 'track_code' => new DoctrineFilterMapping - ( - "(cat.code :operator :value)" - ), - 'group_title' => new DoctrineFilterMapping - ( - "(grp.title :operator :value)" - ), - 'group_code' => new DoctrineFilterMapping - ( - "(grp.code :operator :value)" - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'name' => 'pcg.name', - 'id' => 'pcg.id', - 'slug' => 'pcg.slug', - ]; - } - - /** - * @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 - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("pcg") - ->from(PresentationCategoryGroup::class, "pcg") - ->leftJoin(PrivatePresentationCategoryGroup::class, 'ppcg', 'WITH', 'ppcg.id = pcg.id') - ->leftJoin("pcg.categories", "cat") - ->leftJoin("ppcg.allowed_groups", "grp") - ->leftJoin('pcg.summit', 's') - ->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("pcg.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 - ); - } - - /** - * @param Summit $summit - * @return array - */ - public function getMetadata(Summit $summit) - { - return [ - PresentationCategoryGroup::getMetadata(), - PrivatePresentationCategoryGroup::getMetadata(), - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrinePresentationSpeakerSummitAssistanceConfirmationRequestRepository.php b/app/Repositories/Summit/DoctrinePresentationSpeakerSummitAssistanceConfirmationRequestRepository.php deleted file mode 100644 index e39e3cc0..00000000 --- a/app/Repositories/Summit/DoctrinePresentationSpeakerSummitAssistanceConfirmationRequestRepository.php +++ /dev/null @@ -1,174 +0,0 @@ - 'r.id:json_int', - 'on_site_phone' => 'r.on_site_phone:json_string', - 'is_confirmed' => 'r.is_confirmed', - 'registered' => 'r.registered', - 'confirmation_date' => 'r.confirmation_date:datetime_epoch', - 'speaker' => new DoctrineFilterMapping - ( - "( concat(spkr.first_name, ' ', spkr.last_name) :operator :value ". - "OR concat(spmm.first_name, ' ', spmm.last_name) :operator :value ". - "OR spkr.first_name :operator :value ". - "OR spkr.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)" - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'created' => 'r.created', - 'confirmation_date' => 'r.confirmation_date', - 'id' => 'r.id', - 'is_confirmed' => 'r.is_confirmed', - 'registered' => 'r.registered' - ]; - } - - /** - * @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) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(PresentationSpeakerSummitAssistanceConfirmationRequest::class, "r") - ->leftJoin('r.summit', 's') - ->leftJoin('r.speaker', 'spkr') - ->leftJoin('spkr.member', "spmm", Join::LEFT_JOIN) - ->leftJoin('spkr.registration_request', "sprr", Join::LEFT_JOIN) - ->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("r.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 - ); - } - - /** - * @inheritDoc - */ - public function getBySpeaker(PresentationSpeaker $speaker, Summit $summit): ?PresentationSpeakerSummitAssistanceConfirmationRequest - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.summit = :summit") - ->andWhere("e.speaker = :speaker") - ->setParameter("speaker", $speaker) - ->setParameter("summit", $summit) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param PresentationSpeakerSummitAssistanceConfirmationRequest $request - * @return bool - * @throws \Doctrine\ORM\NonUniqueResultException - */ - public function existByHash(PresentationSpeakerSummitAssistanceConfirmationRequest $request): bool - { - $res = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.summit = :summit") - ->andWhere("e.speaker <> :speaker") - ->andWhere("e.confirmation_hash = :confirmation_hash") - ->setParameter("speaker", $request->getSpeaker()) - ->setParameter("summit", $request->getSummit()) - ->setParameter("confirmation_hash", $request->getConfirmationHash()) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - return !is_null($res); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineRSVPRepository.php b/app/Repositories/Summit/DoctrineRSVPRepository.php deleted file mode 100644 index c4a88f3a..00000000 --- a/app/Repositories/Summit/DoctrineRSVPRepository.php +++ /dev/null @@ -1,35 +0,0 @@ - '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 - ); - } - - /** - * @param Summit $summit - * @return array - */ - public function getQuestionsMetadata(Summit $summit) - { - return [ - RSVPMemberEmailQuestionTemplate::getMetadata(), - RSVPMemberFirstNameQuestionTemplate::getMetadata(), - RSVPMemberLastNameQuestionTemplate::getMetadata(), - RSVPTextBoxQuestionTemplate::getMetadata(), - RSVPTextAreaQuestionTemplate::getMetadata(), - RSVPCheckBoxListQuestionTemplate::getMetadata(), - RSVPRadioButtonListQuestionTemplate::getMetadata(), - RSVPDropDownQuestionTemplate::getMetadata(), - RSVPLiteralContentQuestionTemplate::getMetadata(), - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineScheduleCalendarSyncInfoRepository.php b/app/Repositories/Summit/DoctrineScheduleCalendarSyncInfoRepository.php deleted file mode 100644 index 3a3b8d81..00000000 --- a/app/Repositories/Summit/DoctrineScheduleCalendarSyncInfoRepository.php +++ /dev/null @@ -1,115 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("si") - ->from(ScheduleCalendarSyncInfo::class, "si") - ->join('si.calendar_sync_info', 'ci', Join::WITH, " ci.revoked = :credential_status") - ->where("si.summit_event_id = :event_id") - ->orderBy('si.id', 'ASC') - ->setParameter('event_id', $summit_event_id) - ->setParameter('credential_status',false); - - $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 - ); - } - - /** - * @param int $location_id - * @param PagingInfo $paging_info - * @return PagingResponse - */ - public function getAllBySummitLocation($location_id, PagingInfo $paging_info) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("si") - ->from(ScheduleCalendarSyncInfo::class, "si") - ->join('si.calendar_sync_info', 'ci', Join::WITH, " ci.revoked = :credential_status") - ->where("si.location_id = :location_id") - ->orderBy('si.id', 'ASC') - ->setParameter('location_id', $location_id) - ->setParameter('credential_status',false); - - $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 - ); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return ScheduleCalendarSyncInfo::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSelectionPlanRepository.php b/app/Repositories/Summit/DoctrineSelectionPlanRepository.php deleted file mode 100644 index 309ad4c6..00000000 --- a/app/Repositories/Summit/DoctrineSelectionPlanRepository.php +++ /dev/null @@ -1,33 +0,0 @@ -findBy(["is_default" => true]); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSpeakerEditPermissionRequestRepository.php b/app/Repositories/Summit/DoctrineSpeakerEditPermissionRequestRepository.php deleted file mode 100644 index 3fbebdcb..00000000 --- a/app/Repositories/Summit/DoctrineSpeakerEditPermissionRequestRepository.php +++ /dev/null @@ -1,72 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(SpeakerEditPermissionRequest::class, "r") - ->where("r.speaker = :speaker") - ->andWhere("r.requested_by = :requestor") - ->setParameter("speaker", $speaker) - ->setParameter("requestor", $requestor) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $token - * @return ?SpeakerEditPermissionRequest - */ - public function getByToken(string $token): ?SpeakerEditPermissionRequest - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(SpeakerEditPermissionRequest::class, "r") - ->where("r.hash = :hash") - ->setParameter("hash", SpeakerEditPermissionRequest::HashConfirmationToken($token)) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSpeakerOrganizationalRoleRepository.php b/app/Repositories/Summit/DoctrineSpeakerOrganizationalRoleRepository.php deleted file mode 100644 index 2c699133..00000000 --- a/app/Repositories/Summit/DoctrineSpeakerOrganizationalRoleRepository.php +++ /dev/null @@ -1,62 +0,0 @@ -findBy(["is_default" => true]); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SpeakerOrganizationalRole::class; - } - - /** - * @param string $role - * @return SpeakerOrganizationalRole|null - */ - public function getByRole($role) - { - $query = <<getEntityManager()); - $rsm->addRootEntityFromClassMetadata(SpeakerOrganizationalRole::class, 'r'); - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - $native_query->setParameter("role", $role); - - return $native_query->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSpeakerRegistrationRequestRepository.php b/app/Repositories/Summit/DoctrineSpeakerRegistrationRequestRepository.php deleted file mode 100644 index a754a8b5..00000000 --- a/app/Repositories/Summit/DoctrineSpeakerRegistrationRequestRepository.php +++ /dev/null @@ -1,86 +0,0 @@ -getByHash($hash) != null; - } - - /** - * @param string $hash - * @return SpeakerRegistrationRequest - */ - public function getByHash($hash) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(SpeakerRegistrationRequest::class, "r") - ->where("r.confirmation_hash = :confirmation_hash") - ->setParameter("confirmation_hash", trim($hash)) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $email - * @return bool - */ - public function existByEmail($email) - { - return $this->getByEmail($email) != null; - } - - /** - * @param string $email - * @return SpeakerRegistrationRequest - */ - public function getByEmail($email) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("r") - ->from(SpeakerRegistrationRequest::class, "r") - ->where("r.email = :email") - ->setParameter("email", trim($email)) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSpeakerRepository.php b/app/Repositories/Summit/DoctrineSpeakerRepository.php deleted file mode 100644 index c11a8158..00000000 --- a/app/Repositories/Summit/DoctrineSpeakerRepository.php +++ /dev/null @@ -1,1010 +0,0 @@ -toRawSQL([ - 'full_name' => 'FullName', - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'email' => 'Email', - 'id' => 'ID' - ]); - if(!empty($where_conditions)) { - $extra_filters = " WHERE {$where_conditions}"; - $bindings = array_merge($bindings, $filter->getSQLBindings()); - } - } - - if(!is_null($order)) - { - $extra_orders = $order->toRawSQL(array - ( - 'id' => 'ID', - 'email' => 'Email', - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'full_name' => 'FullName', - )); - } - - $query_count = <<getId()} AND PS.PresentationSpeakerID = S.ID - ) - UNION - SELECT S.ID, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email, R.Email) AS Email - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID - ) - UNION - SELECT S.ID, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email, R.Email) AS Email - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID - ) - UNION - SELECT S.ID, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email, R.Email) AS Email - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT A.ID FROM PresentationSpeakerSummitAssistanceConfirmationRequest A - WHERE A.SummitID = {$summit->getId()} AND A.SpeakerID = S.ID - ) -) -SUMMIT_SPEAKERS -{$extra_filters} -SQL; - - - $stm = $this->getEntityManager()->getConnection()->executeQuery($query_count, $bindings); - - $total = intval($stm->fetchColumn(0)); - - $bindings = array_merge( $bindings, array - ( - 'per_page' => $paging_info->getPerPage(), - 'offset' => $paging_info->getOffset(), - )); - - $query = <<getId()} AND PS.PresentationSpeakerID = S.ID - ) - UNION - SELECT - S.ID, - S.ClassName, - S.Created, - S.LastEdited, - S.Title AS SpeakerTitle, - S.Bio, - S.IRCHandle, - S.AvailableForBureau, - S.FundedTravel, - S.Country, - S.MemberID, - S.WillingToTravel, - S.WillingToPresentVideo, - S.Notes, - S.TwitterName, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email,R.Email) AS Email, - S.PhotoID, - S.BigPhotoID, - R.ID AS RegistrationRequestID - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID - ) - UNION - SELECT - S.ID, - S.ClassName, - S.Created, - S.LastEdited, - S.Title AS SpeakerTitle, - S.Bio, - S.IRCHandle, - S.AvailableForBureau, - S.FundedTravel, - S.Country, - S.MemberID, - S.WillingToTravel, - S.WillingToPresentVideo, - S.Notes, - S.TwitterName, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email,R.Email) AS Email, - S.PhotoID, - S.BigPhotoID, - R.ID AS RegistrationRequestID - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID - ) - UNION - SELECT - S.ID, - S.ClassName, - S.Created, - S.LastEdited, - S.Title AS SpeakerTitle, - S.Bio, - S.IRCHandle, - S.AvailableForBureau, - S.FundedTravel, - S.Country, - S.MemberID, - S.WillingToTravel, - S.WillingToPresentVideo, - S.Notes, - S.TwitterName, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - IFNULL(M.Email,R.Email) AS Email, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - S.PhotoID, - S.BigPhotoID, - R.ID AS RegistrationRequestID - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT A.ID FROM PresentationSpeakerSummitAssistanceConfirmationRequest A - WHERE A.SummitID = {$summit->getId()} AND A.SpeakerID = S.ID - ) -) -SUMMIT_SPEAKERS -{$extra_filters} {$extra_orders} limit :per_page offset :offset; -SQL; - - /*$rsm = new ResultSetMapping(); - $rsm->addEntityResult(\models\summit\PresentationSpeaker::class, 's'); - $rsm->addJoinedEntityResult(\models\main\File::class,'p', 's', 'photo'); - $rsm->addJoinedEntityResult(\models\main\Member::class,'m', 's', 'member'); - - $rsm->addFieldResult('s', 'ID', 'id'); - $rsm->addFieldResult('s', 'FirstName', 'first_name'); - $rsm->addFieldResult('s', 'LastName', 'last_name'); - $rsm->addFieldResult('s', 'Bio', 'last_name'); - $rsm->addFieldResult('s', 'SpeakerTitle', 'title' ); - $rsm->addFieldResult('p', 'PhotoID', 'id'); - $rsm->addFieldResult('p', 'PhotoTitle', 'title'); - $rsm->addFieldResult('p', 'PhotoFileName', 'filename'); - $rsm->addFieldResult('p', 'PhotoName', 'name'); - $rsm->addFieldResult('m', 'MemberID', 'id');*/ - - $rsm = new ResultSetMappingBuilder($this->getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\summit\PresentationSpeaker::class, 's', ['Title' => 'SpeakerTitle']); - - // build rsm here - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - foreach($bindings as $k => $v) - $native_query->setParameter($k, $v); - - $speakers = $native_query->getResult(); - - $last_page = (int) ceil($total / $paging_info->getPerPage()); - - return new PagingResponse($total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $last_page, $speakers); - } - - /** - * @param Summit $summit - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getSpeakersBySummitAndOnSchedule(Summit $summit, PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - - $extra_filters = ''; - $extra_events_filters = ''; - $extra_orders = ''; - $bindings = []; - - if(!is_null($filter)) - { - $where_conditions = $filter->toRawSQL([ - 'full_name' => 'FullName', - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'email' => 'Email', - 'id' => 'ID', - 'featured' => 'Featured' - ]); - - if(!empty($where_conditions)) { - $extra_filters = " WHERE {$where_conditions}"; - $bindings = array_merge($bindings, $filter->getSQLBindings()); - } - - $where_event_conditions = $filter->toRawSQL([ - 'event_start_date' => 'E.StartDate:datetime_epoch', - 'event_end_date' => 'E.EndDate:datetime_epoch', - ], count($bindings) + 1); - - if(!empty($where_event_conditions)) { - $extra_events_filters = " AND {$where_event_conditions}"; - $bindings = array_merge($bindings, $filter->getSQLBindings()); - } - } - - foreach ($bindings as $key => $value){ - if($value == 'true') - $bindings[$key] = 1; - if($value == 'false') - $bindings[$key] = 0; - } - - if(!is_null($order)) - { - $extra_orders = $order->toRawSQL(array - ( - 'id' => 'ID', - 'email' => 'Email', - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'full_name' => 'FullName', - )); - } - - $query_count = <<getId()}) AS Featured - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND PS.PresentationSpeakerID = S.ID AND E.Published = 1 {$extra_events_filters} - ) - UNION - SELECT S.ID, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email, R.Email) AS Email, - EXISTS(SELECT 1 FROM Summit_FeaturedSpeakers WHERE Summit_FeaturedSpeakers.PresentationSpeakerID = S.ID AND Summit_FeaturedSpeakers.SummitID = {$summit->getId()}) AS Featured - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID AND E.Published = 1 {$extra_events_filters} - ) - UNION - SELECT S.ID, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email, R.Email) AS Email, - EXISTS(SELECT 1 FROM Summit_FeaturedSpeakers WHERE Summit_FeaturedSpeakers.PresentationSpeakerID = S.ID AND Summit_FeaturedSpeakers.SummitID = {$summit->getId()}) AS Featured - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID AND E.Published = 1 {$extra_events_filters} - ) -) -SUMMIT_SPEAKERS -{$extra_filters} -SQL; - - - $stm = $this->getEntityManager()->getConnection()->prepare($query_count); - $stm->execute($bindings); - $res = $stm->fetchAll(\PDO::FETCH_COLUMN); - - $total = count($res) > 0 ? $res[0] : 0; - - $bindings = array_merge( $bindings, array - ( - 'per_page' => $paging_info->getPerPage(), - 'offset' => $paging_info->getOffset(), - )); - - $query = <<getId()}) AS Featured - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN File F ON F.ID = S.PhotoID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND PS.PresentationSpeakerID = S.ID AND E.Published = 1 {$extra_events_filters} - ) - UNION - SELECT - S.ID, - S.ClassName, - S.Created, - S.LastEdited, - S.Title AS SpeakerTitle, - S.Bio, - S.IRCHandle, - S.AvailableForBureau, - S.FundedTravel, - S.Country, - S.MemberID, - S.WillingToTravel, - S.WillingToPresentVideo, - S.Notes, - S.TwitterName, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email,R.Email) AS Email, - S.PhotoID, - S.BigPhotoID, - R.ID AS RegistrationRequestID, - EXISTS(SELECT 1 FROM Summit_FeaturedSpeakers WHERE Summit_FeaturedSpeakers.PresentationSpeakerID = S.ID AND Summit_FeaturedSpeakers.SummitID = {$summit->getId()}) AS Featured - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID AND E.Published = 1 {$extra_events_filters} - ) - UNION - SELECT - S.ID, - S.ClassName, - S.Created, - S.LastEdited, - S.Title AS SpeakerTitle, - S.Bio, - S.IRCHandle, - S.AvailableForBureau, - S.FundedTravel, - S.Country, - S.MemberID, - S.WillingToTravel, - S.WillingToPresentVideo, - S.Notes, - S.TwitterName, - IFNULL(S.FirstName, M.FirstName) AS FirstName, - IFNULL(S.LastName, M.Surname) AS LastName, - CONCAT(IFNULL(S.FirstName, M.FirstName), ' ', IFNULL(S.LastName, M.Surname)) AS FullName, - IFNULL(M.Email,R.Email) AS Email, - S.PhotoID, - S.BigPhotoID, - R.ID AS RegistrationRequestID, - EXISTS(SELECT 1 FROM Summit_FeaturedSpeakers WHERE Summit_FeaturedSpeakers.PresentationSpeakerID = S.ID AND Summit_FeaturedSpeakers.SummitID = {$summit->getId()}) AS Featured - FROM PresentationSpeaker S - LEFT JOIN Member M ON M.ID = S.MemberID - LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID - WHERE - EXISTS - ( - SELECT E.ID FROM SummitEvent E - INNER JOIN Presentation P ON E.ID = P.ID - INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID - WHERE E.SummitID = {$summit->getId()} AND P.ModeratorID = S.ID AND E.Published = 1 {$extra_events_filters} - ) -) -SUMMIT_SPEAKERS -{$extra_filters} {$extra_orders} limit :per_page offset :offset; -SQL; - - /*$rsm = new ResultSetMapping(); - $rsm->addEntityResult(\models\summit\PresentationSpeaker::class, 's'); - $rsm->addJoinedEntityResult(\models\main\File::class,'p', 's', 'photo'); - $rsm->addJoinedEntityResult(\models\main\Member::class,'m', 's', 'member'); - - $rsm->addFieldResult('s', 'ID', 'id'); - $rsm->addFieldResult('s', 'FirstName', 'first_name'); - $rsm->addFieldResult('s', 'LastName', 'last_name'); - $rsm->addFieldResult('s', 'Bio', 'last_name'); - $rsm->addFieldResult('s', 'SpeakerTitle', 'title' ); - $rsm->addFieldResult('p', 'PhotoID', 'id'); - $rsm->addFieldResult('p', 'PhotoTitle', 'title'); - $rsm->addFieldResult('p', 'PhotoFileName', 'filename'); - $rsm->addFieldResult('p', 'PhotoName', 'name'); - $rsm->addFieldResult('m', 'MemberID', 'id');*/ - - $rsm = new ResultSetMappingBuilder($this->getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\summit\PresentationSpeaker::class, 's', ['Title' => 'SpeakerTitle']); - - // build rsm here - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - foreach($bindings as $k => $v) - $native_query->setParameter($k, $v); - - $speakers = $native_query->getResult(); - - $last_page = (int) ceil($total / $paging_info->getPerPage()); - - return new PagingResponse($total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $last_page, $speakers); - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - - $extra_filters = ''; - $extra_orders = ''; - $bindings = []; - - if(!is_null($filter)) - { - $where_conditions = $filter->toRawSQL([ - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'email' => 'Email', - 'id' => 'ID', - 'full_name' => "FullName", - ]); - if(!empty($where_conditions)) { - $extra_filters = " WHERE {$where_conditions}"; - $bindings = array_merge($bindings, $filter->getSQLBindings()); - } - } - - if(!is_null($order)) - { - $extra_orders = $order->toRawSQL(array - ( - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'email' => 'Email', - 'id' => 'ID', - 'full_name' => "FullName", - )); - } - - $query_count = <<getEntityManager()->getConnection()->executeQuery($query_count, $bindings); - - $total = intval($stm->fetchColumn(0)); - - $bindings = array_merge( $bindings, array - ( - 'per_page' => $paging_info->getPerPage(), - 'offset' => $paging_info->getOffset(), - )); - - $query = <<addEntityResult(\models\summit\PresentationSpeaker::class, 's'); - $rsm->addJoinedEntityResult(\models\main\File::class,'p', 's', 'photo'); - $rsm->addJoinedEntityResult(\models\main\Member::class,'m', 's', 'member'); - - $rsm->addFieldResult('s', 'ID', 'id'); - $rsm->addFieldResult('s', 'FirstName', 'first_name'); - $rsm->addFieldResult('s', 'LastName', 'last_name'); - $rsm->addFieldResult('s', 'Bio', 'last_name'); - $rsm->addFieldResult('s', 'SpeakerTitle', 'title' ); - $rsm->addFieldResult('p', 'PhotoID', 'id'); - $rsm->addFieldResult('p', 'PhotoTitle', 'title'); - $rsm->addFieldResult('p', 'PhotoFileName', 'filename'); - $rsm->addFieldResult('p', 'PhotoName', 'name'); - $rsm->addFieldResult('m', 'MemberID', 'id');*/ - - $rsm = new ResultSetMappingBuilder($this->getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\summit\PresentationSpeaker::class, 's', ['Title' => 'SpeakerTitle']); - - // build rsm here - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - foreach($bindings as $k => $v) - $native_query->setParameter($k, $v); - - $speakers = $native_query->getResult(); - - $last_page = (int) ceil($total / $paging_info->getPerPage()); - - return new PagingResponse($total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $last_page, $speakers); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return PresentationSpeaker::class; - } - - /** - * @param Member $member - * @return PresentationSpeaker - */ - public function getByMember(Member $member) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("s") - ->from(PresentationSpeaker::class, "s") - ->where("s.member = :member") - ->setParameter("member", $member) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $email - * @return PresentationSpeaker|null - */ - public function getByEmail(string $email):?PresentationSpeaker - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("s") - ->from(PresentationSpeaker::class, "s") - ->leftJoin("s.member", "m") - ->leftJoin("s.registration_request", "r") - ->where("m.email = :email1 or r.email = :email2") - ->setParameter("email1", trim($email)) - ->setParameter("email2", trim($email)) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - - /** - * @param string $fullname - * @return PresentationSpeaker|null - */ - public function getByFullName(string $fullname): ?PresentationSpeaker - { - $speakerFullNameParts = explode(" ", $fullname); - $speakerLastName = trim(trim(array_pop($speakerFullNameParts))); - $speakerFirstName = trim(implode(" ", $speakerFullNameParts)); - - return $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from(PresentationSpeaker::class, "e") - ->where("e.first_name = :first_name") - ->andWhere("e.last_name = :last_name") - ->setParameter("first_name",$speakerFirstName) - ->setParameter("last_name", $speakerLastName) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param int $speaker_id - * @param int $summit_id - * @return bool - */ - public function speakerBelongsToSummitSchedule(int $speaker_id, int $summit_id):bool { - - try { - $sql = <<getEntityManager()->getConnection()->prepare($sql); - $stmt->execute([ - 'summit_id' => $summit_id, - 'speaker_id' => $speaker_id - ]); - - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - if (count($res) > 0 && intval($res[0]) > 0) return true; - - $sql = <<getEntityManager()->getConnection()->prepare($sql); - $stmt->execute([ - 'summit_id' => $summit_id, - 'speaker_id' => $speaker_id - ]); - - $res = $stmt->fetchAll(\PDO::FETCH_COLUMN); - if (count($res) > 0 && intval($res[0]) > 0) return true; - } - catch (\Exception $ex){ - Log::warning($ex); - } - - return false; - } - - /** - * @inheritDoc - */ - public function getFeaturedSpeakers(Summit $summit, PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - $extra_filters = ''; - $extra_orders = ''; - $bindings = []; - - if(!is_null($filter)) - { - $where_conditions = $filter->toRawSQL([ - 'full_name' => 'FullName', - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'email' => 'Email', - 'id' => 'ID' - ]); - if(!empty($where_conditions)) { - $extra_filters = " WHERE {$where_conditions}"; - $bindings = array_merge($bindings, $filter->getSQLBindings()); - } - } - - if(!is_null($order)) - { - $extra_orders = $order->toRawSQL(array - ( - 'id' => 'ID', - 'email' => 'Email', - 'first_name' => 'FirstName', - 'last_name' => 'LastName', - 'full_name' => 'FullName', - )); - } - - $query_count = <<getId()} AND FS.PresentationSpeakerID = S.ID - ) -) -SUMMIT_SPEAKERS -{$extra_filters} -SQL; - - - $stm = $this->getEntityManager()->getConnection()->executeQuery($query_count, $bindings); - - $total = intval($stm->fetchColumn(0)); - - $bindings = array_merge( $bindings, array - ( - 'per_page' => $paging_info->getPerPage(), - 'offset' => $paging_info->getOffset(), - )); - - $query = <<getId()} AND FS.PresentationSpeakerID = S.ID - ) -) -SUMMIT_SPEAKERS -{$extra_filters} {$extra_orders} limit :per_page offset :offset; -SQL; - - /*$rsm = new ResultSetMapping(); - $rsm->addEntityResult(\models\summit\PresentationSpeaker::class, 's'); - $rsm->addJoinedEntityResult(\models\main\File::class,'p', 's', 'photo'); - $rsm->addJoinedEntityResult(\models\main\Member::class,'m', 's', 'member'); - - $rsm->addFieldResult('s', 'ID', 'id'); - $rsm->addFieldResult('s', 'FirstName', 'first_name'); - $rsm->addFieldResult('s', 'LastName', 'last_name'); - $rsm->addFieldResult('s', 'Bio', 'last_name'); - $rsm->addFieldResult('s', 'SpeakerTitle', 'title' ); - $rsm->addFieldResult('p', 'PhotoID', 'id'); - $rsm->addFieldResult('p', 'PhotoTitle', 'title'); - $rsm->addFieldResult('p', 'PhotoFileName', 'filename'); - $rsm->addFieldResult('p', 'PhotoName', 'name'); - $rsm->addFieldResult('m', 'MemberID', 'id');*/ - - $rsm = new ResultSetMappingBuilder($this->getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\summit\PresentationSpeaker::class, 's', ['Title' => 'SpeakerTitle']); - - // build rsm here - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - foreach($bindings as $k => $v) - $native_query->setParameter($k, $v); - - $speakers = $native_query->getResult(); - - $last_page = (int) ceil($total / $paging_info->getPerPage()); - - return new PagingResponse($total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $last_page, $speakers); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSpeakerSummitRegistrationPromoCodeRepository.php b/app/Repositories/Summit/DoctrineSpeakerSummitRegistrationPromoCodeRepository.php deleted file mode 100644 index 78b692e7..00000000 --- a/app/Repositories/Summit/DoctrineSpeakerSummitRegistrationPromoCodeRepository.php +++ /dev/null @@ -1,128 +0,0 @@ -getId() == 0) return null; - return $this->getEntityManager() - ->createQueryBuilder() - ->select("c") - ->from(SpeakerSummitRegistrationPromoCode::class, "c") - ->where("c.speaker = :speaker") - ->andWhere("c.summit = :summit") - ->setParameter("speaker", $speaker) - ->setParameter("summit", $summit) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $code - * @param Summit $summit - * @return bool - */ - public function isAssignedCode($code, Summit $summit) - { - return $this->getAssignedCode($code, $summit) != null; - } - - /** - * @param string $code - * @param Summit $summit - * @return SpeakerSummitRegistrationPromoCode - */ - public function getAssignedCode($code, Summit $summit) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("c") - ->from(SpeakerSummitRegistrationPromoCode::class, "c") - ->where("c.speaker is not null") - ->andWhere("c.summit = :summit") - ->andWhere("c.code = :code") - ->setParameter("summit", $summit) - ->setParameter("code", trim($code)) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $code - * @param Summit $summit - * @return SpeakerSummitRegistrationPromoCode - */ - public function getNotAssignedCode($code, Summit $summit) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("c") - ->from(SpeakerSummitRegistrationPromoCode::class, "c") - ->where("c.speaker is null") - ->andWhere("c.summit = :summit") - ->andWhere("c.code = :code") - ->setParameter("summit", $summit) - ->setParameter("code", trim($code)) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param Summit $summit - * @param string $type - * @return SpeakerSummitRegistrationPromoCode - */ - public function getNextAvailableByType(Summit $summit, $type) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("c") - ->from(SpeakerSummitRegistrationPromoCode::class, "c") - ->where("c.speaker is null") - ->andWhere("c.summit = :summit") - ->andWhere("c.type = :type") - ->setParameter("summit", $summit) - ->setParameter("type", trim($type)) - ->setMaxResults(1) - ->getQuery() - ->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSponsorRepository.php b/app/Repositories/Summit/DoctrineSponsorRepository.php deleted file mode 100644 index 607815c3..00000000 --- a/app/Repositories/Summit/DoctrineSponsorRepository.php +++ /dev/null @@ -1,72 +0,0 @@ - new DoctrineJoinFilterMapping("e.company", "c" ,"c.name :operator :value"), - 'sponsorship_name' => new DoctrineJoinFilterMapping("e.sponsorship", "sp" ,"sp.name :operator :value"), - 'sponsorship_label' => new DoctrineJoinFilterMapping("e.sponsorship", "sp" ,"sp.label :operator :value"), - 'sponsorship_size' => new DoctrineJoinFilterMapping("e.sponsorship", "sp" ,"sp.size :operator :value"), - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value"), - 'badge_scans_count' => new DoctrineHavingFilterMapping("", "bs.sponsor", "count(bs.id) :operator :value"), - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query){ - $query = $query->leftJoin("e.user_info_grants", "bs"); - return $query; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - 'order' => 'e.order', - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return Sponsor::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSponsorUserInfoGrantRepository.php b/app/Repositories/Summit/DoctrineSponsorUserInfoGrantRepository.php deleted file mode 100644 index 486f092b..00000000 --- a/app/Repositories/Summit/DoctrineSponsorUserInfoGrantRepository.php +++ /dev/null @@ -1,107 +0,0 @@ - new DoctrineFilterMapping("t.number :operator :value"), - 'summit_id' => new DoctrineFilterMapping("s.id :operator :value"), - 'user_id' => new DoctrineFilterMapping("u.id :operator :value"), - 'sponsor_id' => new DoctrineFilterMapping("sp.id :operator :value"), - 'company_id' => new DoctrineFilterMapping("c.id :operator :value"), - 'order_number' => new DoctrineFilterMapping("ord.number :operator :value"), - 'attendee_first_name' => [ - "m.first_name :operator :value", - "o.first_name :operator :value" - ], - 'attendee_last_name' => [ - "m.last_name :operator :value", - "o.surname :operator :value" - ], - 'attendee_full_name' => [ - "concat(m.first_name, ' ', m.last_name) :operator :value", - "concat(o.first_name, ' ', o.surname) :operator :value" - ], - 'attendee_email' => [ - "m.email :operator :value", - "o.email :operator :value" - ], - 'attendee_company' => new DoctrineFilterMapping("o.company_name :operator :value"), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'scan_date' => 'sbs.scan_date', - 'created' => 'e.created', - 'ticket_number' => "t.number", - 'order_number' => "ord.order_number", - 'sponsor_id' => "sp.id", - 'attendee_company' => 'o.company_name', - "attendee_full_name" => "LOWER(CONCAT(o.first_name, ' ', o.surname))", - 'attendee_first_name' => 'o.first_name', - 'attendee_last_name' => 'o.surname', - 'attendee_email' => 'o.email', - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query){ - $query = $query->join('e.sponsor', 'sp') - ->join('sp.summit', 's') - ->join('sp.company', 'c') - ->leftJoin('e.allowed_user', 'au') - ->leftJoin(SponsorBadgeScan::class, 'sbs', 'WITH', 'e.id = sbs.id') - ->leftJoin('sbs.user', 'u') - ->leftJoin('sbs.badge', 'b') - ->leftJoin('b.ticket', 't') - ->leftJoin('t.order', 'ord') - ->leftJoin('t.owner', 'o') - ->leftJoin('o.member', 'm'); - return $query; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SponsorUserInfoGrant::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSponsorshipTypeRepository.php b/app/Repositories/Summit/DoctrineSponsorshipTypeRepository.php deleted file mode 100644 index e7c035a6..00000000 --- a/app/Repositories/Summit/DoctrineSponsorshipTypeRepository.php +++ /dev/null @@ -1,91 +0,0 @@ -findOneBy(['name' => trim($name)]); - } - - /** - * @param string $label - * @return SponsorshipType|null - */ - public function getByLabel(string $label): ?SponsorshipType - { - return $this->findOneBy(['label' => trim($label)]); - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'name' => 'e.name:json_string', - 'label' => 'e.label:json_string', - 'size' => 'e.size:json_string', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - 'label' => 'e.label', - 'size' => 'e.size', - 'order' => 'e.orde', - ]; - } - - /** - * @return int - * @throws \Doctrine\DBAL\DBALException - */ - public function getMaxOrder(): int - { - $sql = <<getEntityManager()->getConnection()->executeQuery($sql); - - return intval($stm->fetchColumn(0)); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitAccessLevelTypeRepository.php b/app/Repositories/Summit/DoctrineSummitAccessLevelTypeRepository.php deleted file mode 100644 index 88ac4941..00000000 --- a/app/Repositories/Summit/DoctrineSummitAccessLevelTypeRepository.php +++ /dev/null @@ -1,67 +0,0 @@ - 'e.name:json_string', - 'is_default' => 'e.is_default|json_boolean', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitAccessLevelType::class; - } - - /** - * @param string $name - * @return SummitAccessLevelType|null - */ - public function getByName(string $name): ?SummitAccessLevelType - { - return $this->findOneBy(['name'=>trim($name)]); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitAttendeeBadgePrintRuleRepository.php b/app/Repositories/Summit/DoctrineSummitAttendeeBadgePrintRuleRepository.php deleted file mode 100644 index fa86c1de..00000000 --- a/app/Repositories/Summit/DoctrineSummitAttendeeBadgePrintRuleRepository.php +++ /dev/null @@ -1,67 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->join('e.group','g') - ->where("g.id in :group_ids") - ->setParameter("group_ids", $group_ids) - ->getQuery() - ->getResult(); - } - - /** - * @param array $group_slugs - * @return mixed - */ - public function getByGroupsSlugs(array $group_slugs) - { - return $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->join('e.group','g') - ->where("g.code in (:group_slugs)") - ->setParameter("group_slugs", $group_slugs) - ->getQuery() - ->getResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitAttendeeBadgeRepository.php b/app/Repositories/Summit/DoctrineSummitAttendeeBadgeRepository.php deleted file mode 100644 index ca2635a3..00000000 --- a/app/Repositories/Summit/DoctrineSummitAttendeeBadgeRepository.php +++ /dev/null @@ -1,108 +0,0 @@ - new DoctrineFilterMapping("t.number :operator :value"), - 'summit_id' => new DoctrineFilterMapping("s.id :operator :value"), - 'order_number' => new DoctrineFilterMapping("ord.number :operator :value"), - 'owner_first_name' => [ - "m.first_name :operator :value", - "o.first_name :operator :value" - ], - 'owner_last_name' => [ - "m.last_name :operator :value", - "o.surname :operator :value" - ], - 'owner_full_name' => [ - "concat(m.first_name, ' ', m.last_name) :operator :value", - "concat(o.first_name, ' ', o.surname) :operator :value" - ], - 'owner_email' => [ - "m.email :operator :value", - "o.email :operator :value" - ], - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'created' => 'e.created', - 'ticket_number' => "t.number", - 'order_number' => "ord.order_number", - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query){ - $query = $query->join('e.ticket', 't') - ->leftJoin('t.owner', 'o') - ->leftJoin('o.member', 'm') - ->join('t.order', 'ord') - ->join('ord.summit', 's') - ->join('e.type', 'tp') - ->join('e.features','f'); - return $query; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitAttendeeBadge::class; - } - - /** - * @param string $ticket_number - * @return SummitAttendeeBadge|null - */ - public function getBadgeByTicketNumber(string $ticket_number): ?SummitAttendeeBadge - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin('e.ticket', 't') - ->where("t.number = :ticket_number") - ->setParameter("ticket_number", trim($ticket_number)); - - return $query->getQuery()->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitAttendeeRepository.php b/app/Repositories/Summit/DoctrineSummitAttendeeRepository.php deleted file mode 100644 index c0fb101e..00000000 --- a/app/Repositories/Summit/DoctrineSummitAttendeeRepository.php +++ /dev/null @@ -1,285 +0,0 @@ -join('e.summit', 's') - ->leftJoin('e.member', 'm') - ->leftJoin('e.tickets', 't') - ->leftJoin('t.badge', 'b') - ->leftJoin('b.type', 'bt') - ->leftJoin('t.ticket_type', 'tt'); - return $query; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'summit_id' => new DoctrineFilterMapping("s.id :operator :value"), - 'member_id' => new DoctrineFilterMapping("m.id :operator :value"), - 'first_name' => [ - "m.first_name :operator :value", - "e.first_name :operator :value" - ], - 'has_member' => new DoctrineSwitchFilterMapping([ - 'true' => new DoctrineCaseFilterMapping( - 'true', - "m.id is not null and m.id > 0" - ), - 'false' => new DoctrineCaseFilterMapping( - 'false', - "m.id is null" - ), - ] - ), - 'has_tickets' => new DoctrineSwitchFilterMapping([ - 'true' => new DoctrineCaseFilterMapping( - 'true', - sprintf("EXISTS (select t1 from %s t1 where t1.owner = e)", SummitAttendeeTicket::class) - ), - 'false' => new DoctrineCaseFilterMapping( - 'false', - sprintf("not EXISTS (select t1 from %s t1 where t1.owner = e)", SummitAttendeeTicket::class) - ), - ] - ), - 'tickets_count' => new DoctrineHavingFilterMapping("", "t.owner", "count(t.id) :operator :value"), - 'ticket_type' => new DoctrineFilterMapping("tt.name :operator :value"), - 'badge_type' => new DoctrineFilterMapping("bt.name :operator :value"), - 'status' => new DoctrineFilterMapping("e.status :operator :value"), - 'last_name' => [ - "m.last_name :operator :value", - "e.surname :operator :value" - ], - 'full_name' => [ - "concat(m.first_name, ' ', m.last_name) :operator :value", - "concat(e.first_name, ' ', e.surname) :operator :value" - ], - 'company' => new DoctrineFilterMapping("e.company_name :operator :value"), - 'email' => [ - "m.email :operator :value", - "e.email :operator :value" - ], - 'external_order_id' => new DoctrineFilterMapping("t.external_order_id :operator :value"), - 'external_attendee_id' => new DoctrineFilterMapping("t.external_attendee_id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'first_name' => 'e.first_name', - 'last_name' => 'e.surname', - "full_name" => "LOWER(CONCAT(e.first_name, ' ', e.surname))", - 'external_order_id' => 't.external_order_id', - 'company' => 'e.company_name', - 'member_id' => 'm.id', - 'status' => 'e.status', - 'email' => <<getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin('e.summit', 's') - ->leftJoin('e.member', 'm') - ->leftJoin('e.tickets', 't') - ->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("m.first_name",'ASC'); - $query = $query->addOrderBy("m.last_name", 'ASC'); - } - - $query = $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query); - $data = []; - foreach($paginator as $entity) - $data[] = $entity; - - $total = $paginator->count(); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @param Summit $summit - * @param Member $member - * @return SummitAttendee - */ - public function getBySummitAndMember(Summit $summit, Member $member):?SummitAttendee - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin('e.summit', 's') - ->leftJoin('e.member', 'm') - ->where("s.id = :summit_id")->andWhere("m.id = :member_id") - ->setParameter("summit_id", $summit->getId()) - ->setParameter("member_id", $member->getId()); - - $res = $query->getQuery()->getOneOrNullResult(); - - return $res; - } - - /** - * @param Summit $summit - * @param string $email - * @return SummitAttendee|null - */ - public function getBySummitAndEmail(Summit $summit, string $email): ?SummitAttendee - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin('e.summit', 's') - ->leftJoin('e.member', 'm') - ->where("s.id = :summit_id") - ->andWhere("m.email = :email or e.email = :email") - ->setParameter("summit_id", $summit->getId()) - ->setParameter("email", strtolower(trim($email))); - - return $query->getQuery()->getOneOrNullResult(); - } - - /** - * @param string $email - * @return mixed - */ - public function getByEmail(string $email) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.email = :email") - ->setParameter("email", strtolower(trim($email))); - return $query->getQuery()->getResult(); - } - - /** - * @param Summit $summit - * @param string $email - * @param null|string $first_name - * @param null|string $last_name - * @param null|string $external_id - * @return SummitAttendee|null - */ - public function getBySummitAndEmailAndFirstNameAndLastNameAndExternalId(Summit $summit, string $email, ?string $first_name = null, ?string $last_name = null, ?string $external_id = null):?SummitAttendee - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin('e.summit', 's') - ->leftJoin('e.member', 'm') - ->where("s.id = :summit_id") - ->andWhere("m.email = :email or e.email = :email"); - - if(!empty($first_name)){ - $query = $query->andWhere("e.first_name = :first_name")->setParameter("first_name", $first_name); - } - - if(!empty($last_name)){ - $query = $query->andWhere("e.surname = :surname")->setParameter("surname", $last_name); - } - if(!empty($external_id)){ - $query = $query->andWhere("e.external_id = :external_id")->setParameter("external_id", $external_id); - } - - $query = - $query - ->setParameter("summit_id", $summit->getId()) - ->setParameter("email", trim($email)); - - return $query->getQuery()->getOneOrNullResult(); - } - -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php b/app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php deleted file mode 100644 index 984bb471..00000000 --- a/app/Repositories/Summit/DoctrineSummitAttendeeTicketRepository.php +++ /dev/null @@ -1,294 +0,0 @@ - 'e.number:json_string', - 'is_active' => 'e.is_active', - 'order_number' => 'o.number:json_string', - 'owner_name' => [ - "concat(m.first_name, ' ', m.last_name) :operator :value", - "concat(a.first_name, ' ', a.surname) :operator :value" - ], - 'owner_company' => 'a.company_name:json_string', - 'owner_first_name' => [ - 'm.first_name:json_string', - 'a.first_name:json_string' - ], - 'owner_last_name' => ['m.last_name:json_string', 'a.surname:json_string'], - 'owner_email' => ['m.email:json_string', 'm.second_email:json_string', 'm.third_email:json_string','a.email:json_string'], - 'summit_id' => 's.id:json_int', - 'owner_id' => 'a.id:json_int', - 'member_id' => 'm.id:json_int', - 'order_id' => 'o.id:json_int', - 'status' => 'e.status:json_string', - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query){ - $query->join("e.order","o"); - $query->join("o.summit","s"); - $query->leftJoin("e.owner","a"); - $query->leftJoin("a.member","m"); - return $query; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'number' => 'e.number', - 'status' => 'e.status', - ]; - } - - /** - * @param string $external_order_id - * @param string $external_attendee_id - * @return SummitAttendeeTicket - */ - public function getByExternalOrderIdAndExternalAttendeeId($external_order_id, $external_attendee_id) - { - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e"); - - $tickets = $query - ->where('e.external_order_id = :external_order_id') - ->andWhere('e.external_attendee_id = :external_attendee_id') - ->setParameter('external_order_id', $external_order_id) - ->setParameter('external_attendee_id', $external_attendee_id)->getQuery()->getResult(); - - return count($tickets) > 0 ? $tickets[0] : null; - } - - /** - * @param string $external_order_id - * @param string $external_attendee_id - * @return SummitAttendeeTicket - */ - public function getByExternalOrderIdAndExternalAttendeeIdExclusiveLock - ( - $external_order_id, - $external_attendee_id - ): ?SummitAttendeeTicket - { - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e"); - - return $query - ->join("e.order","o") - ->join("e.owner","ow") - ->where('o.external_id = :external_order_id') - ->andWhere('ow.external_id = :external_attendee_id') - ->setParameter('external_order_id', $external_order_id) - ->setParameter('external_attendee_id', $external_attendee_id) - ->getQuery() - ->setLockMode(LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitAttendeeTicket::class; - } - - /** - * @param IEntity $entity - * @return void - */ - public function delete($entity) - { - $this->getEntityManager()->getConnection()->delete(" - SummitAttendeeTicket - ", ["ID" => $entity->getIdentifier()]); - } - - /** - * @param string $number - * @return bool - */ - public function existNumber(string $number): bool - { - return $this->count(['number' => $number]) > 0; - } - - /** - * @param string $hash - * @return SummitAttendeeTicket|null - */ - public function getByHashExclusiveLock(string $hash): ?SummitAttendeeTicket - { - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where('e.hash = :hash') - ->setParameter('hash', trim($hash))->getQuery() - ->setLockMode(LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param string $hash - * @return SummitAttendeeTicket|null - */ - public function getByNumberExclusiveLock(string $number):?SummitAttendeeTicket{ - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where('e.number = :number') - ->setParameter('number', trim($number))->getQuery() - ->setLockMode(LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param string $number - * @return SummitAttendeeTicket|null - */ - public function getByNumber(string $number): ?SummitAttendeeTicket - { - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where('e.number = :number') - ->setParameter('number', trim($number))->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $hash - * @return SummitAttendeeTicket|null - */ - public function getByFormerHashExclusiveLock(string $hash): ?SummitAttendeeTicket - { - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->join("e.former_hashes", "fh") - ->where('fh.hash = :hash') - ->setParameter('hash', trim($hash))->getQuery() - ->setLockMode(LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param Summit $summit - * @param string $external_order_id - * @param string $external_attendee_id - * @return SummitAttendeeTicket|null - * @throws \Doctrine\ORM\NonUniqueResultException - * @throws \Doctrine\ORM\TransactionRequiredException - */ - public function getBySummitAndExternalOrderIdAndExternalAttendeeIdExclusiveLock - ( - Summit $summit, - $external_order_id, - $external_attendee_id - ): ?SummitAttendeeTicket - { - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e"); - - return $query - ->join("e.order","o") - ->join("o.summit","s") - ->join("e.owner","ow") - ->where('o.external_id = :external_order_id') - ->andWhere('ow.external_id = :external_attendee_id') - ->andWhere('s.id = :summit_id') - ->setParameter('external_order_id', $external_order_id) - ->setParameter('external_attendee_id', $external_attendee_id) - ->setParameter('summit_id', $summit->getId()) - ->getQuery() - ->setLockMode(LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param Summit $summit - * @param string $external_attendee_id - * @return SummitAttendeeTicket|null - */ - public function getByExternalAttendeeIdExclusiveLock(Summit $summit, string $external_attendee_id):?SummitAttendeeTicket - { - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e"); - - return $query - ->join("e.order","o") - ->join("o.summit","s") - ->join("e.owner","ow") - ->where('ow.external_id = :external_attendee_id') - ->andWhere('s.id = :summit_id') - ->setParameter('external_attendee_id', $external_attendee_id) - ->setParameter('summit_id', $summit->getId()) - ->getQuery() - ->setLockMode(LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraFilters(QueryBuilder $query){ - $query = $query->andWhere("e.status <> :cancelled")->setParameter("cancelled", IOrderConstants::CancelledStatus); - return $query; - } - -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitBadgeFeatureTypeRepository.php b/app/Repositories/Summit/DoctrineSummitBadgeFeatureTypeRepository.php deleted file mode 100644 index 0cc1820d..00000000 --- a/app/Repositories/Summit/DoctrineSummitBadgeFeatureTypeRepository.php +++ /dev/null @@ -1,57 +0,0 @@ - 'e.name:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitBadgeTypeRepository.php b/app/Repositories/Summit/DoctrineSummitBadgeTypeRepository.php deleted file mode 100644 index 36d0bdbe..00000000 --- a/app/Repositories/Summit/DoctrineSummitBadgeTypeRepository.php +++ /dev/null @@ -1,58 +0,0 @@ - 'e.name:json_string', - 'is_default' => 'e.is_default|json_boolean', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitBookableVenueRoomAttributeTypeRepository.php b/app/Repositories/Summit/DoctrineSummitBookableVenueRoomAttributeTypeRepository.php deleted file mode 100644 index c5c29c64..00000000 --- a/app/Repositories/Summit/DoctrineSummitBookableVenueRoomAttributeTypeRepository.php +++ /dev/null @@ -1,62 +0,0 @@ - 'e.type:json_string', - 'summit_id' => new DoctrineJoinFilterMapping - ( - 'e.summit', - 's', - "s.id :operator :value" - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'type' => 'e.type', - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitBookableVenueRoomAttributeType::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitBookableVenueRoomAttributeValueRepository.php b/app/Repositories/Summit/DoctrineSummitBookableVenueRoomAttributeValueRepository.php deleted file mode 100644 index 167039e4..00000000 --- a/app/Repositories/Summit/DoctrineSummitBookableVenueRoomAttributeValueRepository.php +++ /dev/null @@ -1,67 +0,0 @@ - 'e.value:json_string', - 'summit_id' => new DoctrineJoinFilterMapping - ( - 'e.summit', - 's', - "s.id :operator :value" - ), - 'type_id' => new DoctrineJoinFilterMapping - ( - 'e.type', - 't', - "t.id :operator :value" - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'value' => 'e.value', - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitBookableVenueRoomAttributeValue::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitCategoryChangeRepository.php b/app/Repositories/Summit/DoctrineSummitCategoryChangeRepository.php deleted file mode 100644 index f1de3df1..00000000 --- a/app/Repositories/Summit/DoctrineSummitCategoryChangeRepository.php +++ /dev/null @@ -1,86 +0,0 @@ -join("e.presentation","p"); - $query->join("p.selection_plan","sp"); - $query->join("p.summit","s"); - $query->leftJoin("e.new_category","ncat"); - $query->leftJoin("e.old_category","ocat"); - $query->leftJoin("e.requester","r"); - $query->leftJoin("e.aprover","a"); - return $query; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'selection_plan_id' => 'sp.id', - 'new_category_id' => 'ncat.id', - 'old_category_id' => 'ocat.id', - 'new_category_name' => 'ncat.title', - 'old_category_name' => 'ocat.title', - 'presentation_title' => 'p.title', - 'requester_fullname' => "concat(r.first_name, ' ', r.last_name) :operator :value", - 'requester_email' => 'r.email', - 'aprover_fullname' => "concat(a.first_name, ' ', a.last_name) :operator :value", - 'aprover_email' => 'a.email', - 'summit_id' => 's.id', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'approval_date' => 'e.approval_date', - 'presentation_title' => 'p.id', - 'status' => 'e.status', - 'new_category_name' => 'ncat.title', - 'old_category_name' => 'ocat.title', - 'requester_fullname' => "concat(r.first_name, ' ', r.last_name)", - ]; - } -} diff --git a/app/Repositories/Summit/DoctrineSummitDocumentRepository.php b/app/Repositories/Summit/DoctrineSummitDocumentRepository.php deleted file mode 100644 index d5643e4c..00000000 --- a/app/Repositories/Summit/DoctrineSummitDocumentRepository.php +++ /dev/null @@ -1,69 +0,0 @@ -join('e.summit', 's') - ->leftJoin('e.event_types', 'et'); - return $query; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'name' => 'e.name:json_string', - 'description' => 'e.description:json_string', - 'label' => 'e.label:json_string', - 'event_type' => 'et.type:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - 'label' => 'e.label', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitEmailEventFlowRepository.php b/app/Repositories/Summit/DoctrineSummitEmailEventFlowRepository.php deleted file mode 100644 index 8863f998..00000000 --- a/app/Repositories/Summit/DoctrineSummitEmailEventFlowRepository.php +++ /dev/null @@ -1,71 +0,0 @@ -join('e.event_type', 'et') - ->join('et.flow', 'f'); - return $query; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'email_template_identifier' => 'e.email_template_identifier:json_string', - 'event_type_name' => 'et.name:json_string', - 'flow_name' => 'f.name:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'email_template_identifier' => 'e.email_template_identifier', - ]; - } - -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitEntityEventRepository.php b/app/Repositories/Summit/DoctrineSummitEntityEventRepository.php deleted file mode 100644 index 6994af42..00000000 --- a/app/Repositories/Summit/DoctrineSummitEntityEventRepository.php +++ /dev/null @@ -1,145 +0,0 @@ - {$from_id} "; - } - - if(!is_null($from_date)) - { - $str_date = $from_date->format("Y-m-d H:i:s"); - // CDT TO UTC - $filters .= " AND CONVERT_TZ(SummitEntityEvent.Created,'America/Chicago', 'GMT') >= '{$str_date}' "; - } - - $query = << 'MySchedule' AND EntityClassName <> 'SummitAttendee' AND EntityClassName <> 'MyFavorite') - -- GLOBAL TRUNCATE - OR (EntityClassName = 'WipeData' AND EntityID = 0) - ) - AND SummitID = {$summit->getId()} - {$filters} - LIMIT {$limit} -) -AS GLOBAL_EVENTS -SQL; - - if(!is_null($member_id)){ - $query .= <<getId()} - {$filters} - LIMIT {$limit} -) -AS MY_SCHEDULE -UNION -SELECT * FROM -( - SELECT * FROM SummitEntityEvent - WHERE - ( - EntityClassName = 'WipeData' AND EntityID = {$member_id} - ) - AND SummitID = {$summit->getId()} - {$filters} - LIMIT {$limit} -) AS USER_WIPE_DATA -SQL; - } - - $query .= <<getEntityManager()); - $rsm->addRootEntityFromClassMetadata(\models\summit\SummitEntityEvent::class, 'e'); - // build rsm here - $native_query = $this->getEntityManager()->createNativeQuery($query, $rsm); - - $entity_events = $native_query->getResult(); - - if($detach) $this->getEntityManager() ->clear(\models\summit\SummitEntityEvent::class); - - return $entity_events; - } - - /** - * @param Summit $summit - * @return int - */ - public function getLastEntityEventId(Summit $summit) - { - $query = <<getId()} ORDER BY ID DESC LIMIT 1; -SQL; - - return intval($this->getEntityManager()->getConnection()->executeQuery($query)->fetchColumn(0)); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitEntityEvent::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitEventRepository.php b/app/Repositories/Summit/DoctrineSummitEventRepository.php deleted file mode 100644 index 1c98018f..00000000 --- a/app/Repositories/Summit/DoctrineSummitEventRepository.php +++ /dev/null @@ -1,588 +0,0 @@ -getSummit(); - $end_date = $event->getEndDate(); - $start_date = $event->getStartDate(); - - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from(\models\summit\SummitEvent::class, "e") - ->join('e.summit', 's', Join::WITH, " s.id = :summit_id") - ->where('e.published = 1') - ->andWhere('e.start_date < :end_date') - ->andWhere('e.end_date > :start_date') - ->setParameter('summit_id', $summit->getId()) - ->setParameter('start_date', $start_date) - ->setParameter('end_date', $end_date); - - $idx = 1; - foreach(self::$forbidden_classes as $forbidden_class){ - $query = $query - ->andWhere("not e INSTANCE OF :forbidden_class".$idx); - $query->setParameter("forbidden_class".$idx, $forbidden_class); - $idx++; - } - - return $query->getQuery()->getResult(); - } - - /** - * @param int $current_member_id - * @param int $current_track_id - * @return array - */ - protected function getCustomFilterMappings(int $current_member_id , int $current_track_id) - { - return [ - 'id' => 'e.id:json_int', - 'title' => 'e.title:json_string', - 'abstract' => 'e.abstract:json_string', - 'level' => 'e.level:json_string', - 'status' => 'p.status:json_string', - 'progress' => 'p.progress:json_int', - 'is_chair_visible' => new DoctrineJoinFilterMapping - ( - 'e.category', - 'c', - "c.chair_visible :operator :value" - ), - 'is_voting_visible' => new DoctrineJoinFilterMapping - ( - 'e.category', - 'c', - "c.voting_visible :operator :value" - ), - 'social_summary' => 'e.social_summary:json_string', - 'published' => 'e.published', - 'start_date' => 'e.start_date:datetime_epoch', - 'end_date' => 'e.end_date:datetime_epoch', - 'created' => 'e.created:datetime_epoch', - 'last_edited' => 'e.last_edited:datetime_epoch', - 'tags' => new DoctrineLeftJoinFilterMapping - ( - 'e.tags', - 't', - "t.tag :operator :value" - ), - 'summit_id' => new DoctrineJoinFilterMapping - ( - 'e.summit', - 's', - "s.id :operator :value" - ), - 'event_type_id' => new DoctrineJoinFilterMapping - ( - 'e.type', - 'et', - "et.id :operator :value" - ), - 'track_id' => new DoctrineJoinFilterMapping - ( - 'e.category', - 'c', - "c.id :operator :value" - ), - 'selection_plan_id' => new DoctrineFilterMapping - ( - "(selp.id :operator :value)" - ), - 'location_id' => new DoctrineLeftJoinFilterMapping - ( - 'e.location', - 'l', - "l.id :operator :value" - ), - 'speaker' => new DoctrineFilterMapping - ( - "( concat(sp.first_name, ' ', sp.last_name) :operator :value ". - "OR concat(spm.first_name, ' ', spm.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 OR spmm2.email :operator :value OR sprr2.email :operator :value)" - ), - 'speaker_title' => new DoctrineFilterMapping - ( - "(sp.title :operator :value OR spm.title :operator :value)" - ), - 'speaker_company' => new DoctrineFilterMapping - ( - "(sp.company :operator :value OR spm.company :operator :value)" - ), - 'speaker_id' => new DoctrineFilterMapping - ( - "(sp.id :operator :value OR spm.id :operator :value)" - ), - 'sponsor_id' => new DoctrineFilterMapping - ( - "(sprs.id :operator :value)" - ), - 'sponsor' => new DoctrineFilterMapping - ( - "(sprs.name :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 <= cc.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 > cc.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 <= cc.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 > cc.lightning_count and sspl.list_type = 'Group' and sspl.list_class = 'Lightning' and sspl.category = e.category" - ), - ] - ), - 'track_chairs_status' => new DoctrineSwitchFilterMapping - ( - [ - 'voted' => new DoctrineCaseFilterMapping( - 'voted', - "exists (select ssp1 from models\summit\SummitSelectedPresentation ssp1 inner join ssp1.presentation p1 where p1.id = p.id)" - ), - 'untouched' => new DoctrineCaseFilterMapping( - 'untouched', - "not exists (select ssp1 from models\summit\SummitSelectedPresentation ssp1 inner join ssp1.presentation p1 where p1.id = p.id)" - ), - 'team_selected' => new DoctrineCaseFilterMapping( - 'team_selected', - "sspl.list_type = 'Group' and sspl.list_class = 'Session' and ssp.collection= 'selected'" - ), - 'selected' => new DoctrineCaseFilterMapping( - 'selected', - "sspl.list_type = 'Individual' and sspl.list_class = 'Session' and ssp.collection = 'selected' and ssp_member.id = ".$current_member_id - ), - 'maybe' => new DoctrineCaseFilterMapping( - 'maybe', - "sspl.list_type = 'Individual' and sspl.list_class = 'Session' and ssp.collection = 'maybe' and ssp_member.id = ".$current_member_id - ), - 'pass' => new DoctrineCaseFilterMapping( - 'selected', - "sspl.list_type = 'Individual' and sspl.list_class = 'Session' and ssp.collection = 'pass' and ssp_member.id = ".$current_member_id - ), - ] - ), - 'viewed_status' => new DoctrineSwitchFilterMapping - ( - [ - 'seen' => new DoctrineCaseFilterMapping( - 'seen', - sprintf("exists (select vw1 from models\summit\PresentationTrackChairView vw1 inner join vw1.presentation p1 join vw1.viewer v1 where p1.id = p.id and v1.id = %s)", $current_member_id) - ), - 'unseen' => new DoctrineCaseFilterMapping( - 'unseen', - sprintf("not exists (select vw1 from models\summit\PresentationTrackChairView vw1 inner join vw1.presentation p1 join vw1.viewer v1 where p1.id = p.id and v1.id = %s)", $current_member_id) - ), - 'moved' => new DoctrineCaseFilterMapping( - 'moved', - sprintf - ( - "not exists (select vw1 from models\summit\PresentationTrackChairView vw1 - inner join vw1.presentation p1 join vw1.viewer v1 where p1.id = p.id and v1.id = %s) - and exists (select cch from models\summit\PSummitCategoryChange cch - inner join cch.presentation p2 - inner join cch.new_category nc - where p2.id = p.id and - cch.status = %s and - nc.id = %s) ", - $current_member_id, - ISummitCategoryChangeStatus::Approved, - $current_track_id - ) - ), - ] - ), - 'actions' => new DoctrineCollectionFieldsFilterMapping - ( - 'p.actions', - "a", - [ - "type" => 'at', - ], - [ - 'type_id' => 'at.id', - 'is_completed' => 'a.is_completed' - ] - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'title' => 'e.title', - 'start_date' => 'e.start_date', - 'end_date' => 'e.end_date', - 'created' => 'e.created', - 'track' => 'cc.title', - 'location' => 'l.name', - 'trackchairsel' => 'ssp.order', - 'last_edited' => 'e.last_edited', - ]; - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - - Log::debug("DoctrineSummitEventRepository::getAllByPage"); - $current_track_id = 0; - $current_member_id = 0; - - if(!is_null($filter)){ - // check for dependant filtering - $track_id_filter = $filter->getUniqueFilter('track_id'); - if (!is_null($track_id_filter)) { - $current_track_id = intval($track_id_filter->getValue()); - } - $current_member_id_filter = $filter->getUniqueFilter('current_member_id'); - if (!is_null($current_member_id_filter)) { - $current_member_id = intval($current_member_id_filter->getValue()); - } - } - - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin(Presentation::class, 'p', 'WITH', 'e.id = p.id') - ->leftJoin("e.location", 'l', Join::LEFT_JOIN) - ->leftJoin("e.category", 'cc', Join::LEFT_JOIN) - ->leftJoin("e.sponsors", "sprs", Join::LEFT_JOIN) - ->leftJoin("p.speakers", "sp", Join::LEFT_JOIN) - ->leftJoin('p.selected_presentations', "ssp", Join::LEFT_JOIN) - ->leftJoin('ssp.member', "ssp_member", Join::LEFT_JOIN) - ->leftJoin('p.selection_plan', "selp", Join::LEFT_JOIN) - ->leftJoin('ssp.list', "sspl", Join::LEFT_JOIN) - ->leftJoin('p.moderator', "spm", Join::LEFT_JOIN) - ->leftJoin('spm.member', "spmm2", Join::LEFT_JOIN) - ->leftJoin('sp.member', "spmm", Join::LEFT_JOIN) - ->leftJoin('sp.registration_request', "sprr", Join::LEFT_JOIN) - ->leftJoin('spm.registration_request', "sprr2", Join::LEFT_JOIN); - - if(!is_null($filter)){ - $filter->apply2Query($query, $this->getCustomFilterMappings($current_member_id, $current_track_id)); - } - - if (!is_null($order)) { - $order->apply2Query($query, $this->getOrderMappings()); - if(!$order->hasOrder('id')) { - $query = $query->addOrderBy("e.id", 'ASC'); - } - } else { - //default order - $query = $query->addOrderBy("e.start_date",'ASC'); - $query = $query->addOrderBy("e.end_date", 'ASC'); - $query = $query->addOrderBy("e.id", 'ASC'); - } - - $can_view_private_events = self::isCurrentMemberOnGroup(IGroup::SummitAdministrators); - - if(!$can_view_private_events){ - $idx = 1; - foreach(self::$forbidden_classes as $forbidden_class){ - $query = $query - ->andWhere("not e INSTANCE OF :forbidden_class".$idx); - $query->setParameter("forbidden_class".$idx, $forbidden_class); - $idx++; - } - } - - $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; - - Log::debug("DoctrineSummitEventRepository::getAllByPage End"); - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @param int $event_id - */ - public function cleanupScheduleAndFavoritesForEvent($event_id){ - - $query = "DELETE Member_Schedule FROM Member_Schedule WHERE SummitEventID = {$event_id};"; - $this->getEntityManager()->getConnection()->executeUpdate($query); - - $query = "DELETE `Member_FavoriteSummitEvents` FROM `Member_FavoriteSummitEvents` WHERE SummitEventID = {$event_id};"; - $this->getEntityManager()->getConnection()->executeUpdate($query); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitEvent::class; - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPageLocationTBD(PagingInfo $paging_info, Filter $filter = null, Order $order = null) - { - - $current_track_id = 0; - $current_member_id = 0; - - if(!is_null($filter)){ - // check for dependant filtering - $track_id_filter = $filter->getUniqueFilter('track_id'); - if (!is_null($track_id_filter)) { - $current_track_id = intval($track_id_filter->getValue()); - } - $current_member_id_filter = $filter->getUniqueFilter('current_member_id'); - if (!is_null($current_member_id_filter)) { - $current_member_id = intval($current_member_id_filter->getValue()); - } - } - - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin(Presentation::class, 'p', 'WITH', 'e.id = p.id') - ->leftJoin("e.location", 'l', Join::LEFT_JOIN) - ->leftJoin("e.category", 'cc', Join::LEFT_JOIN) - ->leftJoin("p.speakers", "sp", Join::LEFT_JOIN) - ->leftJoin('p.selection_plan', "selp", Join::LEFT_JOIN) - ->leftJoin('p.moderator', "spm", Join::LEFT_JOIN) - ->leftJoin('sp.member', "spmm", Join::LEFT_JOIN) - ->leftJoin('sp.registration_request', "sprr", Join::LEFT_JOIN) - ->where("l.id is null or l.id = 0"); - - if(!is_null($filter)){ - $filter->apply2Query($query, $this->getCustomFilterMappings($current_member_id, $current_track_id)); - } - - if (!is_null($order)) { - $order->apply2Query($query, $this->getOrderMappings()); - } else { - //default order - $query = $query->addOrderBy("e.start_date",'ASC'); - $query = $query->addOrderBy("e.end_date", 'ASC'); - } - - $can_view_private_events = self::isCurrentMemberOnGroup(IGroup::SummitAdministrators); - - if(!$can_view_private_events){ - $idx = 1; - foreach(self::$forbidden_classes as $forbidden_class){ - $query = $query - ->andWhere("not e INSTANCE OF :forbidden_class".$idx); - $query->setParameter("forbidden_class".$idx, $forbidden_class); - $idx++; - } - } - - $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 - ); - } - - /** - * @param Summit $summit, - * @param array $external_ids - * @return mixed - */ - public function getPublishedEventsBySummitNotInExternalIds(Summit $summit, array $external_ids) - { - $query = $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->join('e.summit', 's', Join::WITH, " s.id = :summit_id") - ->where('e.published = 1') - ->andWhere('e.external_id not in (:external_ids)') - ->setParameter('summit_id', $summit->getId()) - ->setParameter('external_ids', $external_ids); - - return $query->getQuery()->getResult(); - } - - /** - * @param int $summit_id, - * @return array - */ - public function getPublishedEventsIdsBySummit(int $summit_id):array - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e.id") - ->from($this->getBaseEntity(), "e") - ->join('e.summit', 's', Join::WITH, " s.id = :summit_id") - ->where('e.published = 1') - ->setParameter('summit_id', $summit_id); - - $res = $query->getQuery()->getArrayResult(); - return array_column($res, 'id'); - } - - /** - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllPublishedTagsByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null): PagingResponse - { - - $query = $this->getEntityManager()->createQueryBuilder() - ->select("distinct t") - ->from(Tag::class, "t") - ->join("t.events", 'e') - ->leftJoin(Presentation::class, 'p', 'WITH', 'e.id = p.id'); - - if(!is_null($filter)){ - $filter->apply2Query($query, [ - 'tag' => 't.tag:json_string', - 'summit_id'=> new DoctrineJoinFilterMapping - ( - 'e.summit', - 's', - "s.id :operator :value" - ), - ]); - } - - if (!is_null($order)) { - $order->apply2Query($query, [ - 'tag' => 't.tag', - ]); - } else { - $query = $query->addOrderBy("t.tag", '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 - ); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitEventTypeRepository.php b/app/Repositories/Summit/DoctrineSummitEventTypeRepository.php deleted file mode 100644 index 8a9b29c2..00000000 --- a/app/Repositories/Summit/DoctrineSummitEventTypeRepository.php +++ /dev/null @@ -1,134 +0,0 @@ - 'et.type:json_string', - 'black_out_times' => 'et.black_out_times:json_boolean', - 'is_default' => 'et.is_default:json_boolean', - 'use_sponsors' => 'et.use_sponsors:json_boolean', - 'are_sponsors_mandatory' => 'et.are_sponsors_mandatory:json_boolean', - 'allows_attachment' => 'et.allows_attachment:json_boolean', - 'use_speakers' => 'pt.use_speakers:json_boolean', - 'are_speakers_mandatory' => 'pt.are_speakers_mandatory:json_boolean', - 'use_moderator' => 'pt.use_moderator:json_boolean', - 'is_moderator_mandatory' => 'pt.is_moderator_mandatory:json_boolean', - 'should_be_available_on_cfp' => 'pt.should_be_available_on_cfp:json_boolean', - - 'class_name' => new DoctrineInstanceOfFilterMapping( - "et", - [ - SummitEventType::ClassName => SummitEventType::class, - PresentationType::ClassName => PresentationType::class, - ] - ) - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'name' => 'et.type', - 'id' => 'et.id', - ]; - } - - /** - * @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 - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("et") - ->from(SummitEventType::class, "et") - ->leftJoin(PresentationType::class, 'pt', 'WITH', 'pt.id = et.id') - ->leftJoin('et.summit', 's') - ->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("et.type",'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 - ); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitLocationBannerRepository.php b/app/Repositories/Summit/DoctrineSummitLocationBannerRepository.php deleted file mode 100644 index b612d5f5..00000000 --- a/app/Repositories/Summit/DoctrineSummitLocationBannerRepository.php +++ /dev/null @@ -1,191 +0,0 @@ - 'b.title:json_string', - 'content' => 'b.content:json_string', - 'type' => 'b.type:json_string', - 'enabled' => 'b.enabled:json_boolean', - 'start_date' => 'sb.start_date:datetime_epoch', - 'end_date' => 'sb.end_date:datetime_epoch', - 'class_name' => new DoctrineInstanceOfFilterMapping( - "b", - [ - SummitLocationBanner::ClassName => SummitLocationBanner::class, - ScheduledSummitLocationBanner::ClassName => ScheduledSummitLocationBanner::class, - ] - ) - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'b.id', - 'title' => 'b.title', - 'location_id' => 'l.id', - 'start_date' => 'sb.start_date', - 'end_date' => 'sb.end_date' - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitLocationBanner::class; - } - - /** - * @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 - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("b") - ->from(SummitLocationBanner::class, "b") - ->leftJoin(ScheduledSummitLocationBanner::class, 'sb', 'WITH', 'sb.id = b.id') - ->leftJoin('b.location', 'l') - ->leftJoin('l.summit', 's') - ->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("b.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 - ); - } - - /** - * @param SummitAbstractLocation $location - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getBySummitLocation - ( - SummitAbstractLocation $location, - PagingInfo $paging_info, - Filter $filter = null, - Order $order = null - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("b") - ->from(SummitLocationBanner::class, "b") - ->leftJoin(ScheduledSummitLocationBanner::class, 'sb', 'WITH', 'sb.id = b.id') - ->leftJoin('b.location', 'l') - ->leftJoin('l.summit', 's') - ->where("l.id = :location_id"); - - $query->setParameter("location_id", $location->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("b.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 - ); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitLocationRepository.php b/app/Repositories/Summit/DoctrineSummitLocationRepository.php deleted file mode 100644 index 6bac8713..00000000 --- a/app/Repositories/Summit/DoctrineSummitLocationRepository.php +++ /dev/null @@ -1,215 +0,0 @@ - 'al.name:json_string', - 'description' => 'al.description:json_string', - 'address_1' => 'gll.address1:json_string', - 'address_2' => 'gll.address2:json_string', - 'zip_code' => 'gll.zip_code:json_string', - 'city' => 'gll.city:json_string', - 'state' => 'gll.state:json_string', - 'country' => 'gll.country:json_string', - 'sold_out' => 'h.sold_out:json_boolean', - 'is_main' => 'v.is_main:json_boolean', - 'time_slot_cost' => 'br.time_slot_cost', - 'currency' => 'br.currency', - 'capacity' => 'r.capacity', - 'attribute' => new DoctrineHavingFilterMapping - ( - "bra.value in (:value) or bra.id in (:value)", - "al.id", - "count(al) = :value_count" - ), - 'class_name' => new DoctrineInstanceOfFilterMapping( - "al", - [ - SummitVenue::ClassName => SummitVenue::class, - SummitHotel::ClassName => SummitHotel::class, - SummitExternalLocation::ClassName => SummitExternalLocation::class, - SummitAirport::ClassName => SummitAirport::class, - SummitBookableVenueRoom::ClassName => SummitBookableVenueRoom::class, - SummitVenueRoom::ClassName => SummitVenueRoom::class, - ] - ) - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'al.id', - 'name' => 'al.name', - 'order' => 'al.order', - ]; - } - - /** - * @param Summit $summit - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @param bool $first_level - * @return PagingResponse - */ - public function getBySummit - ( - Summit $summit, - PagingInfo $paging_info, - Filter $filter = null, - Order $order = null, - bool $first_level = true - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("al") - ->from(SummitAbstractLocation::class, "al") - ->leftJoin(SummitGeoLocatedLocation::class, 'gll', 'WITH', 'gll.id = al.id') - ->leftJoin(SummitVenue::class, 'v', 'WITH', 'v.id = gll.id') - ->leftJoin(SummitExternalLocation::class, 'el', 'WITH', 'el.id = gll.id') - ->leftJoin(SummitHotel::class, 'h', 'WITH', 'h.id = el.id') - ->leftJoin(SummitAirport::class, 'ap', 'WITH', 'ap.id = el.id') - ->leftJoin(SummitVenueRoom::class, 'r', 'WITH', 'r.id = al.id') - ->leftJoin(SummitBookableVenueRoom::class, 'br', 'WITH', 'br.id = al.id') - ->leftJoin('br.attributes', 'bra') - ->leftJoin('al.summit', 's') - ->where("s.id = :summit_id"); - - if($first_level) { - $idx = 1; - foreach (self::$second_level_locations as $second_level_location) { - $query = $query - ->andWhere("not al INSTANCE OF :second_level_class" . $idx); - $query->setParameter("second_level_class" . $idx, $second_level_location); - $idx++; - } - } - - $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("al.id",'ASC'); - } - - if($filter->hasFilter("availability_day")){ - // special case, we need to figure if each room has available slots - $res = $query->getQuery()->execute(); - $rooms = []; - $availability_day = $filter->getUniqueFilter("availability_day")->getValue(); - $day = new \DateTime("@$availability_day"); - - foreach ($res as $room){ - if(!$room instanceof SummitBookableVenueRoom) continue; - if(count($room->getFreeSlots($day)) > 0) - $rooms[] = $room; - } - - return new PagingResponse - ( - count($rooms), - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage(count($rooms)), - array_slice( $rooms, $paging_info->getOffset(), $paging_info->getPerPage() ) - ); - } - - $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 - ); - } - - /** - * @param Summit $summit - * @return array - */ - public function getMetadata(Summit $summit) - { - return [ - SummitVenue::getMetadata(), - SummitAirport::getMetadata(), - SummitHotel::getMetadata(), - SummitExternalLocation::getMetadata() - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitMediaFileTypeRepository.php b/app/Repositories/Summit/DoctrineSummitMediaFileTypeRepository.php deleted file mode 100644 index d153092d..00000000 --- a/app/Repositories/Summit/DoctrineSummitMediaFileTypeRepository.php +++ /dev/null @@ -1,50 +0,0 @@ - 'e.name:json_string', - ]; - } - - /** - * @inheritDoc - */ - protected function getBaseEntity() - { - return SummitMediaFileType::class; - } - - public function getByName(string $name): ?SummitMediaFileType - { - return $this->findOneBy(['name'=> trim($name)]); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitMediaUploadTypeRepository.php b/app/Repositories/Summit/DoctrineSummitMediaUploadTypeRepository.php deleted file mode 100644 index a19e0121..00000000 --- a/app/Repositories/Summit/DoctrineSummitMediaUploadTypeRepository.php +++ /dev/null @@ -1,56 +0,0 @@ - 'e.name:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitMetricRepository.php b/app/Repositories/Summit/DoctrineSummitMetricRepository.php deleted file mode 100644 index 74b46810..00000000 --- a/app/Repositories/Summit/DoctrineSummitMetricRepository.php +++ /dev/null @@ -1,77 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.type = :type"); - - if(!is_null($source_id) && $source_id > 0){ - if($type == ISummitMetricType::Event){ - $query = $query->leftJoin(SummitEventAttendanceMetric::class, 'sam', 'WITH', 'e.id = sam.id') - ->join("sam.event", "evt") - ->andWhere("evt.id = :source_id") - ->setParameter("source_id", $source_id); - } - if($type == ISummitMetricType::Sponsor){ - $query = $query->leftJoin(SummitSponsorMetric::class, 'sm', 'WITH', 'e.id = sm.id') - ->join("sm.sponsor", "sp") - ->andWhere("sp.id = :source_id") - ->setParameter("source_id", $source_id); - } - } - - return $query - ->andWhere("e.outgress_date is null") - ->andWhere("e.member = :member") - ->setParameter("member", $member) - ->setParameter("type", trim($type)) - ->setMaxResults(1) - ->orderBy('e.ingress_date', 'DESC') - ->getQuery() - ->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitNotificationRepository.php b/app/Repositories/Summit/DoctrineSummitNotificationRepository.php deleted file mode 100644 index d468725a..00000000 --- a/app/Repositories/Summit/DoctrineSummitNotificationRepository.php +++ /dev/null @@ -1,201 +0,0 @@ - 'e.id:json_int', - 'message' => 'n.message:json_string', - 'channel' => 'n.channel:json_string', - 'sent_date' => 'n.sent_date:datetime_epoch', - 'created' => 'n.created:datetime_epoch', - 'is_sent' => 'n.is_sent:json_boolean', - 'approved' => 'n.approved:json_boolean', - 'recipient_id' => new DoctrineFilterMapping(" - r.id :operator :value - "), - 'group_id' => new DoctrineFilterMapping(" - g.id :operator :value - ") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'sent_date' => 'n.sent_date', - 'created' => 'n.created', - 'id' => 'n.id', - ]; - } - - /** - * @param Member|null $current_member - * @param Summit $summit - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPageByUserBySummit - ( - ?Member $current_member, - Summit $summit, - PagingInfo $paging_info, - Filter $filter = null, - Order $order = null - ):PagingResponse - { - $query = $this->createBaseQuery($summit); - - $query->orWhere(sprintf("n.channel = '%s'", SummitPushNotificationChannel::Everyone)); - $query->orWhere(sprintf("n.channel = '%s'", SummitPushNotificationChannel::Summit)); - - if(!is_null($current_member)){ - - $groups_ids = $current_member->getGroupsIds(); - $events_ids = $current_member->getScheduledEventsIds($summit); - - $query->orWhere(sprintf("r = :current_member and n.channel = '%s'", SummitPushNotificationChannel::Members))->setParameter("current_member", $current_member); - - if(count($groups_ids) > 0){ - $query->orWhere(sprintf("g.id in (:groups_ids) and n.channel = '%s'", SummitPushNotificationChannel::Group))->setParameter("groups_ids", $groups_ids); - } - - if(count($events_ids) > 0){ - $query->orWhere(sprintf("e.id in (:events_id) and n.channel = '%s'", SummitPushNotificationChannel::Event))->setParameter('events_id', $events_ids); - $query->orWhere(sprintf("n.channel = '%s'", SummitPushNotificationChannel::Attendees)); - } - - if($current_member->hasSpeaker() && $current_member->getSpeaker()->isSpeakerOfSummit($summit)){ - $query->orWhere(sprintf("n.channel = '%s'", SummitPushNotificationChannel::Speakers)); - } - } - return $this->applyPaginationLogic($query, $paging_info, $filter, $order); - } - - /** - * @param QueryBuilder $query - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - private function applyPaginationLogic(QueryBuilder $query, - PagingInfo $paging_info, - Filter $filter = null, - Order $order = null):PagingResponse{ - - if (!is_null($filter)) { - $filter->apply2Query($query, $this->getFilterMappings()); - } - - if (!is_null($order)) { - $order->apply2Query($query, $this->getOrderMappings()); - } else { - //default order - $query = $query->orderBy('n.id', Criteria::DESC); - } - - $query = $query - ->setFirstResult($paging_info->getOffset())->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query, $fetchJoinCollection = true); - $total = $paginator->count(); - $data = array(); - - foreach ($paginator as $entity) - array_push($data, $entity); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - /** - * @param Summit $summit - * @return QueryBuilder - */ - private function createBaseQuery( Summit $summit):QueryBuilder{ - return $this->getEntityManager() - ->createQueryBuilder() - ->select("n") - ->from(SummitPushNotification::class, "n") - ->leftJoin('n.summit_event', 'e') - ->leftJoin('n.group', 'g') - ->leftJoin('n.recipients', 'r') - ->join('n.summit', 's', Join::WITH, " s.id = :summit_id") - ->setParameter('summit_id', $summit->getId()); - } - - - /** - * @param Summit $summit - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllByPageBySummit - ( - Summit $summit, - PagingInfo $paging_info, - Filter $filter = null, - Order $order = null - ):PagingResponse - { - return $this->applyPaginationLogic($this->createBaseQuery($summit), $paging_info, $filter, $order); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitPushNotification::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitOrderExtraQuestionTypeRepository.php b/app/Repositories/Summit/DoctrineSummitOrderExtraQuestionTypeRepository.php deleted file mode 100644 index d0b26831..00000000 --- a/app/Repositories/Summit/DoctrineSummitOrderExtraQuestionTypeRepository.php +++ /dev/null @@ -1,55 +0,0 @@ - 'e.printable;:json_boolean', - 'usage' => 'e.usage;:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]); - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return parent::getOrderMappings(); - } - - /** - * - * @return string - */ - protected function getBaseEntity() - { - return SummitOrderExtraQuestionType::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitOrderRepository.php b/app/Repositories/Summit/DoctrineSummitOrderRepository.php deleted file mode 100644 index e9c861e2..00000000 --- a/app/Repositories/Summit/DoctrineSummitOrderRepository.php +++ /dev/null @@ -1,307 +0,0 @@ - 'e.number:json_string', - 'summit_id' => new DoctrineFilterMapping("s.id :operator :value"), - 'owner_id' => new DoctrineFilterMapping("o.id :operator :value"), - 'owner_name' => [ - "LOWER(CONCAT(o.first_name, ' ', o.last_name)) :operator :value" , - "LOWER(CONCAT(e.owner_first_name, ' ', e.owner_surname)) :operator :value" - ], - 'owner_email' => [ - "o.email :operator :value", - "e.owner_email :operator :value" - ], - 'owner_company' => 'e.owner_company:json_string', - 'status' => 'e.status:json_string', - 'ticket_owner_name' => [ - "LOWER(CONCAT(to.first_name, ' ', to.surname)) :operator :value", - "LOWER(CONCAT(tom.first_name, ' ', tom.last_name)) :operator :value" - ], - 'ticket_owner_email' => [ - "to.email :operator :value", - "tom.email :operator :value" - ], - 'ticket_number' => new DoctrineFilterMapping("t.number :operator :value"), - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query){ - $query - ->join('e.tickets','t') - ->join('e.summit','s') - ->leftJoin('e.owner','o') - ->leftJoin('t.owner','to') - ->leftJoin('to.member', 'tom'); - return $query; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'number' => 'e.number', - 'id' => 'e.id', - 'status' => 'e.status', - /* 'owner_name' => << <<andWhere("e.status <> :cancelled")->setParameter("cancelled", IOrderConstants::CancelledStatus); - return $query; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitOrder::class; - } - - /** - * @param string $hash - * @return SummitOrder|null - */ - public function getByHashLockExclusive(string $hash): ?SummitOrder - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.hash = :hash"); - - $query->setParameter("hash", $hash); - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param string $payment_gateway_cart_id - * @return SummitOrder|null - */ - public function getByPaymentGatewayCartIdExclusiveLock(string $payment_gateway_cart_id): ?SummitOrder - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.payment_gateway_cart_id = :payment_gateway_cart_id"); - - $query->setParameter("payment_gateway_cart_id", $payment_gateway_cart_id); - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param string $email - * @return mixed - */ - public function getAllByOwnerEmail(string $email) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.owner_email = :owner_email"); - - $query->setParameter("owner_email", trim($email)); - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getResult(); - } - - /** - * @param int $minutes - * @param int $max - * @return mixed - */ - public function getAllReservedOlderThanXMinutes(int $minutes, int $max = 100) - { - $eol = new \DateTime('now', new \DateTimeZone(SilverstripeBaseModel::DefaultTimeZone)); - $eol->sub(new \DateInterval('PT' . $minutes . 'M')); - - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.created <= :eol") - ->andWhere("e.status = :status"); - - $query->setParameter("eol", $eol); - $query->setParameter("status", IOrderConstants::ReservedStatus); - - return $query->getQuery()->setMaxResults($max)->getResult(); - - } - - /** - * @param int $minutes - * @param int $max - * @return mixed - */ - public function getAllConfirmedOlderThanXMinutes(int $minutes, int $max = 100) - { - $eol = new \DateTime('now', new \DateTimeZone(SilverstripeBaseModel::DefaultTimeZone)); - $eol->sub(new \DateInterval('PT' . $minutes . 'M')); - - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.created <= :eol") - ->andWhere("e.status = :status"); - - $query->setParameter("eol", $eol); - $query->setParameter("status", IOrderConstants::ConfirmedStatus); - - return $query->getQuery()->setMaxResults($max)->getResult(); - - } - - /** - * @param string $externalId - * @return SummitOrder|null - */ - public function getByExternalIdLockExclusive(string $externalId): ?SummitOrder - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.external_id = :external_id"); - - $query->setParameter("external_id", $externalId); - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param Summit $summit - * @param string $externalId - * @return SummitOrder|null - */ - public function getByExternalIdAndSummitLockExclusive(Summit $summit, string $externalId): ?SummitOrder - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->join('e.summit', 's') - ->where("e.external_id = :external_id") - ->andWhere('s.id = :summit_id') - ; - - $query->setParameter("external_id", $externalId); - $query->setParameter("summit_id", $summit->getId()) - ; - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param Summit $summit - * @param PagingInfo $paging_info - * @return PagingResponse - */ - public function getAllOrderThatNeedsEmailActionReminder(Summit $summit, PagingInfo $paging_info):PagingResponse - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->join("e.tickets","t") - ->join("e.summit","s") - ->leftJoin("t.owner","o") - ->where('e.status = :order_status') - ->andWhere('s.id = :summit_id') - ->andWhere("o is null OR o.status = :attendee_status"); - - $query->setParameter("order_status", IOrderConstants::PaidStatus); - $query->setParameter("summit_id", $summit->getId()); - $query->setParameter("attendee_status", SummitAttendee::StatusIncomplete); - - $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 - ); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitRefundPolicyTypeRepository.php b/app/Repositories/Summit/DoctrineSummitRefundPolicyTypeRepository.php deleted file mode 100644 index 0e164817..00000000 --- a/app/Repositories/Summit/DoctrineSummitRefundPolicyTypeRepository.php +++ /dev/null @@ -1,60 +0,0 @@ - 'e.name:json_string', - 'until_x_days_before_event_starts' => 'e.until_x_days_before_event_starts:json_int', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - 'until_x_days_before_event_starts' => 'e.until_x_days_before_event_starts' - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return SummitRefundPolicyType::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitRegistrationInvitationRepository.php b/app/Repositories/Summit/DoctrineSummitRegistrationInvitationRepository.php deleted file mode 100644 index 8e8f7c52..00000000 --- a/app/Repositories/Summit/DoctrineSummitRegistrationInvitationRepository.php +++ /dev/null @@ -1,117 +0,0 @@ -join('e.summit', 's'); - return $query; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'email' => 'e.email:json_string', - 'first_name' => 'e.first_name:json_string', - 'last_name' => 'e.last_name:json_string', - 'is_accepted' => new DoctrineSwitchFilterMapping([ - 'true' => new DoctrineCaseFilterMapping( - 'true', - "e.accepted_date is not null" - ), - 'false' => new DoctrineCaseFilterMapping( - 'false', - "e.accepted_date is null" - ), - ] - ), - 'is_sent' => new DoctrineSwitchFilterMapping([ - 'true' => new DoctrineCaseFilterMapping( - 'true', - "e.hash is not null" - ), - 'false' => new DoctrineCaseFilterMapping( - 'false', - "e.hash is null" - ), - ] - ), - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'email' => 'e.email', - ]; - } - - /** - * @param string $hash - * @return SummitRegistrationInvitation|null - */ - public function getByHashExclusiveLock(string $hash): ?SummitRegistrationInvitation - { - return $this->findOneBy(['hash'=> trim($hash)]); - } - - /** - * @inheritDoc - */ - public function getAllIdsNonAcceptedPerSummit(Summit $summit): array - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e.id") - ->from($this->getBaseEntity(), "e") - ->join("e.summit","s") - ->where('e.accepted_date is null') - ->andWhere('s.id = :summit_id')->setParameter("summit_id", $summit->getId()); - return $query->getQuery()->getResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitRegistrationPromoCodeRepository.php b/app/Repositories/Summit/DoctrineSummitRegistrationPromoCodeRepository.php deleted file mode 100644 index 4ad0a6f9..00000000 --- a/app/Repositories/Summit/DoctrineSummitRegistrationPromoCodeRepository.php +++ /dev/null @@ -1,290 +0,0 @@ -getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.code = :code"); - - $query->setParameter("code", $code); - - return $query->getQuery()->getOneOrNullResult(); - } - - protected function getFilterMappings() - { - return [ - 'code' => 'pc.code:json_string', - 'sponsor' => new DoctrineFilterMapping - ( - "(spnr.name :operator :value) OR (spnr2.name :operator :value)" - ), - 'creator' => new DoctrineFilterMapping - ( - "( concat(ct.first_name, ' ', ct.last_name) :operator :value ". - "OR ct.first_name :operator :value ". - "OR ct.last_name :operator :value ) " - ), - 'creator_email' => new DoctrineFilterMapping - ( - "(ct.email :operator :value)" - ), - 'owner' => new DoctrineFilterMapping - ( - "( concat(owr.first_name, ' ', owr.last_name) :operator :value ". - "OR owr.first_name :operator :value ". - "OR owr.last_name :operator :value ) ". - "OR ( concat(owr2.first_name, ' ', owr2.last_name) :operator :value ". - "OR owr2.first_name :operator :value ". - "OR owr2.last_name :operator :value ) " - ), - 'owner_email' => new DoctrineFilterMapping - ( - "(owr.email :operator :value) ". - "OR (owr2.email :operator :value) " - ), - 'speaker' => new DoctrineFilterMapping - ( - "( concat(spkr.first_name, ' ', spkr.last_name) :operator :value ". - "OR concat(spmm.first_name, ' ', spmm.last_name) :operator :value ". - "OR spkr.first_name :operator :value ". - "OR spkr.last_name :operator :value ". - "OR spmm.first_name :operator :value ". - "OR spmm.last_name :operator :value ) ". - "OR ( concat(spkr2.first_name, ' ', spkr2.last_name) :operator :value ". - "OR concat(spmm2.first_name, ' ', spmm2.last_name) :operator :value ". - "OR spkr2.first_name :operator :value ". - "OR spkr2.last_name :operator :value ". - "OR spmm2.first_name :operator :value ". - "OR spmm2.last_name :operator :value ) " - ), - 'speaker_email' => new DoctrineFilterMapping - ( - "(sprr.email :operator :value OR spmm.email :operator :value) ". - "OR (sprr2.email :operator :value OR spmm2.email :operator :value) " - ), - 'type' => new DoctrineFilterMapping - ( - "(mpc.type :operator :value OR spkpc.type :operator :value) ". - " OR (mdc.type :operator :value OR spkdc.type :operator :value) " - ), - 'class_name' => new DoctrineInstanceOfFilterMapping( - "pc", - [ - SummitRegistrationPromoCode::ClassName => SummitRegistrationPromoCode::class, - SummitRegistrationDiscountCode::ClassName => SummitRegistrationDiscountCode::class, - MemberSummitRegistrationPromoCode::ClassName => MemberSummitRegistrationPromoCode::class, - SpeakerSummitRegistrationPromoCode::ClassName => SpeakerSummitRegistrationPromoCode::class, - SponsorSummitRegistrationPromoCode::ClassName => SponsorSummitRegistrationPromoCode::class, - MemberSummitRegistrationDiscountCode::ClassName => MemberSummitRegistrationDiscountCode::class, - SpeakerSummitRegistrationDiscountCode::ClassName => SpeakerSummitRegistrationDiscountCode::class, - SponsorSummitRegistrationDiscountCode::ClassName => SponsorSummitRegistrationDiscountCode::class, - ] - ) - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'code' => 'pc.code', - 'id' => 'pc.id', - ]; - } - - /** - * @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("pc") - ->from($this->getBaseEntity(), "pc") - ->leftJoin(SummitRegistrationDiscountCode::class, 'dc', 'WITH', 'pc.id = dc.id') - ->leftJoin(MemberSummitRegistrationDiscountCode::class, 'mdc', 'WITH', 'pc.id = mdc.id') - ->leftJoin(SpeakerSummitRegistrationDiscountCode::class, 'spkdc', 'WITH', 'pc.id = spkdc.id') - ->leftJoin(SponsorSummitRegistrationDiscountCode::class, 'spdc', 'WITH', 'pc.id = spdc.id') - ->leftJoin(MemberSummitRegistrationPromoCode::class, 'mpc', 'WITH', 'pc.id = mpc.id') - ->leftJoin(SponsorSummitRegistrationPromoCode::class, 'spc', 'WITH', 'mpc.id = spc.id') - ->leftJoin(SpeakerSummitRegistrationPromoCode::class, 'spkpc', 'WITH', 'spkpc.id = pc.id') - ->leftJoin('pc.summit', 's') - ->leftJoin('pc.creator', 'ct') - ->leftJoin("spkpc.speaker", "spkr") - ->leftJoin("spkdc.speaker", "spkr2") - ->leftJoin('spkr.member', "spmm", Join::LEFT_JOIN) - ->leftJoin('spkr2.member', "spmm2", Join::LEFT_JOIN) - ->leftJoin('spkr.registration_request', "sprr", Join::LEFT_JOIN) - ->leftJoin('spkr2.registration_request', "sprr2", Join::LEFT_JOIN) - ->leftJoin("mpc.owner", "owr") - ->leftJoin("mdc.owner", "owr2") - ->leftJoin("spc.sponsor", "spnr") - ->leftJoin("spdc.sponsor", "spnr2") - ->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("pc.code",'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 - ); - } - - /** - * @param Summit $summit - * @return array - */ - public function getMetadata(Summit $summit) - { - return [ - SummitRegistrationPromoCode::getMetadata(), - SummitRegistrationDiscountCode::getMetadata(), - MemberSummitRegistrationPromoCode::getMetadata(), - SpeakerSummitRegistrationPromoCode::getMetadata(), - SponsorSummitRegistrationPromoCode::getMetadata(), - SponsorSummitRegistrationDiscountCode::getMetadata(), - SpeakerSummitRegistrationDiscountCode::getMetadata(), - MemberSummitRegistrationDiscountCode::getMetadata(), - ]; - } - - /** - * @param Summit $sumit - * @param array $codes - * @return SummitRegistrationPromoCode|null - */ - public function getByValuesExclusiveLock(Summit $summit, array $codes) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin('e.summit', 's') - ->where("s.id = :summit_id") - ->andWhere("e.code in (:codes)"); - - $query->setParameter("summit_id", $summit->getId()); - $query->setParameter("codes", $codes); - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getResult(); - } - - /** - * @param Summit $summit - * @param string $code - * @return SummitRegistrationPromoCode|null - * @throws \Doctrine\ORM\NonUniqueResultException - * @throws \Doctrine\ORM\TransactionRequiredException - */ - public function getByValueExclusiveLock(Summit $summit, string $code): ?SummitRegistrationPromoCode - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->leftJoin('e.summit', 's') - ->where("s.id = :summit_id") - ->andWhere("e.code = :code"); - - $query->setParameter("code", strtoupper(trim($code))); - $query->setParameter("summit_id", $summit->getId()); - - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitRepository.php b/app/Repositories/Summit/DoctrineSummitRepository.php deleted file mode 100644 index 1ff164c0..00000000 --- a/app/Repositories/Summit/DoctrineSummitRepository.php +++ /dev/null @@ -1,300 +0,0 @@ - 'e.name', - 'start_date' => 'e.begin_date:datetime_epoch', - 'end_date' => 'e.end_date:datetime_epoch', - 'submission_begin_date' => 'sp.submission_begin_date:datetime_epoch', - 'submission_end_date' => 'sp.submission_end_date:datetime_epoch', - 'voting_begin_date' => 'sp.voting_begin_date:datetime_epoch', - 'voting_end_date' => 'sp.voting_end_date:datetime_epoch', - 'selection_begin_date' => 'sp.selection_begin_date:datetime_epoch', - 'selection_end_date' => 'sp.selection_end_date:datetime_epoch', - 'selection_plan_enabled' => 'sp.is_enabled:json_boolean', - 'registration_begin_date' => 'e.registration_begin_date:datetime_epoch', - 'registration_end_date' => 'e.registration_end_date:datetime_epoch', - 'available_on_api' => 'e.available_on_api:json_int', - 'summit_id' => 'e.id:json_int', - 'ticket_types_count' => new DoctrineHavingFilterMapping("", "tt.summit", "count(tt.id) :operator :value"), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - 'start_date' => 'e.begin_date', - 'registration_begin_date' => 'e.registration_begin_date', - ]; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraFilters(QueryBuilder $query) - { - return $query; - } - - /** - * @param QueryBuilder $query - * @return QueryBuilder - */ - protected function applyExtraJoins(QueryBuilder $query) - { - $query = $query->leftJoin("e.ticket_types", "tt"); - $query = $query->leftJoin("e.selection_plans", "sp"); - return $query; - } - - /** - * @return Summit - */ - public function getCurrent() - { - $res = $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), "s") - ->where('s.active = 1') - ->orderBy('s.begin_date', 'DESC') - ->getQuery() - ->getResult(); - if (count($res) == 0) return null; - return $res[0]; - } - - /** - * @return Summit[] - */ - public function getCurrentAndFutureSummits() - { - $now_utc = new \DateTime('now', new \DateTimeZone('UTC')); - return $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), "s") - // current - ->where('s.begin_date <= :now and s.end_date >= :now') - // or future - ->orWhere('s.begin_date >= :now') - ->orderBy('s.begin_date', 'DESC') - ->setParameter('now', $now_utc) - ->getQuery() - ->getResult(); - } - - /** - * @return Summit[] - */ - public function getAvailables() - { - return $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), "s") - ->where('s.available_on_api = 1') - ->orderBy('s.begin_date', 'ASC') - ->getQuery() - ->getResult(); - } - - /** - * @return Summit[] - */ - public function getAllOrderedByBeginDate() - { - return $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), "s") - ->orderBy('s.begin_date', 'ASC') - ->getQuery() - ->getResult(); - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return Summit::class; - } - - /** - * @param string $name - * @return Summit - */ - public function getByName($name) - { - return $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), "s") - ->where('s.name = :name') - ->setParameter('name', $name) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $slug - * @return Summit|null - */ - public function getBySlug(string $slug): ?Summit - { - try { - return $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), "s") - ->where('s.slug = :slug') - ->setParameter('slug', strtolower($slug)) - ->getQuery() - ->getOneOrNullResult(); - } catch (\Exception $ex) { - Log::warning($ex); - return null; - } - } - - /** - * @return Summit - */ - public function getActive() - { - $res = $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), "s") - ->where('s.active = 1') - ->orderBy('s.begin_date', 'DESC') - ->getQuery() - ->getResult(); - if (count($res) == 0) return null; - return $res[0]; - } - - /** - * @return Summit - */ - public function getCurrentAndAvailable() - { - $res = $this->getEntityManager()->createQueryBuilder() - ->select("s") - ->from($this->getBaseEntity(), 's') - ->where('s.active = 1') - ->andWhere('s.available_on_api = 1') - ->orderBy('s.begin_date', 'DESC') - ->getQuery() - ->getResult(); - if (count($res) == 0) return null; - return $res[0]; - } - - /** - * @return Summit[] - */ - public function getWithExternalFeed(): array - { - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.api_feed_type is not null") - ->andWhere("e.api_feed_type <> ''") - ->andWhere("e.api_feed_url is not null") - ->andWhere("e.api_feed_url <> ''") - ->andWhere("e.api_feed_key is not null") - ->andWhere("e.api_feed_key <>''") - ->andWhere("e.end_date >= :now") - ->orderBy('e.id', 'DESC') - ->setParameter("now", new \DateTime('now', new \DateTimeZone('UTC'))) - ->getQuery() - ->getResult(); - } - - /** - * @return Summit[] - */ - public function getAllWithExternalRegistrationFeed(): array - { - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.api_feed_type is not null") - ->andWhere("e.external_registration_feed_type <> ''") - ->andWhere("e.external_registration_feed_type is not null") - ->andWhere("e.external_registration_feed_api_key <> ''") - ->andWhere("e.external_registration_feed_api_key is not null") - ->andWhere("e.external_summit_id <> ''") - ->andWhere("e.external_summit_id is not null") - ->andWhere("e.end_date >= :now") - ->orderBy('e.id', 'DESC') - ->setParameter("now", new \DateTime('now', new \DateTimeZone('UTC'))) - ->getQuery() - ->getResult(); - } - - /** - * @return array - */ - public function getNotEnded(): array - { - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.end_date >= :now") - ->orderBy('e.id', 'DESC') - ->setParameter("now", new \DateTime('now', new \DateTimeZone('UTC'))) - ->getQuery() - ->getResult(); - } - - /** - * @return array - * @throws \Exception - */ - public function getOnGoing(): array - { - return $this->getEntityManager()->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.begin_date <= :now") - ->andWhere("e.end_date >= :now") - ->orderBy('e.id', 'DESC') - ->setParameter("now", new \DateTime('now', new \DateTimeZone('UTC'))) - ->getQuery() - ->getResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitRoomReservationRepository.php b/app/Repositories/Summit/DoctrineSummitRoomReservationRepository.php deleted file mode 100644 index 8df0fba4..00000000 --- a/app/Repositories/Summit/DoctrineSummitRoomReservationRepository.php +++ /dev/null @@ -1,205 +0,0 @@ - 'e.id', - 'start_datetime' => 'e.start_datetime', - 'end_datetime' => 'e.end_datetime', - 'room_name' => 'r1.name', - 'room_id' => 'r1.id', - 'status' => 'e.status', - 'created' => 'e.created', - 'owner_name' => "LOWER(CONCAT(o1.first_name, ' ', o1.last_name))", - ]; - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'status' => 'e.status:json_string', - 'start_datetime' => 'e.start_datetime:datetime_epoch', - 'end_datetime' => 'e.end_datetime:datetime_epoch', - 'created' => 'e.created:datetime_epoch', - 'room_id' => new DoctrineJoinFilterMapping - ( - 'e.room', - 'r', - "r.id :operator :value" - ), - 'room_name' => new DoctrineJoinFilterMapping - ( - 'e.room', - 'r', - "r.name :operator :value" - ), - 'venue_id' => new DoctrineJoinFilterMapping - ( - 'r.venue', - 'v', - "v.id :operator :value" - ), - 'owner_id' => new DoctrineJoinFilterMapping - ( - 'e.owner', - 'o', - "o.id :operator :value" - ), - 'owner_name' => new DoctrineJoinFilterMapping - ( - 'e.owner', - 'o', - "LOWER(CONCAT(o.first_name, ' ', o.last_name)) :operator :value" - ), - 'owner_email' => new DoctrineJoinFilterMapping - ( - 'e.owner', - 'o', - "o.email :operator :value" - ), - ]; - } - - /** - * @param Summit $summit - * @param PagingInfo $paging_info - * @param Filter|null $filter - * @param Order|null $order - * @return PagingResponse - */ - public function getAllBySummitByPage(Summit $summit, PagingInfo $paging_info, Filter $filter = null, Order $order = null):PagingResponse{ - - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->join("e.room","r1") - ->join("e.owner","o1") - ->join("r1.venue", "v1") - ->join("v1.summit", "s1") - ->where("s1.id = ".$summit->getId()) - ; - - $query = $this->applyExtraFilters($query); - - if(!is_null($filter)){ - $filter->apply2Query($query, $this->getFilterMappings()); - } - - if(!is_null($order)){ - $order->apply2Query($query, $this->getOrderMappings()); - } - - $query = $query - ->setFirstResult($paging_info->getOffset()) - ->setMaxResults($paging_info->getPerPage()); - - $paginator = new Paginator($query, $fetchJoinCollection = true); - $total = $paginator->count(); - $data = array(); - - foreach($paginator as $entity) - array_push($data, $entity); - - return new PagingResponse - ( - $total, - $paging_info->getPerPage(), - $paging_info->getCurrentPage(), - $paging_info->getLastPage($total), - $data - ); - } - - /** - * @param string $payment_gateway_cart_id - * @return SummitRoomReservation|null - */ - public function getByPaymentGatewayCartIdExclusiveLock(string $payment_gateway_cart_id):?SummitRoomReservation - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.payment_gateway_cart_id = :payment_gateway_cart_id"); - - $query->setParameter("payment_gateway_cart_id", trim($payment_gateway_cart_id)); - - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getOneOrNullResult(); - } - - /** - * @param int $minutes - * @param int $max - * @return mixed - * @throws \Exception - */ - public function getAllReservedOlderThanXMinutes(int $minutes, int $max = 100) - { - $eol = new \DateTime('now', new \DateTimeZone(SilverstripeBaseModel::DefaultTimeZone)); - $eol->sub(new \DateInterval('PT' . $minutes . 'M')); - - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from($this->getBaseEntity(), "e") - ->where("e.created <= :eol") - ->andWhere("e.status = :status"); - - $query->setParameter("eol", $eol); - $query->setParameter("status", SummitRoomReservation::ReservedStatus); - - return $query->getQuery()->setMaxResults($max)->getResult(); - - } - -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitSelectionPlanExtraQuestionTypeRepository.php b/app/Repositories/Summit/DoctrineSummitSelectionPlanExtraQuestionTypeRepository.php deleted file mode 100644 index 02214b53..00000000 --- a/app/Repositories/Summit/DoctrineSummitSelectionPlanExtraQuestionTypeRepository.php +++ /dev/null @@ -1,59 +0,0 @@ - new DoctrineLeftJoinFilterMapping - ( - "e.selection_plan", - "s" , - "s.id :operator :value" - ) - ]); - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return parent::getOrderMappings(); - } - - /** - * - * @return string - */ - protected function getBaseEntity() - { - return SummitSelectionPlanExtraQuestionType::class; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitTaxTypeRepository.php b/app/Repositories/Summit/DoctrineSummitTaxTypeRepository.php deleted file mode 100644 index 2e57212c..00000000 --- a/app/Repositories/Summit/DoctrineSummitTaxTypeRepository.php +++ /dev/null @@ -1,79 +0,0 @@ -findOneBy([ - 'name' => trim($name) - ]); - } - - /** - * @param string $tax_id - * @return SummitTaxType|null - */ - public function getByTaxID(string $tax_id): ?SummitTaxType - { - return $this->findOneBy([ - 'tax_id' => trim($tax_id) - ]); - } - - /** - * @return array - */ - protected function getFilterMappings() - { - return [ - 'name' => 'e.name:json_string', - 'summit_id' => new DoctrineLeftJoinFilterMapping("e.summit", "s" ,"s.id :operator :value") - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'name' => 'e.name', - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitTicketTypeRepository.php b/app/Repositories/Summit/DoctrineSummitTicketTypeRepository.php deleted file mode 100644 index 748654f6..00000000 --- a/app/Repositories/Summit/DoctrineSummitTicketTypeRepository.php +++ /dev/null @@ -1,159 +0,0 @@ - 'tt.name:json_string', - 'description' => 'tt.description:json_string', - 'external_id' => 'tt.external_id:json_string', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'name' => 'tt.name', - 'id' => 'tt.id', - 'external_id' => 'tt.external_id', - ]; - } - - /** - * @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 - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("tt") - ->from(SummitTicketType::class, "tt") - ->leftJoin('tt.summit', 's') - ->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("tt.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 - ); - } - - /** - * @param Summit $summit - * @param array $ids - * @return SummitTicketType[] - */ - public function getByIdsExclusiveLock(Summit $summit, array $ids) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from(SummitTicketType::class, "e") - ->leftJoin('e.summit', 's') - ->where("s.id = :summit_id") - ->andWhere("e.id in (:ticket_ids)"); - - $query->setParameter("summit_id", $summit->getId()); - $query->setParameter("ticket_ids", $ids); - return $query->getQuery() - ->setLockMode(\Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) - ->setHint(\Doctrine\ORM\Query::HINT_REFRESH, true) - ->getResult(); - } - - /** - * @param Summit $summit - * @param string $type - * @return SummitTicketType|null - */ - public function getByType(Summit $summit, string $type): ?SummitTicketType - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("e") - ->from(SummitTicketType::class, "e") - ->leftJoin('e.summit', 's') - ->where("s.id = :summit_id") - ->andWhere("e.name = :type"); - - $query->setParameter("summit_id", $summit->getId()); - $query->setParameter("type", $type); - - return $query->getQuery()->getOneOrNullResult(); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitTrackChairRepository.php b/app/Repositories/Summit/DoctrineSummitTrackChairRepository.php deleted file mode 100644 index c2ed3d4e..00000000 --- a/app/Repositories/Summit/DoctrineSummitTrackChairRepository.php +++ /dev/null @@ -1,75 +0,0 @@ -join('e.summit', 's') - ->leftJoin('e.member', 'm') - ->leftJoin('e.categories', 'cat'); - return $query; - } - - protected function getFilterMappings() - { - return [ - 'summit_id' => 's.id', - 'member_id' => 'm.id', - 'track_id' => 'cat.id', - 'member_first_name' => "m.first_name :operator :value", - 'member_last_name' => "m.last_name :operator :value", - 'member_full_name' => "concat(m.first_name, ' ', m.last_name) :operator :value", - 'member_email' => "m.email :operator :value" - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'id' => 'e.id', - 'track_id' => 'cat.id', - "member_full_name" => "LOWER(CONCAT(m.first_name, ' ', m.last_name))", - 'member_first_name' => 'm.first_name', - 'member_last_name' => 'm.last_name', - ]; - } - -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineSummitTrackRepository.php b/app/Repositories/Summit/DoctrineSummitTrackRepository.php deleted file mode 100644 index d0a3f838..00000000 --- a/app/Repositories/Summit/DoctrineSummitTrackRepository.php +++ /dev/null @@ -1,124 +0,0 @@ - 't.title:json_string', - 'description' => 't.description:json_string', - 'code' => 't.code:json_string', - 'group_name' => new DoctrineFilterMapping - ( - "(g.name :operator :value)" - ), - 'voting_visible' => 't.voting_visible', - 'chair_visible' => 't.chair_visible', - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'code' => 't.code', - 'name' => 't.title', - 'id' => 't.id', - ]; - } - - /** - * @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 - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("t") - ->from(PresentationCategory::class, "t") - ->leftJoin('t.groups', 'g') - ->leftJoin('t.summit', 's') - ->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.code",'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 - ); - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineTrackQuestionTemplateRepository.php b/app/Repositories/Summit/DoctrineTrackQuestionTemplateRepository.php deleted file mode 100644 index 3672dc8d..00000000 --- a/app/Repositories/Summit/DoctrineTrackQuestionTemplateRepository.php +++ /dev/null @@ -1,118 +0,0 @@ - 'e.name:json_string', - 'label' => 'e.label:json_string', - 'class_name' => new DoctrineInstanceOfFilterMapping - ( - "e", - [ - TrackLiteralContentQuestionTemplate::ClassName => TrackLiteralContentQuestionTemplate::class, - TrackRadioButtonListQuestionTemplate::ClassName => TrackRadioButtonListQuestionTemplate::class, - TrackCheckBoxListQuestionTemplate::ClassName => TrackCheckBoxListQuestionTemplate::class, - TrackDropDownQuestionTemplate::ClassName => TrackDropDownQuestionTemplate::class, - TrackTextBoxQuestionTemplate::ClassName => TrackTextBoxQuestionTemplate::class, - TrackCheckBoxQuestionTemplate::ClassName => TrackCheckBoxQuestionTemplate::class, - ] - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'name' => 'e.name', - 'label' => 'e.name', - 'id' => 'e.id', - ]; - } - - /** - * @return string - */ - protected function getBaseEntity() - { - return TrackQuestionTemplate::class; - } - - /** - * @param string $name - * @return TrackQuestionTemplate - */ - public function getByName($name) - { - return $this->getEntityManager()->createQueryBuilder() - ->select("g") - ->from(TrackQuestionTemplate::class, "g") - ->where('LOWER(g.name) = :name') - ->setParameter('name', strtolower(trim($name))) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @param string $label - * @return TrackQuestionTemplate - */ - public function getByLabel($label) - { - return $this->getEntityManager()->createQueryBuilder() - ->select("g") - ->from(TrackQuestionTemplate::class, "g") - ->where('LOWER(g.label) = :label') - ->setParameter('label', strtolower(trim($label))) - ->getQuery() - ->getOneOrNullResult(); - } - - /** - * @return array - */ - public function getQuestionsMetadata() - { - return [ - TrackTextBoxQuestionTemplate::getMetadata(), - TrackCheckBoxQuestionTemplate::getMetadata(), - TrackLiteralContentQuestionTemplate::getMetadata(), - TrackRadioButtonListQuestionTemplate::getMetadata(), - TrackCheckBoxListQuestionTemplate::getMetadata(), - TrackDropDownQuestionTemplate::getMetadata(), - ]; - } -} \ No newline at end of file diff --git a/app/Repositories/Summit/DoctrineTrackTagGroupAllowedTagsRepository.php b/app/Repositories/Summit/DoctrineTrackTagGroupAllowedTagsRepository.php deleted file mode 100644 index e0f7cd3d..00000000 --- a/app/Repositories/Summit/DoctrineTrackTagGroupAllowedTagsRepository.php +++ /dev/null @@ -1,119 +0,0 @@ - new DoctrineFilterMapping - ( - "(tg.tag :operator :value)" - ), - ]; - } - - /** - * @return array - */ - protected function getOrderMappings() - { - return [ - 'tag' => 'tg.tag', - 'id' => 't.id', - ]; - } - - - /** - * @return string - */ - protected function getBaseEntity() - { - return TrackTagGroupAllowedTag::class; - } - - /** - * @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 - ) - { - $query = $this->getEntityManager() - ->createQueryBuilder() - ->select("t") - ->from(TrackTagGroupAllowedTag::class, "t") - ->innerJoin('t.tag', 'tg') - ->innerJoin('t.track_tag_group', 'g') - ->innerJoin('g.summit', 's') - ->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 - ); - } -} \ No newline at end of file diff --git a/app/Security/CompanyScopes.php b/app/Security/CompanyScopes.php deleted file mode 100644 index 6083ff5f..00000000 --- a/app/Security/CompanyScopes.php +++ /dev/null @@ -1,23 +0,0 @@ -client = $client; - $this->summit = $summit; - } - - /** - * @param string $url - * @return array - * @throws Exception - */ - protected function get(string $url):array { - try { - $response = $this->client->get($url); - - if ($response->getStatusCode() !== 200) - throw new Exception('invalid status code!'); - - $json = $response->getBody()->getContents(); - Log::debug(sprintf("AbstractExternalFeed get from %s - %s", $url, $json)); - $res = json_decode($json, true); - return $res ?? []; - } - catch(RequestException $ex){ - Log::warning($ex->getMessage()); - throw $ex; - } - } - - /** - * @param null|string $content - * @return string - */ - public static function convert2UTF8(?string $content):string{ - if(empty($content)) return ''; - if(!mb_check_encoding($content, 'UTF-8') - OR !($content === mb_convert_encoding(mb_convert_encoding($content, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { - $content = mb_convert_encoding($content, 'UTF-8'); - } - return $content; - } - -} \ No newline at end of file diff --git a/app/Services/Apis/AbstractOAuth2Api.php b/app/Services/Apis/AbstractOAuth2Api.php deleted file mode 100644 index 7af912ae..00000000 --- a/app/Services/Apis/AbstractOAuth2Api.php +++ /dev/null @@ -1,114 +0,0 @@ -cacheService = $cacheService; - } - - const SkewTime = 60; - const AccessTokenCacheKey = '%s_OAUTH2_ACCESS_TOKEN'; - - public abstract function getAppName():string; - - public function getIdpConfig():array { - return [ - 'authorization_endpoint' => Config::get("idp.authorization_endpoint"), - 'token_endpoint' => Config::get("idp.token_endpoint"), - ]; - } - - /** - * @return array - */ - public abstract function getAppConfig():array; - - /** - * @return GenericProvider - */ - private function getIDPClient():GenericProvider { - return OAuth2ClientFactory::build - ( - $this->getIdpConfig(), - $this->getAppConfig() - ); - } - - /** - * @return string - */ - private function getAccessTokenCacheKey():string{ - return sprintf(self::AccessTokenCacheKey, $this->getAppName()); - } - - /** - * @return string|null - * @throws \League\OAuth2\Client\Provider\Exception\IdentityProviderException - */ - protected function getAccessToken():?string{ - Log::debug("AbstractOAuth2Api::getAccessToken"); - $token = $this->cacheService->getSingleValue($this->getAccessTokenCacheKey()); - if (empty($token)) { - try { - Log::debug("AbstractOAuth2Api::getAccessToken - access token is empty, getting new one"); - $client = $this->getIDPClient(); - $appConfig = $this->getAppConfig(); - $scopes = $appConfig['scopes'] ?? []; - Log::debug(sprintf( "AbstractOAuth2Api::getAccessToken - got scopes %s", $scopes)); - // Try to get an access token using the client credentials grant. - $accessToken = $client->getAccessToken('client_credentials', ['scope' => $scopes]); - $token = $accessToken->getToken(); - $expires_in = $accessToken->getExpires() - time(); - Log::debug(sprintf("AbstractOAuth2Api::getAccessToken - setting new access token %s expires in %s", $token, $expires_in)); - $ttl = $expires_in - self::SkewTime; - if($ttl < 0) - $ttl = $expires_in; - if($ttl > 0) { - Log::debug(sprintf("AbstractOAuth2Api::getAccessToken ttl %s", $ttl)); - $this->cacheService->setSingleValue($this->getAccessTokenCacheKey(), $token, $ttl); - } - } - catch (ClientException $ex){ - Log::warning($ex); - if($ex->getCode() == 401) { - // invalid token - $this->cacheService->delete($this->getAccessTokenCacheKey()); - } - throw $ex; - } - } - return $token; - } -} \ No newline at end of file diff --git a/app/Services/Apis/AddressInfo.php b/app/Services/Apis/AddressInfo.php deleted file mode 100644 index 9d34bf15..00000000 --- a/app/Services/Apis/AddressInfo.php +++ /dev/null @@ -1,64 +0,0 @@ -address = $address; - $this->address1 = $address1; - $this->zip_code = $zip_code; - $this->state = $state; - $this->city = $city; - $this->country = $country; - } - - public function getAddress(){ - return array($this->address,$this->address1); - } - - public function getZipCode(){ - return $this->zip_code; - } - - public function getState(){ - return $this->state; - } - - public function getCity(){ - return $this->city; - } - - public function getCountry(){ - return $this->country; - } -} \ No newline at end of file diff --git a/app/Services/Apis/CalendarSync/AbstractCalendarSyncRemoteFacade.php b/app/Services/Apis/CalendarSync/AbstractCalendarSyncRemoteFacade.php deleted file mode 100644 index fd203daa..00000000 --- a/app/Services/Apis/CalendarSync/AbstractCalendarSyncRemoteFacade.php +++ /dev/null @@ -1,42 +0,0 @@ -sync_calendar_info = $sync_calendar_info; - } - - /** - * @return mixed - */ - abstract public function getSleepInterval(); -} \ No newline at end of file diff --git a/app/Services/Apis/CalendarSync/CalendarSyncRemoteFacadeFactory.php b/app/Services/Apis/CalendarSync/CalendarSyncRemoteFacadeFactory.php deleted file mode 100644 index 4653ada4..00000000 --- a/app/Services/Apis/CalendarSync/CalendarSyncRemoteFacadeFactory.php +++ /dev/null @@ -1,47 +0,0 @@ -getProvider()) { - case CalendarSyncInfo::ProviderGoogle: - return new GoogleCalendarSyncRemoteFacade($sync_calendar_info); - break; - case CalendarSyncInfo::ProvideriCloud: - return new ICloudCalendarSyncRemoteFacade($sync_calendar_info); - break; - case CalendarSyncInfo::ProviderOutlook: - return new OutlookCalendarSyncRemoteFacade($sync_calendar_info); - break; - } - return null; - } - catch (\Exception $ex){ - Log::warning($ex); - return null; - } - } -} \ No newline at end of file diff --git a/app/Services/Apis/CalendarSync/Exceptions/RateLimitExceededException.php b/app/Services/Apis/CalendarSync/Exceptions/RateLimitExceededException.php deleted file mode 100644 index e763f6c7..00000000 --- a/app/Services/Apis/CalendarSync/Exceptions/RateLimitExceededException.php +++ /dev/null @@ -1,23 +0,0 @@ -client = new \Google_Client(); - $this->client->setClientId(Config::get("google_api.google_client_id")); - $this->client->setClientSecret(Config::get("google_api.google_client_secret")); - //$this->client->setRedirectUri(Config::get("google_api.google_redirect_url")); - $this->client->setScopes(explode(',', Config::get("google_api.google_scopes"))); - $this->client->setApprovalPrompt('force'); - $this->client->setAccessType('offline'); - $this->client->setAccessToken($sync_calendar_info->getAccessToken()); - $this->checkAccessToken(); - } - - private function checkAccessToken(){ - if($this->client->isAccessTokenExpired()) - { - $creds = $this->client->fetchAccessTokenWithRefreshToken($this->sync_calendar_info->getRefreshToken()); - $access_token = isset($creds['access_token']) ? $creds['access_token'] : null; - $refresh_token = isset($creds['refresh_token']) ? $creds['refresh_token'] : null; - - if(!empty($access_token)) { - $this->sync_calendar_info->setAccessToken($creds); - } - - if(!empty($refresh_token)) - $this->sync_calendar_info->setRefreshToken($refresh_token); - } - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @throws RateLimitExceededException - * @throws Google_Service_Exception - * @throws RevokedAccessException - * @return ScheduleCalendarSyncInfo - */ - public function addEvent(MemberEventScheduleSummitActionSyncWorkRequest $request) - { - try { - $this->checkAccessToken(); - $service = new Google_Service_Calendar($this->client); - $summit_event = $request->getSummitEvent(); - $vo = $this->buildEventVO($summit_event); - $calendar_id = $this->sync_calendar_info->getExternalId(); - $created_event = $service->events->insert($calendar_id, $vo); - - // new schedule sync info - $sync_info = new ScheduleCalendarSyncInfo(); - // primitives - $sync_info->setEtag($created_event->getEtag()); - $sync_info->setExternalId($created_event->getId()); - $sync_info->setExternalUrl($created_event->getHtmlLink()); - // relationships - $sync_info->setSummitEventId($summit_event->getId()); - $sync_info->setCalendarSyncInfo($this->sync_calendar_info); - $sync_info->setLocationId($summit_event->getLocationId()); - return $sync_info; - } - catch(Google_Service_Exception $ex1){ - if($ex1->getCode() == 403) { - $errors = $ex1->getErrors(); - if(count($errors) == 0 ) return false; - $errors = $errors[0]; - $reason = isset($errors['reason']) ? $errors['reason'] : ''; - if($reason == self::ReasonForbidden) { - Log::warning($ex1); - return false; - } - if($reason == self::ReasonRateLimit) { - Log::error($ex1); - throw new RateLimitExceededException($ex1->getMessage(), $ex1->getCode()); - } - return false; - } - if($ex1->getCode() == 401){ - throw new RevokedAccessException($ex1->getMessage()); - } - Log::warning($ex1); - return null; - } - catch (Exception $ex){ - Log::error($ex); - return null; - } - } - - /** - * @param SummitEvent $summit_event - * @param bool $update - * @return Google_Service_Calendar_Event - */ - private function buildEventVO(SummitEvent $summit_event, $update = false){ - $vo = new Google_Service_Calendar_Event(); - $title = $summit_event->getTitle(); - if($update) $title = "{$title} [UPDATED]"; - $vo->setSummary($title); - $vo->setDescription($summit_event->getAbstract()); - - $location = null; - - if($summit_event->hasLocation()){ - $venue = $summit_event->getLocation(); - $room = null; - if($venue instanceof SummitVenueRoom){ - $room = $venue; - $venue = $venue->getVenue(); - } - if($venue instanceof SummitGeoLocatedLocation) { - $location = $venue->getFullAddress($room); - } - } - - if(!empty($location)) - $vo->setLocation($location); - - // dates - - $time_zone = $summit_event->getSummit()->getTimeZone()->getName(); - $start = new Google_Service_Calendar_EventDateTime(); - $start->setDateTime($summit_event->getLocalStartDate()->format(DateTime::RFC3339)); - $start->setTimeZone($time_zone); - $vo->setStart($start); - - $end = new Google_Service_Calendar_EventDateTime(); - $end->setDateTime($summit_event->getLocalEndDate()->format(DateTime::RFC3339)); - $end->setTimeZone($time_zone); - $vo->setEnd($end); - - return $vo; - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @param ScheduleCalendarSyncInfo $schedule_sync_info - * @throws RateLimitExceededException - * @throws RevokedAccessException - * @throws Google_Service_Exception - * @return bool - */ - public function deleteEvent - ( - MemberEventScheduleSummitActionSyncWorkRequest $request, - ScheduleCalendarSyncInfo $schedule_sync_info - ) - { - try{ - $this->checkAccessToken(); - $service = new Google_Service_Calendar($this->client); - $calendar_id = $this->sync_calendar_info->getExternalId(); - $res = $service->events->delete($calendar_id, $schedule_sync_info->getExternalId()); - if(!$res instanceof Response) return false; - return $res->getStatusCode() == 204; - } - catch(Google_Service_Exception $ex1){ - if($ex1->getCode() == 403) { - $errors = $ex1->getErrors(); - if(count($errors) == 0 ) return false; - $errors = $errors[0]; - $reason = isset($errors['reason']) ? $errors['reason'] : ''; - if($reason == self::ReasonForbidden) { - Log::warning($ex1); - return false; - } - if($reason == self::ReasonRateLimit) { - Log::error($ex1); - throw new RateLimitExceededException($ex1->getMessage(), $ex1->getCode()); - } - return false; - } - if($ex1->getCode() == 401){ - throw new RevokedAccessException($ex1->getMessage()); - } - Log::warning($ex1); - return false; - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @param ScheduleCalendarSyncInfo $schedule_sync_info - * @throws RateLimitExceededException - * @throws RevokedAccessException - * @throws Google_Service_Exception - * @return bool - */ - public function updateEvent - ( - MemberEventScheduleSummitActionSyncWorkRequest $request, - ScheduleCalendarSyncInfo $schedule_sync_info - ) - { - try{ - $this->checkAccessToken(); - $service = new Google_Service_Calendar($this->client); - $summit_event = $request->getSummitEvent(); - $vo = $this->buildEventVO($summit_event, true); - $calendar_id = $this->sync_calendar_info->getExternalId(); - - $updated_event = $service->events->update($calendar_id, $schedule_sync_info->getExternalId(), $vo); - // primitives - $schedule_sync_info->setEtag($updated_event->getEtag()); - // relationships - $schedule_sync_info->setLocationId($summit_event->getLocationId()); - - return true; - } - catch(Google_Service_Exception $ex1){ - if($ex1->getCode() == 403) { - $errors = $ex1->getErrors(); - if(count($errors) == 0 ) return false; - $errors = $errors[0]; - $reason = isset($errors['reason']) ? $errors['reason'] : ''; - if($reason == self::ReasonForbidden) { - Log::warning($ex1); - return false; - } - if($reason == self::ReasonRateLimit) { - Log::error($ex1); - throw new RateLimitExceededException($ex1->getMessage(), $ex1->getCode()); - } - return false; - } - if($ex1->getCode() == 401){ - throw new RevokedAccessException($ex1->getMessage()); - } - Log::warning($ex1); - return false; - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberCalendarScheduleSummitActionSyncWorkRequest $request - * @param CalendarSyncInfo $calendar_sync_info - * @throws RateLimitExceededException - * @throws RevokedAccessException - * @throws Google_Service_Exception - * @return bool - */ - public function createCalendar - ( - MemberCalendarScheduleSummitActionSyncWorkRequest $request, - CalendarSyncInfo $calendar_sync_info - ) - { - try { - $this->checkAccessToken(); - $service = new Google_Service_Calendar($this->client); - $google_calendar = new Google_Service_Calendar_Calendar($this->client); - $google_calendar->setSummary($request->getCalendarName()); - $google_calendar->setDescription($request->getCalendarDescription()); - $google_calendar->setTimeZone($calendar_sync_info->getSummit()->getTimeZone()->getName()); - $created_calendar = $service->calendars->insert($google_calendar); - $calendar_id = $created_calendar->getId(); - Log::info(sprintf("GoogleCalendarSyncRemoteFacade::createCalendar: calendarId %s", $calendar_id)); - $this->sync_calendar_info->setExternalId($calendar_id); - $this->sync_calendar_info->setEtag($created_calendar->getEtag()); - return true; - } - catch(Google_Service_Exception $ex1){ - if($ex1->getCode() == 403) { - $errors = $ex1->getErrors(); - if(count($errors) == 0 ) return false; - $errors = $errors[0]; - $reason = isset($errors['reason']) ? $errors['reason'] : ''; - if($reason == self::ReasonForbidden) { - Log::warning($ex1); - return false; - } - if($reason == self::ReasonRateLimit) { - Log::error($ex1); - throw new RateLimitExceededException($ex1->getMessage(), $ex1->getCode()); - } - return false; - } - if($ex1->getCode() == 401){ - throw new RevokedAccessException($ex1->getMessage()); - } - Log::warning($ex1); - return false; - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberCalendarScheduleSummitActionSyncWorkRequest $request - * @param CalendarSyncInfo $calendar_sync_info - * @throws RateLimitExceededException - * @throws RevokedAccessException - * @throws Google_Service_Exception - * @return bool - */ - public function deleteCalendar - ( - MemberCalendarScheduleSummitActionSyncWorkRequest $request, - CalendarSyncInfo $calendar_sync_info - ) - { - try { - $this->checkAccessToken(); - $service = new Google_Service_Calendar($this->client); - Log::info(sprintf("GoogleCalendarSyncRemoteFacade::deleteCalendar: calendarId %s", $calendar_sync_info->getExternalId())); - $res = $service->calendars->delete($calendar_sync_info->getExternalId()); - if(!$res instanceof Response) return false; - return $res->getStatusCode() == 204; - } - catch(Google_Service_Exception $ex1){ - if($ex1->getCode() == 403) { - $errors = $ex1->getErrors(); - if(count($errors) == 0 ) return false; - $errors = $errors[0]; - $reason = isset($errors['reason']) ? $errors['reason'] : ''; - if($reason == self::ReasonForbidden) { - Log::warning($ex1); - return false; - } - if($reason == self::ReasonRateLimit) { - Log::error($ex1); - throw new RateLimitExceededException($ex1->getMessage(), $ex1->getCode()); - } - return false; - } - if($ex1->getCode() == 401){ - throw new RevokedAccessException($ex1->getMessage()); - } - Log::warning($ex1); - return false; - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @return mixed - */ - public function getSleepInterval() - { - return 500; - } -} \ No newline at end of file diff --git a/app/Services/Apis/CalendarSync/ICalendarSyncRemoteFacade.php b/app/Services/Apis/CalendarSync/ICalendarSyncRemoteFacade.php deleted file mode 100644 index 26bd6e3a..00000000 --- a/app/Services/Apis/CalendarSync/ICalendarSyncRemoteFacade.php +++ /dev/null @@ -1,60 +0,0 @@ -client = new CalDavClient( - $this->sync_calendar_info->getServer(), - $this->sync_calendar_info->getUserName(), - $this->sync_calendar_info->getUserPassword() - ); - } - - /** - * @param $prod_id - * @param SummitEvent $summit_event - * @param bool $update - * @return EventRequestVO - */ - private function buildEventVO($prod_id, SummitEvent $summit_event, $update = false){ - $location_name = null; - $location_title = null; - $location_lat = null; - $location_lng = null; - - if($summit_event->hasLocation()){ - $venue = $summit_event->getLocation(); - $room = null; - if($venue instanceof SummitVenueRoom){ - $room = $venue; - $venue = $venue->getVenue(); - } - $location_full_name = $venue->getName(); - if(!is_null($room)){ - if($room->hasFloor()){ - $location_full_name .= ' - '.$room->getFloor()->getName(); - } - $location_full_name .= ' - '.$room->getName(); - } - - $location_name = $location_full_name; - $location_title = $location_full_name; - if($venue instanceof SummitGeoLocatedLocation) { - $location_lat = $venue->getLat(); - $location_lng = $venue->getLng(); - } - } - - $title = $summit_event->getTitle(); - if($update) $title = "{$title} [UPDATED]"; - return new EventRequestVO( - $prod_id, - $title, - $summit_event->getAbstract(), - $summit_event->getSocialSummary(), - $summit_event->getLocalStartDate(), - $summit_event->getLocalEndDate(), - $summit_event->getSummit()->getTimeZone(), - $location_name, - $location_title, - $location_lat, - $location_lng - ); - } - - /** - * @param string $calendar_url - * @param string $event_url - * @return array - */ - private function getEventInfo($calendar_url, $event_url){ - $etag = null; - $vcard = null; - - try { - - $relative_resource_url = parse_url($event_url, PHP_URL_PATH); - - $events_response = $this->client->getEventsBy - ( - $calendar_url, [ - $relative_resource_url - ]); - - if ($events_response->isSuccessFull() && count($events_response->getResponses()) > 0) { - $etag = $events_response->getResponses()[0]->getETag(); - $vcard = $events_response->getResponses()[0]->getVCard(); - } - } - catch (\Exception $ex){ - - } - return [$etag, $vcard]; - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @return ScheduleCalendarSyncInfo|null - * @throws RevokedAccessException - * @throws \GuzzleHttp\Exception\GuzzleException - */ - public function addEvent(MemberEventScheduleSummitActionSyncWorkRequest $request) - { - try { - $summit_event = $request->getSummitEvent(); - $calendar_url = $this->sync_calendar_info->getCalendarUrl(); - $vo = $this->buildEventVO($this->sync_calendar_info->getCalendarDisplayName(), $summit_event); - $res = $this->client->createEvent( - $calendar_url, - $vo - ); - - $etag = $res->getETag(); - $vcard = ""; - - if (empty($etag)) { - list($etag, $vcard) = $this->getEventInfo($calendar_url, $res->getResourceUrl()); - } - - $sync_info = new ScheduleCalendarSyncInfo(); - // primitives - $sync_info->setEtag($etag); - $sync_info->setExternalId($res->getUid()); - $sync_info->setExternalUrl($res->getResourceUrl()); - $sync_info->setVCard($vcard); - // relationships - $sync_info->setSummitEventId($summit_event->getId()); - $sync_info->setCalendarSyncInfo($this->sync_calendar_info); - $sync_info->setLocationId($summit_event->getLocationId()); - - return $sync_info; - } - catch(UserUnAuthorizedException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (ConflictException $ex2){ - Log::warning($ex2); - if(strpos($ex2->getMessage(), self::NonExistParentConflict) != false) - throw new RevokedAccessException($ex2->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return null; - } - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @param ScheduleCalendarSyncInfo $schedule_sync_info - * @return bool - * @throws RevokedAccessException - * @throws \GuzzleHttp\Exception\GuzzleException - */ - public function updateEvent - ( - MemberEventScheduleSummitActionSyncWorkRequest $request, - ScheduleCalendarSyncInfo $schedule_sync_info - ) - { - try { - $summit_event = $request->getSummitEvent(); - $calendar_url = $this->sync_calendar_info->getCalendarUrl(); - $vo = $this->buildEventVO($this->sync_calendar_info->getCalendarDisplayName(), $summit_event, true); - $vo->setUID($schedule_sync_info->getExternalId()); - $res = $this->client->updateEvent( - $calendar_url, - $vo - ); - - $etag = $res->getETag(); - $vcard = ""; - - if (empty($etag)) { - list($etag, $vcard) = $this->getEventInfo($calendar_url, $res->getResourceUrl()); - } - - // primitives - $schedule_sync_info->setEtag($etag); - $schedule_sync_info->setVCard($vcard); - // relationships - $schedule_sync_info->setLocationId($summit_event->getLocationId()); - return true; - } - catch(UserUnAuthorizedException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (ConflictException $ex2){ - Log::warning($ex2); - if(strpos($ex2->getMessage(), self::NonExistParentConflict) != false) - throw new RevokedAccessException($ex2->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @param ScheduleCalendarSyncInfo $schedule_sync_info - * @return bool - * @throws RevokedAccessException - * @throws \GuzzleHttp\Exception\GuzzleException - */ - public function deleteEvent(MemberEventScheduleSummitActionSyncWorkRequest $request, ScheduleCalendarSyncInfo $schedule_sync_info) - { - try{ - if(empty($schedule_sync_info->getEtag())) return false; - - $res = $this->client->deleteEvent - ( - $this->sync_calendar_info->getCalendarUrl(), - $schedule_sync_info->getExternalId() - ); - - return $res->isSuccessFull(); - } - catch(UserUnAuthorizedException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (ConflictException $ex2){ - Log::warning($ex2); - if(strpos($ex2->getMessage(), self::NonExistParentConflict) != false) - throw new RevokedAccessException($ex2->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberCalendarScheduleSummitActionSyncWorkRequest $request - * @param CalendarSyncInfo $calendar_sync_info - * @return bool - * @throws RevokedAccessException - * @throws \GuzzleHttp\Exception\GuzzleException - */ - public function createCalendar(MemberCalendarScheduleSummitActionSyncWorkRequest $request, CalendarSyncInfo $calendar_sync_info) - { - try{ - try { - // get calendar home url - $user_ppal_url = $this->sync_calendar_info->getUserPrincipalUrl(); - $res = $this->client->getCalendarHome - ( - $user_ppal_url - ); - $calendar_home = $res->getCalendarHomeSetUrl(); - $real_server = $res->getRealCalDAVHost(); - - // make calendar - $summit = $this->sync_calendar_info->getSummit(); - $calendar_url = $this->client->createCalendar($calendar_home, - new MakeCalendarRequestVO( - $request->getCalendarId(), - $request->getCalendarName(), - $request->getCalendarDescription(), - $summit->getTimeZone() - ) - ); - $calendar_url = rtrim($calendar_url, '/') . '/'; - } - catch(ForbiddenException $ex){ - // calendar already exists - $calendar_url = $calendar_home.'/'.$request->getCalendarId().'/'; - } - - $this->sync_calendar_info->setUserPrincipalUrl - ( - str_replace - ( - Config::get("apple_api.base_caldav_server"), - $real_server, - $user_ppal_url - ) - ); - - $this->sync_calendar_info->setCalendarDisplayName($request->getCalendarName()); - $this->sync_calendar_info->setExternalId($calendar_url); - - $res = $this->client->getCalendar($calendar_url); - $this->sync_calendar_info->setCalendarSyncToken($res->getSyncToken()); - return true; - } - catch(UserUnAuthorizedException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberCalendarScheduleSummitActionSyncWorkRequest $request - * @param CalendarSyncInfo $calendar_sync_info - * @return bool - * @throws RevokedAccessException - * @throws \GuzzleHttp\Exception\GuzzleException - */ - public function deleteCalendar(MemberCalendarScheduleSummitActionSyncWorkRequest $request, CalendarSyncInfo $calendar_sync_info) - { - try { - $this->client->deleteCalendar($this->sync_calendar_info->getExternalId()); - return true; - } - catch(UserUnAuthorizedException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @return mixed - */ - public function getSleepInterval() - { - return 500; - } -} \ No newline at end of file diff --git a/app/Services/Apis/CalendarSync/OutlookCalendarSyncRemoteFacade.php b/app/Services/Apis/CalendarSync/OutlookCalendarSyncRemoteFacade.php deleted file mode 100644 index 61c7cf0c..00000000 --- a/app/Services/Apis/CalendarSync/OutlookCalendarSyncRemoteFacade.php +++ /dev/null @@ -1,327 +0,0 @@ -client = new OutlookRestClient(); - $this->client->setAccessToken($sync_calendar_info->getAccessToken()); - $this->client->setTokenCallback(function($access_token){ - - $this->sync_calendar_info->setAccessToken($access_token); - - if(isset($access_token['refresh_token'])) - $this->sync_calendar_info->setRefreshToken($access_token['refresh_token']); - }); - - } - - - /** - * @param SummitEvent $summit_event - * @param bool $update - * @return EventVO - */ - private function buildEventVO(SummitEvent $summit_event, $update = false){ - - try { - $location_name = null; - $location_title = null; - $location_lat = null; - $location_lng = null; - $location_street = null; - $location_city = null; - $location_state = null; - $location_country = null; - $location_postal_code = null; - - if ($summit_event->hasLocation()) { - $venue = $summit_event->getLocation(); - $room = null; - if ($venue instanceof SummitVenueRoom) { - $room = $venue; - $venue = $venue->getVenue(); - } - $location_full_name = $venue->getName(); - if (!is_null($room)) { - if ($room->hasFloor()) { - $location_full_name .= ', ' . $room->getFloor()->getName(); - } - $location_full_name .= ', ' . $room->getName(); - } - - $location_name = $location_full_name; - $location_title = $location_full_name; - if ($venue instanceof SummitGeoLocatedLocation) { - $location_lat = $venue->getLat(); - $location_lng = $venue->getLng(); - $location_street = $venue->getAddress1(); - $location_city = $venue->getCity(); - $location_state = $venue->getState(); - $location_country = $venue->getCountry(); - $location_postal_code = $venue->getZipCode(); - } - } - $title = $summit_event->getTitle(); - if($update) $title = "{$title} [UPDATED]"; - return new EventVO( - $title, - $summit_event->getAbstract(), - $summit_event->getLocalStartDate(), - $summit_event->getLocalEndDate(), - $summit_event->getSummit()->getTimeZone(), - new LocationVO - ( - $location_name, - new AddressVO - ( - $location_street, - $location_city, - $location_state, - $location_country, - $location_postal_code - ), - $location_lat, - $location_lng - ) - ); - } - catch (Exception $ex){ - Log::error($ex); - return null; - } - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @return ScheduleCalendarSyncInfo - * @throws RevokedAccessException - */ - public function addEvent(MemberEventScheduleSummitActionSyncWorkRequest $request) - { - try { - $summit_event = $request->getSummitEvent(); - $vo = $this->buildEventVO($summit_event); - if(is_null($vo)) throw new LogicException(); - $calendar_id = $this->sync_calendar_info->getExternalId(); - $created_event = $this->client->createEvent($calendar_id, $vo); - // new schedule sync info - $sync_info = new ScheduleCalendarSyncInfo(); - // primitives - $sync_info->setEtag($created_event->getEtag()); - $sync_info->setExternalId($created_event->getId()); - $sync_info->setExternalUrl($created_event->getDataId()); - // relationships - $sync_info->setSummitEventId($summit_event->getId()); - $sync_info->setCalendarSyncInfo($this->sync_calendar_info); - $sync_info->setLocationId($summit_event->getLocationId()); - return $sync_info; - } - catch (LogicException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return null; - } - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @param ScheduleCalendarSyncInfo $schedule_sync_info - * @return bool - * @throws RevokedAccessException - */ - public function deleteEvent - ( - MemberEventScheduleSummitActionSyncWorkRequest $request, - ScheduleCalendarSyncInfo $schedule_sync_info - ) - { - try { - $res = $this->client->deleteEvent($schedule_sync_info->getExternalId()); - return !($res instanceof ErrorResponse); - } - catch (LogicException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberEventScheduleSummitActionSyncWorkRequest $request - * @param ScheduleCalendarSyncInfo $schedule_sync_info - * @return bool - * @throws RevokedAccessException - */ - public function updateEvent - ( - MemberEventScheduleSummitActionSyncWorkRequest $request, - ScheduleCalendarSyncInfo $schedule_sync_info - ) - { - try { - $summit_event = $request->getSummitEvent(); - $vo = $this->buildEventVO($summit_event, true); - if(is_null($vo)) throw new LogicException(); - $event_id = $schedule_sync_info->getExternalId(); - $updated_event = $this->client->updateEvent($event_id, $vo); - // primitives - $schedule_sync_info->setEtag($updated_event->getEtag()); - // relationships - $schedule_sync_info->setLocationId($summit_event->getLocationId()); - return true; - } - catch (LogicException $ex1){ - Log::warning($ex1); - throw new RevokedAccessException($ex1->getMessage()); - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberCalendarScheduleSummitActionSyncWorkRequest $request - * @param CalendarSyncInfo $calendar_sync_info - * @return bool - */ - public function createCalendar - ( - MemberCalendarScheduleSummitActionSyncWorkRequest $request, - CalendarSyncInfo $calendar_sync_info - ) - { - try { - $res = $this->client->createCalendar(new CalendarVO - ( - $request->getCalendarName() - )); - - if ($res instanceof CalendarResponse) { - - $this->sync_calendar_info->setExternalId($res->getId()); - $this->sync_calendar_info->setEtag($res->getChangeKey()); - return true; - } - return false; - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @param MemberCalendarScheduleSummitActionSyncWorkRequest $request - * @param CalendarSyncInfo $calendar_sync_info - * @return bool - */ - public function deleteCalendar - ( - MemberCalendarScheduleSummitActionSyncWorkRequest $request, - CalendarSyncInfo $calendar_sync_info - ) - { - try { - $calendar_id = $calendar_sync_info->getExternalId(); - $counter = 1; - do { - $res = $this->client->deleteCalendar($calendar_id); - $deleted = is_bool($res) ? $res : false; - if ($res instanceof ErrorResponse) { - log::warning(sprintf("OutlookCalendarSyncRemoteFacade::deleteCalendar: error deleting calendar id %s", $calendar_id)); - if($res->getErrorCode() == "ErrorItemNotFound"){ - log::info("OutlookCalendarSyncRemoteFacade::deleteCalendar: ErrorItemNotFound"); - break; - } - // @see https://stackoverflow.com/questions/31923669/office-365-unified-api-error-when-deleting-a-calendar - // @see https://stackoverflow.com/questions/44597230/office365-calendar-rest-api-cannot-delete-calendars - // change name ... - log::info(sprintf("OutlookCalendarSyncRemoteFacade::deleteCalendar: renaming calendar id %s", $calendar_id)); - $this->client->updateCalendar($calendar_id, new CalendarVO( - md5(uniqid(mt_rand(), true)) - )); - $exp = $this->getSleepInterval() * (pow(2, $counter) - 1); - log::info(sprintf("OutlookCalendarSyncRemoteFacade::deleteCalendar: retrying calendar id %s on %s ms", $calendar_id, $exp)); - usleep($exp); - } - ++$counter; - if($counter == self::MaxRetriesAttempt){ - log::warning(sprintf("OutlookCalendarSyncRemoteFacade::deleteCalendar: error deleting calendar id %s (MaxRetriesAttempt reached !)", $calendar_id)); - break; - } - } while (!$deleted); - return $deleted; - } - catch (Exception $ex){ - Log::error($ex); - return false; - } - } - - /** - * @return mixed - */ - public function getSleepInterval() - { - return 500; - } -} \ No newline at end of file diff --git a/app/Services/Apis/EventbriteAPI.php b/app/Services/Apis/EventbriteAPI.php deleted file mode 100644 index 85c1a2ff..00000000 --- a/app/Services/Apis/EventbriteAPI.php +++ /dev/null @@ -1,117 +0,0 @@ -auth_info = $auth_info; - } - - /** - * @param string $api_url - * @param array $params - * @return mixed - * @throws Exception - */ - public function getEntity($api_url, array $params) - { - try { - if (strstr($api_url, self::BaseUrl) === false) - throw new Exception('invalid base url!'); - - $client = new Client(); - - $query = [ - 'token' => $this->auth_info['token'] - ]; - - foreach ($params as $param => $value) { - $query[$param] = $value; - } - - $response = $client->get($api_url, [ - 'query' => $query - ] - ); - - if ($response->getStatusCode() !== 200) - throw new Exception('invalid status code!'); - - $content_type = $response->getHeaderLine('content-type'); - - if (empty($content_type)) - throw new Exception('invalid content type!'); - - if ($content_type !== 'application/json') - throw new Exception('invalid content type!'); - - $json = $response->getBody()->getContents(); - return json_decode($json, true); - } - catch(RequestException $ex){ - Log::warning($ex->getMessage()); - throw $ex; - } - } - - /** - * @param string $order_id - * @return mixed - */ - public function getOrder($order_id) - { - $order_id = intval($order_id); - $url = sprintf('%s/orders/%s', self::BaseUrl, $order_id); - return $this->getEntity($url, ['expand' => 'attendees']); - } - - /** - * @param Summit $summit - * @return mixed - */ - public function getTicketTypes(Summit $summit){ - $event_id = $summit->getExternalSummitId(); - $url = sprintf('%s/events/%s', self::BaseUrl, $event_id); - return $this->getEntity($url, ['expand' => 'ticket_classes']); - } - - /** - * @param Summit $summit - * @param int $page_nbr - * @param string $expand - * @return mixed - */ - public function getAttendees(Summit $summit, $page_nbr, $expand = 'promotional_code'){ - $event_id = $summit->getExternalSummitId(); - $url = sprintf('%s/events/%s/attendees', self::BaseUrl, $event_id); - return $this->getEntity($url, ['expand' => $expand, 'page' => $page_nbr]); - } -} \ No newline at end of file diff --git a/app/Services/Apis/ExternalRegistrationFeeds/ExternalRegistrationFeedFactory.php b/app/Services/Apis/ExternalRegistrationFeeds/ExternalRegistrationFeedFactory.php deleted file mode 100644 index 429ef50d..00000000 --- a/app/Services/Apis/ExternalRegistrationFeeds/ExternalRegistrationFeedFactory.php +++ /dev/null @@ -1,40 +0,0 @@ -getExternalRegistrationFeedType()){ - case ISummitExternalRegistrationFeedType::Eventbrite: - return new EventbriteRegistrationFeed($summit, $client); - break; - } - return null; - } -} \ No newline at end of file diff --git a/app/Services/Apis/ExternalRegistrationFeeds/IExternalRegistrationFeed.php b/app/Services/Apis/ExternalRegistrationFeeds/IExternalRegistrationFeed.php deleted file mode 100644 index 6cf1b661..00000000 --- a/app/Services/Apis/ExternalRegistrationFeeds/IExternalRegistrationFeed.php +++ /dev/null @@ -1,26 +0,0 @@ -summit->getExternalRegistrationFeedApiKey(); - $eventId = $this->summit->getExternalSummitId(); - - if (empty($apiFeedKey)) { - Log::warning(sprintf("external_registration_feed_api_key is empty for summit %s", $this->summit->getId())); - return null; - } - if (empty($eventId)) { - Log::warning(sprintf("external_summit_id is empty for summit %s", $this->summit->getId())); - return null; - } - - $api = new EventbriteAPI(); - $api->setCredentials([ - 'token' => $apiFeedKey - ]); - - return new EventbriteRegistrationFeedResponse($api->getAttendees($this->summit, $page_nbr, 'promotional_code,order,ticket_class')); - - } - catch(RequestException $ex){ - Log::warning($ex->getMessage()); - throw $ex; - } - } -} \ No newline at end of file diff --git a/app/Services/Apis/ExternalRegistrationFeeds/implementations/EventbriteRegistrationFeedResponse.php b/app/Services/Apis/ExternalRegistrationFeeds/implementations/EventbriteRegistrationFeedResponse.php deleted file mode 100644 index f1897fdc..00000000 --- a/app/Services/Apis/ExternalRegistrationFeeds/implementations/EventbriteRegistrationFeedResponse.php +++ /dev/null @@ -1,70 +0,0 @@ -position = 0; - $this->data = $data; - - if(isset($data['attendees'])) - $this->attendees = $data['attendees']; - } - - public function rewind() { - $this->position = 0; - } - - public function current() { - return $this->attendees[$this->position]; - } - - public function key() { - return $this->position; - } - - public function next() { - ++$this->position; - } - - public function valid() { - return isset($this->attendees[$this->position]); - } - - public function hasData(): bool - { - if (!isset($this->data ['pagination'])) return false; - if (!isset($this->data ['attendees'])) return false; - return true; - } - - public function hasMoreItems(): bool - { - if (!isset($this->data['pagination'])) return false; - $pagination = $this->data['pagination']; - return boolval($pagination['has_more_items']); - } -} \ No newline at end of file diff --git a/app/Services/Apis/ExternalScheduleFeeds/AbstractExternalScheduleFeed.php b/app/Services/Apis/ExternalScheduleFeeds/AbstractExternalScheduleFeed.php deleted file mode 100644 index 17037b09..00000000 --- a/app/Services/Apis/ExternalScheduleFeeds/AbstractExternalScheduleFeed.php +++ /dev/null @@ -1,25 +0,0 @@ -getApiFeedType()){ - case ISummitExternalScheduleFeedType::SchedType: - return new SchedScheduleFeed($summit, $client); - case ISummitExternalScheduleFeedType::VanderpoelType: - return new VanderpoelScheduleFeed($summit, $client); - } - return null; - } -} \ No newline at end of file diff --git a/app/Services/Apis/ExternalScheduleFeeds/IExternalScheduleFeed.php b/app/Services/Apis/ExternalScheduleFeeds/IExternalScheduleFeed.php deleted file mode 100644 index 8773d01b..00000000 --- a/app/Services/Apis/ExternalScheduleFeeds/IExternalScheduleFeed.php +++ /dev/null @@ -1,24 +0,0 @@ -summit->getApiFeedUrl(); - $apiFeedKey = $this->summit->getApiFeedKey(); - - if(empty($apiFeedUrl)) { - Log::warning(sprintf("api_feeed_url is empty for summit %s", $this->summit->getId())); - return []; - } - if(empty($apiFeedKey)) { - Log::warning(sprintf("api_feeed_key is empty for summit %s", $this->summit->getId())); - return []; - } - $url = sprintf("%s/api/session/list?api_key=%s&format=json", $apiFeedUrl, $apiFeedKey); - $response = $this->get($url); - $timezone = $this->summit->getTimeZone(); - $events = []; - foreach($response as $event){ - // Y-m-d H:i:s - $event_start = DateTime::createFromFormat('Y-m-d H:i:s', $event['event_start'], $timezone); - // Y-m-d H:i:s - $event_end = DateTime::createFromFormat('Y-m-d H:i:s', $event['event_end'], $timezone); - $speakers = []; - if(isset($event['speakers'])){ - foreach(explode(',', trim($event['speakers'])) as $speaker_full_name){ - $speakers[] = trim($speaker_full_name);; - } - } - - $events[] = [ - 'external_id' => trim($event['event_key']), - 'title' => isset($event['name']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($event['name'])) : '', - 'abstract' => isset($event['description']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($event['description'])) : '', - 'track' => isset($event['event_type']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($event['event_type'])) : '', - 'location' => isset($event['venue']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($event['venue'])) : '', - "start_date" => $event_start->getTimestamp(), - "end_date" => $event_end->getTimestamp(), - 'speakers' => $speakers - ]; - } - return $events; - - } - - /** - * @return array - * @throws \Exception - */ - public function getSpeakers(): array - { - $apiFeedUrl = $this->summit->getApiFeedUrl(); - $apiFeedKey = $this->summit->getApiFeedKey(); - - if(empty($apiFeedUrl)) { - Log::warning(sprintf("api_feeed_url is empty for summit %s", $this->summit->getId())); - return []; - } - if(empty($apiFeedKey)) { - Log::warning(sprintf("api_feeed_key is empty for summit %s", $this->summit->getId())); - return []; - } - - $url = sprintf("%s/api/user/list?api_key=%s&format=json", $apiFeedUrl, $apiFeedKey); - $response = $this->get($url); - - $speakers = []; - foreach($response as $speaker){ - if(!isset($speaker['name'])) continue; - $speakerFullNameParts = explode(" ", AbstractExternalScheduleFeed::convert2UTF8($speaker['name'])); - $speakerLastName = trim(trim(array_pop($speakerFullNameParts))); - $speakerFirstName = trim(implode(" ", $speakerFullNameParts)); - $email = isset($speaker['email']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['email'])) : null; - - if(empty($email)) - $email = $this->getDefaultSpeakerEmail(trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['name']))); - - $speakers[trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['name']))] = [ - 'full_name' => trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['name'])), - 'first_name' => trim(AbstractExternalScheduleFeed::convert2UTF8($speakerFirstName)), - 'last_name' => trim(AbstractExternalScheduleFeed::convert2UTF8($speakerLastName)), - 'email' => AbstractExternalScheduleFeed::convert2UTF8($email), - 'company' => trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['company'])), - 'position' => trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['position'])), - 'avatar' => trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['avatar'])), - ]; - } - - return $speakers; - } - - public function getDefaultSpeakerEmail(string $speakerFullName): string - { - return sprintf("%s@sched.com", ltrim(str_replace(",", "",str_replace(" ", "",strtolower($speakerFullName)))), "."); - } -} \ No newline at end of file diff --git a/app/Services/Apis/ExternalScheduleFeeds/Implementations/VanderpoelScheduleFeed.php b/app/Services/Apis/ExternalScheduleFeeds/Implementations/VanderpoelScheduleFeed.php deleted file mode 100644 index 1dcbf06b..00000000 --- a/app/Services/Apis/ExternalScheduleFeeds/Implementations/VanderpoelScheduleFeed.php +++ /dev/null @@ -1,102 +0,0 @@ -summit->getApiFeedUrl(); - $apiFeedKey = $this->summit->getApiFeedKey(); - - if(empty($apiFeedUrl)) { - Log::warning(sprintf("api_feeed_url is empty for summit %s", $this->summit->getId())); - return []; - } - if(empty($apiFeedKey)) { - Log::warning(sprintf("api_feeed_key is empty for summit %s", $this->summit->getId())); - return []; - } - - $url = sprintf("%s/sessions/%s", $apiFeedUrl, $apiFeedKey); - $response = $this->get($url); - - $events = []; - foreach($response as $event){ - $speakers = []; - - if(isset($event['speakers'])){ - foreach($event['speakers'] as $speaker){ - $speakerFullName = trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['first_name'])).' '.trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['last_name'])); - $speakers[] = $speakerFullName; - if(!isset($this->speakers[$speakerFullName])) - $this->speakers[$speakerFullName] = [ - 'full_name' => $speakerFullName, - 'first_name' => trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['first_name'])), - 'last_name' => trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['last_name'])), - 'email' => $this->getDefaultSpeakerEmail($speakerFullName), - 'company' => isset($speaker['company']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['company'])): '', - 'position' => isset($speaker['job_title']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($speaker['job_title'])): '', - 'avatar' => isset($speaker['photo']) ? trim($speaker['photo']) : '', - ]; - } - } - - $track = isset($event["track"]) ? ucwords(str_replace($this::CHARS_TO_REMOVE, " ", trim($event["track"]))) : ''; - - $events[] = [ - 'external_id' => trim($event['id']), - 'title' => isset($event['title']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($event['title'])): '', - 'abstract' => isset($event['abstract']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($event['abstract'])) : '', - 'track' => $track, - 'location' => isset($event['room']) ? trim(AbstractExternalScheduleFeed::convert2UTF8($event['room'])) : '', - 'start_date' => $event['start_timestamp'], - 'end_date' => $event['end_timestamp'], - 'speakers' => $speakers, - 'tags' => isset($event["keywords"]) ? self::encode_array($event["keywords"]) : [], - ]; - } - return $events; - } - - private static function encode_array($array){ - if(is_array($array)){ - $res = []; - foreach ($array as $element){ - $res[] = AbstractExternalScheduleFeed::convert2UTF8($element); - } - return $res; - } - return $array; - } - - public function getSpeakers(): array - { - return $this->speakers; - } - - public function getDefaultSpeakerEmail(string $speakerFullName): string - { - return sprintf("%s@vanderpoel.com", strtolower($speakerFullName)); - } -} \ No newline at end of file diff --git a/app/Services/Apis/ExternalUserApi.php b/app/Services/Apis/ExternalUserApi.php deleted file mode 100644 index eb58c7b9..00000000 --- a/app/Services/Apis/ExternalUserApi.php +++ /dev/null @@ -1,183 +0,0 @@ -client = new Client([ - 'base_uri' => Config::get('idp.base_url') ?? '', - 'timeout' => Config::get('curl.timeout', 60), - 'allow_redirects' => Config::get('curl.allow_redirects', false), - 'verify' => Config::get('curl.verify_ssl_cert', true), - ]); - } - - /** - * @param string $email - * @return null|mixed - * @throws Exception - */ - public function getUserByEmail(string $email) - { - try { - Log::debug(sprintf("ExternalUserApi::getUserByEmail email %s", $email)); - - $query = [ - 'access_token' => $this->getAccessToken() - ]; - - $params = [ - 'filter' => 'primary_email==' . $email - ]; - - foreach ($params as $param => $value) { - $query[$param] = $value; - } - - $response = $this->client->get('/api/v1/users', [ - 'query' => $query, - ] - ); - - $data = json_decode($response->getBody()->getContents(), true); - - return intval($data['total']) > 0 ? $data['data'][0] : null; - } - catch (Exception $ex) { - Log::error($ex); - throw $ex; - } - } - - /** - * @param string $email - * @param string $first_name - * @param string $last_name - * @return mixed - * @throws Exception - */ - public function registerUser(string $email, ?string $first_name, ?string $last_name) - { - Log::debug(sprintf("ExternalUserApi::registerUser email %s first_name %s last_name %s", $email, $first_name, $last_name)); - - try { - $query = [ - 'access_token' => $this->getAccessToken() - ]; - - if(empty($email)) - throw new ValidationException("Email field es required."); - - if(empty($first_name)) - throw new ValidationException("First Name field es required."); - - if(empty($last_name)) - throw new ValidationException("Last Name field es required."); - - $response = $this->client->post('/api/v1/user-registration-requests', [ - 'query' => $query, - RequestOptions::JSON => [ - 'email' => $email, - 'first_name' => $first_name, - 'last_name' => $last_name, - ] - ] - ); - - return json_decode($response->getBody()->getContents(), true); - } catch (Exception $ex) { - Log::error($ex); - throw $ex; - } - } - - const AppName = 'REGISTRATION_SERVICE'; - - /** - * @return string - */ - public function getAppName(): string - { - return self::AppName; - } - - /** - * @return array - */ - public function getAppConfig(): array - { - return [ - 'client_id' => Config::get("registration.service_client_id"), - 'client_secret' => Config::get("registration.service_client_secret"), - 'scopes' => Config::get("registration.service_client_scopes") - ]; - } - - /** - * @param int $id - * @return mixed|null - * @throws Exception - */ - public function getUserById(int $id) - { - try { - Log::debug(sprintf("ExternalUserApi::getUserById id %s", $id)); - - $query = [ - 'access_token' => $this->getAccessToken() - ]; - - $response = $this->client->get(sprintf('/api/v1/users/%s', $id), [ - 'query' => $query, - ] - ); - - return json_decode($response->getBody()->getContents(), true); - } - catch (Exception $ex) { - Log::error($ex); - throw $ex; - } - } -} - diff --git a/app/Services/Apis/FireBaseGCMApi.php b/app/Services/Apis/FireBaseGCMApi.php deleted file mode 100644 index 694aafe3..00000000 --- a/app/Services/Apis/FireBaseGCMApi.php +++ /dev/null @@ -1,79 +0,0 @@ -api_server_key = $api_server_key; - } - - /** - * https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages - * @param string $to - * @param array $data - * @param string $priority - * @param null|int $ttl - * @return bool - */ - function sendPush($to, array $data, $priority = PushNotificationMessagePriority::Normal, $ttl = null) - { - $endpoint = self::BaseUrl.'/fcm/send'; - $client = new Client(); - $res = true; - - try { - foreach ($to as $recipient) { - - $message = [ - 'to' => '/topics/' . $recipient, - 'data' => $data, - ]; - - $response = $client->post($endpoint, [ - 'headers' => [ - 'Authorization' => sprintf('key=%s', $this->api_server_key), - ], - 'json' => $message - ]); - - if ($response->getStatusCode() !== 200) $res = $res && false; - } - return $res; - } - catch (ClientException $ex1){ - Log::error($ex1->getMessage()); - return false; - } - catch(Exception $ex){ - Log::error($ex->getMessage()); - return false; - } - } -} \ No newline at end of file diff --git a/app/Services/Apis/GeoCodingApiException.php b/app/Services/Apis/GeoCodingApiException.php deleted file mode 100644 index 55dee94d..00000000 --- a/app/Services/Apis/GeoCodingApiException.php +++ /dev/null @@ -1,40 +0,0 @@ -status = $status; - } - - /** - * @return string - */ - public function getStatus() - { - return $this->status; - } -} \ No newline at end of file diff --git a/app/Services/Apis/GeoCoordinatesInfo.php b/app/Services/Apis/GeoCoordinatesInfo.php deleted file mode 100644 index 40e68a5b..00000000 --- a/app/Services/Apis/GeoCoordinatesInfo.php +++ /dev/null @@ -1,57 +0,0 @@ -lat = $lat; - $this->lng = $lng; - } - - /** - * @return string - */ - public function getLat() - { - return $this->lat; - } - - /** - * @return string - */ - public function getLng() - { - return $this->lng; - } -} \ No newline at end of file diff --git a/app/Services/Apis/GoogleGeoCodingAPI.php b/app/Services/Apis/GoogleGeoCodingAPI.php deleted file mode 100644 index 9951f12d..00000000 --- a/app/Services/Apis/GoogleGeoCodingAPI.php +++ /dev/null @@ -1,226 +0,0 @@ -api_key = $api_key; - $this->client = new Client(); - } - - /** - * @param AddressInfo $address_info - * @return GeoCoordinatesInfo - * @throws GeoCodingApiException - */ - public function getGeoCoordinates(AddressInfo $address_info) - { - - list($address1, $address2) = $address_info->getAddress(); - $address = $address1 . ' ' . $address2; - $city = $address_info->getCity(); - $state = $address_info->getState(); - if (!empty($city)) { - $address .= ", {$city}"; - } - if (!empty($state)) { - $address .= ", {$state}"; - } - $zip_code = $address_info->getZipCode(); - $country = $address_info->getCountry(); - - $formatted_city = urlencode($city); - $components = "locality:{$formatted_city}|country:{$country}"; - $params = []; - if (!empty($state)) { - $formatted_state = urlencode($state); - $components .= "|administrative_area:{$formatted_state}"; - } - if (!empty($address)) { - $formatted_address = urlencode($address); - $components .= "|address:{$formatted_address}"; - } - $params['components'] = $components; - - if (!empty($zip_code)) { - $params['postal_code'] = urlencode($zip_code); - } - - $response = $this->doRequest($params); - - if($response['status'] != GoogleGeoCodingAPI::ResponseStatusOK){ - throw new GeoCodingApiException($response['status']); - } - - return new GeoCoordinatesInfo - ( - $response['results'][0]['geometry']['location']['lat'], - $response['results'][0]['geometry']['location']['lng'] - ); - } - - /** - * @param array $params - * @return array - * @throws Exception - * @throws RequestException - */ - private function doRequest(array $params){ - try { - - $query = [ - 'key' => $this->api_key - ]; - - foreach ($params as $param => $value) { - $query[$param] = $value; - } - - $response = $this->client->get(self::BaseUrl, [ - 'query' => $query - ] - ); - - if ($response->getStatusCode() !== 200) - throw new Exception('invalid status code!'); - - $content_type = $response->getHeaderLine('content-type'); - - if (empty($content_type)) - throw new Exception('invalid content type!'); - - if (!strstr($content_type, 'application/json') ) - throw new Exception('invalid content type!'); - - $json = $response->getBody()->getContents(); - return json_decode($json, true); - } - catch(RequestException $ex){ - Log::warning($ex->getMessage()); - throw $ex; - } - } - - /** - * @param GeoCoordinatesInfo $coordinates - * @return AddressInfo - * @throws GeoCodingApiException - */ - public function getAddressInfo(GeoCoordinatesInfo $coordinates) - { - $params = [ - 'latlng' => sprintf("%s,%s", $coordinates->getLat(), $coordinates->getLng()) - ]; - - $response = $this->doRequest($params); - - if($response['status'] != IGeoCodingAPI::ResponseStatusOK){ - throw new GeoCodingApiException($response['status']); - } - - $results = $response['results']; - $street_address = null; - - foreach($results as $result){ - $types = $result['types']; - foreach($types as $type) { - if ($type == 'street_address') { - $street_address = $result; - break; - } - } - if(!is_null($street_address)) break; - } - - if(is_null($street_address)) - throw new GeoCodingApiException(IGeoCodingAPI::ResponseStatusZeroResults); - - $components = []; - - foreach ($street_address['address_components'] as $component){ - foreach($component['types'] as $comp_type){ - if($comp_type == 'street_number'){ - $components['street_number'] = $component['long_name']; - break; - } - if($comp_type == 'route'){ - $components['street_name'] = $component['long_name']; - break; - } - if($comp_type == 'locality'){ - $components['city'] = $component['long_name']; - break; - } - if($comp_type == 'administrative_area_level_1'){ - $components['state'] = $component['long_name']; - break; - } - if($comp_type == 'country'){ - $components['country'] = $component['short_name']; - break; - } - if($comp_type == 'postal_code'){ - $components['zip_code'] = $component['long_name']; - break; - } - if($comp_type == 'postal_code'){ - $components['zip_code'] = $component['long_name']; - break; - } - } - } - - if(isset($components['street_name']) && isset($components['street_number'])){ - $components['address1'] = sprintf("%s %s", $components['street_name'], $components['street_number']); - } - - return new AddressInfo - ( - isset($components['address1']) ? $components['address1'] : '', - isset($components['address2']) ? $components['address2'] : '', - isset($components['zip_code']) ? $components['zip_code'] : '', - isset($components['state']) ? $components['state'] : '', - isset($components['city']) ? $components['city'] : '', - isset($components['country']) ? $components['country'] : '' - ); - } -} \ No newline at end of file diff --git a/app/Services/Apis/IEventbriteAPI.php b/app/Services/Apis/IEventbriteAPI.php deleted file mode 100644 index 31a49ae3..00000000 --- a/app/Services/Apis/IEventbriteAPI.php +++ /dev/null @@ -1,46 +0,0 @@ -client = new Client([ - 'base_uri' => Config::get('mail.service_base_url') ?? '', - 'timeout' => Config::get('curl.timeout', 60), - 'allow_redirects' => Config::get('curl.allow_redirects', false), - 'verify' => Config::get('curl.verify_ssl_cert', true), - ]); - } - - /** - * @return array - */ - public function getAppConfig(): array - { - return [ - 'client_id' => Config::get("mail.service_client_id"), - 'client_secret' => Config::get("mail.service_client_secret"), - 'scopes' => Config::get("mail.service_client_scopes") - ]; - } - - /** - * @param array $payload - * @param string $template_identifier - * @param string $to_email - * @param string|null $subject - * @return array - * @throws \Exception - */ - public function sendEmail(array $payload, string $template_identifier, string $to_email, string $subject = null): array - { - - Log::debug - ( - sprintf - ( - "MailApi::sendEmail template_identifier %s to_email %s payload %s", - $template_identifier, - $to_email, - json_encode($payload) - ) - ); - - try { - if(empty($to_email)) - throw new ValidationException("to_email field es required."); - - if(empty($template_identifier)) - throw new ValidationException("template_identifier field es required."); - - $query = [ - 'access_token' => $this->getAccessToken() - ]; - - $response = $this->client->post('/api/v1/mails', [ - 'query' => $query, - RequestOptions::JSON => [ - 'payload' => $payload, - 'template' => $template_identifier, - 'to_email' => $to_email - ] - ] - ); - - $body = $response->getBody()->getContents(); - Log::debug - ( - sprintf - ( - "MailApi::sendEmail template_identifier %s to_email %s body %s", - $template_identifier, - $to_email, - $body - ) - ); - return json_decode($body, true); - - } catch (\Exception $ex) { - Log::error($ex); - throw $ex; - } - } -} \ No newline at end of file diff --git a/app/Services/Apis/MuxCredentials.php b/app/Services/Apis/MuxCredentials.php deleted file mode 100644 index 0ee4f2ac..00000000 --- a/app/Services/Apis/MuxCredentials.php +++ /dev/null @@ -1,64 +0,0 @@ -/settings/access-tokens - * Class MuxCredentials - * @package App\Services\Apis - */ -final class MuxCredentials -{ - /** - * @var string - */ - private $token_id; - - /** - * @var string - */ - private $token_secret; - - /** - * MuxCredentials constructor. - * @param string $token_id - * @param string $token_secret - */ - public function __construct(string $token_id, string $token_secret) - { - $this->token_id = $token_id; - $this->token_secret = $token_secret; - } - - /** - * @return string - */ - public function getTokenId(): string - { - return $this->token_id; - } - - /** - * @return string - */ - public function getTokenSecret(): string - { - return $this->token_secret; - } - - public function __toString() - { - return sprintf("id %s secret %s", $this->token_id, $this->token_secret); - } -} \ No newline at end of file diff --git a/app/Services/Apis/PaymentGateways/StripeApi.php b/app/Services/Apis/PaymentGateways/StripeApi.php deleted file mode 100644 index d837c0df..00000000 --- a/app/Services/Apis/PaymentGateways/StripeApi.php +++ /dev/null @@ -1,433 +0,0 @@ -secret_key = $config['secret_key'] ?? null; - $this->webhook_secret_key = $config['webhook_secret_key'] ?? null; - $this->send_email_receipt = false; - if(isset($config['send_email_receipt'])) - $this->send_email_receipt = boolval($config['send_email_receipt']); - - Log::debug - ( - sprintf - ( - "StripeApi::__construct secret_key %s webhook_secret_key %s", - $this->secret_key, - $this->webhook_secret_key - ) - ); - } - - /** - * @param string $webhook_secret_key - */ - public function setWebHookSecretKey(string $webhook_secret_key):void{ - $this->webhook_secret_key = $webhook_secret_key; - } - - /** - * @param array $payload - * @return array - */ - public function generatePayment(array $payload): array - { - if (empty($this->secret_key)) - throw new \InvalidArgumentException(); - - Stripe::setApiKey($this->secret_key); - Stripe::setApiVersion(self::Version); - - $amount = $payload['amount']; - $currency = $payload['currency']; - - if (!self::isZeroDecimalCurrency($currency)) { - /** - * All API requests expect amounts to be provided in a currency’s smallest unit. For example, - * to charge $10 USD, provide an amount value of 1000 (i.e, 1000 cents). - * For zero-decimal currencies, still provide amounts as an integer but without multiplying by 100. - * For example, to charge ¥500, simply provide an amount value of 500. - */ - $amount = $amount * 100; - } - - $request = [ - 'amount' => intval($amount), - 'currency' => $currency, - 'payment_method_types' => ['card'], - ]; - - // check setting to send stripe invoice - // @see https://stripe.com/docs/receipts - if (isset($payload['receipt_email']) && $this->send_email_receipt) { - Log::debug(sprintf("StripeApi::generatePayment setting receipt_email to %s", $payload['receipt_email'])); - $request['receipt_email'] = trim($payload['receipt_email']); - } - - if (isset($payload['metadata'])) { - $request['metadata'] = $payload['metadata']; - } - - Log::debug(sprintf("StripeApi::generatePayment creating payment intent %s", json_encode($request))); - - $intent = PaymentIntent::create($request); - Log::debug(sprintf("StripeApi::generatePayment intent id %s", $intent->id)); - return [ - 'client_token' => $intent->client_secret, - 'cart_id' => $intent->id, - ]; - } - - /** - * @param string $currency - * @return bool - * @see https://stripe.com/docs/currencies#zero-decimal - */ - private static function isZeroDecimalCurrency(string $currency): bool - { - $zeroDecimalCurrencies = [ - 'JPY', - 'BIF', - 'CLP', - 'DJF', - 'GNF', - 'KMF', - 'KRW', - 'MGA', - 'PYG', - 'RWF', - 'UGX', - 'VND', - 'VUV', - 'XAF', - 'XOF', - 'XPF', - ]; - return in_array($currency, $zeroDecimalCurrencies); - } - - /** - * @param LaravelRequest $request - * @return array - * @throws SignatureVerification - * @throws \Exception - * @throws \InvalidArgumentException - */ - public function processCallback(LaravelRequest $request): array - { - try { - - $signature = $request->header('Stripe-Signature'); - $requestContent = $request->getContent(); - Log::debug - ( - sprintf - ( - "StripeApi::processCallback Stripe-Signature %s requestContent %s webHook Secret %s", - $signature, - $requestContent, - $this->webhook_secret_key - ) - ); - - WebhookSignature::verifyHeader( - $requestContent, - $signature, - $this->webhook_secret_key - ); - - $event = Event::constructFrom(json_decode($requestContent, true)); - if (!in_array($event->type, ["payment_intent.succeeded", "payment_intent.payment_failed"])) - throw new \InvalidArgumentException(); - - $intent = $event->data->object; - if ($event->type == "payment_intent.succeeded") { - Log::debug("StripeApi::processCallback: payment_intent.succeeded"); - return [ - "event_type" => $event->type, - "cart_id" => $intent->id, - ]; - } - - if ($event->type == "payment_intent.payment_failed") { - Log::debug("StripeApi::processCallback: payment_intent.payment_failed"); - $intent = $event->data->object; - return [ - "event_type" => $event->type, - "cart_id" => $intent->id, - "error" => [ - "last_payment_error" => $intent->last_payment_error, - "message" => $intent->last_payment_error->message - ] - ]; - } - - throw new ValidationException(sprintf("event type %s not handled!", $event->type)); - } catch (\UnexpectedValueException $e) { - // Invalid payload - throw $e; - } catch (SignatureVerification $e) { - // Invalid signature - throw $e; - } catch (\Exception $e) { - throw $e; - } - } - - /** - * @param array $payload - * @return bool - */ - public function isSuccessFullPayment(array $payload): bool - { - if (isset($payload['event_type']) && $payload['event_type'] == "payment_intent.succeeded") return true; - Log::debug("StripeApi::isSuccessFullPayment false"); - return false; - } - - /** - * @param array $payload - * @return string - */ - public function getPaymentError(array $payload): ?string - { - if (isset($payload['event_type']) && $payload['event_type'] == "payment_intent.payment_failed") { - if (isset($payload['error'])) { - $error = $payload['error']; - if (isset($error["message"])) { - return $error["message"]; - } - } - } - return null; - } - - /** - * @param string $cart_id - * @param float $amount - * @param string $currency - * @throws \InvalidArgumentException - */ - public function refundPayment(string $cart_id, float $amount, string $currency): void - { - if (empty($this->secret_key)) - throw new \InvalidArgumentException(); - - Stripe::setApiKey($this->secret_key); - Stripe::setApiVersion(self::Version); - - $intent = PaymentIntent::retrieve($cart_id); - - if (is_null($intent)) - throw new \InvalidArgumentException(); - if (count($intent->charges->data) == 0) - throw new \InvalidArgumentException("this intent payment has no charges"); - $charge = $intent->charges->data[0]; - if (!$charge instanceof Charge) - throw new \InvalidArgumentException(); - $params = []; - if ($amount > 0) { - if (!self::isZeroDecimalCurrency($currency)) { - /** - * All API requests expect amounts to be provided in a currency’s smallest unit. For example, - * to charge $10 USD, provide an amount value of 1000 (i.e, 1000 cents). - * For zero-decimal currencies, still provide amounts as an integer but without multiplying by 100. - * For example, to charge ¥500, simply provide an amount value of 500. - */ - $amount = $amount * 100; - } - - $params['amount'] = intval($amount); - } - $charge->refund($params); - } - - /** - * @param string $cart_id - * @return mixed|void - * @throws CartAlreadyPaidException - */ - public function abandonCart(string $cart_id) - { - if (empty($this->secret_key)) - throw new \InvalidArgumentException(); - - Stripe::setApiKey($this->secret_key); - Stripe::setApiVersion(self::Version); - - $intent = PaymentIntent::retrieve($cart_id); - - if (is_null($intent)) - throw new \InvalidArgumentException(); - - if (!in_array($intent->status, [ - PaymentIntent::STATUS_REQUIRES_PAYMENT_METHOD, - PaymentIntent::STATUS_REQUIRES_CAPTURE, - PaymentIntent::STATUS_REQUIRES_CONFIRMATION, - PaymentIntent::STATUS_REQUIRES_ACTION, - "requires_source", - "requires_source_action", - ])) - throw new CartAlreadyPaidException(sprintf("cart id %s has status %s", $cart_id, $intent->status)); - - $intent->cancel(); - } - - /** - * @param string $status - * @return bool - */ - public function canAbandon(string $status): bool - { - return in_array($status, [ - PaymentIntent::STATUS_REQUIRES_PAYMENT_METHOD, - PaymentIntent::STATUS_REQUIRES_CAPTURE, - PaymentIntent::STATUS_REQUIRES_CONFIRMATION, - PaymentIntent::STATUS_REQUIRES_ACTION, - "requires_source", - "requires_source_action", - ]); - } - - /** - * @param string $status - * @return bool - */ - public function isSucceeded(string $status): bool - { - return $status == PaymentIntent::STATUS_SUCCEEDED; - } - - /** - * @param string $cart_id - * @return string|null - */ - public function getCartStatus(string $cart_id): ?string - { - - if (empty($this->secret_key)) - throw new \InvalidArgumentException(); - - Stripe::setApiKey($this->secret_key); - Stripe::setApiVersion(self::Version); - - try { - $intent = PaymentIntent::retrieve($cart_id); - - if (is_null($intent)) - throw new \InvalidArgumentException(); - - return $intent->status; - } - catch(InvalidRequest $ex){ - Log::warning(sprintf("StripeApi::getCartStatus cart_id %s code %s message %s", $cart_id, $ex->getCode(), $ex->getMessage())); - return null; - } - } - - /** - * @param string $webhook_endpoint_url - * @return array - */ - public function createWebHook(string $webhook_endpoint_url): array - { - if (empty($this->secret_key)) - throw new \InvalidArgumentException(); - - Stripe::setApiKey($this->secret_key); - Stripe::setApiVersion(self::Version); - - $res = WebhookEndpoint::create([ - 'url' => $webhook_endpoint_url, - 'enabled_events' => [ - 'payment_intent.succeeded', - 'payment_intent.payment_failed', - ], - ]); - - return [ - 'id' => $res->id, - 'secret' => $res->secret, - 'livemode' => $res->livemode - ]; - } - - /** - * @param string $id - * @return WebhookEndpoint - */ - public function getWebHookById(string $id){ - - if (empty($this->secret_key)) - throw new \InvalidArgumentException(); - - Stripe::setApiKey($this->secret_key); - Stripe::setApiVersion(self::Version); - - return WebhookEndpoint::retrieve($id); - } - - /** - * @param string $id - * @return void - */ - public function deleteWebHookById(string $id):void{ - - $webhook = $this->getWebHookById($id); - if(!$webhook) return; - $webhook->delete(); - } -} \ No newline at end of file diff --git a/app/Services/Auth/OAuth2ClientFactory.php b/app/Services/Auth/OAuth2ClientFactory.php deleted file mode 100644 index 6e3aaced..00000000 --- a/app/Services/Auth/OAuth2ClientFactory.php +++ /dev/null @@ -1,59 +0,0 @@ - $client_id, - 'clientSecret' => $client_secret, - 'redirectUri' => $redirectUri, - 'urlAuthorize' => $idpConfig['authorization_endpoint'] ?? '', - 'urlAccessToken' => $idpConfig['token_endpoint'] ?? '', - 'urlResourceOwnerDetails' => "", - 'scopes' => $scopes, - ]); - - $provider->setHttpClient( - new Client([ - 'timeout' => Config::get('curl.timeout', 60), - 'allow_redirects' => Config::get('curl.allow_redirects', false), - 'verify' => Config::get('curl.verify_ssl_cert', true), - ]) - ); - return $provider; - } -} \ No newline at end of file diff --git a/app/Services/BaseServicesProvider.php b/app/Services/BaseServicesProvider.php deleted file mode 100644 index b8794044..00000000 --- a/app/Services/BaseServicesProvider.php +++ /dev/null @@ -1,141 +0,0 @@ -setCredentials(array('token' => Config::get("server.eventbrite_oauth2_personal_token", null))); - return $api; - }); - - App::singleton(IPushNotificationApi::class, function(){ - $api = new FireBaseGCMApi(Config::get("server.firebase_gcm_server_key", null)); - return $api; - }); - - App::singleton(IGeoCodingAPI::class, function(){ - return new GoogleGeoCodingAPI - ( - Config::get("server.google_geocoding_api_key", null) - ); - }); - - App::singleton( - IExternalUserApi::class, - ExternalUserApi::class - ); - - App::singleton - ( - IFolderService::class, - FolderService::class - ); - - App::singleton( - IMailApi::class, - MailApi::class - ); - - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - ClientInterface::class, - ICacheService::class, - IPermissionsManager::class, - ITransactionService::class, - ISerializerTypeSelector::class, - IEncryptionService::class, - IEventbriteAPI::class, - IPushNotificationApi::class, - IGeoCodingAPI::class, - IExternalUserApi::class, - IFolderService::class - ]; - } -} \ No newline at end of file diff --git a/app/Services/FileSystem/AbstractFileUploadStrategy.php b/app/Services/FileSystem/AbstractFileUploadStrategy.php deleted file mode 100644 index a00a3fc2..00000000 --- a/app/Services/FileSystem/AbstractFileUploadStrategy.php +++ /dev/null @@ -1,58 +0,0 @@ -getDriver())->putFileAs($path, $file, $filename); - } - - /** - * @param string $path - * @param string|null $filename - * @return bool|mixed - */ - public function markAsDeleted(string $path, ?string $filename = null) - { - Log::debug(sprintf("AbstractFileUploadStrategy:: markAsDeleted path %s filename %s", $path, $filename)); - $from = empty($filename) ? $path : sprintf("%s/%s", $path, $filename); - $to = null; - if(empty($filename)){ - $parts = explode("/", $path); - $parts[count($parts) - 1] = sprintf("DELETED_%s", $parts[count($parts) - 1] ); - $to = implode("/", $parts); - } - else{ - $to = sprintf("%s/DELETED_%s", $path, $filename); - } - Log::debug(sprintf("AbstractFileUploadStrategy:: markAsDeleted from %s to %s", $from, $to)); - - return Storage::disk($this->getDriver())->move - ( - $from, - $to - ); - } -} \ No newline at end of file diff --git a/app/Services/FileSystem/Dropbox/DropboxAdapter.php b/app/Services/FileSystem/Dropbox/DropboxAdapter.php deleted file mode 100644 index 566a3d4e..00000000 --- a/app/Services/FileSystem/Dropbox/DropboxAdapter.php +++ /dev/null @@ -1,54 +0,0 @@ -client; - try { - // default visibility is RequestedVisibility.public. - $res = $client->createSharedLinkWithSettings($path); - return $res['url']; - } - catch (BadRequestException $ex){ - if($ex->dropboxCode === 'shared_link_already_exists') - { - try { - Log::debug(sprintf("DropboxAdapter::getUrl getting list of shared links for %s", $path)); - $res = $client->listSharedLinks($path); - foreach ($res as $entry) { - Log::debug(sprintf("DropboxAdapter::getUrl getting list of shared links for %s entry %s", $path, json_encode($entry))); - if($entry['.tag'] === 'file' ) - return $entry['url']; - } - } - catch (Exception $ex){ - Log::warning($ex); - } - } - } - catch (Exception $ex){ - Log::warning($ex); - } - return '#'; - } -} diff --git a/app/Services/FileSystem/Dropbox/DropboxServiceProvider.php b/app/Services/FileSystem/Dropbox/DropboxServiceProvider.php deleted file mode 100644 index 69323f51..00000000 --- a/app/Services/FileSystem/Dropbox/DropboxServiceProvider.php +++ /dev/null @@ -1,49 +0,0 @@ -download( - $path, - $name, - $options - ); - } - - /** - * @inheritDoc - */ - public function getUrl(string $relativeFileName): ?string - { - return Storage::disk('dropbox')->url($relativeFileName); - } - - /** - * @inheritDoc - */ - public function delete(string $relativeFileName) - { - return Storage::disk('dropbox')->delete($relativeFileName); - } -} diff --git a/app/Services/FileSystem/Dropbox/DropboxStorageFileUploadStrategy.php b/app/Services/FileSystem/Dropbox/DropboxStorageFileUploadStrategy.php deleted file mode 100644 index 5cb72c06..00000000 --- a/app/Services/FileSystem/Dropbox/DropboxStorageFileUploadStrategy.php +++ /dev/null @@ -1,27 +0,0 @@ - '-', // remove whitespace - '/_/' => '-', // underscores to dashes - '/[^A-Za-z0-9+.\-]+/' => '', // remove non-ASCII chars, only allow alphanumeric plus dash and dot - '/[\-]{2,}/' => '-', // remove duplicate dashes - '/^[\.\-_]+/' => '', // Remove all leading dots, dashes or underscores - ]; - - /** - * @param string $filename - * @return string - */ - public static function sanitize(string $filename):string { - $filename = trim(Transliterator::utf8ToAscii($filename)); - foreach(self::$default_replacements as $regex => $replace) { - $filename = preg_replace($regex, $replace, $filename); - } - return $filename; - } -} \ No newline at end of file diff --git a/app/Services/FileSystem/FileUploadStrategyFactory.php b/app/Services/FileSystem/FileUploadStrategyFactory.php deleted file mode 100644 index be356296..00000000 --- a/app/Services/FileSystem/FileUploadStrategyFactory.php +++ /dev/null @@ -1,46 +0,0 @@ -download($path, $name, $options); - } - - /** - * @inheritDoc - */ - public function getUrl(string $relativeFileName): ?string - { - return Storage::disk('local')->url($relativeFileName); - } - - /** - * @inheritDoc - */ - public function delete(string $relativeFileName) - { - return Storage::disk('local')->delete($relativeFileName); - } -} diff --git a/app/Services/FileSystem/Local/LocalStorageFileUploadStrategy.php b/app/Services/FileSystem/Local/LocalStorageFileUploadStrategy.php deleted file mode 100644 index a5461c62..00000000 --- a/app/Services/FileSystem/Local/LocalStorageFileUploadStrategy.php +++ /dev/null @@ -1,27 +0,0 @@ -download( - $path, - $name, - $options - ); - } - - /** - * @inheritDoc - */ - public function getUrl(string $relativeFileName): ?string - { - return Storage::disk('s3')->url($relativeFileName); - } - - /** - * @inheritDoc - */ - public function delete(string $relativeFileName) - { - return Storage::disk('s3')->delete($relativeFileName); - } -} \ No newline at end of file diff --git a/app/Services/FileSystem/S3/S3StorageFileUploadStrategy.php b/app/Services/FileSystem/S3/S3StorageFileUploadStrategy.php deleted file mode 100644 index d2b62ea4..00000000 --- a/app/Services/FileSystem/S3/S3StorageFileUploadStrategy.php +++ /dev/null @@ -1,28 +0,0 @@ -setPathPrefix($prefix); - $this->container = $container; - } - - /** - * {@inheritdoc} - */ - public function write($path, $contents, Config $config, $size = 0) - { - $path = $this->applyPathPrefix($path); - - $data = $this->getWriteData($path, $config); - $type = 'content'; - - if (is_a($contents, 'GuzzleHttp\Psr7\Stream')) { - $type = 'stream'; - } - - $data[$type] = $contents; - - // Create large object if the stream is larger than 300 MiB (default). - if ($type === 'stream' && $size > $config->get('swiftLargeObjectThreshold', 314572800)) { - // Set the segment size to 100 MiB by default as suggested in OVH docs. - $data['segmentSize'] = $config->get('swiftSegmentSize', 104857600); - // Set segment container to the same container by default. - $data['segmentContainer'] = $config->get('swiftSegmentContainer', $this->container->name); - - $response = $this->container->createLargeObject($data); - } else { - $response = $this->container->createObject($data); - } - - return $this->normalizeObject($response); - } - - /** - * {@inheritdoc} - */ - public function writeStream($path, $resource, Config $config) - { - return $this->write($path, new Stream($resource), $config, fstat($resource)['size']); - } - - /** - * {@inheritdoc} - */ - public function update($path, $contents, Config $config) - { - return $this->write($path, $contents, $config); - } - - /** - * {@inheritdoc} - */ - public function updateStream($path, $resource, Config $config) - { - return $this->write($path, new Stream($resource), $config, fstat($resource)['size']); - } - - /** - * {@inheritdoc} - */ - public function rename($path, $newpath) - { - $object = $this->getObject($path); - $newLocation = $this->applyPathPrefix($newpath); - $destination = '/'.$this->container->name.'/'.ltrim($newLocation, '/'); - - try { - $response = $object->copy(compact('destination')); - } catch (BadResponseError $e) { - return false; - } - - $object->delete(); - - return true; - } - - /** - * {@inheritdoc} - */ - public function delete($path) - { - $object = $this->getObjectInstance($path); - - try { - $object->delete(); - } catch (BadResponseError $e) { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function deleteDir($dirname) - { - $objects = $this->container->listObjects([ - 'prefix' => $this->applyPathPrefix($dirname) - ]); - - try { - foreach ($objects as $object) { - $object->containerName = $this->container->name; - $object->delete(); - } - } catch (BadResponseError $e) { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function createDir($dirname, Config $config) - { - return ['path' => $dirname]; - } - - /** - * {@inheritdoc} - */ - public function has($path) - { - try { - $object = $this->getObject($path); - } catch (BadResponseError $e) { - $code = $e->getResponse()->getStatusCode(); - - if ($code == 404) return false; - - throw $e; - } - - return $this->normalizeObject($object); - } - - /** - * {@inheritdoc} - */ - public function read($path) - { - $object = $this->getObject($path); - $data = $this->normalizeObject($object); - - $stream = $object->download(); - $stream->rewind(); - $data['contents'] = $stream->getContents(); - - return $data; - } - - /** - * {@inheritdoc} - */ - public function readStream($path) - { - $object = $this->getObject($path); - $data = $this->normalizeObject($object); - - $stream = $object->download(); - $stream->rewind(); - $data['stream'] = StreamWrapper::getResource($stream); - - return $data; - } - - /** - * {@inheritdoc} - */ - public function listContents($directory = '', $recursive = false) - { - $location = $this->applyPathPrefix($directory); - - $objectList = $this->container->listObjects([ - 'prefix' => $directory - ]); - - $response = iterator_to_array($objectList); - - return Util::emulateDirectories(array_map([$this, 'normalizeObject'], $response)); - } - - /** - * {@inheritdoc} - */ - public function getMetadata($path) - { - $object = $this->getObject($path); - - return $this->normalizeObject($object); - } - - /** - * {@inheritdoc} - */ - public function getSize($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function getMimetype($path) - { - return $this->getMetadata($path); - } - - /** - * {@inheritdoc} - */ - public function getTimestamp($path) - { - return $this->getMetadata($path); - } - - /** - * Get the data properties to write or update an object. - * - * @param string $path - * @param Config $config - * - * @return array - */ - protected function getWriteData($path, $config) - { - return ['name' => $path]; - } - - /** - * Get an object instance. - * - * @param string $path - * - * @return StorageObject - */ - protected function getObjectInstance($path) - { - $location = $this->applyPathPrefix($path); - - $object = $this->container->getObject($location); - - return $object; - } - - /** - * Get an object instance and retrieve its metadata from storage. - * - * @param string $path - * - * @return StorageObject - */ - protected function getObject($path) - { - $object = $this->getObjectInstance($path); - $object->retrieve(); - - return $object; - } - - /** - * Normalize Openstack "StorageObject" object into an array - * - * @param StorageObject $object - * @return array - */ - protected function normalizeObject(StorageObject $object) - { - $name = $this->removePathPrefix($object->name); - $mimetype = explode('; ', $object->contentType); - - if ($object->lastModified instanceof \DateTimeInterface) { - $timestamp = $object->lastModified->getTimestamp(); - } else { - $timestamp = strtotime($object->lastModified); - } - - return [ - 'type' => 'file', - 'dirname' => Util::dirname($name), - 'path' => $name, - 'timestamp' => $timestamp, - 'mimetype' => reset($mimetype), - 'size' => $object->contentLength, - ]; - } - - - public function getTemporaryLink(string $path): ?string - { - return $this->getUrl($path); - } - - public function getTemporaryUrl(string $path): ?string - { - return $this->getUrl($path); - } - - public function getUrl(string $path): ?string - { - $obj = $this->container->getObject($path); - if(is_null($obj)) - return null; - $url = $obj->getPublicUri(); - //Log::debug(sprintf("SwiftAdapter get Url for path %s got %s", $path, $url)); - return $url; - } -} diff --git a/app/Services/FileSystem/Swift/SwiftServiceProvider.php b/app/Services/FileSystem/Swift/SwiftServiceProvider.php deleted file mode 100644 index 3f1afba4..00000000 --- a/app/Services/FileSystem/Swift/SwiftServiceProvider.php +++ /dev/null @@ -1,92 +0,0 @@ - $config["auth_url"], - 'region' => $config["region"], - ]; - - $userName = $config["user_name"] ?? null; - $userPassword = $config["api_key"] ?? null; - - if (!empty($userName) && !empty($userPassword)) { - - $configOptions['user'] = [ - 'name' => $userName, - 'password' => $userPassword, - 'domain' => ['id' => $config["user_domain"] ?? 'default'] - ]; - - $configOptions['scope'] = [ - 'project' => [ - 'name' => $config["project_name"], - 'domain' => ['id' => $config["project_domain"] ?? 'default'] - ], - ]; - } - - $appCredentialId = $config["app_credential_id"] ?? null; - $appCredentialSecret = $config["app_credential_secret"] ?? null; - - if (!empty($appCredentialId) && !empty($appCredentialSecret)) { - $configOptions['application_credential'] = [ - 'id' => $appCredentialId, - 'secret' => $appCredentialSecret, - ]; - } - - $openstackClient = new OpenStack($configOptions); - - $container = $openstackClient->objectStoreV1()->getContainer($config["container"]); - - return new Filesystem(new SwiftAdapter($container)); - } - catch(\Exception $ex){ - Log::error($ex); - return null; - } - }); - } -} diff --git a/app/Services/FileSystem/Swift/SwiftStorageFileDownloadStrategy.php b/app/Services/FileSystem/Swift/SwiftStorageFileDownloadStrategy.php deleted file mode 100644 index ea7b9131..00000000 --- a/app/Services/FileSystem/Swift/SwiftStorageFileDownloadStrategy.php +++ /dev/null @@ -1,49 +0,0 @@ -download( - $path, - $name, - $options - ); - } - - /** - * @inheritDoc - */ - public function getUrl(string $relativeFileName): ?string - { - return Storage::disk('swift')->url($relativeFileName); - } - - /** - * @inheritDoc - */ - public function delete(string $relativeFileName) - { - return Storage::disk('swift')->delete($relativeFileName); - } -} \ No newline at end of file diff --git a/app/Services/FileSystem/Swift/SwiftStorageFileUploadStrategy.php b/app/Services/FileSystem/Swift/SwiftStorageFileUploadStrategy.php deleted file mode 100644 index 86d0b03a..00000000 --- a/app/Services/FileSystem/Swift/SwiftStorageFileUploadStrategy.php +++ /dev/null @@ -1,28 +0,0 @@ -tx_service = $tx_service; - } -} \ No newline at end of file diff --git a/app/Services/Model/AdminActionsCalendarSyncPreProcessor.php b/app/Services/Model/AdminActionsCalendarSyncPreProcessor.php deleted file mode 100644 index cf25a811..00000000 --- a/app/Services/Model/AdminActionsCalendarSyncPreProcessor.php +++ /dev/null @@ -1,67 +0,0 @@ -queue_manager = $queue_manager; - $this->strategy_factory = $strategy_factory; - } - - /** - * @param array $requests - * @return array - */ - public function preProcessActions(array $requests) - { - foreach ($requests as $request){ - $strategy = $this->strategy_factory->build($this->queue_manager, $request); - if(is_null($strategy)) continue; - $request = $strategy->process($request); - if(!is_null($request)) - $this->queue_manager->registerRequest($request); - } - - return $this->queue_manager->getPurgedRequests(); - } -} \ No newline at end of file diff --git a/app/Services/Model/AdminActionsCalendarSyncProcessingService.php b/app/Services/Model/AdminActionsCalendarSyncProcessingService.php deleted file mode 100644 index 989490ba..00000000 --- a/app/Services/Model/AdminActionsCalendarSyncProcessingService.php +++ /dev/null @@ -1,166 +0,0 @@ -work_request_repository = $work_request_repository; - $this->calendar_sync_repository = $calendar_sync_repository; - $this->schedule_sync_repository = $schedule_sync_repository; - $this->preprocessor_requests = $preprocessor_requests; - $this->tx_manager = $tx_manager; - } - - /** - * @param int $batch_size - * @return int - */ - public function processActions($batch_size = PHP_INT_MAX) - { - return $this->tx_manager->transaction(function() use($batch_size){ - $count = 0; - - $res = $this->work_request_repository->getUnprocessedAdminScheduleWorkRequestActionByPage - ( - new PagingInfo(1, $batch_size) - ); - - foreach ($this->preprocessor_requests->preProcessActions($res->getItems()) as $request){ - - try { - if (!$request instanceof AdminScheduleSummitActionSyncWorkRequest) continue; - - if($request instanceof AdminSummitEventActionSyncWorkRequest){ - - $page = 1; - $summit_event_id = $request->getSummitEventId(); - - do{ - $page_response = $this->schedule_sync_repository->getAllBySummitEvent($summit_event_id, new PagingInfo($page, 1000)); - $has_more = count($page_response->getItems()) > 0; - if(!$has_more) continue; - foreach ($page_response->getItems() as $schedule_event){ - if(!$schedule_event instanceof ScheduleCalendarSyncInfo) continue; - $work_request = new MemberEventScheduleSummitActionSyncWorkRequest(); - $work_request->setType($request->getType()); - $work_request->setCalendarSyncInfo($schedule_event->getCalendarSyncInfo()); - $work_request->setOwner($schedule_event->getMember()); - $work_request->setSummitEventId($summit_event_id); - $this->work_request_repository->add($work_request); - } - $page++; - - }while($has_more); - } - - if($request instanceof AdminSummitLocationActionSyncWorkRequest){ - $location_id = $request->getLocationId(); - $page = 1; - - do{ - $page_response = $this->schedule_sync_repository->getAllBySummitLocation($location_id, new PagingInfo($page, 1000)); - $has_more = count($page_response->getItems()) > 0; - if(!$has_more) continue; - foreach ($page_response->getItems() as $schedule_event){ - if(!$schedule_event instanceof ScheduleCalendarSyncInfo) continue; - $work_request = new MemberEventScheduleSummitActionSyncWorkRequest(); - // always is update no matter what - $work_request->setType(AbstractCalendarSyncWorkRequest::TypeUpdate); - $work_request->setCalendarSyncInfo($schedule_event->getCalendarSyncInfo()); - $work_request->setOwner($schedule_event->getMember()); - $work_request->setSummitEventId($schedule_event->getSummitEvent()->getId()); - $this->work_request_repository->add($work_request); - } - $page++; - - }while($has_more); - } - - $request->markProcessed(); - $count++; - } - catch(DBALException $ex1){ - echo 'DBALException !!'.PHP_EOL; - Log::error($ex1); - } - catch(Exception $ex6){ - echo 'Exception !!'.PHP_EOL; - Log::error($ex6); - } - } - return $count; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/AdminScheduleWorkQueueManager.php b/app/Services/Model/AdminScheduleWorkQueueManager.php deleted file mode 100644 index b99c6415..00000000 --- a/app/Services/Model/AdminScheduleWorkQueueManager.php +++ /dev/null @@ -1,152 +0,0 @@ -getSummitEventId(); - } - if($request instanceof AdminSummitLocationActionSyncWorkRequest){ - $location_id = $request->getLocationId(); - } - return $this->generateKey($request->getType(), $event_id, $location_id); - } - - /** - * @param string $type - * @param int $event_id - * @param int $location_id - * @return string - */ - private function generateKey($type, $event_id = null, $location_id = null){ - $sub_type = !is_null($event_id) ? AdminSummitEventActionSyncWorkRequest::SubType : AdminSummitLocationActionSyncWorkRequest::SubType; - $id = !is_null($event_id) ? $event_id : $location_id; - $key = "{$sub_type}_{$type}_{$id}"; - return $key; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return bool - */ - public function registerRequest(AbstractCalendarSyncWorkRequest $request){ - $key = $this->getKey($request); - if(isset($this->registered_requests[$key])) return false; - $this->registered_requests[$key] = $request; - return true; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return bool - */ - public function removeRequest(AbstractCalendarSyncWorkRequest $request){ - $key = $this->getKey($request); - if(isset($this->registered_requests[$key])){ - unset($this->registered_requests[$key]); - return true; - } - return false; - } - - /** - * @param int $event_id - * @param string $type - * @return AdminSummitEventActionSyncWorkRequest[] - */ - public function getSummitEventRequestFor($event_id, $type = null){ - $types = [ - AbstractCalendarSyncWorkRequest::TypeAdd, - AbstractCalendarSyncWorkRequest::TypeRemove, - AbstractCalendarSyncWorkRequest::TypeUpdate, - ]; - - if(!empty($type)) $types = [$type]; - $list = []; - foreach ($types as $t){ - $key = $this->generateKey($t, $event_id); - if(isset($this->registered_requests[$key])){ - $list[] = $this->registered_requests[$key]; - } - } - return $list; - } - - /** - * @param int $location_id - * @param string $type - * @return AdminSummitLocationActionSyncWorkRequest[] - */ - public function getSummitLocationRequestFor($location_id, $type = null){ - $types = [ - AbstractCalendarSyncWorkRequest::TypeAdd, - AbstractCalendarSyncWorkRequest::TypeRemove, - AbstractCalendarSyncWorkRequest::TypeUpdate, - ]; - - if(!empty($type)) $types = [$type]; - $list = []; - foreach ($types as $t){ - $key = $this->generateKey($t, null, $location_id); - if(isset($this->registered_requests[$key])){ - $list[] = $this->registered_requests[$key]; - } - } - return $list; - } - /** - * @return array - */ - public function getPurgedRequests(){ - return array_values($this->registered_requests); - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return bool - */ - public function registerRequestForDelete(AbstractCalendarSyncWorkRequest $request) - { - // TODO: Implement registerRequestForDelete() method. - } - - /** - * @return array - */ - public function getRequestsToDelete() - { - // TODO: Implement getRequestsToDelete() method. - } -} \ No newline at end of file diff --git a/app/Services/Model/AttendeeService.php b/app/Services/Model/AttendeeService.php deleted file mode 100644 index a1098dfc..00000000 --- a/app/Services/Model/AttendeeService.php +++ /dev/null @@ -1,446 +0,0 @@ -attendee_repository = $attendee_repository; - $this->ticket_repository = $ticket_repository; - $this->member_repository = $member_repository; - $this->ticket_type_repository = $ticket_type_repository; - $this->promo_code_repository = $promo_code_repository; - $this->eventbrite_api = $eventbrite_api; - $this->summit_repository = $summit_repository; - } - - /** - * @param Summit $summit - * @param array $data - * @return mixed|SummitAttendee - * @throws \Exception - */ - public function addAttendee(Summit $summit, array $data) - { - return $this->tx_service->transaction(function() use($summit, $data){ - - $member = null; - $member_id = $data['member_id'] ?? 0; - $member_id = intval($member_id); - $email = $data['email'] ?? null; - - if($member_id > 0 && !empty($email)){ - // both are defined - throw new ValidationException("you should define a member_id or an email, not both"); - } - - if($member_id > 0 ) { - - $member = $this->member_repository->getById($member_id); - if (is_null($member) || !$member instanceof Member) - throw new EntityNotFoundException("member not found"); - - $old_attendee = $this->attendee_repository->getBySummitAndMember($summit, $member); - - if (!is_null($old_attendee)) - throw new ValidationException(sprintf("attendee already exist for summit id %s and member id %s", $summit->getId(), $member->getIdentifier())); - - } - - if(!empty($email)) { - $old_attendee = $this->attendee_repository->getBySummitAndEmail($summit, trim($email)); - if (!is_null($old_attendee)) - throw new ValidationException(sprintf("attendee already exist for summit id %s and email %s", $summit->getId(), trim($data['email']))); - } - - $attendee = SummitAttendeeFactory::build($summit, $data, $member); - - $this->attendee_repository->add($attendee); - - $attendee->updateStatus(); - - return $attendee; - }); - } - - /** - * @param Summit $summit - * @param int $attendee_id - * @return void - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteAttendee(Summit $summit, $attendee_id) - { - return $this->tx_service->transaction(function() use($summit, $attendee_id){ - - $attendee = $summit->getAttendeeById($attendee_id); - if(is_null($attendee)) - throw new EntityNotFoundException(); - - $this->attendee_repository->delete($attendee); - }); - } - - /** - * @param Summit $summit - * @param int $attendee_id - * @param array $data - * @return SummitAttendee - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateAttendee(Summit $summit, $attendee_id, array $data) - { - return $this->tx_service->transaction(function() use($summit, $attendee_id, $data){ - - $attendee = $summit->getAttendeeById($attendee_id); - if(is_null($attendee)) - throw new EntityNotFoundException(sprintf("Attendee does not belongs to summit id %s.", $summit->getId())); - - $member = null; - if(isset($data['member_id']) && intval($data['member_id']) > 0) { - $member_id = intval($data['member_id']); - $member = $this->member_repository->getById($member_id); - - if (is_null($member) || !$member instanceof Member) - throw new EntityNotFoundException("Member not found."); - - $old_attendee = $this->attendee_repository->getBySummitAndMember($summit, $member); - if(!is_null($old_attendee) && $old_attendee->getId() != $attendee->getId()) - throw new ValidationException(sprintf("Another attendee (%s) already exist for summit id %s and member id %s.", $old_attendee->getId(), $summit->getId(), $member->getIdentifier())); - } - - if(isset($data['email'])) { - $old_attendee = $this->attendee_repository->getBySummitAndEmail($summit, trim($data['email'])); - if(!is_null($old_attendee) && $old_attendee->getId() != $attendee->getId()) - throw new ValidationException(sprintf("Attendee already exist for summit id %s and email %s.", $summit->getId(), trim($data['email']))); - } - - // check if attendee already exist for this summit - - SummitAttendeeFactory::populate($summit, $attendee , $data, $member); - $attendee->updateStatus(); - return $attendee; - }); - } - - /** - * @param SummitAttendee $attendee - * @param int $ticket_id - * @throws ValidationException - * @throws EntityNotFoundException - * @return SummitAttendeeTicket - */ - public function deleteAttendeeTicket(SummitAttendee $attendee, $ticket_id) - { - return $this->tx_service->transaction(function() use($attendee, $ticket_id){ - $ticket = $attendee->getTicketById($ticket_id); - if(is_null($ticket)){ - throw new EntityNotFoundException(sprintf("ticket id %s does not belongs to attendee id %s", $ticket_id, $attendee->getId())); - } - $attendee->removeTicket($ticket); - }); - } - - /** - * @param Summit $summit - * @param int $page_nbr - * @return mixed - */ - public function updateRedeemedPromoCodes(Summit $summit, $page_nbr = 1) - { - return $this->tx_service->transaction(function() use($summit, $page_nbr){ - $response = $this->eventbrite_api->getAttendees($summit, $page_nbr); - - if(!isset($response['pagination'])) return false; - if(!isset($response['attendees'])) return false; - $pagination = $response['pagination']; - $attendees = $response['attendees']; - $has_more_items = boolval($pagination['has_more_items']); - - foreach($attendees as $attendee){ - if(!isset($attendee['promotional_code'])) continue; - $promotional_code = $attendee['promotional_code']; - if(!isset($promotional_code['code'])) continue; - $code = $promotional_code['code']; - - $promo_code = $this->promo_code_repository->getByCode($code); - if(is_null($promo_code)) continue; - $promo_code->setRedeemed(true); - } - - return $has_more_items; - }); - } - - /** - * @param Summit $summit - * @param SummitAttendee $attendee - * @param Member $other_member - * @param int $ticket_id - * @return SummitAttendeeTicket - * @throws \Exception - */ - public function reassignAttendeeTicketByMember(Summit $summit, SummitAttendee $attendee, Member $other_member, int $ticket_id):SummitAttendeeTicket - { - return $this->tx_service->transaction(function() use($summit, $attendee, $other_member, $ticket_id){ - $ticket = $this->ticket_repository->getByIdExclusiveLock($ticket_id); - - if(is_null($ticket) || !$ticket instanceof SummitAttendeeTicket){ - throw new EntityNotFoundException("ticket not found"); - } - - $new_owner = $this->attendee_repository->getBySummitAndMember($summit, $other_member); - if(is_null($new_owner)){ - $new_owner = SummitAttendeeFactory::build($summit,[ - 'first_name' => $other_member->getFirstName(), - 'last_name' => $other_member->getLastName(), - 'email' => $other_member->getEmail(), - ], $other_member); - $this->attendee_repository->add($new_owner); - } - - $attendee->sendRevocationTicketEmail($ticket); - - $attendee->removeTicket($ticket); - - $new_owner->addTicket($ticket); - - $ticket->generateQRCode(); - $ticket->generateHash(); - - $new_owner->sendInvitationEmail($ticket); - - return $ticket; - }); - } - - - /** - * @param Summit $summit - * @param SummitAttendee $attendee - * @param int $ticket_id - * @param array $payload - * @return SummitAttendeeTicket - * @throws \Exception - */ - public function reassignAttendeeTicket(Summit $summit, SummitAttendee $attendee, int $ticket_id, array $payload):SummitAttendeeTicket - { - return $this->tx_service->transaction(function() use($summit, $attendee, $ticket_id, $payload){ - $ticket = $this->ticket_repository->getByIdExclusiveLock($ticket_id); - - if(is_null($ticket) || !$ticket instanceof SummitAttendeeTicket){ - throw new EntityNotFoundException("ticket not found"); - } - - $attendee_email = $payload['attendee_email'] ?? null; - - $new_owner = $this->attendee_repository->getBySummitAndEmail($summit , $attendee_email); - - if(is_null($new_owner)){ - Log::debug(sprintf("attendee %s does no exists .. creating it ", $attendee_email)); - $attendee_payload = [ - 'email' => $attendee_email - ]; - - $new_owner = SummitAttendeeFactory::build - ( - $summit, - $attendee_payload, - $this->member_repository->getByEmail($attendee_email) - ); - - $this->attendee_repository->add($new_owner); - } - - $attendee_payload = []; - - if(isset($payload['attendee_first_name'])) - $attendee_payload['first_name'] = $payload['attendee_first_name']; - - if(isset($payload['attendee_last_name'])) - $attendee_payload['last_name'] = $payload['attendee_last_name']; - - if(isset($payload['attendee_company'])) - $attendee_payload['company'] = $payload['attendee_company']; - - if(isset($payload['extra_questions'])) - $attendee_payload['extra_questions'] = $payload['extra_questions']; - - SummitAttendeeFactory::populate($summit, $new_owner , $attendee_payload); - - $attendee->sendRevocationTicketEmail($ticket); - - $attendee->removeTicket($ticket); - $attendee->updateStatus(); - $new_owner->addTicket($ticket); - - $ticket->generateQRCode(); - $ticket->generateHash(); - $new_owner->updateStatus(); - $new_owner->sendInvitationEmail($ticket); - - return $ticket; - }); - - } - - /** - * @inheritDoc - */ - public function triggerSend(Summit $summit, array $payload, $filter = null): void - { - ProcessAttendeesEmailRequestJob::dispatch($summit, $payload, $filter); - } - - /** - * @inheritDoc - */ - public function send(int $summit_id, array $payload, Filter $filter = null): void - { - $flow_event = trim($payload['email_flow_event']); - - Log::debug(sprintf("AttendeeService::send summit id %s flow_event %s", $summit_id, $flow_event)); - - $ids = $this->tx_service->transaction(function() use($summit_id, $payload, $filter){ - if(isset($payload['attendees_ids'])) { - Log::debug(sprintf("AttendeeService::send summit id %s attendees_ids %s", $summit_id, json_encode($payload['attendees_ids']))); - return $payload['attendees_ids']; - } - Log::debug(sprintf("AttendeeService::send summit id %s getting by filter", $summit_id)); - if(is_null($filter)){ - $filter = new Filter(); - } - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit_id)); - return $this->attendee_repository->getAllIdsByPage(new PagingInfo(1, PHP_INT_MAX), $filter); - }); - - foreach ($ids as $attendee_id) - try { - $this->tx_service->transaction(function () use ($flow_event, $attendee_id) { - - Log::debug(sprintf("AttendeeService::send processing attendee id %s", $attendee_id)); - - $attendee = $this->attendee_repository->getByIdExclusiveLock(intval($attendee_id)); - if (is_null($attendee) || !$attendee instanceof SummitAttendee) return; - - foreach ($attendee->getTickets() as $ticket) { - try { - Log::debug(sprintf("AttendeeService::send processing attendee %s - ticket %s", $attendee->getEmail(), $ticket->getId())); - // send email - if ($flow_event == SummitAttendeeTicketRegenerateHashEmail::EVENT_SLUG) { - $ticket->sendPublicEditEmail(); - } - - if ($flow_event == InviteAttendeeTicketEditionMail::EVENT_SLUG) { - $attendee->sendInvitationEmail($ticket, true); - } - } catch (\Exception $ex) { - Log::warning($ex); - } - } - }); - } - catch (\Exception $ex) { - Log::warning($ex); - } - } - - public function recalculateAttendeeStatus(int $summit_id):void{ - $this->tx_service->transaction(function() use($summit_id){ - $summit = $this->summit_repository->getById($summit_id); - if(is_null($summit) || !$summit instanceof Summit) return; - - foreach($summit->getAttendees() as $attendee){ - $attendee->updateStatus(); - } - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/ChatTeamService.php b/app/Services/Model/ChatTeamService.php deleted file mode 100644 index d2b3c913..00000000 --- a/app/Services/Model/ChatTeamService.php +++ /dev/null @@ -1,376 +0,0 @@ -invitation_repository = $invitation_repository; - $this->chat_message_repository = $chat_message_repository; - $this->repository = $repository; - $this->member_repository = $member_repository; - $this->resource_server_context = $resource_server_context; - $this->push_sender_service = $push_sender_service; - $this->tx_service = $tx_service; - } - - /** - * @param array $data - * @param Member $owner - * @return ChatTeam - */ - function addTeam(array $data, Member $owner) - { - return $this->tx_service->transaction(function () use($data, $owner){ - $team = new ChatTeam(); - $team->setName($data['name']); - if(isset($data['description'])) - $team->setDescription($data['description']); - $team->setOwner($owner); - $team_member = $team->createMember($owner, ChatTeamPermission::Admin); - $team->addMember($team_member); - $this->repository->add($team); - return $team; - }); - } - - /** - * @param array $data - * @param int $team_id - * @return ChatTeam - */ - function updateTeam(array $data, $team_id){ - return $this->tx_service->transaction(function () use($data, $team_id){ - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new EntityNotFoundException(); - - $team = $this->repository->getById($team_id); - if(is_null($team)) throw new EntityNotFoundException(); - - if(!$team->isAdmin($current_member)) - throw new EntityNotFoundException(); - - $team->setName($data['name']); - if(isset($data['description'])) - $team->setDescription($data['description']); - $this->repository->add($team); - return $team; - }); - } - - /** - * @param int $team_id - * @return void - * @throws EntityNotFoundException - */ - function deleteTeam($team_id) - { - $this->tx_service->transaction(function() use($team_id){ - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new EntityNotFoundException(); - - $team = $this->repository->getById($team_id); - if(is_null($team)) throw new EntityNotFoundException(); - if(!$team->isAdmin($current_member)) - throw new EntityNotFoundException(); - - $this->repository->delete($team); - }); - } - - /** - * @param int $team_id - * @param int $invitee_id - * @param string $permission - * @throws EntityNotFoundException - * @throws ValidationException - * @return ChatTeamInvitation - */ - function addMember2Team($team_id, $invitee_id, $permission = ChatTeamPermission::Read) - { - return $this->tx_service->transaction(function() use($team_id, $invitee_id, $permission){ - - $team = $this->repository->getById($team_id); - if(is_null($team)) throw new EntityNotFoundException(); - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new EntityNotFoundException(); - - $inviter = $this->member_repository->getById($current_member->getId()); - if (is_null($inviter)) throw new EntityNotFoundException(); - - $invitee = $this->member_repository->getById($invitee_id); - if(is_null($invitee)) throw new EntityNotFoundException(); - - if(!$team->isAdmin($inviter)) throw new EntityNotFoundException(); - - if($team->isMember($invitee)) - throw new ValidationException(sprintf('member id %s already is a member of team id %s', $invitee_id, $team_id)); - - if($team->isAlreadyInvited($invitee)) - throw new ValidationException(sprintf('member id %s has a pending invitation on team id %s', $invitee_id, $team_id)); - - $invitation = $team->createInvitation($inviter, $invitee, $permission); - - $team->addInvitation($invitation); - - $this->repository->add($team); - - return $invitation; - - }); - } - - /** - * @param int $invitation_id - * @param int $invitee_id - * @return ChatTeamMember - * @throws EntityNotFoundException - * @throws ValidationException - */ - function acceptInvitation($invitation_id, $invitee_id) - { - return $this->tx_service->transaction(function() use($invitation_id, $invitee_id){ - - $invitee = $this->member_repository->getById($invitee_id); - if(is_null($invitee)) - throw new EntityNotFoundException(); - - $invitation = $this->invitation_repository->getById($invitation_id); - if(is_null($invitation)) - throw new EntityNotFoundException(); - - if($invitation->getInviteeId() != $invitee_id) - throw new EntityNotFoundException(); - - if($invitation->isAccepted()) - throw new ValidationException(sprintf('invitation id %s is already accepted!', $invitee_id)); - - $invitation->accept(); - - $team = $invitation->getTeam(); - - if($team->isMember($invitee)) - throw new ValidationException(sprintf('invitee id %s is already member of team id %s!', $invitee_id, $team->getId())); - - $team_member = $team->createMember($invitee, $invitation->getPermission()); - - $team->addMember($team_member); - - return $team_member; - }); - } - - /** - * @param int $invitation_id - * @param int $invitee_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - function declineInvitation($invitation_id, $invitee_id) - { - $this->tx_service->transaction(function() use($invitation_id, $invitee_id){ - - $invitee = $this->member_repository->getById($invitee_id); - if(is_null($invitee)) - throw new EntityNotFoundException(); - - $invitation = $this->invitation_repository->getById($invitation_id); - if(is_null($invitation)) - throw new EntityNotFoundException(); - - if($invitation->getInviteeId() != $invitee_id) - throw new EntityNotFoundException(); - - if($invitation->isAccepted()) - throw new ValidationException(sprintf('invitation id %s is already accepted!', $invitee_id)); - - $this->invitation_repository->delete($invitation); - }); - } - - /** - * @param int $team_id - * @param int $member_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - function removeMemberFromTeam($team_id, $member_id) - { - $this->tx_service->transaction(function() use($member_id, $team_id){ - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new EntityNotFoundException(); - - $team_member = $this->member_repository->getById($member_id); - if (is_null($team_member)) throw new EntityNotFoundException(); - - $team = $this->repository->getById($team_id); - if(is_null($team)) throw new EntityNotFoundException(); - - if(!$team->isAdmin($current_member)) - throw new EntityNotFoundException(); - - if(!$team->isMember($team_member)) - throw new ValidationException(sprintf('member id %s is not a member of team id %s', $member_id, $team_id)); - - $team->removeMember($team_member); - - }); - } - - /** - * @param int $team_id - * @param array $values - * @return ChatTeamPushNotificationMessage - * @throws EntityNotFoundException - * @throws ValidationException - */ - function postMessage($team_id, array $values) - { - return $this->tx_service->transaction(function() use($team_id, $values){ - - $current_member = $this->resource_server_context->getCurrentUser(); - if (is_null($current_member)) throw new EntityNotFoundException(); - - $team = $this->repository->getById($team_id); - if(is_null($team)) throw new EntityNotFoundException(); - - if(!$team->canPostMessages($current_member)) - throw new ValidationException(sprintf('you do not have permissions to post messages to team id %s', $team_id)); - - $message = $team->createMessage($current_member, $values['body'], $values['priority']); - - $team->addMessage($message) ; - - return $message; - }); - } - - /** - * @param int $batch_size - * @return int - */ - function sendMessages($batch_size = 1000) - { - return $this->tx_service->transaction(function() use($batch_size){ - echo(sprintf('calling ChatTeamService.sendMessages(%s)', $batch_size)).PHP_EOL; - - $teams_ids = $this->repository->getAllTeamsIdsWithPendingMessages2Sent(); - $qty = 0; - - foreach($teams_ids as $team_id) { - - echo(sprintf('processing messages for team id %s', $team_id)).PHP_EOL; - $messages = $this->chat_message_repository->getAllNotSentByTeamPaginated - ( - $team_id, - new PagingInfo(1, $batch_size) - ); - echo(sprintf('found %s messages for team id %s, send them...', $team_id, $messages->getTotal())).PHP_EOL; - $team_messages_counter = 0; - foreach ($messages->getItems() as $message){ - - $data = [ - 'id' => intval($message->getId()), - 'type' => ChatTeamPushNotificationMessage::PushType, - 'body' => $message->getMessage(), - 'from_id' => intval($message->getOwner()->getId()), - 'from_first_name' => $message->getOwner()->getFirstName(), - 'from_last_name' => $message->getOwner()->getLastName(), - 'created_at' => intval($message->getCreatedUTC()->getTimestamp()), - 'team_id' => intval($message->getTeamId()) - ]; - - $this->push_sender_service->sendPush([sprintf('team_%s', $team_id)], $data); - $message->markSent(); - ++$qty; - ++$team_messages_counter; - } - - echo(sprintf('sent %s messages for team id %s', $team_messages_counter, $team_id)).PHP_EOL; - } - return $qty; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/FolderService.php b/app/Services/Model/FolderService.php deleted file mode 100644 index a4824491..00000000 --- a/app/Services/Model/FolderService.php +++ /dev/null @@ -1,92 +0,0 @@ -folder_repository = $folder_repository; - } - - /** - * @param string $folder_name - * @return File - */ - public function findOrMake($folder_name) - { - return $this->tx_service->transaction(function() use($folder_name){ - Log::debug(sprintf("FolderService::findOrMake folder_name %s", $folder_name)); - $folder = $this->folder_repository->getFolderByFileName($folder_name); - if(!is_null($folder)) return $folder; - - // create it - $folder_path = preg_replace('/^\/?(.*)\/?$/', '$1', $folder_name); - $parts = explode("/", $folder_path); - $parent = null; - $item = null; - $file_name = null; - foreach($parts as $part) { - Log::debug(sprintf("FolderService::findOrMake part %s", $part)); - if(!$part) continue; // happens for paths with a trailing slash - if(!empty($file_name)) - $file_name .= '/'; - $file_name .= $part; - Log::debug(sprintf("FolderService::findOrMake file_name %s", $file_name)); - $item = is_null($parent) ? - $this->folder_repository->getFolderByName($part) : - $this->folder_repository->getFolderByNameAndParent($part, $parent); - - if(!$item) { - $item = new File(); - if(!is_null($parent)){ - $item->setParent($parent); - } - else{ - $file_name = 'assets/'.$file_name; - } - $item->setFolder(); - $item->setName($part); - $item->setTitle($part); - $item->setFilename($file_name); - $this->folder_repository->add($item, true); - } - $parent = $item; - } - - return $item; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/IAdminActionsCalendarSyncProcessingService.php b/app/Services/Model/IAdminActionsCalendarSyncProcessingService.php deleted file mode 100644 index 94c38340..00000000 --- a/app/Services/Model/IAdminActionsCalendarSyncProcessingService.php +++ /dev/null @@ -1,26 +0,0 @@ -tx_service = $tx_service; - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/CompanyService.php b/app/Services/Model/Imp/CompanyService.php deleted file mode 100644 index 30d60ae5..00000000 --- a/app/Services/Model/Imp/CompanyService.php +++ /dev/null @@ -1,214 +0,0 @@ -repository = $repository; - $this->file_uploader = $file_uploader; - } - - /** - * @param array $payload - * @throws ValidationException - * @return Company - */ - public function addCompany(array $payload): Company - { - return $this->tx_service->transaction(function() use($payload){ - $company_name = trim($payload['name']); - $former_company = $this->repository->getByName($company_name); - if(!is_null($former_company)){ - throw new ValidationException(sprintf("company %s already exists", $company_name)); - } - $company = CompanyFactory::build($payload); - $this->repository->add($company); - return $company; - }); - } - - /** - * @param int $company_id - * @param array $payload - * @throws ValidationException - * @throws EntityNotFoundException - * @return Company - */ - public function updateCompany(int $company_id, array $payload): Company - { - return $this->tx_service->transaction(function() use($company_id, $payload){ - $company = $this->repository->getById($company_id); - if(is_null($company) || !$company instanceof Company) - throw new EntityNotFoundException(sprintf("company %s not found.", $company_id)); - - if(isset($payload['name'])){ - $former_company = $this->repository->getByName(trim($payload['name'])); - if(!is_null($former_company) && $company_id !== $former_company->getId()){ - throw new ValidationException(sprintf("company %s already exists", $payload['name'])); - } - } - - return CompanyFactory::populate($company, $payload); - }); - } - - /** - * @param int $company_id - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteCompany(int $company_id): void - { - $this->tx_service->transaction(function() use($company_id){ - $company = $this->repository->getById($company_id); - if(is_null($company)) - throw new EntityNotFoundException(sprintf("company %s not found.", $company_id)); - - $this->repository->delete($company); - }); - } - - /** - * @inheritDoc - */ - public function addCompanyLogo(int $company_id, UploadedFile $file, $max_file_size = 10485760): File - { - return $this->tx_service->transaction(function () use ($company_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'svg']; - - $company = $this->repository->getById($company_id); - - if (is_null($company) || !$company instanceof Company) { - throw new EntityNotFoundException('company not found!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png', 'jpg', 'jpeg', 'svg')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $logo = $this->file_uploader->build($file, sprintf('companies/%s/logos', $company->getId()), true); - $company->setLogo($logo); - return $logo; - }); - } - - /** - * @inheritDoc - */ - public function deleteCompanyLogo(int $company_id): void - { - $this->tx_service->transaction(function () use ($company_id) { - - $company = $this->repository->getById($company_id); - - if (is_null($company) || !$company instanceof Company) { - throw new EntityNotFoundException('company not found!'); - } - - $company->clearLogo(); - - }); - } - - /** - * @inheritDoc - */ - public function addCompanyBigLogo(int $company_id, UploadedFile $file, $max_file_size = 10485760): File - { - return $this->tx_service->transaction(function () use ($company_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'svg']; - - $company = $this->repository->getById($company_id); - - if (is_null($company) || !$company instanceof Company) { - throw new EntityNotFoundException('company not found!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png', 'jpg', 'jpeg', 'svg')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $logo = $this->file_uploader->build($file, sprintf('companies/%s/logos', $company->getId()), true); - $company->setBigLogo($logo); - return $logo; - }); - } - - /** - * @inheritDoc - */ - public function deleteCompanyBigLogo(int $company_id): void - { - $this->tx_service->transaction(function () use ($company_id) { - - $company = $this->repository->getById($company_id); - - if (is_null($company) || !$company instanceof Company) { - throw new EntityNotFoundException('company not found!'); - } - - $company->clearBigLogo(); - - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/ExtraQuestionTypeService.php b/app/Services/Model/Imp/ExtraQuestionTypeService.php deleted file mode 100644 index 8f57312c..00000000 --- a/app/Services/Model/Imp/ExtraQuestionTypeService.php +++ /dev/null @@ -1,130 +0,0 @@ -tx_service->transaction(function () use ($question, $payload) { - - $name = trim($payload['value']); - $former_value = $question->getValueByName($name); - if(!is_null($former_value)) - throw new ValidationException("Value already exists."); - - if(isset($payload['label'])) { - $label = trim($payload['label']); - $former_value = $question->getValueByLabel($label); - if (!is_null($former_value)) - throw new ValidationException("Value already exists."); - } - - $value = ExtraQuestionTypeValueFactory::build($payload); - - $question->addValue($value); - - return $value; - - }); - } - - - /** - * @param ExtraQuestionType $question - * @param int $value_id - * @param array $payload - * @return ExtraQuestionTypeValue - * @throws \Exception - */ - protected function _updateOrderExtraQuestionValue(ExtraQuestionType $question, int $value_id, array $payload): ExtraQuestionTypeValue - { - return $this->tx_service->transaction(function () use ($question, $value_id, $payload) { - - $value = $question->getValueById($value_id); - if(is_null($value)) - throw new EntityNotFoundException("Value not found."); - - if(isset($payload['value'])) { - $name = trim($payload['value']); - $former_value = $question->getValueByName($name); - if (!is_null($former_value) && $former_value->getId() != $value_id) - throw new ValidationException("value already exists."); - } - - if(isset($payload['label'])) { - $label = trim($payload['label']); - $former_value = $question->getValueByLabel($label); - if (!is_null($former_value) && $former_value->getId() != $value_id) - throw new ValidationException("value already exists."); - } - - - if (isset($payload['order']) && intval($payload['order']) != $value->getOrder()) { - // request to update order - $question->recalculateValueOrder($value, intval($payload['order']) ); - } - - return ExtraQuestionTypeValueFactory::populate($value, $payload); - }); - } - - - /** - * @param ExtraQuestionType $question - * @param int $value_id - * @throws \Exception - */ - protected function _deleteOrderExtraQuestionValue(ExtraQuestionType $question, int $value_id): void - { - $this->tx_service->transaction(function () use ($question, $value_id) { - - $value = $question->getValueById($value_id); - - if(is_null($value)) - throw new EntityNotFoundException("value not found"); - - // check if question has answers - - if($this->repository->hasAnswers($question)){ - throw new ValidationException(sprintf("You can not delete question value %s bc already has answers from attendees.", $value_id)); - } - - $question->removeValue($value); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/MemberActionsCalendarSyncPreProcessor.php b/app/Services/Model/Imp/MemberActionsCalendarSyncPreProcessor.php deleted file mode 100644 index edbe99c1..00000000 --- a/app/Services/Model/Imp/MemberActionsCalendarSyncPreProcessor.php +++ /dev/null @@ -1,79 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - $this->strategy_factory = $strategy_factory; - } - - /** - * @param MemberScheduleSummitActionSyncWorkRequest[] $requests - * @return MemberScheduleSummitActionSyncWorkRequest[] - */ - function preProcessActions(array $requests){ - - foreach ($requests as $request){ - $strategy = $this->strategy_factory->build($this->queue_manager, $request); - if(is_null($strategy)) continue; - $request = $strategy->process($request); - if(!is_null($request)) - $this->queue_manager->registerRequest($request); - } - - foreach($this->queue_manager->getRequestsToDelete() as $request_2_delete){ - $this->work_request_repository->delete($request_2_delete); - } - return $this->queue_manager->getPurgedRequests(); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/MemberActionsCalendarSyncProcessingService.php b/app/Services/Model/Imp/MemberActionsCalendarSyncProcessingService.php deleted file mode 100644 index 9fb2ad82..00000000 --- a/app/Services/Model/Imp/MemberActionsCalendarSyncProcessingService.php +++ /dev/null @@ -1,262 +0,0 @@ -work_request_repository = $work_request_repository; - $this->calendar_sync_repository = $calendar_sync_repository; - $this->preprocessor_requests = $preprocessor_requests; - $this->facade_factory = $facade_factory; - $this->tx_manager = $tx_manager; - } - - /** - * @param CalendarSyncInfo|null $calendar_sync_info - */ - private function sendReSyncCalendarEmail(CalendarSyncInfo $calendar_sync_info){ - if(!is_null($calendar_sync_info) && !$calendar_sync_info->isRevoked()){ - // revoke it ... - $calendar_sync_info->setRevoked(true); - } - } - /** - * @param string $provider - * @param int $batch_size - * @return int|mixed - * @throws Exception - */ - public function processActions($provider = 'ALL', $batch_size = 1000) - { - return $this->tx_manager->transaction(function() use($provider, $batch_size){ - $count = 0; - - $res = $this->work_request_repository->getUnprocessedMemberScheduleWorkRequestActionByPage - ( - $provider, - new PagingInfo(1, $batch_size) - ); - - $requests = $this->preprocessor_requests->preProcessActions($res->getItems()); - log::info(sprintf("provider %s got %s request to process ...", $provider, count($requests))); - - foreach ($requests as $request){ - try { - log::debug(sprintf("iteration # %s", $count+1)); - if (!$request instanceof MemberScheduleSummitActionSyncWorkRequest) continue; - $calendar_sync_info = $request->getCalendarSyncInfo(); - $remote_facade = $this->facade_factory->build($calendar_sync_info); - if (is_null($remote_facade)) continue; - $member = $request->getOwner(); - $request_type = $request->getType(); - $request_sub_type = $request->getSubType(); - - try { - log::info(sprintf - ( - "%s - processing work request %s - sub type %s - type %s - member %s - credential id %s -revoked credentials %s", - $provider, - $request->getIdentifier(), - $request_sub_type, - $request_type, - $member->getIdentifier(), - $calendar_sync_info->getId(), - $calendar_sync_info->isRevoked() ? 1 : 0 - )); - } - catch (Exception $ex8){ - Log::warning($ex8); - continue; - } - - switch ($request_sub_type) { - - case MemberEventScheduleSummitActionSyncWorkRequest::SubType: { - - $summit_event_id = $request->getSummitEventId(); - $summit_event = $request->getSummitEvent(); - - log::info(sprintf - ( - "%s - processing work request %s - sub type %s - type %s - event id %s - member %s - credential id %s -revoked credentials %s", - $provider, - $request->getIdentifier(), - $request_sub_type, - $request_type, - $summit_event_id, - $member->getIdentifier(), - $calendar_sync_info->getId(), - $calendar_sync_info->isRevoked()? 1:0 - )); - - switch ($request_type) { - case AbstractCalendarSyncWorkRequest::TypeAdd: - if(is_null($summit_event)){ - Log::warning(sprintf("EVENT ADD : event id %s does not exists!", $summit_event_id, $member->getId())); - continue; - } - if ($calendar_sync_info->isRevoked()){ - Log::warning(sprintf("EVENT ADD : event id %s - member id %s could not be added on external calendar bc credential are revoked!", $summit_event_id, $member->getId())); - continue; - } - if($member->isEventSynchronized($calendar_sync_info, $summit_event_id)){ - Log::warning(sprintf("EVENT ADD : event id %s - member id %s already synchronized", $summit_event_id, $member->getId())); - continue; - } - $schedule_sync_info = $remote_facade->addEvent($request); - if(is_null($schedule_sync_info)){ - Log::warning(sprintf("EVENT ADD : event id %s - member id %s could not be added on external calendar", $summit_event_id, $member->getId())); - continue; - } - $member->add2ScheduleSyncInfo($schedule_sync_info); - break; - case AbstractCalendarSyncWorkRequest::TypeUpdate: - if(is_null($summit_event)){ - Log::warning(sprintf("EVENT UPDATE : event id %s does not exists!", $summit_event_id, $member->getId())); - continue; - } - if($calendar_sync_info->isRevoked()) continue; - $sync_info = $member->getScheduleSyncInfoByEvent($summit_event_id, $calendar_sync_info); - $is_scheduled = $member->isOnSchedule($summit_event); - if(is_null($sync_info)) continue; - if(!$is_scheduled) { - $member->removeFromScheduleSyncInfo($sync_info); - continue; - } - $remote_facade->updateEvent($request, $sync_info); - break; - case AbstractCalendarSyncWorkRequest::TypeRemove: - if($calendar_sync_info->isRevoked()) continue; - $schedule_sync_info = $member->getScheduleSyncInfoByEvent($summit_event_id, $calendar_sync_info); - if(is_null($schedule_sync_info)){ - Log::warning(sprintf("EVENT REMOVE : event id %s - member id %s could not be removed, schedule synch info is null", $summit_event_id, $member->getId())); - continue; - } - $remote_facade->deleteEvent($request, $schedule_sync_info); - $member->removeFromScheduleSyncInfo($schedule_sync_info); - break; - } - } - break; - case MemberCalendarScheduleSummitActionSyncWorkRequest::SubType: { - switch ($request_type) { - case AbstractCalendarSyncWorkRequest::TypeAdd: - if($calendar_sync_info->isRevoked()){ - Log::warning(sprintf("CALENDAR ADD : calendar sync info id %s, member id %s is revoked!", $calendar_sync_info->getId(), $member->getId())); - continue; - } - $remote_facade->createCalendar($request, $calendar_sync_info); - break; - case AbstractCalendarSyncWorkRequest::TypeRemove: - $remote_facade->deleteCalendar($request, $calendar_sync_info); - $member->removeFromCalendarSyncInfo($calendar_sync_info); - break; - } - } - break; - } - - $request->markProcessed(); - $count++; - usleep($remote_facade->getSleepInterval()); - } - catch(ForbiddenException $ex1){ - // cant create calendar (CAL DAV)... - Log::warning($ex1); - } - catch(RevokedAccessException $ex2){ - Log::warning($ex2); - $this->sendReSyncCalendarEmail($calendar_sync_info); - } - catch(NotFoundResourceException $ex3){ - Log::warning($ex3); - } - catch(ServerErrorException $ex5){ - Log::error($ex5); - } - catch (RateLimitExceededException $ex6){ - Log::critical($ex6); - break; - } - catch(Exception $ex7){ - Log::error($ex7); - } - } - return $count; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/MemberScheduleWorkQueueManager.php b/app/Services/Model/Imp/MemberScheduleWorkQueueManager.php deleted file mode 100644 index 60803227..00000000 --- a/app/Services/Model/Imp/MemberScheduleWorkQueueManager.php +++ /dev/null @@ -1,212 +0,0 @@ -getSummitEventId(); - } - if(empty($type)) $type = $request->getType(); - return $this->generateKey($type, $request->getCalendarSyncInfo()->getId(), $event_id); - } - - /** - * @param string $type - * @param int $calendar_id - * @param null|int $event_id - * @return string - */ - private function generateKey($type, $calendar_id, $event_id = null){ - $sub_type = is_null($event_id) ? MemberCalendarScheduleSummitActionSyncWorkRequest::SubType : MemberEventScheduleSummitActionSyncWorkRequest::SubType; - $key = "{$sub_type}_{$type}_{$calendar_id}"; - if(!is_null($event_id)){ - $key .= "_{$event_id}"; - } - return $key; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return bool - */ - public function registerRequest(AbstractCalendarSyncWorkRequest $request){ - $key = $this->getKey($request); - if(isset($this->registered_requests[$key])) return false; - $this->registered_requests[$key] = $request; - // register request per member calendar - if($request instanceof MemberEventScheduleSummitActionSyncWorkRequest) { - $calendar_info_id = $request->getCalendarSyncInfo()->getId(); - if (!isset($this->calendars_events[$calendar_info_id])) - $this->calendars_events[$calendar_info_id] = []; - $this->calendars_events[$calendar_info_id][] = $request; - } - - return true; - } - - /** - * @param int $calendar_info_id - * @return MemberEventScheduleSummitActionSyncWorkRequest[] - */ - public function getPendingEventsForCalendar($calendar_info_id){ - if (isset($this->calendars_events[$calendar_info_id])){ - return $this->calendars_events[$calendar_info_id]; - } - return []; - } - - /** - * @param int $calendar_info_id - * @return bool - */ - public function clearPendingEventsForCalendar($calendar_info_id){ - if (isset($this->calendars_events[$calendar_info_id])){ - unset($this->calendars_events[$calendar_info_id]); - return true; - } - return false; - } - - /** - * @param int $calendar_id - * @param int $event_id - * @param string $type - * @return MemberEventScheduleSummitActionSyncWorkRequest[] - */ - public function getSummitEventRequestFor($calendar_id, $event_id, $type = null){ - $types = [ - AbstractCalendarSyncWorkRequest::TypeAdd, - AbstractCalendarSyncWorkRequest::TypeRemove, - AbstractCalendarSyncWorkRequest::TypeUpdate, - ]; - - if(!empty($type)) $types = [$type]; - $list = []; - foreach ($types as $t){ - $key = $this->generateKey($t, $calendar_id, $event_id); - if(isset($this->registered_requests[$key]) && !isset($this->registered_requests_2_delete[$key]) ){ - $list[] = $this->registered_requests[$key]; - } - } - return $list; - } - - /** - * @param int $calendar_id - * @param string $type - * @return MemberCalendarScheduleSummitActionSyncWorkRequest|null - */ - public function getCalendarRequestFor($calendar_id, $type){ - $key = $this->generateKey($type, $calendar_id); - return isset($this->registered_requests[$key]) ? $this->registered_requests[$key] : null; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return bool - */ - public function removeRequest(AbstractCalendarSyncWorkRequest $request){ - $key = $this->getKey($request); - if(isset($this->registered_requests[$key])){ - unset($this->registered_requests[$key]); - if($request instanceof MemberEventScheduleSummitActionSyncWorkRequest) { - $calendar_info_id = $request->getCalendarSyncInfo()->getId(); - if (isset($this->calendars_events[$calendar_info_id])) { - // remove from calendar events - $key = array_search($request, $this->calendars_events[$calendar_info_id]); - if($key!==false){ - unset($this->calendars_events[$calendar_info_id][$key]); - if(isset($this->calendars_events[$calendar_info_id])){ - unset($this->calendars_events[$calendar_info_id]); - } - } - } - } - return true; - } - return false; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return bool - */ - public function registerRequestForDelete(AbstractCalendarSyncWorkRequest $request){ - $key = $this->getKey($request); - if(isset($this->registered_requests_2_delete[$key])) return false; - $this->registerRequest($request); - $this->registered_requests_2_delete[$key] = $request; - return true; - } - - /** - * @return array - */ - public function getPurgedRequests(){ - $list = []; - foreach($this->registered_requests as $key => $request){ - if(isset($this->registered_requests_2_delete[$key])) continue; - $list[] = $request; - }; - return $list; - } - - /** - * @return array - */ - public function getRequestsToDelete(){ - return array_values($this->registered_requests_2_delete); - } - - /** - * @param MemberScheduleSummitActionSyncWorkRequest $request - * @param string|null $type - * @return bool - */ - public function unRegisterRequestForDelete(MemberScheduleSummitActionSyncWorkRequest $request , $type = null){ - $key = $this->getKey($request, $type); - if(!isset($this->registered_requests_2_delete[$key])) return false; - unset($this->registered_requests_2_delete[$key]); - return true; - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/MemberService.php b/app/Services/Model/Imp/MemberService.php deleted file mode 100644 index 6cb6a737..00000000 --- a/app/Services/Model/Imp/MemberService.php +++ /dev/null @@ -1,602 +0,0 @@ -organization_repository = $organization_repository; - $this->member_repository = $member_repository; - $this->user_ext_api = $user_ext_api; - $this->group_repository = $group_repository; - $this->cache_service = $cache_service; - $this->external_user_api = $external_user_api; - $this->speaker_registration_request_repository = $speaker_registration_request_repository; - $this->legal_document_repository = $legal_document_repository; - } - - /** - * @param Member $member - * @param int $affiliation_id - * @param array $data - * @return Affiliation - */ - public function updateAffiliation(Member $member, $affiliation_id, array $data) - { - return $this->tx_service->transaction(function () use ($member, $affiliation_id, $data) { - $affiliation = $member->getAffiliationById($affiliation_id); - if (is_null($affiliation)) - throw new EntityNotFoundException(sprintf("affiliation id %s does not belongs to member id %s", $affiliation_id, $member->getId())); - - if (isset($data['is_current'])) { - $affiliation->setIsCurrent(boolval($data['is_current'])); - } - - if (isset($data['start_date'])) { - $start_date = intval($data['start_date']); - $affiliation->setStartDate(new DateTime("@$start_date")); - } - - if (!$affiliation->isCurrent() && isset($data['end_date'])) { - $end_date = intval($data['end_date']); - $affiliation->setEndDate($end_date > 0 ? new DateTime("@$end_date") : null); - } - - if (isset($data['organization_id'])) { - $org = $this->organization_repository->getById(intval($data['organization_id'])); - if (is_null($org)) - throw new EntityNotFoundException(sprintf("organization id %s not found", $data['organization_id'])); - $affiliation->setOrganization($org); - } - - if (isset($data['organization_name'])) { - $org = $this->organization_repository->getByName(trim($data['organization_name'])); - if (is_null($org)) { - $org = new Organization(); - $org->setName(trim($data['organization_name'])); - $this->organization_repository->add($org); - } - - $affiliation->setOrganization($org); - } - - if (isset($data['job_title'])) { - $affiliation->setJobTitle(trim($data['job_title'])); - } - - if ($affiliation->isCurrent()) { - $affiliation->clearEndDate(); - } - - return $affiliation; - }); - } - - /** - * @param Member $member - * @param $affiliation_id - * @return void - */ - public function deleteAffiliation(Member $member, $affiliation_id) - { - return $this->tx_service->transaction(function () use ($member, $affiliation_id) { - $affiliation = $member->getAffiliationById($affiliation_id); - if (is_null($affiliation)) - throw new EntityNotFoundException(sprintf("affiliation id %s does not belongs to member id %s", $affiliation_id, $member->getId())); - - $member->removeAffiliation($affiliation); - }); - } - - /** - * @param Member $member - * @param int $rsvp_id - * @return void - */ - public function deleteRSVP(Member $member, $rsvp_id) - { - return $this->tx_service->transaction(function () use ($member, $rsvp_id) { - $rsvp = $member->getRsvpById($rsvp_id); - if (is_null($rsvp)) - throw new EntityNotFoundException(sprintf("rsvp id %s does not belongs to member id %s", $rsvp_id, $member->getId())); - - $member->removeRsvp($rsvp); - }); - } - - /** - * @param Member $member - * @param array $data - * @return Affiliation - */ - public function addAffiliation(Member $member, array $data) - { - return $this->tx_service->transaction(function () use ($member, $data) { - - $affiliation = new Affiliation(); - - if (isset($data['is_current'])) - $affiliation->setIsCurrent(boolval($data['is_current'])); - if (isset($data['start_date'])) { - $start_date = intval($data['start_date']); - $affiliation->setStartDate(new DateTime("@$start_date")); - } - if (isset($data['end_date'])) { - $end_date = intval($data['end_date']); - $affiliation->setEndDate($end_date > 0 ? new DateTime("@$end_date") : null); - } - - if (isset($data['organization_id'])) { - $org = $this->organization_repository->getById(intval($data['organization_id'])); - if (is_null($org)) - throw new EntityNotFoundException(sprintf("organization id %s not found", $data['organization_id'])); - $affiliation->setOrganization($org); - } - - if (isset($data['organization_name'])) { - $org = $this->organization_repository->getByName(trim($data['organization_name'])); - if (is_null($org)) { - $org = new Organization(); - $org->setName(trim($data['organization_name'])); - $this->organization_repository->add($org); - } - - $affiliation->setOrganization($org); - } - - if (isset($data['job_title'])) { - $affiliation->setJobTitle(trim($data['job_title'])); - } - - if ($affiliation->isCurrent() && $affiliation->getEndDate() != null) - throw new ValidationException - ( - sprintf - ( - "in order to set affiliation as current end_date should be null" - ) - ); - - $member->addAffiliation($affiliation); - return $affiliation; - }); - } - - /** - * @param ExternalUserDTO $userDTO - * @return Member - * @throws \Exception - */ - public function registerExternalUser(ExternalUserDTO $userDTO): Member - { - return $this->tx_service->transaction(function () use ($userDTO) { - - Log::debug - ( - sprintf - ( - "MemberService::registerExternalUser - user_external_id %s email %s first_name %s last_name %s", - $userDTO->getId(), - $userDTO->getEmail(), - $userDTO->getFirstName(), - $userDTO->getLastName() - ) - ); - - $member = $this->member_repository->getByExternalIdExclusiveLock($userDTO->getId()); - - if(is_null($member)) { - $member = new Member(); - $member->setUserExternalId($userDTO->getId()); - $member->setActive($userDTO->isActive()); - $member->setEmailVerified($userDTO->isEmailVerified()); - $member->setEmail($userDTO->getEmail()); - $member->setFirstName($userDTO->getFirstName()); - $member->setLastName($userDTO->getLastName()); - $this->member_repository->add($member, true); - Event::fire(new NewMember($member->getId())); - } - return $member; - }); - } - - /** - * @param $user_external_id - * @return Member - * @throws \Exception - */ - public function registerExternalUserById($user_external_id): Member - { - return $this->tx_service->transaction(function () use ($user_external_id) { - // get external user from IDP - $user_data = $this->user_ext_api->getUserById($user_external_id); - $email = trim($user_data['email']); - // first by external id due email could be updated - Log::debug(sprintf("MemberService::registerExternalUserById trying to get user by external id %s", $user_external_id)); - $member = $this->member_repository->getByExternalIdExclusiveLock(intval($user_external_id)); - // if we dont registered yet a member with that external id try to get by email - if(is_null($member)) { - Log::debug(sprintf("MemberService::registerExternalUserById trying to get user by email %s", $email)); - $member = $this->member_repository->getByEmail($email); - } - $is_new = false; - if(is_null($member)) { - Log::debug(sprintf("MemberService::registerExternalUserById %s does not exists , creating it ...", $email)); - $member = new Member(); - $member->setActive(boolval($user_data['active'])); - $member->setEmailVerified(boolval($user_data['email_verified'])); - $member->setEmail($email); - $member->setFirstName(trim($user_data['first_name'])); - $member->setLastName(trim($user_data['last_name'])); - $member->setBio($user_data['bio']); - $member->setUserExternalId($user_external_id); - if(isset($user_data['pic'])) - $member->setExternalPic($user_data['pic']); - $this->member_repository->add($member, true); - $is_new = true; - } - else { - Log::debug(sprintf("MemberService::registerExternalUserById %s already exists", $email)); - $member->setActive(boolval($user_data['active'])); - $member->setEmailVerified(boolval($user_data['email_verified'])); - $member->setEmail($email); - $member->setFirstName(trim($user_data['first_name'])); - $member->setLastName(trim($user_data['last_name'])); - $member->setBio($user_data['bio']); - if(isset($user_data['pic'])) - $member->setExternalPic($user_data['pic']); - $member->setUserExternalId($user_external_id); - } - - $this->synchronizeGroups($member, $user_data['groups']); - // check speaker registration request by email and no member set - Log::debug(sprintf("MemberService::registerExternalUserById trying to get former registration request by email %s", $email)); - $request = $this->speaker_registration_request_repository->getByEmail($email); - if(!is_null($request) && $request->hasSpeaker()){ - Log::debug(sprintf("MemberService::registerExternalUserById got former registration request by email %s", $email)); - $speaker = $request->getSpeaker(); - if(!is_null($speaker)) - if(!$speaker->hasMember()) { - Log::debug(sprintf("MemberService::registerExternalUserById setting current member to speaker %s", $speaker->getId())); - $speaker->setMember($member); - } - } - - if($is_new) - Event::fire(new NewMember($member->getId())); - - return $member; - }); - } - - /** - * @param mixed $user_external_id - * @throws EntityNotFoundException - */ - public function deleteExternalUserById($user_external_id): void - { - $this->tx_service->transaction(function () use ($user_external_id) { - Log::debug(sprintf("MemberService::deleteExternalUserById trying to get user by external id %s", $user_external_id)); - $member = $this->member_repository->getByExternalIdExclusiveLock(intval($user_external_id)); - // if we dont registered yet a member with that external id try to get by email - if(is_null($member)) { - throw new EntityNotFoundException(sprintf("Member not found (%s)", $user_external_id)); - } - Log::debug(sprintf("MemberService::deleteExternalUserById deleting user %s (%s)", $member->getId(), $member->getEmail())); - $this->member_repository->delete($member); - }); - } - /** - * @param Member $member - * @param array $groups - * @return Member - * @throws \Exception - */ - public function synchronizeGroups(Member $member, array $groups): Member - { - return $this->tx_service->transaction(function () use ($member, $groups) { - - $val = $this->cache_service->getSingleValue(sprintf("member_%s_sync_groups", $member->getId())); - - if(!empty($val)){ - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s synch already done", $member->getId(), $member->getEmail())); - return $member; - } - - $groups2Remove = []; - - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s", $member->getId(), $member->getEmail())); - - foreach($member->getGroups() as $group){ - // if this group was added from idp, clear it, just in case we were deleted from that group - if(!in_array($group->getCode(), $groups)){ - // do not remove if we are super admins, since we do need this group too ( backward compatibility with SS CMS) - if($group->getCode() == IGroup::Administrators && in_array(IGroup::SuperAdmins, $groups)) - continue; - - // skipping this groups bc are managed by SS side - if(in_array($group->getCode(), [IGroup::FoundationMembers, IGroup::CommunityMembers, IGroup::TrackChairs])){ - Log::debug(sprintf("MemberService::synchronizeGroups skipping group %s removal", $group->getCode())); - continue; - } - - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s marking group %s to remove (external) dues is not on member current groups", $member->getId(), $member->getEmail(), $group->getCode())); - $groups2Remove[] = $group; - } - } - - // remove all groups that arent on our IDP profile anymore ... - foreach ($groups2Remove as $externalGroup){ - if($externalGroup->getCode() === IGroup::SuperAdmins && $member->belongsToGroup(IGroup::Administrators)){ - $group = $this->group_repository->getBySlug(IGroup::Administrators); - if(!is_null($group)) { - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s removing from group %s due is also a super admin", $member->getId(), $member->getEmail(), $group->getCode())); - $member->removeFromGroup($group); - } - } - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s removing from group %s", $member->getId(), $member->getEmail(), $externalGroup->getCode())); - $member->removeFromGroup($externalGroup); - } - - // sync - - foreach ($groups as $code) { - - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s processing group code %s", $member->getId(), $member->getEmail(), $code)); - - if(!$member->belongsToGroup($code)){ - $group = $this->group_repository->getBySlug($code); - if (is_null($group)) { - // create it - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s - group %s does not exists!, .. creating it ", $member->getId(), $member->getEmail(), $code)); - $group = new Group(); - $group->setCode($code); - $group->setExternal(); - $group->setDescription($code); - $group->setTitle($code); - $this->group_repository->add($group, true); - } - $group->setExternal(); - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s adding to group %s", $member->getId(), $member->getEmail(), $code)); - $member->add2Group($group); - } - - // map from super admin to admin ( special case ) - if ($code === IGroup::SuperAdmins) { - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s is on group %s, should be added to group %s", $member->getId(), $member->getEmail(), $code, IGroup::Administrators)); - if(!$member->belongsToGroup(IGroup::Administrators)) { - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s is not on group %s", $member->getId(), $member->getEmail(), IGroup::Administrators)); - $group = $this->group_repository->getBySlug(IGroup::Administrators); - if (is_null($group)) { - // create it - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s - group %s does not exists!, .. creating it ", $member->getId(), $member->getEmail(), $code)); - $group = new Group(); - $group->setCode(IGroup::Administrators); - $group->setDescription(IGroup::Administrators); - $group->setTitle(IGroup::Administrators); - $this->group_repository->add($group, true); - } - $group->setExternal(); - Log::debug(sprintf("MemberService::synchronizeGroups member %s email %s adding to group %s", $member->getId(), $member->getEmail(), $group->getCode())); - $member->add2Group($group); - } - } - - } - - $this->cache_service->setSingleValue(sprintf("member_%s_sync_groups", $member->getId()), 1, self::SYNCH_GROUPS_TTL); - return $member; - }); - } - - /** - * @param string $email - * @return array|null - * @throws \Exception - */ - public function checkExternalUser(string $email) { - Log::debug(sprintf("MemberService::checkExternalUser - trying to get member %s from user api", $email)); - $user = $this->external_user_api->getUserByEmail($email); - // check if primary email is the same if not disregard - Log::debug(sprintf("MemberService::checkExternalUser got entity %s for email %s", json_encode($user), $email)); - $primary_email = $user['email'] ?? null; - if (strcmp(strtolower($primary_email), strtolower($email)) !== 0) { - Log::debug - ( - sprintf - ( - "MemberService::checkExternalUser primary email %s differs from original email %s", - $primary_email, - $email - ) - ); - - // email are not equals , then is not the user bc primary emails differs ( could be a - // match on a secondary email) - $user = null; // set null on user and proceed to emit a registration request. - } - - return $user; - } - - /** - * @param string $email - * @param string $first_name - * @param string $last_name - * @return array - * @throws \Exception - */ - public function emitRegistrationRequest(string $email, string $first_name, string $last_name):array{ - // user does not exists , emit a registration request - return $this->external_user_api->registerUser - ( - $email, - $first_name, - $last_name - ); - } - - /** - * @inheritDoc - */ - public function signFoundationMembership(Member $member): Member - { - return $this->tx_service->transaction(function() use($member){ - if($member->isFoundationMember()) - throw new ValidationException(sprintf("Member %s is already a foundation member", $member->getId())); - $group = $this->group_repository->getBySlug(IGroup::FoundationMembers); - if(is_null($group)) - throw new EntityNotFoundException(sprintf("Group %s not found", IGroup::FoundationMembers)); - - $member->add2Group($group); - $document = $this->legal_document_repository->getBySlug(LegalAgreement::Slug); - if(is_null($document)) - throw new EntityNotFoundException(sprintf("Legal Document %s not found.",LegalAgreement::Slug)); - $member->signFoundationMembership($document); - - return $member; - }); - } - - /** - * @inheritDoc - */ - public function signCommunityMembership(Member $member): Member - { - return $this->tx_service->transaction(function() use($member){ - if($member->isFoundationMember()) { - $member->resignFoundationMembership(); - } - - $group = $this->group_repository->getBySlug(IGroup::CommunityMembers); - if(is_null($group)) - throw new EntityNotFoundException(sprintf("Group %s not found", IGroup::CommunityMembers)); - - $member->add2Group($group); - - return $member; - }); - } - - /** - * @inheritDoc - */ - public function resignMembership(Member $member) - { - return $this->tx_service->transaction(function() use($member){ - - $member->resignMembership(); - - $this->member_repository->delete($member); - - }); - } - -} \ No newline at end of file diff --git a/app/Services/Model/Imp/OrganizationService.php b/app/Services/Model/Imp/OrganizationService.php deleted file mode 100644 index c51f969d..00000000 --- a/app/Services/Model/Imp/OrganizationService.php +++ /dev/null @@ -1,94 +0,0 @@ -organization_repository = $organization_repository; - } - - /** - * @param array $data - * @return Organization - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addOrganization(array $data) - { - return $this->tx_service->transaction(function () use($data){ - - $name = trim( $data['name']); - $old_organization = $this->organization_repository->getByName($name); - if(!is_null($old_organization)) - throw new ValidationException(trans("validation_errors.OrganizationService.addOrganization.alreadyExistName", ["name" => $name])); - - $new_organization = new Organization(); - $new_organization->setName($name); - $this->organization_repository->add($new_organization); - return $new_organization; - }); - } - - /** - * @param array $data - * @param int $organization_id - * @return Organization - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateOrganization(array $data, $organization_id) - { - // TODO: Implement updateOrganization() method. - } - - /** - * @param int $organization_id - * @return void - * @throws EntityNotFoundException - */ - public function deleteOrganization($organization_id) - { - // TODO: Implement deleteOrganization() method. - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/PaymentGatewayProfileService.php b/app/Services/Model/Imp/PaymentGatewayProfileService.php deleted file mode 100644 index 83b24c5d..00000000 --- a/app/Services/Model/Imp/PaymentGatewayProfileService.php +++ /dev/null @@ -1,93 +0,0 @@ -tx_service->transaction(function() use($summit, $payload){ - $profile = PaymentGatewayProfileFactory::build($payload['provider'], $payload); - $formerProfile = $summit->getPaymentGateWayProfilePerApp($profile->getApplicationType()); - if($profile->isActive() && !is_null($formerProfile) && $formerProfile->isActive()){ - throw new ValidationException - ( - sprintf("There is already an active Payment Profile for application type %s,", $formerProfile->getApplicationType()) - ); - } - $summit->addPaymentProfile($profile); - if(isset($payload['active']) && boolval($payload['active']) == true){ - // force activation ( rebuild web hook) - $profile->activate(); - } - return $profile; - }); - } - - /** - * @inheritDoc - */ - public function deletePaymentProfile(Summit $summit, int $child_id): void - { - $this->tx_service->transaction(function() use($summit, $child_id){ - $profile = $summit->getPaymentProfileById($child_id); - if(is_null($profile)) - throw new EntityNotFoundException(); - $summit->removePaymentProfile($profile); - }); - } - - /** - * @inheritDoc - */ - public function updatePaymentProfile(Summit $summit, int $child_id, array $payload): ?PaymentGatewayProfile - { - return $this->tx_service->transaction(function() use($summit, $child_id, $payload){ - - $profile = $summit->getPaymentProfileById($child_id); - if(is_null($profile)) - throw new EntityNotFoundException(); - - $formerProfile = $summit->getPaymentGateWayProfilePerApp($profile->getApplicationType()); - // if we are activating this profile, check if there is not already one activated - if(isset($payload['active']) && boolval($payload['active']) == true && - !is_null($formerProfile) && $formerProfile->getId() != $profile->getId() - && $formerProfile->isActive()){ - throw new ValidationException - ( - sprintf("There is already an active Payment Profile for application type %s.", $formerProfile->getApplicationType()) - ); - } - - $profile = PaymentGatewayProfileFactory::populate($profile, $payload); - - return $profile; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/PresentationCategoryGroupService.php b/app/Services/Model/Imp/PresentationCategoryGroupService.php deleted file mode 100644 index cc4cddee..00000000 --- a/app/Services/Model/Imp/PresentationCategoryGroupService.php +++ /dev/null @@ -1,453 +0,0 @@ -group_repository = $group_repository; - } - - /** - * @param Summit $summit - * @param array $data - * @return PresentationCategoryGroup - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTrackGroup(Summit $summit, array $data) - { - $track_group = $this->tx_service->transaction(function () use ($summit, $data) { - - $former_track_group = $summit->getCategoryGroupByName(trim($data['name'])); - if (!is_null($former_track_group)) { - throw new ValidationException - ( - trans - ('validation_errors.PresentationCategoryGroupService.addTrackGroup.NameAlreadyExists', - [ - 'name' => trim($data['name']), - 'summit_id' => $summit->getId(), - ] - ) - ); - } - - $track_group = PresentationCategoryGroupFactory::build($summit, $data); - - $summit->addCategoryGroup($track_group); - - return $track_group; - }); - - Event::fire - ( - new TrackGroupInserted - ( - - $track_group->getId(), - $track_group->getSummitId(), - $track_group->getClassName() - ) - ); - - return $track_group; - } - - /** - * @param Summit $summit - * @param int $track_group_id - * @param array $data - * @return PresentationCategoryGroup - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTrackGroup(Summit $summit, $track_group_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $track_group_id, $data) { - - if (isset($data['name'])) { - $former_track_group = $summit->getCategoryGroupByName(trim($data['name'])); - if (!is_null($former_track_group) && $former_track_group->getId() != $track_group_id) { - throw new ValidationException - ( - trans('validation_errors.PresentationCategoryGroupService.updateTrackGroup.NameAlreadyExists', - [ - 'name' => trim($data['name']), - 'summit_id' => $summit->getId(), - ]) - ); - } - } - - $track_group = $summit->getCategoryGroupById($track_group_id); - - if (is_null($track_group)) { - throw new EntityNotFoundException - ( - trans('not_found_errors.PresentationCategoryGroupService.updateTrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId(), - ]) - ); - } - - Event::fire - ( - new TrackGroupUpdated - ( - - $track_group->getId(), - $track_group->getSummitId(), - $track_group->getClassName() - ) - ); - - return PresentationCategoryGroupFactory::populate($summit, $track_group, $data); - - }); - } - - /** - * @param Summit $summit - * @param int $track_group_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteTrackGroup(Summit $summit, $track_group_id) - { - return $this->tx_service->transaction(function () use ($summit, $track_group_id) { - - $track_group = $summit->getCategoryGroupById($track_group_id); - - if (is_null($track_group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.deleteTrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - Event::fire - ( - new TrackGroupDeleted - ( - $track_group->getId(), - $track_group->getSummitId(), - $track_group->getClassName() - ) - ); - - $summit->removeCategoryGroup($track_group); - }); - } - - /** - * @param Summit $summit - * @param int $track_group_id - * @param int $track_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function associateTrack2TrackGroup(Summit $summit, $track_group_id, $track_id) - { - return $this->tx_service->transaction(function () use ($summit, $track_group_id, $track_id) { - $track_group = $summit->getCategoryGroupById($track_group_id); - - if (is_null($track_group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.associateTrack2TrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $track = $summit->getPresentationCategory($track_id); - - if (is_null($track)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.associateTrack2TrackGroup.TrackNotFound', - [ - 'track_id' => $track_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $track_group->addCategory($track); - - Event::fire - ( - new TrackGroupUpdated - ( - $track_group->getId(), - $track_group->getSummitId(), - $track_group->getClassName() - ) - ); - }); - } - - /** - * @param Summit $summit - * @param int $track_group_id - * @param int $track_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function disassociateTrack2TrackGroup(Summit $summit, $track_group_id, $track_id) - { - return $this->tx_service->transaction(function () use ($summit, $track_group_id, $track_id) { - - $track_group = $summit->getCategoryGroupById($track_group_id); - - if (is_null($track_group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.disassociateTrack2TrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $track = $summit->getPresentationCategory($track_id); - - if (is_null($track)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.disassociateTrack2TrackGroup.TrackNotFound', - [ - 'track_id' => $track_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $track_group->removeCategory($track); - - Event::fire - ( - new TrackGroupUpdated - ( - $track_group->getId(), - $track_group->getSummitId(), - $track_group->getClassName() - ) - ); - - }); - } - - /** - * @param Summit $summit - * @param int $track_group_id - * @param int $group_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function associateAllowedGroup2TrackGroup(Summit $summit, $track_group_id, $group_id) - { - return $this->tx_service->transaction(function () use ($summit, $track_group_id, $group_id) { - - $track_group = $summit->getCategoryGroupById($track_group_id); - - if (is_null($track_group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.associateAllowedGroup2TrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - if (!$track_group instanceof PrivatePresentationCategoryGroup) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.associateAllowedGroup2TrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $group = $this->group_repository->getById($group_id); - - if (is_null($group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.associateAllowedGroup2TrackGroup.GroupNotFound', - [ - 'group_id' => $group_id, - ] - ) - ); - } - - $track_group->addToGroup($group); - - Event::fire - ( - new TrackGroupUpdated - ( - $track_group->getId(), - $track_group->getSummitId(), - $track_group->getClassName() - ) - ); - }); - } - - /** - * @param Summit $summit - * @param int $track_group_id - * @param int $group_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function disassociateAllowedGroup2TrackGroup(Summit $summit, $track_group_id, $group_id) - { - return $this->tx_service->transaction(function () use ($summit, $track_group_id, $group_id) { - - $track_group = $summit->getCategoryGroupById($track_group_id); - - if (is_null($track_group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.disassociateAllowedGroup2TrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - if (!$track_group instanceof PrivatePresentationCategoryGroup) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.disassociateAllowedGroup2TrackGroup.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $group = $this->group_repository->getById($group_id); - - if (is_null($group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.PresentationCategoryGroupService.disassociateAllowedGroup2TrackGroup.GroupNotFound', - [ - 'group_id' => $group_id, - ] - ) - ); - } - - $track_group->removeFromGroup($group); - - Event::fire - ( - new TrackGroupUpdated - ( - $track_group->getId(), - $track_group->getSummitId(), - $track_group->getClassName() - ) - ); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/PresentationService.php b/app/Services/Model/Imp/PresentationService.php deleted file mode 100644 index 8f89ae7b..00000000 --- a/app/Services/Model/Imp/PresentationService.php +++ /dev/null @@ -1,1153 +0,0 @@ -presentation_repository = $presentation_repository; - $this->speaker_repository = $speaker_repository; - $this->tag_repository = $tag_repository; - $this->folder_service = $folder_service; - $this->file_uploader = $file_uploader; - $this->folder_repository = $folder_repository; - } - - /** - * @param int $presentation_id - * @param array $video_data - * @return PresentationVideo - */ - public function addVideoTo($presentation_id, array $video_data) - { - $video = $this->tx_service->transaction(function () use ($presentation_id, $video_data) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - if ($presentation->hasVideos()) - throw new ValidationException(sprintf('presentation %s already has a video!', $presentation_id)); - - if (!isset($video_data['name'])) $video_data['name'] = $presentation->getTitle(); - - $video = PresentationVideoFactory::build($video_data); - - $presentation->addVideo($video); - - return $video; - }); - - return $video; - } - - /** - * @param int $presentation_id - * @param int $video_id - * @param array $video_data - * @return PresentationVideo - */ - public function updateVideo($presentation_id, $video_id, array $video_data) - { - $video = $this->tx_service->transaction(function () use ($presentation_id, $video_id, $video_data) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - $video = $presentation->getVideoBy($video_id); - - if (is_null($video)) - throw new EntityNotFoundException('video not found!'); - - if (!$video instanceof PresentationVideo) - throw new EntityNotFoundException('video not found!'); - - PresentationVideoFactory::populate($video, $video_data); - - if (isset($data['order']) && intval($video_data['order']) != $video->getOrder()) { - // request to update order - $presentation->recalculateMaterialOrder($video, intval($video_data['order'])); - } - - return $video; - - }); - Event::fire(new PresentationMaterialUpdated($video)); - return $video; - } - - /** - * @param int $presentation_id - * @param int $video_id - * @return void - */ - public function deleteVideo($presentation_id, $video_id) - { - $this->tx_service->transaction(function () use ($presentation_id, $video_id) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - $video = $presentation->getVideoBy($video_id); - - if (is_null($video)) - throw new EntityNotFoundException('video not found!'); - - if (!$video instanceof PresentationVideo) - throw new EntityNotFoundException('video not found!'); - - $presentation->removeVideo($video); - - Event::fire(new PresentationMaterialDeleted($presentation, $video_id, 'PresentationVideo')); - }); - - } - - /** - * @param Summit $summit - * @return int - */ - public function getSubmissionLimitFor(Summit $summit) - { - $res = -1; - if ($summit->isSubmissionOpen()) { - $res = intval($summit->getCurrentSelectionPlanByStatus(SelectionPlan::STATUS_SUBMISSION)->getMaxSubmissionAllowedPerUser()); - } - - // zero means infinity - return $res === 0 ? PHP_INT_MAX : $res; - } - - /** - * @param Summit $summit - * @param array $data - * @return Presentation - * @throws ValidationException - * @throws EntityNotFoundException - * @throws \Exception - */ - public function submitPresentation(Summit $summit, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $data) { - - $member = ResourceServerContext::getCurrentUser(false); - $current_selection_plan = $summit->getCurrentSelectionPlanByStatus(SelectionPlan::STATUS_SUBMISSION); - - if (is_null($current_selection_plan)) - throw new ValidationException(trans( - 'validation_errors.PresentationService.submitPresentation.NotValidSelectionPlan' - )); - - if (!$current_selection_plan->isAllowNewPresentations()) { - throw new ValidationException(sprintf("Selection Plan %s does not allow new submissions", $current_selection_plan->getId())); - } - - $current_speaker = $this->speaker_repository->getByMember($member); - - if (is_null($current_speaker)) - throw new ValidationException(trans( - 'validation_errors.PresentationService.submitPresentation.NotValidSpeaker' - )); - - if (!$current_selection_plan->IsEnabled()) { - throw new ValidationException(sprintf("Submission Period is Closed.")); - } - if (!$current_selection_plan->isSubmissionOpen()) { - throw new ValidationException(sprintf("Submission Period is Closed.")); - } - // check qty - - $limit = $this->getSubmissionLimitFor($summit); - $presentations = []; - - foreach ($current_speaker->getPresentationsBySelectionPlanAndRole($current_selection_plan, PresentationSpeaker::ROLE_MODERATOR) as $p) { - if (isset($presentations[$p->getId()])) continue; - $presentations[$p->getId()] = $p->getId(); - } - - foreach ($current_speaker->getPresentationsBySelectionPlanAndRole($current_selection_plan, PresentationSpeaker::ROLE_SPEAKER) as $p) { - if (isset($presentations[$p->getId()])) continue; - $presentations[$p->getId()] = $p->getId(); - } - - $count = count($presentations); - - if ($count >= $limit) - throw new ValidationException(trans( - 'validation_errors.PresentationService.submitPresentation.limitReached', - ['limit' => $limit])); - - $presentation = new Presentation(); - $presentation->setSelectionPlan($current_selection_plan); - - $presentation->setCreatedBy(ResourceServerContext::getCurrentUser(false)); - $presentation->setUpdatedBy(ResourceServerContext::getCurrentUser(false)); - - $summit->addEvent($presentation); - - if (!$presentation->isCompleted()) - $presentation->setProgress(Presentation::PHASE_SUMMARY); - - $presentation = $this->saveOrUpdatePresentation - ( - $summit, - $current_selection_plan, - $presentation, - $current_speaker, - $data - ); - - return $presentation; - }); - - } - - /** - * @param Summit $summit - * @param int $presentation_id - * @param array $data - * @return Presentation - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updatePresentationSubmission(Summit $summit, $presentation_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $presentation_id, $data) { - - $member = ResourceServerContext::getCurrentUser(false); - - $current_selection_plan = $summit->getCurrentSelectionPlanByStatus(SelectionPlan::STATUS_SUBMISSION); - $current_speaker = $this->speaker_repository->getByMember($member); - - if (is_null($current_speaker)) - throw new ValidationException(trans( - 'validation_errors.PresentationService.updatePresentationSubmission.NotValidSpeaker' - )); - - if (is_null($current_selection_plan)) - throw new ValidationException(trans( - 'validation_errors.PresentationService.updatePresentationSubmission.NotValidSelectionPlan' - )); - - if (!$current_selection_plan->IsEnabled()) { - throw new ValidationException(sprintf("Submission Period is Closed.")); - } - if (!$current_selection_plan->isSubmissionOpen()) { - throw new ValidationException(sprintf("Submission Period is Closed.")); - } - - $presentation = $summit->getEvent($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException(trans( - 'not_found_errors.PresentationService.updatePresentationSubmission.PresentationNotFound', - ['presentation_id' => $presentation_id] - )); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException(trans( - 'not_found_errors.PresentationService.updatePresentationSubmission.PresentationNotFound', - ['presentation_id' => $presentation_id] - )); - - if (!$presentation->canEdit($current_speaker)) - throw new ValidationException(trans( - 'validation_errors.PresentationService.updatePresentationSubmission.CurrentSpeakerCanNotEditPresentation', - ['presentation_id' => $presentation_id] - )); - - $presentation->setUpdatedBy(ResourceServerContext::getCurrentUser(false)); - - return $this->saveOrUpdatePresentation - ( - $summit, - $current_selection_plan, - $presentation, - $current_speaker, - $data - ); - }); - } - - /** - * @param Summit $summit - * @param SelectionPlan $selection_plan - * @param Presentation $presentation - * @param PresentationSpeaker $current_speaker - * @param array $data - * @return Presentation - * @throws \Exception - */ - private function saveOrUpdatePresentation(Summit $summit, - SelectionPlan $selection_plan, - Presentation $presentation, - PresentationSpeaker $current_speaker, - array $data - ) - { - return $this->tx_service->transaction(function () use ($summit, $selection_plan, $presentation, $current_speaker, $data) { - - $event_type = $summit->getEventType(intval($data['type_id'])); - if (is_null($event_type)) { - throw new EntityNotFoundException( - trans( - 'not_found_errors.PresentationService.saveOrUpdatePresentation.eventTypeNotFound', - ['type_id' => $data['type_id']] - ) - ); - } - - if (!$event_type instanceof PresentationType) { - throw new ValidationException(trans( - 'validation_errors.PresentationService.saveOrUpdatePresentation.invalidPresentationType', - ['type_id' => $event_type->getIdentifier()]) - ); - } - - if (!$event_type->isShouldBeAvailableOnCfp()) { - throw new ValidationException(trans( - 'validation_errors.PresentationService.saveOrUpdatePresentation.notAvailableCFP', - ['type_id' => $event_type->getIdentifier()])); - } - - if ($presentation->getId() > 0 && $presentation->getTypeId() != $event_type->getId()) { - // presentation is not new and we are trying to change the presentation type - throw new ValidationException("you cant change the presentation type"); - } - - $track = $summit->getPresentationCategory(intval($data['track_id'])); - if (is_null($track)) { - throw new EntityNotFoundException( - trans( - 'not_found_errors.PresentationService.saveOrUpdatePresentation.trackNotFound', - ['track_id' => $data['track_id']] - ) - ); - } - - if (!$selection_plan->hasTrack($track)) { - throw new ValidationException(trans( - 'validation_errors.PresentationService.saveOrUpdatePresentation.trackDontBelongToSelectionPlan', - [ - 'selection_plan_id' => $selection_plan->getIdentifier(), - 'track_id' => $track->getIdentifier(), - ])); - } - - $presentation->setType($event_type); - $presentation->setCategory($track); - // tags - if (isset($data['tags'])) { - $presentation->clearTags(); - - if (count($data['tags']) > 0) { - if (!$presentation->isCompleted()) - $presentation->setProgress(Presentation::PHASE_TAGS); - } - - foreach ($data['tags'] as $tag_value) { - $tag = $track->getAllowedTagByVal($tag_value); - if (is_null($tag)) { - throw new ValidationException( - trans( - 'validation_errors.PresentationService.saveOrUpdatePresentation.TagNotAllowed', - [ - 'tag' => $tag_value, - 'track_id' => $track->getId() - ] - ) - ); - } - $presentation->addTag($tag); - } - } - - return PresentationFactory::populate($presentation, $data); - }); - } - - /** - * @param Summit $summit - * @param int $presentation_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deletePresentation(Summit $summit, $presentation_id) - { - return $this->tx_service->transaction(function () use ($summit, $presentation_id) { - - $member = ResourceServerContext::getCurrentUser(false); - - $current_speaker = $this->speaker_repository->getByMember($member); - if (is_null($current_speaker)) - throw new EntityNotFoundException(sprintf("member %s does not has a speaker profile", $member->getId())); - - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation)) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation->canEdit($current_speaker)) - throw new ValidationException(sprintf("member %s can not edit presentation %s", - $member->getId(), - $presentation_id - )); - - $presentation->clearMediaUploads(); - - $summit->removeEvent($presentation); - - }); - } - - /** - * @param Summit $summit - * @param int $presentation_id - * @return Presentation - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function completePresentationSubmission(Summit $summit, $presentation_id) - { - return $this->tx_service->transaction(function () use ($summit, $presentation_id) { - - $member = ResourceServerContext::getCurrentUser(false); - - $current_selection_plan = $summit->getCurrentSelectionPlanByStatus(SelectionPlan::STATUS_SUBMISSION); - $current_speaker = $this->speaker_repository->getByMember($member); - - if (is_null($current_speaker)) - throw new EntityNotFoundException(sprintf("member %s does not has a speaker profile", $member->getId())); - - if (is_null($current_selection_plan)) - throw new ValidationException(trans( - 'validation_errors.PresentationService.updatePresentationSubmission.NotValidSelectionPlan' - )); - - if (!$current_selection_plan->IsEnabled()) { - throw new ValidationException(sprintf("Submission Period is Closed.")); - } - if (!$current_selection_plan->isSubmissionOpen()) { - throw new ValidationException(sprintf("Submission Period is Closed.")); - } - - $presentation = $summit->getEvent($presentation_id); - if (is_null($presentation)) - throw new EntityNotFoundException(sprintf("Presentation %s not found.", $presentation_id)); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException(sprintf("Presentation %s not found.", $presentation_id)); - - if ($presentation->isSubmitted()) { - throw new ValidationException - ( - sprintf("Presentation %s is not allowed to mark as completed.", $presentation_id) - ); - } - - if (!$presentation->canEdit($current_speaker)) - throw new ValidationException(sprintf("Member %s can not edit presentation %s.", - $member->getId(), - $presentation_id - )); - - if (!$presentation->fulfilMediaUploadsConditions()) { - throw new ValidationException - ( - sprintf("Presentation %s is not allowed to mark as completed because does not fulfil media uploads conditions.", $presentation_id) - ); - } - - if (!$presentation->fulfilSpeakersConditions()) { - throw new ValidationException - ( - sprintf("Presentation %s is not allowed to mark as completed because does not fulfil speakers conditions.", $presentation_id) - ); - } - - $title = $presentation->getTitle(); - $abstract = $presentation->getAbstract(); - $level = $presentation->getLevel(); - - if (empty($title)) { - throw new ValidationException('Title is Mandatory.'); - } - - if (empty($abstract)) { - throw new ValidationException('Abstract is mandatory.'); - } - - if ($presentation->getType()->isAllowsLevel() && empty($level)) { - throw new ValidationException('Level is mandatory.'); - } - - $presentation->setProgress(Presentation::PHASE_COMPLETE); - $presentation->setStatus(Presentation::STATUS_RECEIVED); - - PresentationCreatorNotificationEmail::dispatch($presentation); - - $presentation->setUpdatedBy($member); - - return $presentation; - }); - } - - /** - * @param LaravelRequest $request - * @param int $presentation_id - * @param array $slide_data - * @param array $allowed_extensions - * @param int $max_file_size - * @return mixed|PresentationSlide - * @throws \Exception - */ - public function addSlideTo - ( - LaravelRequest $request, - $presentation_id, - array $slide_data, - array $allowed_extensions = [], - $max_file_size = 10485760 // bytes - ) - { - $slide = $this->tx_service->transaction(function () use ( - $request, - $presentation_id, - $slide_data, - $max_file_size, - $allowed_extensions - ) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - $hasLink = isset($slide_data['link']) && !empty($slide_data['link']); - $fileInfo = FileUploadInfo::build($request, $slide_data); - $hasFile = !is_null($fileInfo); - - if ($hasFile && $hasLink) { - throw new ValidationException("you must provide a file or a link, not both."); - } - - $slide = PresentationSlideFactory::build($slide_data); - // check if there is any file sent - if ($hasFile) { - - if (!in_array($fileInfo->getFileExt(), $allowed_extensions)) { - throw new ValidationException( - sprintf("file does not has a valid extension '(%s)'.", implode("','", $allowed_extensions))); - } - - if ($fileInfo->getSize(FileSizeUtil::B) > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $slideFile = $this->file_uploader->build - ( - $fileInfo->getFile(), - sprintf('summits/%s/presentations/%s/slides', $presentation->getSummitId(), $presentation_id), - false - ); - - $slide->setSlide($slideFile); - } - - $presentation->addSlide($slide); - - return $slide; - }); - - return $slide; - } - - /** - * @param LaravelRequest $request - * @param int $presentation_id - * @param int $slide_id - * @param array $slide_data - * @param array $allowed_extensions - * @param int $max_file_size - * @return mixed|PresentationSlide - * @throws \Exception - */ - public function updateSlide - ( - LaravelRequest $request, - $presentation_id, - $slide_id, - array $slide_data, - array $allowed_extensions = [], - $max_file_size = 10485760 // bytes - ) - { - - $slide = $this->tx_service->transaction(function () use ( - $request, - $presentation_id, - $slide_data, - $max_file_size, - $allowed_extensions, - $slide_id - ) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - $slide = $presentation->getSlideBy($slide_id); - - if (is_null($slide)) - throw new EntityNotFoundException('slide not found!'); - - if (!$slide instanceof PresentationSlide) - throw new EntityNotFoundException('slide not found!'); - - - $hasLink = isset($slide_data['link']) && !empty($slide_data['link']); - $fileInfo = FileUploadInfo::build($request, $slide_data); - $hasFile = !is_null($fileInfo); - - if ($hasFile && $hasLink) { - throw new ValidationException("you must provide a file or a link, not both."); - } - - if (!$hasLink && !$hasFile && !$slide->hasSlide()) { - throw new ValidationException("you must provide a file or a link."); - } - - PresentationSlideFactory::populate($slide, $slide_data); - - if ($hasLink && $slide->hasSlide()) { - // drop file - $file = $slide->getSlide(); - $this->folder_repository->delete($file); - $slide->clearSlide(); - } - - // check if there is any file sent - if ($hasFile) { - if (!in_array($fileInfo->getFileExt(), $allowed_extensions)) { - throw new ValidationException( - sprintf("file does not has a valid extension '(%s)'.", implode("','", $allowed_extensions))); - } - - if ($fileInfo->getSize(FileSizeUtil::B) > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $slideFile = $this->file_uploader->build - ( - $fileInfo->getFile(), - sprintf('summits/%s/presentations/%s/slides', $presentation->getSummitId(), $presentation_id), - false - ); - - $slide->setSlide($slideFile); - $slide->clearLink(); - } - - if (isset($data['order']) && intval($slide_data['order']) != $slide->getOrder()) { - // request to update order - $presentation->recalculateMaterialOrder($slide, intval($slide_data['order'])); - } - - return $slide; - - }); - - Event::fire(new PresentationMaterialUpdated($slide)); - return $slide; - } - - /** - * @param int $presentation_id - * @param int $slide_id - * @return void - * @throws EntityNotFoundException - */ - public function deleteSlide($presentation_id, $slide_id) - { - $this->tx_service->transaction(function () use ($presentation_id, $slide_id) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - $slide = $presentation->getSlideBy($slide_id); - - if (is_null($slide)) - throw new EntityNotFoundException('slide not found!'); - - if (!$slide instanceof PresentationSlide) - throw new EntityNotFoundException('slide not found!'); - - $presentation->removeSlide($slide); - - Event::fire(new PresentationMaterialDeleted($presentation, $slide_id, 'PresentationSlide')); - }); - } - - /** - * @param $presentation_id - * @param array $link_data - * @return PresentationLink - */ - public function addLinkTo($presentation_id, array $link_data) - { - $link = $this->tx_service->transaction(function () use ( - $presentation_id, - $link_data - ) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - $link = PresentationLinkFactory::build($link_data); - - $presentation->addLink($link); - - return $link; - }); - - return $link; - } - - /** - * @param $presentation_id - * @param $link_id - * @param array $link_data - * @return PresentationLink - */ - public function updateLink($presentation_id, $link_id, array $link_data) - { - $link = $this->tx_service->transaction(function () use ( - $presentation_id, - $link_id, - $link_data - ) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - $link = $presentation->getLinkBy($link_id); - - if (is_null($link)) - throw new EntityNotFoundException('link not found!'); - - if (!$link instanceof PresentationLink) - throw new EntityNotFoundException('link not found!'); - - $link = PresentationLinkFactory::populate($link, $link_data); - - - return $link; - }); - - Event::fire(new PresentationMaterialUpdated($link)); - - return $link; - } - - /** - * @param int $presentation_id - * @param int $link_id - * @return void - */ - public function deleteLink($presentation_id, $link_id) - { - $this->tx_service->transaction(function () use ($presentation_id, $link_id) { - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation)) - throw new EntityNotFoundException('presentation not found!'); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException('presentation not found!'); - - $link = $presentation->getLinkBy($link_id); - - if (is_null($link)) - throw new EntityNotFoundException('link not found!'); - - if (!$link instanceof PresentationLink) - throw new EntityNotFoundException('link not found!'); - - $presentation->removeLink($link); - - Event::fire(new PresentationMaterialDeleted($presentation, $link_id, 'PresentationLink')); - }); - } - - // media uploads - - /** - * @param LaravelRequest $request - * @param Summit $summit - * @param $presentation_id - * @param array $payload - * @return PresentationMediaUpload - * @throws \Exception - */ - public function addMediaUploadTo - ( - LaravelRequest $request, - Summit $summit, - int $presentation_id, - array $payload - ): PresentationMediaUpload - { - return $this->tx_service->transaction(function () use ( - $request, - $summit, - $presentation_id, - $payload - ) { - - Log::debug(sprintf("PresentationService::addMediaUploadTo summit %s presentation %s", $summit->getId(), $presentation_id)); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation) || !$presentation instanceof Presentation) - throw new EntityNotFoundException('Presentation not found.'); - - $media_upload_type_id = intval($payload['media_upload_type_id']); - - $mediaUploadType = $summit->getMediaUploadTypeById($media_upload_type_id); - - if (is_null($mediaUploadType)) - throw new EntityNotFoundException(sprintf("Media Upload Type %s not found.", $media_upload_type_id)); - - if (!$mediaUploadType->isPresentationTypeAllowed($presentation->getType())) { - throw new ValidationException(sprintf("Presentation Type %s is not allowed on Media Upload %s", $presentation->getTypeId(), $media_upload_type_id)); - } - - if ($presentation->hasMediaUploadByType($mediaUploadType)) { - throw new ValidationException - ( - sprintf - ( - "Presentation %s already has a media upload for that type %s.", - $presentation_id, $mediaUploadType->getName() - ) - ); - } - - $fileInfo = FileUploadInfo::build($request, $payload); - - if (is_null($fileInfo)) { - throw new ValidationException("You must provide a file."); - } - - if ($mediaUploadType->getMaxSize() < $fileInfo->getSize()) { - throw new ValidationException(sprintf("Max Size is %s MB (%s).", $mediaUploadType->getMaxSizeMB(), $fileInfo->getSize() / 1024)); - } - - if (!$mediaUploadType->isValidExtension($fileInfo->getFileExt())) { - throw new ValidationException(sprintf("File Extension %s is not valid (%s).", $fileInfo->getFileExt(), $mediaUploadType->getValidExtensions())); - } - - $mediaUpload = PresentationMediaUploadFactory::build(array_merge( - $payload, - [ - 'media_upload_type' => $mediaUploadType, - 'presentation' => $presentation - ] - )); - - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPrivateStorageType()); - if (!is_null($strategy)) { - $strategy->save($fileInfo->getFile(), $mediaUpload->getPath(IStorageTypesConstants::PrivateType), $fileInfo->getFileName()); - } - - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPublicStorageType()); - if (!is_null($strategy)) { - $strategy->save($fileInfo->getFile(), $mediaUpload->getPath(IStorageTypesConstants::PublicType), $fileInfo->getFileName()); - } - - $mediaUpload->setFilename($fileInfo->getFileName()); - $presentation->addMediaUpload($mediaUpload); - - if (!$presentation->isCompleted()) { - Log::debug(sprintf("PresentationService::addMediaUploadTo presentation %s is not complete", $presentation_id)); - $summitMediaUploadCount = $summit->getMediaUploadsMandatoryCount(); - Log::debug(sprintf("PresentationService::addMediaUploadTo presentation %s got summitMediaUploadCount %s", $presentation_id, $summitMediaUploadCount)); - if ($summitMediaUploadCount == 0) { - Log::debug(sprintf("PresentationService::addMediaUploadTo presentation %s marking as PHASE_UPLOADS ( no mandatories uploads)", $presentation_id)); - $presentation->setProgress(Presentation::PHASE_UPLOADS); - } - - if ($summitMediaUploadCount > 0 && $summitMediaUploadCount == $presentation->getMediaUploadsMandatoryCount()) { - Log::debug(sprintf("PresentationService::addMediaUploadTo presentation %s marking as PHASE_UPLOADS ( mandatories completed)", $presentation_id)); - $presentation->setProgress(Presentation::PHASE_UPLOADS); - } - } - Log::debug(sprintf("PresentationService::addMediaUploadTo presentation %s deleting original file %s", $presentation_id, $fileInfo->getFileName())); - $fileInfo->delete(); - - return $mediaUpload; - }); - } - - /** - * @param LaravelRequest $request - * @param Summit $summit - * @param int $presentation_id - * @param int $media_upload_id - * @param array $payload - * @return PresentationMediaUpload - * @throws \Exception - */ - public function updateMediaUploadFrom - ( - LaravelRequest $request, - Summit $summit, - int $presentation_id, - int $media_upload_id, - array $payload - ): PresentationMediaUpload - { - return $this->tx_service->transaction(function () use ( - $request, - $summit, - $presentation_id, - $media_upload_id, - $payload - ) { - - Log::debug(sprintf("PresentationService::updateMediaUploadFrom summit %s presentation %s", $summit->getId(), $presentation_id)); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation) || !$presentation instanceof Presentation) - throw new EntityNotFoundException('Presentation not found.'); - - $mediaUpload = $presentation->getMediaUploadBy($media_upload_id); - - if (is_null($mediaUpload)) - throw new EntityNotFoundException('Presentation Media Upload not found.'); - - $fileInfo = FileUploadInfo::build($request, $payload); - - if (!is_null($fileInfo)) { - // process file - $mediaUploadType = $mediaUpload->getMediaUploadType(); - if (is_null($mediaUploadType)) - throw new ValidationException("Media Upload Type is not set."); - - $fileInfo = FileUploadInfo::build($request, $payload); - if (is_null($fileInfo)) { - throw new ValidationException("You must provide a file."); - } - - if ($mediaUploadType->getMaxSize() < $fileInfo->getSize()) { - throw new ValidationException(sprintf("Max Size is %s MB (%s).", $mediaUploadType->getMaxSizeMB(), $fileInfo->getSize() / 1024)); - } - - if (!$mediaUploadType->isValidExtension($fileInfo->getFileExt())) { - throw new ValidationException(sprintf("File Extension %s is not valid (%s).", $fileInfo->getFileExt(), $mediaUploadType->getValidExtensions())); - } - - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPrivateStorageType()); - - if (!is_null($strategy)) { - $strategy->save($fileInfo->getFile(), $mediaUpload->getPath(IStorageTypesConstants::PrivateType), $fileInfo->getFileName()); - } - - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPublicStorageType()); - if (!is_null($strategy)) { - $strategy->save($fileInfo->getFile(), $mediaUpload->getPath(IStorageTypesConstants::PublicType), $fileInfo->getFileName()); - } - - $payload['file_name'] = $fileInfo->getFileName(); - - $fileInfo->delete(); - } - - return PresentationMediaUploadFactory::populate($mediaUpload, $payload); - }); - } - - - /** - * @inheritDoc - */ - public function deleteMediaUpload(Summit $summit, int $presentation_id, int $media_upload_id): void - { - $this->tx_service->transaction(function () use ( - $summit, - $presentation_id, - $media_upload_id - ) { - Log::debug(sprintf("PresentationService::deleteMediaUpload summit %s presentation %s", $summit->getId(), $presentation_id)); - - $presentation = $this->presentation_repository->getById($presentation_id); - - if (is_null($presentation) || !$presentation instanceof Presentation) - throw new EntityNotFoundException('Presentation not found.'); - - $mediaUpload = $presentation->getMediaUploadBy($media_upload_id); - if (is_null($mediaUpload)) { - throw new EntityNotFoundException("Media Upload not found."); - } - - $mediaUploadType = $mediaUpload->getMediaUploadType(); - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPrivateStorageType()); - - if (!is_null($strategy)) { - $strategy->markAsDeleted($mediaUpload->getPath(IStorageTypesConstants::PrivateType), $mediaUpload->getFilename()); - } - - $strategy = FileUploadStrategyFactory::build($mediaUploadType->getPublicStorageType()); - - if (!is_null($strategy)) { - $strategy->markAsDeleted($mediaUpload->getPath(IStorageTypesConstants::PublicType), $mediaUpload->getFilename()); - } - - $presentation->removeMediaUpload($mediaUpload); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/PresentationVideoMediaUploadProcessor.php b/app/Services/Model/Imp/PresentationVideoMediaUploadProcessor.php deleted file mode 100644 index 83b4057a..00000000 --- a/app/Services/Model/Imp/PresentationVideoMediaUploadProcessor.php +++ /dev/null @@ -1,510 +0,0 @@ -event_repository = $event_repository; - $this->assets_api = null; - } - - /** - * @param int $summit_id - * @param MuxCredentials $credentials - * @param string|null $mountingFolder - * @return int - * @throws \Exception - */ - public function processPublishedPresentationFor(int $summit_id, MuxCredentials $credentials, ?string $mountingFolder = null): int - { - $this->_configMux($credentials); - - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::processPublishedPresentationFor summit id %s mountingFolder %s", $summit_id, $mountingFolder)); - $event_ids = $this->tx_service->transaction(function () use ($summit_id) { - return $this->event_repository->getPublishedEventsIdsBySummit($summit_id); - }); - - foreach ($event_ids as $event_id) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processPublishedPresentationFor processing event %s", $event_id)); - $this->processEvent(intval($event_id), $mountingFolder); - } - - return count($event_ids); - } - - /** - * @param int $event_id - * @param string|null $mountingFolder - * @param MuxCredentials|null $credentials - * @return bool - */ - public function processEvent(int $event_id, ?string $mountingFolder, ?MuxCredentials $credentials = null): bool - { - try { - $this->_configMux($credentials); - return $this->tx_service->transaction(function () use ($event_id, $mountingFolder) { - try { - $event = $this->event_repository->getByIdExclusiveLock($event_id); - if (is_null($event) || !$event instanceof Presentation) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s not found", $event_id)); - return false; - } - - if (!$event->isPublished()) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s not published", $event_id)); - return false; - } - - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::processEvent processing event %s (%s)", $event->getTitle(), $event_id)); - - if (!empty($event->getMuxAssetId())) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s already has assigned an asset id %s", $event_id, $event->getMuxAssetId())); - return false; - } - - $has_video = false; - foreach ($event->getMediaUploads() as $mediaUpload) { - - if ($mediaUpload->getMediaUploadType()->isVideo()) { - if ($has_video) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s processing media upload %s (%s) already has a video processed!.", $event_id, $mediaUpload->getId(), $mediaUpload->getFilename())); - continue; - } - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s processing media upload %s", $event_id, $mediaUpload->getId())); - $has_video = true; - - $strategy = FileDownloadStrategyFactory::build($mediaUpload->getMediaUploadType()->getPrivateStorageType()); - if (!is_null($strategy)) { - $relativePath = $mediaUpload->getRelativePath(IStorageTypesConstants::PrivateType, $mountingFolder); - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s processing media upload %s relativePath %s", $event_id, $mediaUpload->getId(), $relativePath)); - $assetUrl = $strategy->getUrl($relativePath); - if ($assetUrl == '#') { - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s processing media upload %s got asset url %s is not valid", $event_id, $mediaUpload->getId(), $assetUrl)); - return false; - } - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s processing media upload %s got asset url %s", $event_id, $mediaUpload->getId(), $assetUrl)); - - // Create Asset Request - $input = new MuxInputSettings(["url" => $assetUrl]); - $createAssetRequest = new MuxCreateAssetRequest(["input" => $input, "playback_policy" => [MuxPlaybackPolicy::PUBLIC_PLAYBACK_POLICY]]); - // Ingest - $result = $this->assets_api->createAsset($createAssetRequest); - - // Print URL - $playback_id = $result->getData()->getPlaybackIds()[0]->getId(); - $streaming_url = sprintf("https://stream.mux.com/%s.m3u8", $playback_id); - $asset_id = $result->getData()->getId(); - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::processEvent event %s Playback URL: %s assset id %s", $event_id, $streaming_url, $asset_id)); - - $event->setStreamingUrl($streaming_url); - $event->setMuxAssetId($asset_id); - $event->setMuxPlaybackId($playback_id); - } - } - } - } catch (\Exception $ex) { - Log::warning($ex); - throw $ex; - } - return true; - }); - } catch (\Exception $ex) { - Log::error($ex); - return false; - } - } - - /** - * @param int $event_id - * @throws \Exception - */ - public function enableMP4Support(int $event_id, ?MuxCredentials $credentials = null): void - { - $this->_configMux($credentials); - $this->tx_service->transaction(function () use ($event_id) { - $event = $this->event_repository->getByIdExclusiveLock($event_id); - if (is_null($event) || !$event instanceof Presentation) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::enableMP4Support event %s not found", $event_id)); - return; - } - if (!$event->isPublished()) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::enableMP4Support event %s not published", $event_id)); - return; - } - - Log::debug(sprintf("PresentationVideoMediaUploadProcessor::enableMP4Support processing event %s (%s)", $event->getTitle(), $event_id)); - - $assetId = $event->getMuxAssetId(); - if (empty($assetId)) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::enableMP4Support event %s asset id is empty", $event_id)); - return; - } - - $this->_enableMP4Support($assetId); - }); - } - - /** - * @param string $assetId - * @return \MuxPhp\Models\AssetResponse - * @throws \MuxPhp\ApiException - */ - private function _enableMP4Support(string $assetId) - { - try { - $request = new MuxUpdateAssetMP4SupportRequest(['mp4_support' => MuxUpdateAssetMP4SupportRequest::MP4_SUPPORT_STANDARD]); - $result = $this->assets_api->updateAssetMp4Support($assetId, $request); - $tracks = $result->getData()->getTracks(); - Log::debug - ( - sprintf - ( - "PresentationVideoMediaUploadProcessor::_enableMP4Support asset id %s enable mp4 support response %s", - $assetId, - json_encode($tracks) - ) - ); - - return $tracks; - } - catch(ApiException $ex){ - Log::warning($ex); - $response = json_decode($ex->getResponseBody()); - if(count($response->error->messages) > 0){ - if($response->error->messages[0] == "Download already exists"){ - return null; - } - } - throw $ex; - } - } - - - private function _configMux(MuxCredentials $credentials) - { - if (!is_null($this->assets_api)) return; - - try { - // Authentication Setup - $config = MuxConfig::getDefaultConfiguration() - ->setUsername($credentials->getTokenId()) - ->setPassword($credentials->getTokenSecret()); - - // API Client Initialization - $this->assets_api = new MuxAssetApi( - new GuzzleHttpClient, - $config - ); - - $this->playback_api = new MuxPlaybackIDApi( - new GuzzleHttpClient, - $config - ); - } - catch (\Exception $ex){ - Log::error($ex); - throw $ex; - } - } - - /** - * @param int $summit_id - * @param MuxCredentials $credentials - * @param string|null $mail_to - * @return int - * @throws \Exception - */ - public function processSummitEventsStreamURLs - ( - int $summit_id, - MuxCredentials $credentials, - ?string $mail_to - ): int - { - - Log::debug - ( - sprintf - ( - "PresentationVideoMediaUploadProcessor::processSummitEventsStreamURLs Summit %s Credentials %s mail to %s", - $summit_id, - $credentials, - $mail_to - ) - ); - - $event_ids = []; - $excerpt = sprintf('Starting MUX Assets Enabling MP4 Support Process Summit %s.', $summit_id).PHP_EOL; - - try { - $event_ids = $this->tx_service->transaction(function () use ($summit_id) { - return $this->event_repository->getPublishedEventsIdsBySummit($summit_id); - }); - - $this->_configMux($credentials); - - - foreach ($event_ids as $event_id) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processMuxAssetsFromStreamUrl processing event %s", $event_id)); - try { - $this->tx_service->transaction(function () use ($event_id, $credentials, &$excerpt) { - try { - - $event = $this->event_repository->getByIdExclusiveLock($event_id); - if (is_null($event) || !$event instanceof Presentation) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processMuxAssetsFromStreamUrl event %s not found", $event_id)); - return false; - } - - if (!$event->isPublished()) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processMuxAssetsFromStreamUrl event %s not published", $event_id)); - $excerpt .= sprintf("event %s not published", $event_id) . PHP_EOL; - return false; - } - - if (!empty($event->getMuxAssetId())) { - $excerpt .= sprintf("event %s - mux asset id (%s) - already has enabled mp4 support.", $event_id, $event->getMuxAssetId()) . PHP_EOL; - return false; - } - $stream_url = $event->getStreamingUrl(); - if(empty($stream_url)){ - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processMuxAssetsFromStreamUrl event %s stream url does not match mux format (empty)", $event_id)); - $excerpt .= sprintf("event %s stream url does not match mux format (empty)", $event_id) . PHP_EOL; - } - // test $stream_url to check if a mux playlist format - if (!preg_match(self::MUX_STREAM_REGEX, $stream_url, $matches)) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processMuxAssetsFromStreamUrl event %s stream url does not match mux format (%s)", $event_id, $stream_url)); - $excerpt .= sprintf("event %s stream url does not match mux format (%s)", $event_id, $stream_url) . PHP_EOL; - return false; - } - if(count($matches) < 2){ - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::processMuxAssetsFromStreamUrl event %s stream url does not match mux format (%s)", $event_id, $stream_url)); - $excerpt .= sprintf("event %s stream url does not match mux format (%s)", $event_id, $stream_url) . PHP_EOL; - return false; - } - $playback_id = $matches[1]; - $event->setMuxPlaybackId($playback_id); - $playbackResponse = $this->playback_api->getAssetOrLivestreamId($playback_id); - $asset_id = $playbackResponse->getData()->getObject()->getId(); - $event->setMuxAssetId($asset_id); - $assetResponse = $this->assets_api->getAsset($asset_id); - $staticRenditions = $assetResponse->getData()->getStaticRenditions(); - if (!is_null($staticRenditions)) { - $excerpt .= sprintf("event %s - mux asset id (%s) - has already enabled mp4 support.", $event_id, $asset_id) . PHP_EOL; - return false; - } - $this->_enableMP4Support($asset_id); - $excerpt .= sprintf("event %s - mux asset id (%s) - has been enabled mp4 support.", $event_id, $asset_id) . PHP_EOL; - } catch (\Exception $ex) { - $excerpt .= sprintf("event %s - error on enabling mp4 support.", $event_id) . PHP_EOL; - Log::warning($ex); - throw $ex; - } - }); - } catch (\Exception $ex) { - Log::error($ex); - } - } - - $excerpt .= sprintf("%s events processed.", count($event_ids)) . PHP_EOL; - } - catch (\Exception $ex){ - $excerpt .= sprintf("Process Error %s", $ex->getMessage()) . PHP_EOL; - Log::error($ex); - } - - if (!empty($mail_to)) - Mail::queue(new MUXExportExcerptMail($mail_to, "MUX Assets MP4 Enabling Process", $excerpt)); - - if(count($event_ids) > 0) { - // fire exporting - // @see https://docs.mux.com/guides/video/download-your-videos#download-videos - CreateVideosFromMUXAssetsForSummitJob::dispatch( - $summit_id, - $credentials->getTokenId(), - $credentials->getTokenSecret(), - $mail_to - )->delay(now()->addMinutes(1)); - } - - return count($event_ids); - } - - /** - * @param int $summit_id - * @param MuxCredentials $credentials - * @param string|null $mail_to - * @return int - * @throws \Exception - */ - public function createVideosFromMUXAssets(int $summit_id, - MuxCredentials $credentials, - ?string $mail_to): int - { - Log::debug - ( - sprintf - ( - "PresentationVideoMediaUploadProcessor::createVideosFromMUXAssets Summit %s Credentials %s mail to %s", - $summit_id, - $credentials, - $mail_to - ) - ); - $event_ids = []; - $excerpt = sprintf('Starting Create Videos From MUX Assets Process Summit %s.', $summit_id).PHP_EOL; - try { - $event_ids = $this->tx_service->transaction(function () use ($summit_id) { - return $this->event_repository->getPublishedEventsIdsBySummit($summit_id); - }); - - $this->_configMux($credentials); - - foreach ($event_ids as $event_id) { - $this->tx_service->transaction(function () use ($event_id, $credentials, &$excerpt) { - try { - - $event = $this->event_repository->getByIdExclusiveLock($event_id); - if (is_null($event) || !$event instanceof Presentation) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::createVideosFromMUXAssets event %s not found", $event_id)); - return false; - } - - if (!$event->isPublished()) { - Log::warning(sprintf("PresentationVideoMediaUploadProcessor::createVideosFromMUXAssets event %s not published", $event_id)); - $excerpt .= sprintf("event %s not published.", $event_id) . PHP_EOL; - return false; - } - - if ($event->getVideosWithExternalUrls()->count() > 0) { - $excerpt .= sprintf("event %s already processed.", $event_id) . PHP_EOL; - return false; - } - - $assetId = $event->getMuxAssetId(); - if (empty($assetId)) { - $excerpt .= sprintf("event %s not processed.", $event_id) . PHP_EOL; - return false; - } - - $result = $this->assets_api->getAsset($assetId); - $staticRenditions = $result->getData()->getStaticRenditions(); - - if (is_null($staticRenditions)) { - $excerpt .= sprintf("event %s - mp4 not enabled.", $event_id) . PHP_EOL; - return false; - } - - if ($staticRenditions->getStatus() != 'ready') { - $excerpt .= sprintf("event %s - transcoding not ready (%s)", $event_id, $staticRenditions->getStatus()) . PHP_EOL; - return false; - } - - $bestFile = null; - - $fileNames = [ - 'low.mp4', - 'medium.mp4', - 'high.mp4', - ]; - - foreach ($staticRenditions->getFiles() as $file) { - if (is_null($bestFile)) $bestFile = $file; - if (array_search($bestFile->getName(), $fileNames) < array_search($file->getName(), $fileNames)) { - $bestFile = $file; - } - } - if (is_null($bestFile)) { - $excerpt .= sprintf("event %s - transcoding not ready (%s).", $event_id, $staticRenditions->getStatus()) . PHP_EOL; - return 0; - }; - $newVideo = PresentationVideoFactory::build([ - 'name' => $event->getTitle(), - 'external_url' => sprintf("https://stream.mux.com/%s/%s", $event->getMuxPlaybackId(), $bestFile->getName()) - ]); - - $event->addVideo($newVideo); - - } catch (\Exception $ex) { - $excerpt .= sprintf("event %s - error on exporting mux asset.", $event_id) . PHP_EOL; - Log::warning($ex); - throw $ex; - } - }); - } - - $excerpt .= sprintf("%s events processed.", count($event_ids)) . PHP_EOL; - } - catch (\Exception $ex){ - $excerpt .= sprintf("Process Error %s", $ex->getMessage()) . PHP_EOL; - Log::error($ex); - } - if (!empty($mail_to)) - Mail::queue(new MUXExportExcerptMail($mail_to, "Videos Creation Process", $excerpt)); - - return count($event_ids); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/RSVPTemplateService.php b/app/Services/Model/Imp/RSVPTemplateService.php deleted file mode 100644 index a183d3c1..00000000 --- a/app/Services/Model/Imp/RSVPTemplateService.php +++ /dev/null @@ -1,614 +0,0 @@ -rsvp_template_repository = $rsvp_template_repository; - } - - /** - * @param Summit $summit - * @param Member|null $creator - * @param array $payload - * @return RSVPTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTemplate(Summit $summit, Member $creator, array $payload) - { - return $this->tx_service->transaction(function() use($summit, $creator, $payload){ - - $former_template = $summit->getRSVPTemplateByTitle($payload['title']); - - if(!is_null($former_template)){ - throw new ValidationException - ( - trans('validation_errors.RSVPTemplateService.addTemplate.TitleAlreadyExists', - [ - 'title' => $payload['title'], - 'summit_id' => $summit->getId() - ] - )); - } - - $template = SummitRSVPTemplateFactory::build($payload); - - if(!is_null($creator)) - $template->setCreatedBy($creator); - - $summit->addRSVPTemplate($template); - - return $template; - }); - } - - /** - * @param Summit $summit - * @param int $template_id - * @param array $payload - * @return RSVPTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTemplate(Summit $summit, $template_id, array $payload) - { - return $this->tx_service->transaction(function() use($summit, $template_id, $payload){ - - if(isset($payload['title'])) { - $former_template = $summit->getRSVPTemplateByTitle($payload['title']); - - if (!is_null($former_template) && $former_template->getId() != $template_id) { - throw new ValidationException - ( - trans('validation_errors.RSVPTemplateService.updateTemplate.TitleAlreadyExists', - [ - 'title' => $payload['title'], - 'summit_id' => $summit->getId() - ] - ) - ); - } - } - - $template = $summit->getRSVPTemplateById($template_id); - - if(is_null($template)){ - throw new EntityNotFoundException - ( - trans('not_found_errors.RSVPTemplateService.updateTemplate.TemplateNotFound', - [ - 'template_id' => $template_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - return SummitRSVPTemplateFactory::populate($template, $payload); - }); - } - - /** - * @param Summit $summit - * @param int $template_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteTemplate(Summit $summit, $template_id) - { - $this->tx_service->transaction(function() use($summit, $template_id){ - $template = $summit->getRSVPTemplateById($template_id); - if(is_null($template)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.deleteTemplate.TemplateNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - ] - ) - ); - - $summit->removeRSVPTemplate($template); - }); - } - - /** - * @param Summit $summit - * @param $template_id - * @param array $data - * @return RSVPQuestionTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addQuestion(Summit $summit, $template_id, array $data) - { - return $this->tx_service->transaction(function() use($summit, $template_id, $data){ - - $template = $summit->getRSVPTemplateById($template_id); - - if(is_null($template)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.addQuestion.TemplateNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - ] - ) - ); - - $former_question = $template->getQuestionByName($data['name']); - if(!is_null($former_question)){ - throw new ValidationException - ( - trans - ( - 'validation_errors.RSVPTemplateService.addQuestion.QuestionNameAlreadyExists', - [ - 'template_id' => $template_id, - 'name' => $data['name'] - ] - ) - ); - } - - $question = SummitRSVPTemplateQuestionFactory::build($data); - - $template->addQuestion($question); - - return $question; - }); - } - - /** - * @param Summit $summit - * @param int $template_id - * @param int $question_id - * @param array $data - * @return RSVPQuestionTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateQuestion(Summit $summit, $template_id, $question_id, array $data) - { - return $this->tx_service->transaction(function() use($summit, $template_id, $question_id, $data){ - - $template = $summit->getRSVPTemplateById($template_id); - - if(is_null($template)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.updateQuestion.TemplateNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - ] - ) - ); - - $question = $template->getQuestionById($question_id); - if(is_null($question)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.updateQuestion.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - - $class_name = $data['class_name']; - $reflect = new \ReflectionClass($question); - if ($reflect->getShortName() !== $class_name) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.updateQuestion.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - } - - if(isset($data['name'])) { - $former_question = $template->getQuestionByName($data['name']); - if (!is_null($former_question) && $former_question->getId() != $question_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.RSVPTemplateService.updateQuestion.QuestionNameAlreadyExists', - [ - 'template_id' => $template_id, - 'name' => $data['name'] - ] - ) - ); - } - } - - if (isset($data['order']) && intval($data['order']) != $question->getOrder()) { - // request to update order - $template->recalculateQuestionOrder($question, intval($data['order'])); - } - - return SummitRSVPTemplateQuestionFactory::populate($question, $data); - - }); - } - - /** - * @param Summit $summit - * @param int $template_id - * @param int $question_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteQuestion(Summit $summit, $template_id, $question_id) - { - return $this->tx_service->transaction(function() use($summit, $template_id, $question_id){ - - $template = $summit->getRSVPTemplateById($template_id); - - if(is_null($template)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.deleteQuestion.TemplateNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - ] - ) - ); - - $question = $template->getQuestionById($question_id); - if(is_null($question)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.deleteQuestion.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - - $template->removeQuestion($question); - }); - } - - /** - * @param Summit $summit - * @param int $template_id - * @param int $question_id - * @param array $data - * @return RSVPQuestionValueTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addQuestionValue($summit, $template_id, $question_id, $data) - { - return $this->tx_service->transaction(function() use($summit, $template_id, $question_id, $data){ - - $template = $summit->getRSVPTemplateById($template_id); - - if(is_null($template)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.addQuestionValue.TemplateNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - ] - ) - ); - - $question = $template->getQuestionById($question_id); - if(is_null($question)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.addQuestionValue.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - - if(!$question instanceof RSVPMultiValueQuestionTemplate){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.addQuestionValue.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - } - - $former_value = $question->getValueByValue($data['value']); - if(!is_null($former_value)){ - throw new ValidationException - ( - trans - ( - 'validation_errors.RSVPTemplateService.addQuestionValue.ValueAlreadyExist', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - 'value' => $data['value'] - ] - ) - ); - } - - $value = SummitRSVPTemplateQuestionValueFactory::build($data); - - $question->addValue($value); - - return $value; - }); - } - - /** - * @param Summit $summit - * @param int $template_id - * @param int $question_id - * @param int $value_id - * @param array $data - * @return RSVPQuestionValueTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateQuestionValue($summit, $template_id, $question_id, $value_id, $data) - { - return $this->tx_service->transaction(function() use($summit, $template_id, $question_id, $value_id, $data){ - - $template = $summit->getRSVPTemplateById($template_id); - - if(is_null($template)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.updateQuestionValue.TemplateNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - ] - ) - ); - - $question = $template->getQuestionById($question_id); - if(is_null($question)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.updateQuestionValue.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - - if(!$question instanceof RSVPMultiValueQuestionTemplate){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.updateQuestionValue.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - } - - if(isset($data['value'])) { - $former_value = $question->getValueByValue($data['value']); - if (!is_null($former_value) && $former_value->getId() != $value_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.RSVPTemplateService.updateQuestionValue.ValueAlreadyExist', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - 'value' => $data['value'] - ] - ) - ); - } - } - - $value = $question->getValueById($value_id); - if(is_null($value)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.updateQuestionValue.ValueNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - 'value_id' => $value_id, - ] - ) - ); - - $value = SummitRSVPTemplateQuestionValueFactory::populate($value, $data); - - - if (isset($data['order']) && intval($data['order']) != $value->getOrder()) { - // request to update order - $question->recalculateValueOrder($value, intval($data['order'])); - } - - - return $value; - }); - } - - /** - * @param Summit $summit - * @param int $template_id - * @param int $question_id - * @param int $value_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteQuestionValue($summit, $template_id, $question_id, $value_id) - { - return $this->tx_service->transaction(function() use($summit, $template_id, $question_id, $value_id){ - - $template = $summit->getRSVPTemplateById($template_id); - - if(is_null($template)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.deleteQuestionValue.TemplateNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - ] - ) - ); - - $question = $template->getQuestionById($question_id); - if(is_null($question)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.deleteQuestionValue.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - - if(!$question instanceof RSVPMultiValueQuestionTemplate) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.deleteQuestionValue.QuestionNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - ] - ) - ); - - $value = $question->getValueById($value_id); - - if(is_null($value)){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.RSVPTemplateService.deleteQuestionValue.ValueNotFound', - [ - 'summit_id' => $summit->getId(), - 'template_id' => $template_id, - 'question_id' => $question_id, - 'value_id' => $value_id - ] - ) - ); - } - - $question->removeValue($value); - - }); - } - -} \ No newline at end of file diff --git a/app/Services/Model/Imp/RegistrationIngestionService.php b/app/Services/Model/Imp/RegistrationIngestionService.php deleted file mode 100644 index 4439df9c..00000000 --- a/app/Services/Model/Imp/RegistrationIngestionService.php +++ /dev/null @@ -1,331 +0,0 @@ -summit_repository = $summit_repository; - $this->feed_factory = $feed_factory; - $this->order_repository = $order_repository; - $this->ticket_repository = $ticket_repository; - $this->member_repository = $member_repository; - $this->attendee_repository = $attendee_repository; - } - - public function ingestAllSummits(): void - { - - $summits = $this->tx_service->transaction(function () { - return $this->summit_repository->getAllWithExternalRegistrationFeed(); - }); - - foreach ($summits as $summit) { - $this->ingestSummit($summit); - } - } - - /** - * @param Summit $summit - * @throws \Exception - */ - public function ingestSummit(Summit $summit): void - { - try { - $start = time(); - $summit_id = $summit->getId(); - $page = 1; - $has_more_items = false; - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: ingesting summit %s", $summit_id)); - $feed = $this->feed_factory->build($summit); - - if (is_null($feed)) - throw new ValidationException("invalid feed"); - - if (!$summit->hasDefaultBadgeType()) - throw new ValidationException(sprintf("summit %s has not default badge type set", $summit_id)); - - do { - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: getting external attendees page %s", $page)); - $response = $feed->getAttendees($page); - if (!$response->hasData()) return; - $has_more_items = $response->hasMoreItems(); - - foreach ($response as $index => $external_attendee) { - - $this->tx_service->transaction(function () use ($summit_id, $external_attendee) { - $summit = $this->summit_repository->getById($summit_id); - if (!$summit instanceof Summit) return; - $default_badge_type = $summit->getDefaultBadgeType(); - - if (!$summit instanceof Summit) return; - $external_attendee_profile = $external_attendee['profile']; - $external_promo_code = $external_attendee['promotional_code']; - $ticket_class = $external_attendee['ticket_class']; - $external_order = $external_attendee['order']; - $refunded = $external_attendee['refunded']; - $cancelled = $external_attendee['cancelled']; - - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: proccessing external attendee %s - external order id %s", $external_attendee['id'], $external_order['id'])); - - $ticket_type = $summit->getTicketTypeByExternalId($ticket_class['id']); - if (is_null($ticket_type)) { - // create ticket type if does not exists - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: ticket class %s does not exists", $ticket_class['id'])); - $ticket_type = SummitTicketTypeFactory::build( - $summit, [ - 'name' => $ticket_class['name'], - 'description' => $ticket_class['description'], - 'external_id' => $ticket_class['id'], - 'cost' => $ticket_class['cost']['major_value'], - 'currency' => $ticket_class['cost']['currency'], - 'quantity_2_sell' => $ticket_class['quantity_total'], - ] - ); - - $summit->addTicketType($ticket_type); - } - - $order = $this->order_repository->getByExternalIdAndSummitLockExclusive($summit, $external_order['id']); - if (is_null($order)) { - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: order %s does not exists", $external_order['id'])); - $order = SummitOrderFactory::build($summit, [ - 'external_id' => $external_order['id'], - 'owner_first_name' => $external_order['first_name'], - 'owner_last_name' => $external_order['last_name'], - 'owner_email' => $external_order['email'], - ]); - - $order->setSummit($summit); - - $order->generateNumber(); - - $owner = $this->member_repository->getByEmail($external_order['email']); - if (!is_null($owner)) { - $owner->addSummitRegistrationOrder($order); - } - - do { - if (!$summit->existOrderNumber($order->getNumber())) - break; - $order->generateNumber(); - } while (1); - - // generate the key to access - $order->generateHash(); - $order->generateQRCode(); - - $summit->addOrder($order); - } - - $ticket = $this->ticket_repository->getBySummitAndExternalOrderIdAndExternalAttendeeIdExclusiveLock - ( - $summit, - $external_order['id'], - $external_attendee['id'] - ); - - if (is_null($ticket)) { - - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: ticket %s - %s does not exists", $external_order['id'], $external_attendee['id'])); - $ticket = new SummitAttendeeTicket(); - $ticket->setExternalAttendeeId($external_attendee['id']); - $ticket->setExternalOrderId($external_order['id']); - $ticket->setBoughtDate(new \DateTime($external_attendee['created'], new \DateTimeZone('UTC'))); - $ticket->setOrder($order); - $ticket->generateNumber(); - - do { - - if (!$this->ticket_repository->existNumber($ticket->getNumber())) - break; - $ticket->generateNumber(); - } while (1); - - $ticket->setTicketType($ticket_type); - } - - // default badge - if (!$ticket->hasBadge()) { - $ticket->setBadge(SummitBadgeType::buildBadgeFromType($default_badge_type)); - } - - if (count($external_promo_code)) { - // has promo code - $promo_code = $summit->getPromoCodeByCode($external_promo_code['code']); - if (is_null($promo_code)) { - - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: promo code %s - %s does not exists", $external_promo_code['id'], $external_promo_code['code'])); - - $promo_code_params = [ - 'class_name' => $external_promo_code['promotion_type'] == 'discount' ? SummitRegistrationDiscountCode::ClassName : SummitRegistrationPromoCode::ClassName, - 'code' => trim($external_promo_code['code']), - 'external_id' => trim($external_promo_code['id']) - ]; - - if ($external_promo_code['promotion_type'] == 'discount') { - if (isset($external_promo_code['percent_off'])) { - $promo_code_params['rate'] = floatval($external_promo_code['percent_off']); - } - if (isset($external_promo_code['amount_off'])) { - $amount_off = $external_promo_code['amount_off']; - if (isset($amount_off['major_value'])) - $promo_code_params['amount'] = floatval($amount_off['major_value']); - } - } - - $promo_code = SummitPromoCodeFactory::build($summit, $promo_code_params); - $summit->addPromoCode($promo_code); - } - - $promo_code->applyTo($ticket); - } - - // assign attendee - // check if we have already an attendee on this summit - $attendee_email = trim($external_attendee_profile['email']); - $first_name = trim($external_attendee_profile['first_name']); - $last_name = trim($external_attendee_profile['last_name']); - $company = isset($external_attendee_profile['company']) ? trim($external_attendee_profile['company']) : ''; - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: looking for attendee %s , %s (%s)", $first_name, $last_name, $attendee_email)); - $attendee = $this->attendee_repository->getBySummitAndEmailAndFirstNameAndLastNameAndExternalId($summit, $attendee_email, $first_name, $last_name, $external_attendee['id']); - - if (is_null($attendee)) { - Log::debug(sprintf("RegistrationIngestionService::ingestSummit: attendee %s does not exists", $attendee_email)); - $attendee = SummitAttendeeFactory::build($summit, [ - 'external_id' => $external_attendee['id'], - 'first_name' => $first_name, - 'last_name' => $last_name, - 'company' => $company, - 'email' => $attendee_email - ], $this->member_repository->getByEmail($attendee_email)); - - $summit->addAttendee($attendee); - } else { - SummitAttendeeFactory::populate($summit, $attendee, [ - 'external_id' => $external_attendee['id'], - 'first_name' => $first_name, - 'last_name' => $last_name, - 'company' => $company, - 'email' => $attendee_email - ]); - } - - $ticket->setOwner($attendee); - if (!$cancelled && !$refunded) { - $ticket->setPaid(); - $order->setPaidStatus(); - } - if ($cancelled) { - $ticket->setCancelled(); - } - if ($refunded) { - $ticket->setRefunded(); - } - $attendee->updateStatus(); - $order->addTicket($ticket); - $ticket->generateQRCode(); - $ticket->generateHash(); - }); - } - - ++$page; - } while ($has_more_items); - - $end = time(); - $delta = $end - $start; - log::debug(sprintf("RegistrationIngestionService::ingestSummit execution call %s seconds - summit %s", $delta, $summit_id)); - } catch (Exception $ex) { - Log::warning(sprintf("error external feed for summit id %s", $summit->getId())); - Log::warning($ex); - } - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/ScheduleIngestionService.php b/app/Services/Model/Imp/ScheduleIngestionService.php deleted file mode 100644 index 96ad9c0a..00000000 --- a/app/Services/Model/Imp/ScheduleIngestionService.php +++ /dev/null @@ -1,403 +0,0 @@ -member_repository = $member_repository; - $this->summit_repository = $summit_repository; - $this->org_repository = $org_repository; - $this->speaker_repository = $speaker_repository; - $this->event_repository = $event_repository; - $this->tag_repository = $tag_repository; - $this->feed_factory = $feed_factory; - $this->location_repository = $location_repository; - } - - /** - * @throws \Exception - */ - public function ingestAllSummits(): void - { - - $summits = $this->tx_service->transaction(function () { - return $this->summit_repository->getWithExternalFeed(); - }); - - foreach ($summits as $summit) { - - $processedExternalIds = $this->ingestSummit($summit); - - Log::debug(sprintf( "ScheduleIngestionService::ingestAllSummits trying to get all events to delete for summit %s...", $summit->getId())); - - $summit_events = $this->tx_service->transaction(function () use ($summit, $processedExternalIds) { - return $this->event_repository->getPublishedEventsBySummitNotInExternalIds($summit, $processedExternalIds); - }); - - //Log::debug(sprintf( "ScheduleIngestionService::ingestAllSummits got %s events to delete for summit %s...", $summit_events->count(), $summit->getId())); - - foreach ($summit_events as $summit_event) { - $this->tx_service->transaction(function () use ($summit_event) { - try { - Log::debug(sprintf( "ScheduleIngestionService::ingestAllSummits trying to delete event %s...", $summit_event->getId())); - $this->event_repository->delete($summit_event); - } catch (Exception $ex) { - Log::error($ex); - } - - }); - } - } - } - - /** - * @param Summit $summit - * @return array - * @throws \Exception - */ - public function ingestSummit(Summit $summit): array - { - - $processedExternalIds = []; - $locations_pool = []; - $speaker_pool = []; - $tracks_pool = []; - - try { - $start = time(); - $summit_id = $summit->getId(); - Log::debug(sprintf("ScheduleIngestionService::ingestSummit:: ingesting summit %s", $summit->getId())); - $feed = $this->feed_factory->build($summit); - if (is_null($feed)) - throw new \InvalidArgumentException("invalid feed"); - - $this->tx_service->transaction(function () use ($summit_id) { - $summit = $this->summit_repository->getById($summit_id); - $mainVenues = $summit->getMainVenues(); - if ($mainVenues->count() == 0) - throw new ValidationException(sprintf("summit %s does not has a main venue set!", $summit->getId())); - - if (is_null($summit->getBeginDate()) || is_null($summit->getEndDate())) - throw new ValidationException(sprintf("summit %s does not has set begin date/end date", $summit->getId())); - - if (is_null($summit->getTimeZone())) - throw new ValidationException(sprintf("summit %s does not has set a valid time zone", $summit->getId())); - - // get presentation type from summit - $presentationType = $summit->getEventTypeByType(IPresentationType::Presentation); - - if (is_null($presentationType)) { - // create it - $presentationType = new PresentationType(); - $presentationType->setType(IPresentationType::Presentation); - $presentationType->setMaxSpeakers(10); - $presentationType->setMinSpeakers(0); - $presentationType->setMaxModerators(1); - $presentationType->setMinModerators(0); - $summit->addEventType($presentationType); - } - }); - $events = $feed->getEvents(); - $speakers = $feed->getSpeakers(); - - foreach ($events as $event) { - - try { - - $external_id = $this->tx_service->transaction(function () use ($summit_id, $event, $speakers) { - - Log::debug(sprintf("processing event %s - %s for summit %s", $event['external_id'], $event['title'], $summit_id)); - // get first as default - $summit = $this->summit_repository->getById($summit_id); - if (is_null($summit) || !$summit instanceof Summit) return null; - $mainVenues = $summit->getMainVenues(); - - if ($mainVenues->count() == 0) - throw new ValidationException(sprintf("summit %s does not has a main venue set!", $summit->getId())); - - $mainVenue = $mainVenues->first(); - - if(is_null($mainVenue)) - throw new ValidationException(sprintf("summit %s does not has a main venue set!", $summit->getId())); - - $presentationType = $summit->getEventTypeByType(IPresentationType::Presentation); - $track_title = $event['track']; - if (empty($track_title)) $track_title = 'TBD'; - $track_title = str_limit($track_title, 255); - $track = $summit->getPresentationCategoryByTitle($track_title); - - if (is_null($track)) { - $track = new PresentationCategory(); - $track->setTitle($track_title); - $summit->addPresentationCategory($track); - } - - // location - $location = null; - if (isset($event['location'])) { - $location = $mainVenue->getRoomByName($event['location']); - if (is_null($location)) { - $location = new SummitVenueRoom(); - $location->setName(trim($event['location'])); - $mainVenue->addRoom($location); - } - } - - // speakers - $presentationSpeakers = []; - if (isset($event['speakers'])) { - foreach ($event['speakers'] as $speakerFullName) { - $speakerFullNameParts = explode(" ", $speakerFullName); - $speakerLastName = trim(trim(array_pop($speakerFullNameParts))); - $speakerFirstName = trim(implode(" ", $speakerFullNameParts)); - - Log::debug(sprintf("processing event %s - %s for summit %s - speaker %s", $event['external_id'], $event['title'], $summit_id, $speakerFullName)); - - $foundSpeaker = isset($speakers[$speakerFullName]) ? $speakers[$speakerFullName] : null; - if (is_null($foundSpeaker)) { - // partial match - $result_array = preg_grep("/{$speakerFullName}/i", array_keys($speakers)); - if (count($result_array) > 0) { - $foundSpeaker = $speakers[array_values($result_array)[0]]; - } - } - - $speakerEmail = $foundSpeaker && isset($foundSpeaker['email']) ? $foundSpeaker['email'] : null; - - Log::debug(sprintf("ScheduleIngestionService::ingestSummit event %s - %s for summit %s speakerEmail %s", $event['external_id'], $event['title'], $summit_id, $speakerEmail )); - - $companyName = $foundSpeaker && isset($foundSpeaker['company']) ? $foundSpeaker['company'] : null; - $companyPosition = $foundSpeaker && isset($foundSpeaker['position']) ? $foundSpeaker['position'] : null;; - $speakerTitle = !empty($companyName) && !empty($companyPosition) ? sprintf("%s, %s", $companyName, $companyPosition) : null; - // member - $member = !empty($speakerEmail) ? $this->member_repository->getByEmail($speakerEmail) : $this->member_repository->getByFullName($speakerFullName); - - if (is_null($member)) { - $member = new Member(); - $member->setEmail($speakerEmail); - $member->setFirstName($speakerFirstName); - $member->setLastName($speakerLastName); - $this->member_repository->add($member, true); - } - - $member->setEmail($speakerEmail); - $member->setFirstName($speakerFirstName); - $member->setLastName($speakerLastName); - - // check affiliations - if (!empty($companyName)) { - $affiliation = $member->getAffiliationByOrgName($companyName); - - if (is_null($affiliation)) { - $affiliation = new Affiliation(); - $org = $this->org_repository->getByName($companyName); - if (is_null($org)) { - $org = new Organization(); - $org->setName($companyName); - $this->org_repository->add($org, true); - } - $affiliation->setOrganization($org); - $affiliation->setIsCurrent(true); - $member->addAffiliation($affiliation); - } - } - - // speaker - $speaker = $this->speaker_repository->getByFullName($speakerFullName); - if(!is_null($speaker)){ - // we got an existent speaker for that full name, check if has a member assigned - if($speaker->hasMember() && $speaker->getMemberId() !== $member->getId()){ - // speaker already belongs to another user, so we need to create a new one - Log::debug(sprintf("ScheduleIngestionService::ingestSummit speaker alredy belongs to another user (%s) creating a new one", $speaker->getMemberId())); - $speaker = null; - } - } - - if (is_null($speaker)) { - $speaker = new PresentationSpeaker(); - $speaker->setFirstName($speakerFirstName); - $speaker->setLastName($speakerLastName); - $speaker->setTitle($speakerTitle); - $speaker->setMember($member); - $this->speaker_repository->add($speaker, true); - } - - $speaker->setFirstName($speakerFirstName); - $speaker->setLastName($speakerLastName); - $speaker->setTitle($speakerTitle); - $speaker->setMember($member); - - $presentationSpeakers[] = $speaker; - } - } - - $presentation = $summit->getEventByExternalId($event['external_id']); - if (is_null($presentation)) { - $presentation = new Presentation(); - $summit->addEvent($presentation); - } - - $presentation->setType($presentationType); - $presentation->setCategory($track); - $presentation->setExternalId($event['external_id']); - $presentation->setLocation($location); - $presentation->setTitle($event['title']); - $presentation->setAbstract($event['abstract']); - - // epoch local time - $start_datetime = $event['start_date']; - $end_datetime = $event['end_date']; - $start_datetime = new \DateTime("@$start_datetime"); - $end_datetime = new \DateTime("@$end_datetime"); - $start_datetime->setTimezone($summit->getTimeZone()); - $end_datetime->setTimezone($summit->getTimeZone()); - $presentation->setStartDate($start_datetime); - $presentation->setEndDate($end_datetime); - - if (count($presentationSpeakers) > 0) { - $presentation->clearSpeakers(); - foreach ($presentationSpeakers as $presentationSpeaker) - $presentation->addSpeaker($presentationSpeaker); - } - if (isset($event['tags'])) { - $presentation->clearTags(); - foreach ($event['tags'] as $tagValue) { - $tag = $this->tag_repository->getByTag($tagValue); - if (is_null($tag)) { - $tag = new Tag($tagValue); - $this->tag_repository->add($tag, true); - } - $presentation->addTag($tag); - } - } - if (!$presentation->isPublished()) - $presentation->publish(); - - return $event['external_id']; - }); - if (!is_null($external_id)) - $processedExternalIds[] = $external_id; - - } catch (Exception $ex) { - Log::warning(sprintf("error external feed for summit id %s", $summit->getId())); - Log::warning($ex); - } - } - $end = time(); - $delta = $end - $start; - log::debug(sprintf("ScheduleIngestionService::ingestSummit execution call %s seconds - summit %s", $delta, $summit->getId())); - - } catch (Exception $ex) { - Log::warning(sprintf("error external feed for summit id %s", $summit->getId())); - Log::warning($ex); - } - - return $processedExternalIds; - - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SelectionPlanOrderExtraQuestionTypeService.php b/app/Services/Model/Imp/SelectionPlanOrderExtraQuestionTypeService.php deleted file mode 100644 index 42b00097..00000000 --- a/app/Services/Model/Imp/SelectionPlanOrderExtraQuestionTypeService.php +++ /dev/null @@ -1,171 +0,0 @@ -repository = $repository; - } - - /** - * @inheritDoc - */ - public function addExtraQuestion(SelectionPlan $selectionPlan, array $payload): SummitSelectionPlanExtraQuestionType - { - return $this->tx_service->transaction(function () use ($selectionPlan, $payload) { - $name = trim($payload['name']); - $former_question = $selectionPlan->getExtraQuestionByName($name); - if (!is_null($former_question)) - throw new ValidationException("Question Name already exists for Selection Plan."); - - $label = trim($payload['label']); - $former_question = $selectionPlan->getExtraQuestionByName($label); - if (!is_null($former_question)) - throw new ValidationException("Question Label already exists for Selection Plan."); - - $question = SummitSelectionPlanExtraQuestionTypeFactory::build($payload); - - $selectionPlan->addExtraQuestion($question); - - return $question; - }); - } - - /** - * @inheritDoc - */ - public function updateExtraQuestion(SelectionPlan $selectionPlan, int $question_id, array $payload): SummitSelectionPlanExtraQuestionType - { - return $this->tx_service->transaction(function () use ($selectionPlan, $question_id, $payload) { - - $question = $selectionPlan->getExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("question not found"); - - if (isset($payload['name'])) { - $name = trim($payload['name']); - $former_question = $selectionPlan->getExtraQuestionByName($name); - if (!is_null($former_question) && $former_question->getId() != $question_id) - throw new ValidationException("Question Name already exists for Selection Plan."); - } - - if (isset($payload['label'])) { - $label = trim($payload['label']); - $former_question = $selectionPlan->getExtraQuestionByLabel($label); - if (!is_null($former_question) && $former_question->getId() != $question_id) - throw new ValidationException("Question Label already exists for Selection Plan."); - } - - if (isset($payload['order']) && intval($payload['order']) != $question->getOrder()) { - // request to update order - $selectionPlan->recalculateQuestionOrder($question, intval($payload['order'])); - } - - return SummitSelectionPlanExtraQuestionTypeFactory::populate($question, $payload); - }); - } - - /** - * @inheritDoc - */ - public function deleteExtraQuestion(SelectionPlan $selectionPlan, int $question_id): void - { - $this->tx_service->transaction(function () use ($selectionPlan, $question_id) { - - $question = $selectionPlan->getExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - // check if question has answers - - if ($this->repository->hasAnswers($question)) { - //throw new ValidationException(sprintf("you can not delete question %s bc already has answers from attendees", $question_id)); - $this->repository->deleteAnswersFrom($question); - } - - $selectionPlan->removeExtraQuestion($question); - }); - } - - /** - * @inheritDoc - */ - public function addExtraQuestionValue(SelectionPlan $selectionPlan, int $question_id, array $payload): ExtraQuestionTypeValue - { - return $this->tx_service->transaction(function () use ($selectionPlan, $question_id, $payload) { - - $question = $selectionPlan->getExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - return parent::_addOrderExtraQuestionValue($question, $payload); - }); - } - - /** - * @inheritDoc - */ - public function updateExtraQuestionValue(SelectionPlan $selectionPlan, int $question_id, int $value_id, array $payload): ExtraQuestionTypeValue - { - return $this->tx_service->transaction(function () use ($selectionPlan, $question_id, $value_id, $payload) { - $question = $selectionPlan->getExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - return parent::_updateOrderExtraQuestionValue($question, $value_id, $payload); - }); - } - - /** - * @inheritDoc - */ - public function deleteExtraQuestionValue(SelectionPlan $selectionPlan, int $question_id, int $value_id): void - { - $this->tx_service->transaction(function () use ($selectionPlan, $question_id, $value_id) { - $question = $selectionPlan->getExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - parent::_deleteOrderExtraQuestionValue($question, $value_id); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SpeakerService.php b/app/Services/Model/Imp/SpeakerService.php deleted file mode 100644 index 1c5f5a96..00000000 --- a/app/Services/Model/Imp/SpeakerService.php +++ /dev/null @@ -1,1262 +0,0 @@ -speaker_repository = $speaker_repository; - $this->member_repository = $member_repository; - $this->folder_service = $folder_service; - $this->speaker_registration_request_repository = $speaker_registration_request_repository; - $this->registration_code_repository = $registration_code_repository; - $this->speakers_assistance_repository = $speakers_assistance_repository; - $this->language_repository = $language_repository; - $this->speaker_organizational_role_repository = $speaker_organizational_role_repository; - $this->speaker_involvement_repository = $speaker_involvement_repository; - $this->file_uploader = $file_uploader; - $this->speaker_edit_permisssion_repository = $speaker_edit_permisssion_repository; - } - - /** - * @param array $data - * @param null|Member $creator - * @param bool $send_email - * @return PresentationSpeaker - * @throws ValidationException - */ - public function addSpeaker(array $data, ?Member $creator = null, $send_email = true) - { - - return $this->tx_service->transaction(function () use ($data, $creator, $send_email) { - - - $member_id = intval($data['member_id'] ?? 0); - $email = trim($data['email'] ?? ''); - - Log::debug(sprintf("SpeakerService::addSpeaker: member id %s email %s", $member_id, $email)); - - if (empty($email) && $member_id == 0) - throw - new ValidationException - (trans("validation_errors.SpeakerService.addSpeaker.MissingMemberOrEmail")); - - $speaker = new PresentationSpeaker(); - $speaker->setCreatedFromApi(true); - - // check if we have a previous registration request and user it - - $formerRegistrationRequest = null; - if(!empty($email)) { - $formerRegistrationRequest = $this->speaker_registration_request_repository->getByEmail($email); - if(!is_null($formerRegistrationRequest)){ - if($formerRegistrationRequest->isConfirmed()){ - throw new ValidationException(sprintf("Speaker already exists and its confirmed.")); - } - $speaker = $formerRegistrationRequest->getSpeaker(); - } - } - - // if we pass the member , honor that and override email - if ($member_id > 0) { - $member = $this->member_repository->getById($member_id); - if (is_null($member) || !$member instanceof Member) - throw new EntityNotFoundException(sprintf("member id %s does not exists!", $member_id)); - - $existent_speaker = $this->speaker_repository->getByMember($member); - if (!is_null($existent_speaker)) - throw new ValidationException - ( - trans("validation_errors.SpeakerService.addSpeaker.MemberAlreadyAssigned2Speaker", - [ - 'member_id' => $member_id, - 'speaker_id' => $existent_speaker->getId() - ]) - ); - - $speaker->setMember($member); - } - - // if we dont pass the member , try to get member by email - if ($member_id == 0 && !empty($email)) { - Log::debug(sprintf("SpeakerService::addSpeaker: member id is zero email is %s", $email)); - $member = $this->member_repository->getByEmail($email); - if (!is_null($member)) { - Log::debug(sprintf("SpeakerService::addSpeaker: member %s found, setting it to speaker", $email)); - $existent_speaker = $this->speaker_repository->getByMember($member); - if (!is_null($existent_speaker)) - throw new ValidationException - ( - trans("validation_errors.SpeakerService.addSpeaker.MemberAlreadyAssigned2Speaker", - [ - 'member_id' => $member->getIdentifier(), - 'speaker_id' => $existent_speaker->getId() - ]) - - ); - $speaker->setMember($member); - } - // if member does not exists and we dont have a former registration request - if (is_null($member) && is_null($formerRegistrationRequest)) { - Log::debug(sprintf("SpeakerService::addSpeaker: member %s not found", $email)); - $request = $this->registerSpeaker($speaker, $email); - if(!is_null($creator)) - $request->setProposer($creator); - } - } - - $this->updateSpeakerMainData($speaker, $data); - - $this->speaker_repository->add($this->updateSpeakerRelations($speaker, $data)); - - // only send the email if we dont have a former registration request - if(is_null($formerRegistrationRequest) && $send_email) - SpeakerCreationEmail::dispatch($speaker); - - if(!is_null($formerRegistrationRequest)){ - $formerRegistrationRequest->confirm(); - } - - if(!is_null($creator)){ - // create edit permission for creator - $request = SpeakerEditPermissionRequestFactory::build($speaker, $creator); - $request->approve(); - $this->speaker_edit_permisssion_repository->add($request); - } - return $speaker; - }); - } - - /** - * @param Summit $summit - * @param array $data - * @throws ValidationException - * @return PresentationSpeaker - */ - public function addSpeakerBySummit(Summit $summit, array $data) - { - - return $this->tx_service->transaction(function () use ($data, $summit) { - - $speaker = $this->addSpeaker($data); - - $speaker->addSummitAssistance( - PresentationSpeakerSummitAssistanceConfirmationRequestFactory::build($summit, $speaker, $data) - ); - - $reg_code = isset($data['registration_code']) ? trim($data['registration_code']) : null; - - if (!empty($reg_code)) { - $this->registerSummitPromoCodeByValue($speaker, $summit, $reg_code); - } - - return $speaker; - }); - } - - /** - * @param array $data - * @param PresentationSpeaker $speaker - * @return PresentationSpeaker - * @throws ValidationException - */ - public function updateSpeaker(PresentationSpeaker $speaker, array $data) - { - return $this->tx_service->transaction(function () use ($speaker, $data) { - $member_id = isset($data['member_id']) ? intval($data['member_id']) : null; - - if ($member_id > 0) { - $member = $this->member_repository->getById($member_id); - if (is_null($member)) - throw new EntityNotFoundException; - - $existent_speaker = $this->speaker_repository->getByMember($member); - if ($existent_speaker && $existent_speaker->getId() !== $speaker->getId()) - throw new ValidationException - ( - trans("validation_errors.SpeakerService.updateSpeaker.MemberAlreadyAssigned2Speaker", - [ - 'member_id' => $member_id, - 'speaker_id' => $existent_speaker->getId() - ]) - ); - - $speaker->setMember($member); - } - - return $this->updateSpeakerRelations($this->updateSpeakerMainData($speaker, $data), $data); - - }); - } - - /** - * @param Summit $summit - * @param array $data - * @param PresentationSpeaker $speaker - * @return PresentationSpeaker - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateSpeakerBySummit(Summit $summit, PresentationSpeaker $speaker, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $speaker, $data) { - - $speaker = $this->updateSpeaker($speaker, $data); - - // get summit assistance - $summit_assistance = $speaker->getAssistanceFor($summit); - // if does not exists create it - if (is_null($summit_assistance)) { - $summit_assistance = $speaker->buildAssistanceFor($summit); - $speaker->addSummitAssistance($summit_assistance); - } - - PresentationSpeakerSummitAssistanceConfirmationRequestFactory::populate($summit_assistance, $data); - - $reg_code = isset($data['registration_code']) ? trim($data['registration_code']) : null; - if (!empty($reg_code)) { - $this->registerSummitPromoCodeByValue($speaker, $summit, $reg_code); - } - - return $speaker; - }); - } - - /** - * @param PresentationSpeaker $speaker - * @param string $email - * @return SpeakerRegistrationRequest - * @throws ValidationException - */ - private function registerSpeaker(PresentationSpeaker $speaker, $email) - { - - if ($this->speaker_registration_request_repository->existByEmail($email)) - throw new ValidationException(sprintf("email %s already has a Speaker Registration Request", $email)); - - $registration_request = new SpeakerRegistrationRequest(); - $registration_request->setEmail($email); - - do { - $registration_request->generateConfirmationToken(); - } while($this->speaker_registration_request_repository->existByHash($registration_request->getConfirmationHash())); - - $speaker->setRegistrationRequest($registration_request); - return $registration_request; - } - - /** - * @param PresentationSpeaker $speaker - * @param Summit $summit - * @param string $reg_code - * @return SpeakerSummitRegistrationPromoCode - * @throws ValidationException - */ - public function registerSummitPromoCodeByValue(PresentationSpeaker $speaker, Summit $summit, $reg_code) - { - - return $this->tx_service->transaction(function () use ($speaker, $summit, $reg_code) { - // check if our speaker already has an assigned code for this summit ... - $existent_code = $this->registration_code_repository->getBySpeakerAndSummit($speaker, $summit); - - // we are trying to update the promo code with another one .... - if (!is_null($existent_code) && $reg_code !== $existent_code->getCode() && $existent_code->isRedeemed()) { - throw new ValidationException(sprintf( - 'speaker has been already assigned to another registration code (%s) already redeemed!', $existent_code->getCode() - )); - } - - if (!is_null($existent_code) && $reg_code == $existent_code->getCode()) return $existent_code; - - // check if reg code is assigned already to another speaker ... - if ($assigned_code = $this->registration_code_repository->getAssignedCode($reg_code, $summit)) { - - if ($assigned_code->getSpeaker()->getId() != $speaker->getId()) - throw new ValidationException(sprintf( - 'there is another speaker with that code for this summit ( speaker id %s )', $assigned_code->getSpeaker()->getId() - )); - } - // check is not assigned already - $new_code = $this->registration_code_repository->getNotAssignedCode($reg_code, $summit); - - if (is_null($new_code)) { - // create it - $new_code = new SpeakerSummitRegistrationPromoCode(); - $new_code->setSummit($summit); - $new_code->setCode($reg_code); - $new_code->setSourceAdmin(); - $new_code->setSpeaker($speaker); - - PromoCodeEmailFactory::send($new_code); - } - - $speaker->addPromoCode($new_code); - if (!is_null($existent_code)) { - $speaker->removePromoCode($existent_code); - } - return $new_code; - }); - - } - - /** - * @param PresentationSpeaker $speaker - * @param array $data - * @return PresentationSpeaker - */ - private function updateSpeakerMainData(PresentationSpeaker $speaker, array $data) - { - if (isset($data['title'])) - $speaker->setTitle(trim($data['title'])); - - if (isset($data['bio'])) - $speaker->setBio(trim($data['bio'])); - - if (isset($data['first_name'])) - $speaker->setFirstName(trim($data['first_name'])); - - if (isset($data['last_name'])) - $speaker->setLastName(trim($data['last_name'])); - - if (isset($data['irc'])) - $speaker->setIrcHandle(trim($data['irc'])); - - if (isset($data['twitter'])) - $speaker->setTwitterName(trim($data['twitter'])); - - if (isset($data['notes'])) - $speaker->setNotes(trim($data['notes'])); - - if (isset($data['available_for_bureau'])) - $speaker->setAvailableForBureau(boolval($data['available_for_bureau'])); - - if (isset($data['funded_travel'])) - $speaker->setFundedTravel(boolval($data['funded_travel'])); - - if (isset($data['willing_to_travel'])) - $speaker->setWillingToTravel(boolval($data['willing_to_travel'])); - - if (isset($data['willing_to_present_video'])) - $speaker->setWillingToPresentVideo(boolval($data['willing_to_present_video'])); - - if (isset($data['org_has_cloud'])) - $speaker->setOrgHasCloud(boolval($data['org_has_cloud'])); - - if (isset($data['country'])) - $speaker->setCountry(trim($data['country'])); - - if (isset($data['company'])) - $speaker->setCompany(trim($data['company'])); - - if (isset($data['phone_number'])) - $speaker->setPhoneNumber(trim($data['phone_number'])); - - return $speaker; - } - - /** - * @param PresentationSpeaker $speaker - * @param array $data - * @return PresentationSpeaker - */ - private function updateSpeakerRelations(PresentationSpeaker $speaker, array $data) - { - - // other_presentation_links - - if (isset($data['other_presentation_links']) && is_array($data['other_presentation_links'])) { - $speaker->clearOtherPresentationLinks(); - foreach ($data['other_presentation_links'] as $link) { - $speaker->addOtherPresentationLink(new SpeakerPresentationLink(trim($link['link']), trim($link['title']))); - } - } - // languages - - if (isset($data['languages']) && is_array($data['languages'])) { - $speaker->clearLanguages(); - foreach ($data['languages'] as $lang_id) { - $language = $this->language_repository->getById(intval($lang_id)); - if (is_null($language)) - throw new ValidationException( - trans("validation_errors.SpeakerService.updateSpeakerRelations.InvalidLanguage", [ - 'lang_id' => $lang_id - ]) - ); - $speaker->addLanguage($language); - } - } - - // travel_preferences - - if (isset($data['travel_preferences']) && is_array($data['travel_preferences'])) { - $speaker->clearTravelPreferences(); - foreach ($data['travel_preferences'] as $country) { - if (!isset(CountryCodes::$iso_3166_countryCodes[$country])){ - throw new ValidationException( - trans("validation_errors.SpeakerService.updateSpeakerRelations.InvalidCountryCode", [ - 'country' => $country - ])); - } - $speaker->addTravelPreference(new SpeakerTravelPreference($country)); - } - } - // areas_of_expertise - - if (isset($data['areas_of_expertise']) && is_array($data['areas_of_expertise'])) { - $speaker->clearAreasOfExpertise(); - foreach ($data['areas_of_expertise'] as $expertise) { - $speaker->addAreaOfExpertise(new SpeakerExpertise(trim($expertise))); - } - } - - // organizational_roles - - if (isset($data['organizational_roles']) && is_array($data['organizational_roles'])) { - $speaker->clearOrganizationalRoles(); - foreach ($data['organizational_roles'] as $org_role_id) { - $role = $this->speaker_organizational_role_repository->getById(intval($org_role_id)); - if (is_null($role)){ - throw new ValidationException( - trans("validation_errors.SpeakerService.updateSpeakerRelations.InvalidOrganizationRole", [ - 'role' => $role - ])); - } - $speaker->addOrganizationalRole($role); - } - - // other - if (isset($data['other_organizational_rol'])) { - $role = $this->speaker_organizational_role_repository->getByRole(trim($data['other_organizational_rol'])); - if (is_null($role)) { - // create it - $role = new SpeakerOrganizationalRole(trim($data['other_organizational_rol'])); - $this->speaker_organizational_role_repository->add($role); - } - $speaker->addOrganizationalRole($role); - } - } - - // active_involvements - - if (isset($data['active_involvements']) && is_array($data['active_involvements'])) { - $speaker->clearActiveInvolvements(); - foreach ($data['active_involvements'] as $involvement_id) { - $involvement = $this->speaker_involvement_repository->getById(intval($involvement_id)); - if (is_null($involvement)){ - throw new ValidationException( - trans("validation_errors.SpeakerService.updateSpeakerRelations.InvalidActiveInvolvement", [ - 'involvement_id' => $involvement_id - ])); - } - $speaker->addActiveInvolvement($involvement); - } - } - - return $speaker; - } - - /** - * @param PresentationSpeaker $speaker_from - * @param PresentationSpeaker $speaker_to - * @param array $data - * @return void - */ - public function merge(PresentationSpeaker $speaker_from, PresentationSpeaker $speaker_to, array $data) - { - return $this->tx_service->transaction(function () use ($speaker_from, $speaker_to, $data) { - - if ($speaker_from->getIdentifier() == $speaker_to->getIdentifier()) - throw new ValidationException("You can not merge the same speaker!"); - // bio - if (!isset($data['bio'])) throw new ValidationException("bio field is required"); - $speaker_id = intval($data['bio']); - $speaker_to->setBio($speaker_id == $speaker_from->getId() ? $speaker_from->getBio() : $speaker_to->getBio()); - - // first_name - if (!isset($data['first_name'])) throw new ValidationException("first_name field is required"); - $speaker_id = intval($data['first_name']); - $speaker_to->setFirstName($speaker_id == $speaker_from->getId() ? $speaker_from->getFirstName() : $speaker_to->getFirstName()); - - // last_name - if (!isset($data['last_name'])) throw new ValidationException("last_name field is required"); - $speaker_id = intval($data['last_name']); - $speaker_to->setLastName($speaker_id == $speaker_from->getId() ? $speaker_from->getLastName() : $speaker_to->getLastName()); - - // title - if (!isset($data['title'])) throw new ValidationException("title field is required"); - $speaker_id = intval($data['title']); - $speaker_to->setTitle($speaker_id == $speaker_from->getId() ? $speaker_from->getTitle() : $speaker_to->getTitle()); - - // irc - if (!isset($data['irc'])) throw new ValidationException("irc field is required"); - $speaker_id = intval($data['irc']); - $speaker_to->setIrcHandle($speaker_id == $speaker_from->getId() ? $speaker_from->getIrcHandle() : $speaker_to->getIrcHandle()); - - // twitter - if (!isset($data['twitter'])) throw new ValidationException("twitter field is required"); - $speaker_id = intval($data['twitter']); - $speaker_to->setTwitterName($speaker_id == $speaker_from->getId() ? $speaker_from->getTwitterName() : $speaker_to->getTwitterName()); - - // pic - try { - if (!isset($data['pic'])) throw new ValidationException("pic field is required"); - $speaker_id = intval($data['pic']); - $photo = $speaker_id == $speaker_from->getId() ? $speaker_from->getPhoto() : $speaker_to->getPhoto(); - if(!is_null($photo)) - $speaker_to->setPhoto($photo); - } catch (\Exception $ex) { - - } - // registration_request - try { - if (!isset($data['registration_request'])) throw new ValidationException("registration_request field is required"); - $speaker_id = intval($data['registration_request']); - $registration_request = $speaker_id == $speaker_from->getId() ? $speaker_from->getRegistrationRequest() : $speaker_to->getRegistrationRequest(); - if(!is_null($registration_request)) - $speaker_to->setRegistrationRequest($registration_request); - } catch (\Exception $ex) { - - } - // member - try { - if (!isset($data['member'])) throw new ValidationException("member field is required"); - $speaker_id = intval($data['member']); - $member = $speaker_id == $speaker_from->getId() ? $speaker_from->getMember() : $speaker_to->getMember(); - if(!is_null($member)) - $speaker_to->setMember($member); - } catch (\Exception $ex) { - - } - // presentations - - foreach ($speaker_from->getAllPresentations(false) as $presentation) { - $speaker_to->addPresentation($presentation); - } - - foreach ($speaker_from->getAllModeratedPresentations(false) as $presentation) { - $speaker_to->addModeratedPresentation($presentation); - } - - // languages - - foreach ($speaker_from->getLanguages() as $language) { - $speaker_to->addLanguage($language); - } - - // promo codes - - foreach ($speaker_from->getPromoCodes() as $code) { - $speaker_to->addPromoCode($code); - } - - // summit assistances - - foreach ($speaker_from->getSummitAssistances() as $assistance) { - $speaker_to->addSummitAssistance($assistance); - } - - // presentation links - - foreach ($speaker_from->getOtherPresentationLinks() as $link) { - $speaker_to->addOtherPresentationLink($link); - } - - // travel preferences - - foreach ($speaker_from->getTravelPreferences() as $travel_preference) { - $speaker_to->addTravelPreference($travel_preference); - } - - // areas of expertise - - foreach ($speaker_from->getAreasOfExpertise() as $areas_of_expertise) { - $speaker_to->addAreaOfExpertise($areas_of_expertise); - } - - // roles - - foreach ($speaker_from->getOrganizationalRoles() as $role) { - $speaker_to->addOrganizationalRole($role); - } - $speaker_from->clearOrganizationalRoles(); - - // involvements - - foreach ($speaker_from->getActiveInvolvements() as $involvement) { - $speaker_to->addActiveInvolvement($involvement); - } - - $speaker_from->clearActiveInvolvements(); - - $this->speaker_repository->delete($speaker_from); - }); - } - - /** - * @param int $speaker_id - * @throws ValidationException - * @throws EntityNotFoundException - * @return void - */ - public function deleteSpeaker($speaker_id) - { - return $this->tx_service->transaction(function () use ($speaker_id) { - $speaker = $this->speaker_repository->getById($speaker_id); - if (is_null($speaker)) - throw new EntityNotFoundException; - - $this->speaker_repository->delete($speaker); - }); - } - - /** - * @param Summit $summit - * @param array $data - * @throws ValidationException - * @throws EntityNotFoundException - * @return PresentationSpeakerSummitAssistanceConfirmationRequest - */ - public function addSpeakerAssistance(Summit $summit, array $data) - { - return $this->tx_service->transaction(function () use ($data, $summit) { - - $speaker_id = intval($data['speaker_id']); - $speaker = $this->speaker_repository->getById($speaker_id); - - if (is_null($speaker)) - throw new EntityNotFoundException(trans('not_found_errors.add_speaker_assistance_speaker_not_found', ['speaker_id' => $speaker_id])); - - if (!$speaker->isSpeakerOfSummit($summit)) { - throw new ValidationException(trans('validation_errors.add_speaker_assistance_speaker_is_not_on_summit', - [ - 'speaker_id' => $speaker_id, - 'summit_id' => $summit->getId() - ] - )); - } - - if ($speaker->hasAssistanceFor($summit)) - throw new ValidationException(trans('validation_errors.add_speaker_assistance_speaker_already_has_assistance', - [ - 'speaker_id' => $speaker_id, - 'summit_id' => $summit->getId() - ] - )); - - $assistance = PresentationSpeakerSummitAssistanceConfirmationRequestFactory::build - ( - $summit, - $speaker, - $data - ); - - $speaker->addSummitAssistance($assistance); - - return $assistance; - }); - } - - /** - * @param Summit $summit - * @param int $assistance_id - * @param array $data - * @throws ValidationException - * @throws EntityNotFoundException - * @return PresentationSpeakerSummitAssistanceConfirmationRequest - */ - public function updateSpeakerAssistance(Summit $summit, $assistance_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $assistance_id, $data) { - $assistance = $this->speakers_assistance_repository->getById($assistance_id); - if (is_null($assistance)) - throw new EntityNotFoundException; - - if ($assistance->getSummitId() != $summit->getId()) { - throw new ValidationException - ( - trans - ( - 'validation_errors.speaker_assistance_does_not_belongs_to_summit', - [ - 'assistance_id' => $assistance_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - return PresentationSpeakerSummitAssistanceConfirmationRequestFactory::populate - ( - $assistance, - $data - ); - - }); - } - - /** - * @param Summit $summit - * @param int $assistance_id - * @throws ValidationException - * @throws EntityNotFoundException - * @return void - */ - public function deleteSpeakerAssistance(Summit $summit, $assistance_id) - { - return $this->tx_service->transaction(function () use ($summit, $assistance_id) { - - $assistance = $this->speakers_assistance_repository->getById($assistance_id); - - if (is_null($assistance)) - throw new EntityNotFoundException; - - if ($assistance->getSummitId() != $summit->getId()) { - throw new ValidationException - ( - trans - ( - 'validation_errors.speaker_assistance_does_not_belongs_to_summit', - [ - 'assistance_id' => $assistance_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - if ($assistance->isConfirmed()) - throw new ValidationException - ( - trans - ( - 'validation_errors.speaker_assistance_delete_already_confirmed', - [ - 'assistance_id' => $assistance_id, - 'speaker_id' => $assistance->getSpeakerId() - ] - ) - ); - - $this->speakers_assistance_repository->delete($assistance); - }); - } - - /** - * @param Summit $summit - * @param int $assistance_id - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function sendSpeakerSummitAssistanceAnnouncementMail(Summit $summit, $assistance_id) - { - $this->tx_service->transaction(function () use ($summit, $assistance_id) { - - $speaker_assistance = $summit->getSpeakerAssistanceById($assistance_id); - - if (is_null($speaker_assistance)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.send_speaker_summit_assistance_announcement_mail_not_found_assistance', - [ - 'summit_id' => $summit->getId(), - 'assistance_id' => $assistance_id - ] - ) - ); - $speaker = $speaker_assistance->getSpeaker(); - - $role = $speaker->isModeratorFor($summit) ? - PresentationSpeaker::RoleModerator : PresentationSpeaker::RoleSpeaker; - - $promo_code = $speaker->getPromoCodeFor($summit); - - if (is_null($promo_code)) { - // try to get a new one - $has_published = - $speaker->hasPublishedRegularPresentations($summit, $role, true, $summit->getExcludedCategoriesForAcceptedPresentations()) || - $speaker->hasPublishedLightningPresentations($summit, $role, true, $summit->getExcludedCategoriesForAcceptedPresentations()); - $has_alternate = $speaker->hasAlternatePresentations($summit, $role, true, $summit->getExcludedCategoriesForAlternatePresentations()); - - if ($has_published) //get approved code - { - $promo_code = $this->registration_code_repository->getNextAvailableByType - ( - $summit, - PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypeAccepted - ); - if (is_null($promo_code)) - throw new ValidationException - ( - trans - ( - 'validation_errors.send_speaker_summit_assistance_announcement_mail_run_out_promo_code', - [ - 'summit_id' => $summit->getId(), - 'speaker_id' => $speaker->getId(), - 'type' => PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypeAccepted - ] - ) - ); - $speaker->addPromoCode($promo_code); - } else if ($has_alternate) // get alternate code - { - $promo_code = $this->registration_code_repository->getNextAvailableByType - ( - $summit, - PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypeAlternate - ); - if (is_null($promo_code)) - throw new ValidationException - ( - trans - ( - 'validation_errors.send_speaker_summit_assistance_announcement_mail_run_out_promo_code', - [ - 'summit_id' => $summit->getId(), - 'speaker_id' => $speaker->getId(), - 'type' => PromoCodesConstants::SpeakerSummitRegistrationPromoCodeTypeAccepted - ] - ) - - ); - $speaker->addPromoCode($promo_code); - } - } - - if (is_null($promo_code)) - throw new ValidationException - ( - trans - ( - 'validation_errors.send_speaker_summit_assistance_promo_code_not_set', - [ - 'summit_id' => $summit->getId(), - 'speaker_id' => $speaker->getId(), - ] - ) - - ); - - $type = SpeakerSelectionAnnouncementEmailTypeFactory::build($summit, $speaker, $role); - - if ($promo_code->isRedeemed()) - throw new ValidationException - ( - trans - ( - 'validation_errors.send_speaker_summit_assistance_announcement_mail_code_already_redeemed', - [ - 'promo_code' => $promo_code->getCode() - ] - ) - ); - - if (!PresentationSpeakerSelectionProcessEmailFactory::isValidType($type)) - throw new ValidationException - ( - trans - ( - 'validation_errors.send_speaker_summit_assistance_announcement_mail_invalid_mail_type', - [ - 'mail_type' => $type - ] - ) - ); - - $assistance = $this->generateSpeakerAssistance($summit, $speaker); - PresentationSpeakerSelectionProcessEmailFactory::send - ( - $summit, - $speaker, - $role, - $type, - $promo_code, - $assistance - ); - $promo_code->setEmailSent(true); - }); - } - - - /** - * @param Summit $summit - * @param PresentationSpeaker $speaker - * @return PresentationSpeakerSummitAssistanceConfirmationRequest - * @throws \Exception - */ - public function generateSpeakerAssistance(Summit $summit, PresentationSpeaker $speaker):PresentationSpeakerSummitAssistanceConfirmationRequest{ - return $this->tx_service->transaction(function () use ($summit, $speaker) { - $assistance = $this->speakers_assistance_repository->getBySpeaker($speaker, $summit); - - if (is_null($assistance)){ - $assistance = new PresentationSpeakerSummitAssistanceConfirmationRequest(); - $assistance->setSummit($summit); - $assistance->setSpeaker($speaker); - } - - do { - $assistance->generateConfirmationToken(); - } while($this->speakers_assistance_repository->existByHash($assistance)); - - $speaker->addSummitAssistance($assistance); - - return $assistance; - }); - } - - /** - * @param int $requested_by_id - * @param int $speaker_id - * @return SpeakerEditPermissionRequest - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function requestSpeakerEditPermission(int $requested_by_id, int $speaker_id): SpeakerEditPermissionRequest - { - return $this->tx_service->transaction(function () use ($requested_by_id, $speaker_id) { - - $requestor = $this->member_repository->getById($requested_by_id); - if(is_null($requestor)) - throw new EntityNotFoundException(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if(is_null($speaker)) - throw new EntityNotFoundException(); - - $request = $this->speaker_edit_permisssion_repository->getBySpeakerAndRequestor($speaker, $requestor); - if(!is_null($request) && $request->isActionTaken()) - throw new ValidationException("there is another permission edit request already redeem!"); - - // build request with factory - $request = SpeakerEditPermissionRequestFactory::build($speaker, $requestor); - $token = $request->generateConfirmationToken(); - SpeakerEditPermissionRequestedEmail::dispatch($request, $token); - $this->speaker_edit_permisssion_repository->add($request); - - return $request; - }); - } - - /** - * @param int $requested_by_id - * @param int $speaker_id - * @return SpeakerEditPermissionRequest - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function getSpeakerEditPermission(int $requested_by_id, int $speaker_id): SpeakerEditPermissionRequest - { - return $this->tx_service->transaction(function () use ($requested_by_id, $speaker_id) { - - $requestor = $this->member_repository->getById($requested_by_id); - if(is_null($requestor)) - throw new EntityNotFoundException(); - - $speaker = $this->speaker_repository->getById($speaker_id); - if(is_null($speaker)) - throw new EntityNotFoundException(); - - $request = $this->speaker_edit_permisssion_repository->getBySpeakerAndRequestor($speaker, $requestor); - - if(is_null($request) && $speaker->canBeEditedBy($requestor)){ - $request = SpeakerEditPermissionRequestFactory::build($speaker, $requestor); - $request->approve(); - $this->speaker_edit_permisssion_repository->add($request); - return $request; - } - - if(is_null($request)) - throw new EntityNotFoundException(); - - return $request; - }); - } - - /** - * @param string $token - * @param int $speaker_id - * @return SpeakerEditPermissionRequest - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function approveSpeakerEditPermission(string $token, int $speaker_id): SpeakerEditPermissionRequest - { - return $this->tx_service->transaction(function () use ($token, $speaker_id) { - $request = $this->speaker_edit_permisssion_repository->getByToken($token); - if(is_null($request)) - throw new EntityNotFoundException(); - if($request->isApproved()) - throw new ValidationException(); - $request->approve(); - SpeakerEditPermissionApprovedEmail::dispatch($request); - return $request; - }); - } - - /** - * @param string $token - * @param int $speaker_id - * @return SpeakerEditPermissionRequest - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function rejectSpeakerEditPermission(string $token, int $speaker_id): SpeakerEditPermissionRequest - { - return $this->tx_service->transaction(function () use ($token, $speaker_id) { - $request = $this->speaker_edit_permisssion_repository->getByToken($token); - if(is_null($request)) - throw new EntityNotFoundException(); - if($request->isActionTaken()) - throw new ValidationException(); - $request->reject(); - SpeakerEditPermissionRejectedEmail::dispatch($request); - return $request; - }); - } - - /** - * @param int $speaker_id - * @param UploadedFile $file - * @param int $max_file_size - * @throws ValidationException - * @throws EntityNotFoundException - * @return File - */ - public function addSpeakerPhoto($speaker_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($speaker_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - - $speaker = $this->speaker_repository->getById($speaker_id); - - if (is_null($speaker) || !$speaker instanceof PresentationSpeaker) { - throw new EntityNotFoundException('speaker not found!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif','pdf')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $photo = $this->file_uploader->build($file, 'profile-images', true); - $speaker->setPhoto($photo); - - return $photo; - }); - } - - - /** - * @inheritDoc - */ - public function deleteSpeakerPhoto($speaker_id): void - { - $this->tx_service->transaction(function () use ($speaker_id) { - - $speaker = $this->speaker_repository->getById($speaker_id); - - if (is_null($speaker) || !$speaker instanceof PresentationSpeaker) { - throw new EntityNotFoundException('speaker not found!'); - } - - $speaker->clearPhoto(); - - }); - } - - /** - * @inheritDoc - */ - public function addSpeakerBigPhoto($speaker_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($speaker_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - - $speaker = $this->speaker_repository->getById($speaker_id); - - if (is_null($speaker) || !$speaker instanceof PresentationSpeaker) { - throw new EntityNotFoundException('speaker not found!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif','pdf')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $photo = $this->file_uploader->build($file, 'profile-images', true); - $speaker->setBigPhoto($photo); - - return $photo; - }); - } - - /** - * @inheritDoc - */ - public function deleteSpeakerBigPhoto($speaker_id): void - { - $this->tx_service->transaction(function () use ($speaker_id) { - - - $speaker = $this->speaker_repository->getById($speaker_id); - - if (is_null($speaker) || !$speaker instanceof PresentationSpeaker) { - throw new EntityNotFoundException('speaker not found!'); - } - - $speaker->clearBigPhoto(); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SponsorUserInfoGrantService.php b/app/Services/Model/Imp/SponsorUserInfoGrantService.php deleted file mode 100644 index c625ab5e..00000000 --- a/app/Services/Model/Imp/SponsorUserInfoGrantService.php +++ /dev/null @@ -1,156 +0,0 @@ -repository = $repository; - $this->badge_repository = $badge_repository; - } - - /** - * @param Summit $summit - * @param int $sponsor_id - * @param Member $current_member - * @return SponsorUserInfoGrant - * @throws \Exception - */ - public function addGrant(Summit $summit, int $sponsor_id, Member $current_member):SponsorUserInfoGrant { - return $this->tx_service->transaction(function() use($summit, $sponsor_id, $current_member){ - $grant = SponsorUserInfoGrantFactory::build(['class_name' => SponsorUserInfoGrant::ClassName]); - $sponsor = $summit->getSummitSponsorById($sponsor_id); - if(is_null($sponsor)){ - throw new EntityNotFoundException(sprintf("Sponsor not found.")); - } - if($sponsor->hasGrant($current_member)){ - Log::warning( - sprintf - ( - "User %s already gave grant to sponsor %s", - $current_member->getEmail(), - $sponsor_id - ) - ); - - throw new ValidationException - ( - "Thanks for sharing your info!" - ); - } - $grant->setAllowedUser($current_member); - $sponsor->addUserInfoGrant($grant); - return $grant; - }); - } - - /** - * @param Summit $summit - * @param Member $current_member - * @param array $data - * @return SponsorBadgeScan - * @throws \Exception - */ - public function addBadgeScan(Summit $summit, Member $current_member, array $data): SponsorBadgeScan - { - return $this->tx_service->transaction(function() use($summit, $current_member, $data){ - - $qr_code = trim($data['qr_code']); - $fields = SummitAttendeeBadge::parseQRCode($qr_code); - $prefix = $fields['prefix']; - $scan_date_epoch = intval($data['scan_date']); - $scan_date = new \DateTime("@$scan_date_epoch"); - $begin_date = $summit->getBeginDate(); - $end_date = $summit->getEndDate(); - - if(!($scan_date >= $begin_date && $scan_date <= $end_date)) - throw new ValidationException("scan_date is does not belong to summit period."); - - if($summit->getBadgeQRPrefix() != $prefix) - throw new ValidationException - ( - sprintf - ( - "%s qr code is not valid for summit %s", - $qr_code, - $summit->getId() - ) - ); - - $ticket_number = $fields['ticket_number']; - - $badge = $this->badge_repository->getBadgeByTicketNumber($ticket_number); - - if(is_null($badge)) - throw new EntityNotFoundException("badge not found"); - - $sponsor = $current_member->getSponsorBySummit($summit); - - if(is_null($sponsor)) - throw new ValidationException("Current member does not belongs to any summit sponsor."); - - $scan = SponsorUserInfoGrantFactory::build(['class_name' => SponsorBadgeScan::ClassName]); - $scan->setScanDate($scan_date); - $scan->setQRCode($qr_code); - $scan->setUser($current_member); - $scan->setBadge($badge); - - $sponsor->addUserInfoGrant($scan); - - return $scan; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SponsoredProjectService.php b/app/Services/Model/Imp/SponsoredProjectService.php deleted file mode 100644 index 84751dd4..00000000 --- a/app/Services/Model/Imp/SponsoredProjectService.php +++ /dev/null @@ -1,304 +0,0 @@ -repository = $repository; - $this->company_repository = $company_repository; - } - - /** - * @inheritDoc - */ - public function add(array $payload): SponsoredProject - { - return $this->tx_service->transaction(function() use ($payload){ - $name = trim($payload['name']); - $formerProject = $this->repository->getByName($name); - if(!is_null($formerProject)){ - throw new ValidationException(sprintf("sponsored project %s already exists.", $name)); - } - - $sponsoredProject = SponsoredProjectFactory::build($payload); - - $this->repository->add($sponsoredProject); - - return $sponsoredProject; - }); - } - - /** - * @inheritDoc - */ - public function update(int $project_id, array $payload): SponsoredProject - { - return $this->tx_service->transaction(function() use ($project_id, $payload){ - if(isset($payload['name'])) { - $name = trim($payload['name']); - $formerProject = $this->repository->getByName($name); - if (!is_null($formerProject) && $formerProject->getId() !== $project_id) { - throw new ValidationException(sprintf("sponsored project %s already exists.", $name)); - } - } - - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - SponsoredProjectFactory::populate($sponsoredProject, $payload); - - return $sponsoredProject; - }); - } - - /** - * @inheritDoc - */ - public function delete(int $project_id): void - { - $this->tx_service->transaction(function() use ($project_id){ - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - $this->repository->delete($sponsoredProject); - }); - } - - /** - * @inheritDoc - */ - public function addProjectSponsorshipType(int $project_id, array $payload): ProjectSponsorshipType - { - return $this->tx_service->transaction(function() use ($project_id, $payload){ - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - $name = trim($payload['name']); - if($sponsoredProject->getSponsorshipTypeByName($name)){ - throw new ValidationException(sprintf("sponsorship type %s already exists.", $name)); - } - - $projectSponsorshipType = ProjectSponsorshipTypeFactory::build($payload); - $sponsoredProject->addSponsorshipType($projectSponsorshipType); - - return $projectSponsorshipType; - }); - } - - /** - * @inheritDoc - */ - public function updateProjectSponsorshipType(int $project_id, int $sponsorship_id, array $payload): ProjectSponsorshipType - { - return $this->tx_service->transaction(function() use ($project_id, $sponsorship_id, $payload){ - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - if(isset($payload['name'])) { - $name = trim($payload['name']); - $formerProjectSponsorshipType = $sponsoredProject->getSponsorshipTypeByName($name); - if ($formerProjectSponsorshipType && $formerProjectSponsorshipType->getId() !== $sponsorship_id) { - throw new ValidationException(sprintf("sponsorship type %s already exists.", $name)); - } - } - - $projectSponsorshipType = $sponsoredProject->getSponsorshipTypeById($sponsorship_id); - if(is_null($projectSponsorshipType) || !$projectSponsorshipType instanceof ProjectSponsorshipType) - throw new EntityNotFoundException(sprintf("sponsorship type %s not found.", $project_id)); - - $projectSponsorshipType = ProjectSponsorshipTypeFactory::populate($projectSponsorshipType, $payload); - - if (isset($payload['order']) && intval($payload['order']) != $projectSponsorshipType->getOrder()) { - // request to update order - $sponsoredProject->recalculateProjectSponsorshipTypeOrder($projectSponsorshipType, intval($payload['order'])); - } - - return $projectSponsorshipType; - }); - } - - /** - * @param int $project_id - * @param int $sponsorship_id - * @throws \Exception - */ - public function deleteProjectSponsorshipType(int $project_id, int $sponsorship_id): void - { - $this->tx_service->transaction(function() use ($project_id, $sponsorship_id){ - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - $projectSponsorshipType = $sponsoredProject->getSponsorshipTypeById($sponsorship_id); - if(is_null($projectSponsorshipType) || !$projectSponsorshipType instanceof ProjectSponsorshipType) - throw new EntityNotFoundException(sprintf("sponsorship type %s not found.", $project_id)); - - $sponsoredProject->removeSponsorshipType($projectSponsorshipType); - }); - } - - /** - * @param int $project_id - * @param int $sponsorship_id - * @param int $company_id - * @param array $payload - * @return SupportingCompany - * @throws \Exception - */ - public function addCompanyToProjectSponsorshipType(int $project_id, int $sponsorship_id, array $payload): SupportingCompany - { - return $this->tx_service->transaction(function() use ($project_id, $sponsorship_id, $payload){ - - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - $projectSponsorshipType = $sponsoredProject->getSponsorshipTypeById($sponsorship_id); - if(is_null($projectSponsorshipType) || !$projectSponsorshipType instanceof ProjectSponsorshipType) - throw new EntityNotFoundException(sprintf("sponsorship type %s not found.", $project_id)); - - - $company = $this->company_repository->getById(intval($payload['company_id'])); - - if(is_null($company) || !$company instanceof Company) - throw new EntityNotFoundException(sprintf("company %s not found.", $payload['company_id'])); - - $oldSupportingCompany = $projectSponsorshipType->getSupportingCompanyByCompany($company); - if(!is_null($oldSupportingCompany)){ - throw new ValidationException(sprintf("Company %s already is a supporting company.", $payload['company_id'])); - } - - $supportingCompany = $projectSponsorshipType->addSupportingCompany($company); - - if (isset($payload['order']) && intval($payload['order']) != $supportingCompany->getOrder()) { - // request to update order - $projectSponsorshipType->recalculateSupportingCompanyOrder($supportingCompany, intval($payload['order'])); - } - - return $supportingCompany; - }); - } - - /** - * @inheritDoc - */ - public function updateCompanyToProjectSponsorshipType(int $project_id, int $sponsorship_id, int $company_id, array $payload): SupportingCompany - { - return $this->tx_service->transaction(function() use ($project_id, $sponsorship_id,$company_id, $payload){ - - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - $projectSponsorshipType = $sponsoredProject->getSponsorshipTypeById($sponsorship_id); - if(is_null($projectSponsorshipType) || !$projectSponsorshipType instanceof ProjectSponsorshipType) - throw new EntityNotFoundException(sprintf("sponsorship type %s not found.", $sponsorship_id)); - - $supportingCompany = $projectSponsorshipType->getSupportingCompanyById($company_id); - - if(is_null($supportingCompany)) - throw new ValidationException(sprintf("Supporting company %s not found.", $company_id)); - - if (isset($payload['order']) && intval($payload['order']) != $supportingCompany->getOrder()) { - // request to update order - $projectSponsorshipType->recalculateSupportingCompanyOrder($supportingCompany, intval($payload['order'])); - } - - return $supportingCompany; - }); - } - - /** - * @param int $project_id - * @param int $sponsorship_id - * @param int $company_id - * @throws \Exception - */ - public function removeCompanyToProjectSponsorshipType(int $project_id, int $sponsorship_id, int $company_id): void - { - $this->tx_service->transaction(function() use ($project_id, $sponsorship_id, $company_id){ - - $sponsoredProject = $this->repository->getById($project_id); - - if(is_null($sponsoredProject) || !$sponsoredProject instanceof SponsoredProject) - throw new EntityNotFoundException(sprintf("sponsored project %s not found.", $project_id)); - - $projectSponsorshipType = $sponsoredProject->getSponsorshipTypeById($sponsorship_id); - if(is_null($projectSponsorshipType) || !$projectSponsorshipType instanceof ProjectSponsorshipType) - throw new EntityNotFoundException(sprintf("sponsorship type %s not found.", $sponsorship_id)); - - $supportingCompany = $projectSponsorshipType->getSupportingCompanyById($company_id); - - if(is_null($supportingCompany) || !$supportingCompany instanceof SupportingCompany) - throw new EntityNotFoundException(sprintf("supporting company %s not found.", $company_id)); - - $projectSponsorshipType->removeSupportingCompany($supportingCompany); - }); - } - -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SponsorshipTypeService.php b/app/Services/Model/Imp/SponsorshipTypeService.php deleted file mode 100644 index 3c42334c..00000000 --- a/app/Services/Model/Imp/SponsorshipTypeService.php +++ /dev/null @@ -1,134 +0,0 @@ -repository = $repository; - } - - - /** - * @param array $payload - * @return SponsorshipType - * @throws ValidationException - */ - public function addSponsorShipType(array $payload): SponsorshipType - { - return $this->tx_service->transaction(function() use($payload){ - - $name = trim($payload['name']); - $former_sponsorship_type = $this->repository->getByName($name); - if(!is_null($former_sponsorship_type)) - throw new ValidationException("sponsorship type name already exists"); - - - $label = trim($payload['label']); - $former_sponsorship_type = $this->repository->getByLabel($label); - if(!is_null($former_sponsorship_type)) - throw new ValidationException("sponsorship type label already exists"); - - $sponsorship_type = SponsorshipTypeFactory::build($payload); - $max_order = $this->repository->getMaxOrder(); - $sponsorship_type->setOrder($max_order + 1); - $this->repository->add($sponsorship_type); - return $sponsorship_type; - }); - } - - /** - * @param int $sponsorship_type_id - * @param array $payload - * @return SponsorshipType - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateSponsorShipType(int $sponsorship_type_id, array $payload): SponsorshipType - { - return $this->tx_service->transaction(function() use($sponsorship_type_id, $payload){ - $sponsorship_type = $this->repository->getById($sponsorship_type_id); - if(is_null($sponsorship_type)) - throw new EntityNotFoundException("sponsorship not found"); - - if(isset($payload['name'])) { - $name = trim($payload['name']); - $former_sponsorship_type = $this->repository->getByName($name); - if (!is_null($former_sponsorship_type) && $former_sponsorship_type->getId() != $sponsorship_type_id) - throw new ValidationException("sponsorship type name already exists"); - } - - - if(isset($payload['label'])) { - $label = trim($payload['label']); - $former_sponsorship_type = $this->repository->getByLabel($label); - if (!is_null($former_sponsorship_type) && $former_sponsorship_type->getId() != $sponsorship_type_id) - throw new ValidationException("sponsorship type label already exists"); - } - - if (isset($payload['order']) && intval($payload['order']) != $sponsorship_type->getOrder()) { - // request to update order - self::recalculateOrderForCollection($this->repository->getAll(), $sponsorship_type, intval($payload['order'])); - } - - return SponsorshipTypeFactory::populate($sponsorship_type, $payload); - }); - } - - /** - * @param int $sponsorship_type_id - * @throws EntityNotFoundException - */ - public function deleteSponsorShipType(int $sponsorship_type_id): void - { - $this->tx_service->transaction(function() use($sponsorship_type_id){ - $sponsorship_type = $this->repository->getById($sponsorship_type_id); - if(is_null($sponsorship_type)) - throw new EntityNotFoundException("sponsorship not found"); - - $this->repository->delete($sponsorship_type); - - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitAccessLevelTypeService.php b/app/Services/Model/Imp/SummitAccessLevelTypeService.php deleted file mode 100644 index 9fa9d106..00000000 --- a/app/Services/Model/Imp/SummitAccessLevelTypeService.php +++ /dev/null @@ -1,124 +0,0 @@ -repository = $repository; - } - - - /** - * @param Summit $summit - * @param array $data - * @return SummitAccessLevelType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addAccessLevelType(Summit $summit, array $data): SummitAccessLevelType - { - return $this->tx_service->transaction(function() use($summit, $data){ - $name = trim($data['name']); - $former_level = $this->repository->getByName($name); - if(!is_null($former_level) && $former_level->getSummitId() == $summit->getId()){ - throw new ValidationException(sprintf("access level with name %s already exists!", $name)); - } - - $access_level = SummitAccessLevelTypeFactory::build($data); - - $summit->addBadgeAccessLevelType($access_level); - - if($access_level->isDefault()){ - // add to all existent badge types - foreach($summit->getBadgeTypes() as $badgeType){ - $badgeType->addAccessLevel($access_level); - } - } - return $access_level; - - }); - } - - /** - * @param Summit $summit - * @param int $level_id - * @param array $data - * @return SummitAccessLevelType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateAccessLevelType(Summit $summit, int $level_id, array $data): SummitAccessLevelType - { - return $this->tx_service->transaction(function() use($summit, $level_id, $data){ - - $access_level = $summit->getBadgeAccessLevelTypeById($level_id); - if(is_null($access_level)) - throw new EntityNotFoundException; - - if(isset($data['name'])){ - $name = trim($data['name']); - $former_level = $this->repository->getByName($name); - - if (!is_null($former_level) && $former_level->getId() != $level_id && $former_level->getSummitId() == $summit->getId() ) { - throw new ValidationException(sprintf("access level with name %s already exists!", $name)); - } - } - return SummitAccessLevelTypeFactory::populate($access_level, $data); - }); - } - - /** - * @param Summit $summit - * @param int $level_id - * @throws EntityNotFoundException - */ - public function deleteAccessLevelType(Summit $summit, int $level_id): void - { - $this->tx_service->transaction(function() use($summit, $level_id){ - $access_level = $summit->getBadgeAccessLevelTypeById($level_id); - if(is_null($access_level)) - throw new EntityNotFoundException; - - $summit->removeBadgeAccessLevelType($access_level); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitAdministratorPermissionGroupService.php b/app/Services/Model/Imp/SummitAdministratorPermissionGroupService.php deleted file mode 100644 index 252ae729..00000000 --- a/app/Services/Model/Imp/SummitAdministratorPermissionGroupService.php +++ /dev/null @@ -1,221 +0,0 @@ -repository = $repository; - $this->summit_repository = $summit_repository; - $this->member_repository = $member_repository; - } - - /** - * @inheritDoc - */ - public function create(array $payload): SummitAdministratorPermissionGroup - { - return $this->tx_service->transaction(function () use($payload){ - - $group = $this->repository->getByTitle($payload['title']); - - if(!is_null($group)){ - throw new ValidationException(sprintf("Group %s already exists.", $group->getTitle())); - } - - $group = new SummitAdministratorPermissionGroup(); - - $group->setTitle(trim($payload['title'])); - - foreach ($payload['summits'] as $summit_id){ - $summit = $this->summit_repository->getById(intval($summit_id)); - if(is_null($summit)) continue; - if(!$summit instanceof Summit) continue; - $group->addSummit($summit); - } - - foreach ($payload['members'] as $member_id){ - $member = $this->member_repository->getById(intval($member_id)); - if(is_null($member)) continue; - if(!$member instanceof Member) continue; - $group->addMember($member); - } - - $this->repository->add($group); - - return $group; - }); - } - - /** - * @inheritDoc - */ - public function update(int $id, array $payload): SummitAdministratorPermissionGroup - { - return $this->tx_service->transaction(function () use($id, $payload){ - - if(isset($payload['title'])) { - $former_group = $this->repository->getByTitle($payload['title']); - - if (!is_null($former_group) && $former_group->getId() != $id) { - throw new ValidationException(sprintf("Group %s already exists.", $former_group->getTitle())); - } - } - - $group = $this->repository->getById($id); - - if(is_null($group)) - throw new EntityNotFoundException(); - - if(isset($payload['title'])) { - $group->setTitle(trim($payload['title'])); - } - - if(isset($payload['summits'])) { - $group->clearSummits(); - foreach ($payload['summits'] as $summit_id) { - $summit = $this->summit_repository->getById(intval($summit_id)); - if (is_null($summit)) continue; - if (!$summit instanceof Summit) continue; - $group->addSummit($summit); - } - } - - if(isset($payload['members'])) { - $group->clearMembers(); - foreach ($payload['members'] as $member_id) { - $member = $this->member_repository->getById(intval($member_id)); - if (is_null($member)) continue; - if (!$member instanceof Member) continue; - $group->addMember($member); - } - } - - return $group; - }); - } - - /** - * @inheritDoc - */ - public function delete(int $id): void - { - $this->tx_service->transaction(function () use($id){ - $group = $this->repository->getById($id); - - if(is_null($group)) - throw new EntityNotFoundException(); - - $this->repository->delete($group); - }); - } - - /** - * @inheritDoc - */ - public function addMemberTo(SummitAdministratorPermissionGroup $group, int $member_id): SummitAdministratorPermissionGroup - { - return $this->tx_service->transaction(function () use($group, $member_id){ - $member = $this->member_repository->getById($member_id); - - if(is_null($member) || !$member instanceof Member) - throw new EntityNotFoundException(); - - $group->addMember($member); - }); - } - - /** - * @inheritDoc - */ - public function removeMemberFrom(SummitAdministratorPermissionGroup $group, int $member_id): SummitAdministratorPermissionGroup - { - return $this->tx_service->transaction(function () use($group, $member_id){ - $member = $this->member_repository->getById($member_id); - - if(is_null($member) || !$member instanceof Member) - throw new EntityNotFoundException(); - - $group->removeMember($member); - }); - } - - /** - * @inheritDoc - */ - public function addSummitTo(SummitAdministratorPermissionGroup $group, int $summit_id): SummitAdministratorPermissionGroup - { - return $this->tx_service->transaction(function () use($group, $summit_id){ - $summit = $this->summit_repository->getById($summit_id); - if(is_null($summit) || !$summit instanceof Summit) - throw new EntityNotFoundException(); - - $group->addSummit($summit); - }); - } - - /** - * @inheritDoc - */ - public function removeSummitFrom(SummitAdministratorPermissionGroup $group, int $summit_id): SummitAdministratorPermissionGroup - { - return $this->tx_service->transaction(function () use($group, $summit_id){ - $summit = $this->summit_repository->getById($summit_id); - if(is_null($summit) || !$summit instanceof Summit) - throw new EntityNotFoundException(); - - $group->removeSummit($summit); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitBadgeFeatureTypeService.php b/app/Services/Model/Imp/SummitBadgeFeatureTypeService.php deleted file mode 100644 index 92125487..00000000 --- a/app/Services/Model/Imp/SummitBadgeFeatureTypeService.php +++ /dev/null @@ -1,186 +0,0 @@ -file_uploader = $file_uploader; - } - - /** - * @param Summit $summit - * @param array $data - * @return SummitBadgeFeatureType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addBadgeFeatureType(Summit $summit, array $data): SummitBadgeFeatureType - { - return $this->tx_service->transaction(function() use($summit, $data){ - $name = trim($data['name']); - $former_feature = $summit->getFeatureTypeByName($name); - if(!is_null($former_feature)){ - throw new ValidationException("feature type name already exists"); - } - - $feature = SummitBadgeFeatureTypeFactory::build($data); - - $summit->addFeatureType($feature); - - return $feature; - - }); - } - - /** - * @param Summit $summit - * @param int $feature_id - * @param array $data - * @return SummitBadgeFeatureType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateBadgeFeatureType(Summit $summit, int $feature_id, array $data): SummitBadgeFeatureType - { - return $this->tx_service->transaction(function() use($summit, $feature_id, $data){ - - $feature = $summit->getFeatureTypeById($feature_id); - if(is_null($feature)) - throw new EntityNotFoundException('feature not found'); - - if(isset($data['name'])) { - $name = trim($data['name']); - $former_feature = $summit->getFeatureTypeByName($name); - if (!is_null($former_feature) && $former_feature->getId() != $feature_id) { - throw new ValidationException("feature type name already exists"); - } - } - - return SummitBadgeFeatureTypeFactory::populate($feature, $data); - - }); - } - - /** - * @param Summit $summit - * @param int $feature_id - * @throws EntityNotFoundException - */ - public function deleteBadgeFeatureType(Summit $summit, int $feature_id): void - { - $this->tx_service->transaction(function() use($summit, $feature_id){ - - $feature = $summit->getFeatureTypeById($feature_id); - if(is_null($feature)) - throw new EntityNotFoundException('feature not found'); - - $summit->removeFeatureType($feature); - - }); - } - - /** - * @param Summit $summit - * @param int $feature_id - * @param UploadedFile $file - * @param int $max_file_size - * @return File - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addFeatureImage - ( - Summit $summit, - int $feature_id, - UploadedFile $file, - int $max_file_size = 10485760 - ):File - { - return $this->tx_service->transaction(function () use ($summit, $feature_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'svg']; - - $feature = $summit->getFeatureTypeById($feature_id); - - if (is_null($feature) || !$feature instanceof SummitBadgeFeatureType) { - throw new EntityNotFoundException('feature type not found on summit!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif','pdf')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $file = $this->file_uploader->build($file, 'summit-event-images', true); - $feature->setImage($file); - - return $file; - }); - } - - /** - * @param Summit $summit - * @param int $feature_id - * @throws EntityNotFoundException - */ - public function removeFeatureImage(Summit $summit, int $feature_id): void - { - $this->tx_service->transaction(function () use ($summit, $feature_id) { - - $feature = $summit->getFeatureTypeById($feature_id); - - if (is_null($feature) || !$feature instanceof SummitBadgeFeatureType) { - throw new EntityNotFoundException('feature type not found on summit!'); - } - - $feature->clearImage(); - - }); - } - -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitBadgeTypeService.php b/app/Services/Model/Imp/SummitBadgeTypeService.php deleted file mode 100644 index 43816a25..00000000 --- a/app/Services/Model/Imp/SummitBadgeTypeService.php +++ /dev/null @@ -1,228 +0,0 @@ -tx_service->transaction(function () use ($summit, $data) { - - $name = trim($data['name']); - - $former_badge_type = $summit->getBadgeTypeByName($name); - - if (!is_null($former_badge_type)) { - throw new ValidationException("badge type name already exists"); - } - - $is_default = boolval($data['is_default']); - $formerDefault = $summit->getDefaultBadgeType(); - if($is_default){ - if(!is_null($formerDefault)){ - $formerDefault->setIsDefault(false); - } - } - - if(!$is_default && is_null($formerDefault)){ - // force default - throw new ValidationException("You must define a default badge type."); - } - - $badge_type = SummitBadgeTypeFactory::build($data); - // add default access levels - foreach($summit->getDefaultBadgeAccessLevelTypes() as $default_access_level){ - $badge_type->addAccessLevel($default_access_level); - } - $summit->addBadgeType($badge_type); - return $badge_type; - }); - } - - /** - * @param Summit $summit - * @param int $badge_type_id - * @param array $data - * @return SummitBadgeType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateBadgeType(Summit $summit, int $badge_type_id, array $data): SummitBadgeType - { - return $this->tx_service->transaction(function () use ($summit, $badge_type_id, $data) { - $badge_type = $summit->getBadgeTypeById($badge_type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - - if(isset($data['name'])) { - $name = trim($data['name']); - $former_badge_type = $summit->getBadgeTypeByName($name); - if (!is_null($former_badge_type) && $former_badge_type->getId() != $badge_type_id) { - throw new ValidationException("badge type name already exists"); - } - } - // default check - $formerDefault = $summit->getDefaultBadgeType(); - if(isset($data['is_default'])) { // trying to set a default ( true or false) - $is_default = boolval($data['is_default']); - - if ($is_default && !$badge_type->isDefault()) { // is we want to set it as default ... - if(!is_null($formerDefault)){ - // remove former default - $formerDefault->setIsDefault(false); - } - } - // if we dont have a default or the default is already the current one - // and we want to clear the default force it - if(!$is_default && ( is_null($formerDefault) || $badge_type->getId() == $formerDefault->getId())){ - // force default - throw new ValidationException("You must define a default badge type."); - } - } - - return SummitBadgeTypeFactory::populate($badge_type, $data); - }); - } - - /** - * @param Summit $summit - * @param int $badge_type_id - * @throws EntityNotFoundException - */ - public function deleteBadgeType(Summit $summit, int $badge_type_id): void - { - $this->tx_service->transaction(function () use ($summit, $badge_type_id) { - $badge_type = $summit->getBadgeTypeById($badge_type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - - $summit->removeBadgeType($badge_type); - }); - } - - /** - * @param Summit $summit - * @param int $badge_type_id - * @param int $access_level_id - * @return SummitBadgeType - */ - public function addAccessLevelToBadgeType(Summit $summit, int $badge_type_id, int $access_level_id): SummitBadgeType - { - return $this->tx_service->transaction(function () use ($summit, $badge_type_id, $access_level_id) { - $badge_type = $summit->getBadgeTypeById($badge_type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - - $access_level = $summit->getBadgeAccessLevelTypeById($access_level_id); - if (is_null($access_level)) - throw new EntityNotFoundException("access level type not found"); - - $badge_type->addAccessLevel($access_level); - - return $badge_type; - }); - } - - /** - * @param Summit $summit - * @param int $badge_type_id - * @param int $access_level_id - * @return SummitBadgeType - */ - public function removeAccessLevelFromBadgeType(Summit $summit, int $badge_type_id, int $access_level_id): SummitBadgeType - { - return $this->tx_service->transaction(function () use ($summit, $badge_type_id, $access_level_id) { - $badge_type = $summit->getBadgeTypeById($badge_type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - - $access_level = $summit->getBadgeAccessLevelTypeById($access_level_id); - if (is_null($access_level)) - throw new EntityNotFoundException("access level type not found"); - - $badge_type->removeAccessLevel($access_level); - - return $badge_type; - }); - } - - /** - * @param Summit $summit - * @param int $badge_type_id - * @param int $feature_id - * @return SummitBadgeType - * @throws \Exception - */ - public function addFeatureToBadgeType(Summit $summit, int $badge_type_id, int $feature_id): SummitBadgeType - { - return $this->tx_service->transaction(function () use ($summit, $badge_type_id, $feature_id) { - $badge_type = $summit->getBadgeTypeById($badge_type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - - $feature = $summit->getFeatureTypeById($feature_id); - if (is_null($feature)) - throw new EntityNotFoundException("feature not found"); - - $badge_type->addBadgeFeatureType($feature); - - return $badge_type; - }); - } - - /** - * @param Summit $summit - * @param int $badge_type_id - * @param int $feature_id - * @return SummitBadgeType - * @throws \Exception - */ - public function removeFeatureFromBadgeType(Summit $summit, int $badge_type_id, int $feature_id): SummitBadgeType - { - return $this->tx_service->transaction(function () use ($summit, $badge_type_id, $feature_id) { - $badge_type = $summit->getBadgeTypeById($badge_type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - - $feature = $summit->getFeatureTypeById($feature_id); - if (is_null($feature)) - throw new EntityNotFoundException("feature not found"); - - $badge_type->removeBadgeFeatureType($feature); - - return $badge_type; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitDocumentService.php b/app/Services/Model/Imp/SummitDocumentService.php deleted file mode 100644 index 36346c27..00000000 --- a/app/Services/Model/Imp/SummitDocumentService.php +++ /dev/null @@ -1,246 +0,0 @@ -file_uploader = $file_uploader; - $this->folder_repository = $folder_repository; - } - - /** - * @param Summit $summit - * @param array $payload - * @return SummitDocument - * @throws \Exception - */ - public function addSummitDocument(Summit $summit, array $payload): SummitDocument - { - return $this->tx_service->transaction(function() use($summit, $payload){ - - if(isset($payload['name'])){ - $former_document = $summit->getSummitDocumentByName($payload['name']); - if(!is_null($former_document)) - throw new ValidationException(sprintf("name %s already exists.", $payload['name'])); - } - - if(isset($payload['label'])){ - $former_document = $summit->getSummitDocumentByLabel($payload['label']); - if(!is_null($former_document) ) - throw new ValidationException(sprintf("label %s already exists.", $payload['label'])); - } - - $document = SummitDocumentFactory::build($summit, $payload); - - if(!$document->isShowAlways() && isset($payload['event_types'])){ - $document->clearEventTypes(); - foreach($payload['event_types'] as $event_type_id){ - $event_type = $summit->getEventType(intval($event_type_id)); - if(is_null($event_type)){ - throw new EntityNotFoundException(); - } - $document->addEventType($event_type); - } - } - - if(!$document->isShowAlways() && $document->getEventTypes()->count() == 0) - throw new ValidationException("You need to to set at least one Activity Type."); - - $file = $payload['file']; - $attachment = $this->file_uploader->build - ( - $file, - sprintf('summits/%s/documents', $summit->getId()), - false - ); - - $document->setFile($attachment); - - $summit->addSummitDocument($document); - - return $document; - - }); - } - - /** - * @param Summit $summit - * @param int $document_id - * @param array $payload - * @return SummitDocument - * @throws \Exception - */ - public function updateSummitDocument(Summit $summit, int $document_id, array $payload): SummitDocument - { - return $this->tx_service->transaction(function() use($summit, $document_id, $payload){ - - $document = $summit->getSummitDocumentById($document_id); - if(is_null($document)) - throw new EntityNotFoundException(); - - if(isset($payload['name'])){ - $former_document = $summit->getSummitDocumentByName($payload['name']); - if(!is_null($former_document) && $former_document->getId() !== $document_id) - throw new ValidationException(sprintf("name %s already exists.", $payload['name'])); - } - - if(isset($payload['label'])){ - $former_document = $summit->getSummitDocumentByLabel($payload['label']); - if(!is_null($former_document) && $former_document->getId() !== $document_id) - throw new ValidationException(sprintf("label %s already exists.", $payload['label'])); - } - - $document = SummitDocumentFactory::populate($summit, $document, $payload); - - if(!$document->isShowAlways() && isset($payload['event_types'])){ - $document->clearEventTypes(); - foreach($payload['event_types'] as $event_type_id){ - $event_type = $summit->getEventType(intval($event_type_id)); - if(is_null($event_type)){ - throw new EntityNotFoundException(); - } - $document->addEventType($event_type); - } - } - - if(!$document->isShowAlways() && $document->getEventTypes()->count() == 0) - throw new ValidationException("You need to to set at least one Activity Type."); - - if(isset($payload['file'])){ - - if($document->hasFile()){ - // drop file - $attachment = $document->getFile(); - $this->folder_repository->delete($attachment); - $document->clearFile(); - $attachment = null; - } - - $attachment = $this->file_uploader->build - ( - $payload['file'], - sprintf('summits/%s/documents', $summit->getId()), - false - ); - - $document->setFile($attachment); - } - - return $document; - }); - } - - /** - * @param Summit $summit - * @param int $document_id - * @throws \Exception - */ - public function deleteSummitDocument(Summit $summit, int $document_id): void - { - $this->tx_service->transaction(function() use($summit, $document_id){ - $document = $summit->getSummitDocumentById($document_id); - if(is_null($document)) - throw new EntityNotFoundException(); - - $summit->removeSummitDocument($document); - }); - } - - /** - * @param Summit $summit - * @param int $document_id - * @param int $event_type_id - * @return SummitDocument - * @throws \Exception - */ - public function addEventTypeToSummitDocument(Summit $summit, int $document_id, int $event_type_id): SummitDocument - { - return $this->tx_service->transaction(function() use($summit, $document_id, $event_type_id){ - $document = $summit->getSummitDocumentById($document_id); - if(is_null($document)) - throw new EntityNotFoundException(); - - $event_type = $summit->getEventType($event_type_id); - if(is_null($event_type)) - throw new EntityNotFoundException(); - - $document->addEventType($event_type); - - return $document; - }); - } - - /** - * @param Summit $summit - * @param int $document_id - * @param int $event_type_id - * @return SummitDocument - * @throws \Exception - */ - public function removeEventTypeFromSummitDocument(Summit $summit, int $document_id, int $event_type_id): SummitDocument - { - return $this->tx_service->transaction(function() use($summit, $document_id, $event_type_id){ - $document = $summit->getSummitDocumentById($document_id); - if(is_null($document)) - throw new EntityNotFoundException(); - - $event_type = $summit->getEventType($event_type_id); - if(is_null($event_type)) - throw new EntityNotFoundException(); - - $document->removeEventType($event_type); - - return $document; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitEmailEventFlowService.php b/app/Services/Model/Imp/SummitEmailEventFlowService.php deleted file mode 100644 index 340a55a9..00000000 --- a/app/Services/Model/Imp/SummitEmailEventFlowService.php +++ /dev/null @@ -1,65 +0,0 @@ -tx_service->transaction(function () use ($summit, $event_id, $data) { - $event = $summit->getEmailEventById($event_id); - if (is_null($event)) - throw new EntityNotFoundException("Email Event not found"); - - $event->setEmailTemplateIdentifier(trim($data['email_template_identifier'])); - - return $event; - }); - } - - /** - * @param Summit $summit - * @param int $event_id - * @throws \Exception - */ - public function deleteEmailEventFlow(Summit $summit, int $event_id): void - { - $this->tx_service->transaction(function () use ($summit, $event_id) { - $event = $summit->getEmailEventById($event_id); - if (is_null($event)) - throw new EntityNotFoundException("Email Event not found"); - - $summit->removeEmailEventFlow($event); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitEventTypeService.php b/app/Services/Model/Imp/SummitEventTypeService.php deleted file mode 100644 index 6d1b23fd..00000000 --- a/app/Services/Model/Imp/SummitEventTypeService.php +++ /dev/null @@ -1,283 +0,0 @@ -repository = $repository; - $this->default_event_types_repository = $default_event_types_repository; - } - - /** - * @param Summit $summit - * @param array $data - * @return SummitEventType - * @throws EntityNotFoundException - * @throws ValidationException - * @throws \Exception - */ - public function addEventType(Summit $summit, array $data) - { - $event_type = $this->tx_service->transaction(function() use($summit, $data){ - - $type = trim($data['name']); - - if($summit->hasEventType($type)){ - throw new ValidationException(sprintf("event type %s already exist on summit id %s", $type, $summit->getId())); - } - - $event_type = SummitEventTypeFactory::build($summit, $data); - - if(is_null($event_type)) - throw new ValidationException(sprintf("class_name %s is invalid", $data['class_name'])); - - return $event_type; - - }); - - Event::fire - ( - new SummitEventTypeInserted - ( - $event_type->getId(), - $event_type->getClassName(), - $event_type->getSummitId() - ) - ); - - return $event_type; - } - - /** - * @param Summit $summit - * @param int $event_type_id - * @param array $data - * @return SummitEventType - * @throws EntityNotFoundException - * @throws ValidationException - * @throws \Exception - */ - public function updateEventType(Summit $summit, $event_type_id, array $data) - { - return $this->tx_service->transaction(function() use($summit, $event_type_id, $data){ - - $type = isset($data['name']) ? trim($data['name']) : null; - - $event_type = $summit->getEventType($event_type_id); - - if(is_null($event_type)) - throw new EntityNotFoundException(sprintf("event type id %s does not belongs to summit id %s", $event_type_id, $summit->getId())); - - if(!empty($type)) { - $old_event_type = $summit->getEventTypeByType($type); - if(!is_null($old_event_type) && $old_event_type->getId() != $event_type->getId()){ - throw new ValidationException(sprintf("name %s already belongs to another event type id %s", $type, $old_event_type->getId())); - } - } - - $event_type = SummitEventTypeFactory::populate($event_type, $summit, $data); - - Event::fire - ( - new SummitEventTypeUpdated - ( - $event_type->getId(), - $event_type->getClassName(), - $event_type->getSummitId() - ) - ); - - return $event_type; - - }); - } - - /** - * @param Summit $summit - * @param int $event_type_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - * @throws \Exception - */ - public function deleteEventType(Summit $summit, $event_type_id) - { - return $this->tx_service->transaction(function() use($event_type_id, $summit){ - - $event_type = $summit->getEventType($event_type_id); - - if(is_null($event_type)) - throw new EntityNotFoundException - ( - sprintf("event type id %s does not belongs to summit id %s", $event_type_id, $summit->getId()) - ); - - if ($event_type->isDefault()) - throw new ValidationException - ( - sprintf("event type id %s is a default one and is not allowed to be deleted", $event_type_id) - ); - - $summit_events = $event_type->getRelatedPublishedSummitEventsIds(); - - if(count($summit_events) > 0){ - throw new ValidationException - ( - sprintf("event type id %s could not be deleted bc its assigned to published events on summit id %s", $event_type_id, $summit->getId()) - ); - } - - Event::fire - ( - new SummitEventTypeDeleted - ( - $event_type->getId(), - $event_type->getClassName(), - $event_type->getSummitId() - ) - ); - - $summit->removeEventType($event_type); - - }); - } - - /** - * @param Summit $summit - * @return SummitEventType[] - * @throws EntityNotFoundException - * @throws ValidationException - * @throws \Exception - */ - public function seedDefaultEventTypes(Summit $summit) - { - $added_types = $this->tx_service->transaction(function() use($summit){ - $added_types = []; - $default_types = $this->default_event_types_repository->getAll(); - foreach ($default_types as $default_type){ - $former_type = $summit->getEventTypeByType($default_type->getType()); - if(!is_null($former_type)) continue; - $new_type = $default_type->buildType($summit); - $summit->addEventType($new_type); - $added_types[] = $new_type; - } - - return $added_types; - }); - - foreach ($added_types as $event_type){ - Event::fire - ( - new SummitEventTypeInserted - ( - $event_type->getId(), - $event_type->getClassName(), - $event_type->getSummitId() - ) - ); - } - - return $added_types; - } - - /** - * @param Summit $summit - * @param int $event_type_id - * @param int $document_id - * @return SummitEventType - * @throws \Exception - */ - public function addSummitDocumentToEventType(Summit $summit, int $event_type_id, int $document_id): SummitEventType - { - return $this->tx_service->transaction(function() use($summit, $event_type_id, $document_id){ - $document = $summit->getSummitDocumentById($document_id); - if(is_null($document)) - throw new EntityNotFoundException(); - - $event_type = $summit->getEventType($event_type_id); - if(is_null($event_type)) - throw new EntityNotFoundException(); - - $document->addEventType($event_type); - - return $event_type; - }); - } - - /** - * @param Summit $summit - * @param int $event_type_id - * @param int $document_id - * @return SummitEventType - * @throws \Exception - */ - public function removeSummitDocumentFromEventType(Summit $summit, int $event_type_id, int $document_id): SummitEventType - { - return $this->tx_service->transaction(function() use($summit, $event_type_id, $document_id){ - $document = $summit->getSummitDocumentById($document_id); - if(is_null($document)) - throw new EntityNotFoundException(); - - $event_type = $summit->getEventType($event_type_id); - if(is_null($event_type)) - throw new EntityNotFoundException(); - - $document->removeEventType($event_type); - - return $event_type; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitLocationService.php b/app/Services/Model/Imp/SummitLocationService.php deleted file mode 100644 index 368ee2c6..00000000 --- a/app/Services/Model/Imp/SummitLocationService.php +++ /dev/null @@ -1,2532 +0,0 @@ -location_repository = $location_repository; - $this->member_repository = $member_repository; - $this->reservation_repository = $reservation_repository; - $this->geo_coding_api = $geo_coding_api; - $this->file_uploader = $file_uploader; - $this->folder_service = $folder_service; - $this->default_payment_gateway_strategy = $default_payment_gateway_strategy; - } - - /** - * @param Summit $summit - * @param array $data - * @return SummitAbstractLocation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addLocation(Summit $summit, array $data) - { - $location = $this->tx_service->transaction(function () use ($summit, $data) { - - $old_location = $summit->getLocationByName(trim($data['name'])); - - if (!is_null($old_location)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addLocation.LocationNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $location = SummitLocationFactory::build($data); - - if (is_null($location)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addLocation.InvalidClassName' - ) - ); - } - - if ($location instanceof SummitGeoLocatedLocation) { - try { - $geo_location_strategy = GeoLocationStrategyFactory::build($location); - $geo_location_strategy->doGeoLocation($location, $this->geo_coding_api); - } catch (GeoCodingApiException $ex1) { - Log::warning($ex1->getMessage()); - $validation_msg = trans('validation_errors.LocationService.addLocation.geoCodingGenericError'); - switch ($ex1->getStatus()) { - case IGeoCodingAPI::ResponseStatusZeroResults: - { - $validation_msg = trans('validation_errors.LocationService.addLocation.InvalidAddressOrCoordinates'); - } - break; - case IGeoCodingAPI::ResponseStatusOverQueryLimit: - { - $validation_msg = trans('validation_errors.LocationService.addLocation.OverQuotaLimit'); - } - break; - } - throw new ValidationException($validation_msg); - } catch (\Exception $ex) { - Log::warning($ex->getMessage()); - throw $ex; - } - } - - $summit->addLocation($location); - - return $location; - }); - - Event::fire - ( - new LocationInserted - ( - $location->getSummitId(), - $location->getId(), - $location->getClassName() - ) - ); - - return $location; - } - - /** - * @param Summit $summit - * @param int $location_id - * @param array $data - * @return SummitAbstractLocation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateLocation(Summit $summit, $location_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $data) { - - if (isset($data['name'])) { - $old_location = $summit->getLocationByName(trim($data['name'])); - - if (!is_null($old_location) && $old_location->getId() != $location_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.updateLocation.LocationNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - ) - ); - } - } - - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException( - trans - ( - 'validation_errors.LocationService.updateLocation.LocationNotFoundOnSummit', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - if (!Summit::isPrimaryLocation($location)) { - throw new EntityNotFoundException( - trans - ( - 'validation_errors.LocationService.updateLocation.LocationNotFoundOnSummit', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - if ($location->getClassName() != $data['class_name']) { - throw new ValidationException( - trans - ( - 'validation_errors.LocationService.updateLocation.ClassNameMissMatch', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - 'class_name' => $data['class_name'] - ] - ) - ); - } - - $location = SummitLocationFactory::populate($location, $data); - - if ($location instanceof SummitGeoLocatedLocation && $this->hasGeoLocationData2Update($data)) { - try { - $geo_location_strategy = GeoLocationStrategyFactory::build($location); - $geo_location_strategy->doGeoLocation($location, $this->geo_coding_api); - } catch (GeoCodingApiException $ex1) { - Log::warning($ex1->getMessage()); - $validation_msg = trans('validation_errors.LocationService.addLocation.geoCodingGenericError'); - switch ($ex1->getStatus()) { - case IGeoCodingAPI::ResponseStatusZeroResults: - { - $validation_msg = trans('validation_errors.LocationService.addLocation.InvalidAddressOrCoordinates'); - } - break; - case IGeoCodingAPI::ResponseStatusOverQueryLimit: - { - $validation_msg = trans('validation_errors.LocationService.addLocation.OverQuotaLimit'); - } - break; - } - throw new ValidationException($validation_msg); - } catch (\Exception $ex) { - Log::warning($ex->getMessage()); - throw $ex; - } - } - - if (isset($data['order']) && intval($data['order']) != $location->getOrder()) { - // request to update order - $summit->recalculateLocationOrder($location, intval($data['order'])); - } - - Event::fire - ( - new LocationUpdated - ( - $location->getSummitId(), - $location->getId(), - $location->getClassName(), - $summit->getScheduleEventsIdsPerLocation($location) - ) - ); - - return $location; - }); - } - - /** - * @param array $data - * @return bool - */ - private function hasGeoLocationData2Update(array $data) - { - return isset($data['address_1']) || isset($data['lat']); - } - - /** - * @param Summit $summit - * @param int $location_id - * @return SummitAbstractLocation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteLocation(Summit $summit, $location_id) - { - return $this->tx_service->transaction(function () use ($summit, $location_id) { - - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException( - trans - ( - 'validation_errors.LocationService.deleteLocation.LocationNotFoundOnSummit', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - if (!Summit::isPrimaryLocation($location)) { - throw new EntityNotFoundException( - trans - ( - 'validation_errors.LocationService.deleteLocation.LocationNotFoundOnSummit', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - Event::fire(new LocationDeleted - ( - $location->getSummitId(), - $location->getId(), - $location->getClassName(), - $summit->getScheduleEventsIdsPerLocation($location)) - ); - - $summit->removeLocation($location); - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param array $data - * @return SummitVenueFloor - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addVenueFloor(Summit $summit, $venue_id, array $data) - { - $floor = $this->tx_service->transaction(function () use ($summit, $venue_id, $data) { - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueFloor.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueFloor.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - $former_floor = $venue->getFloorByName(trim($data['name'])); - - if (!is_null($former_floor)) { - throw new ValidationException( - trans - ( - 'validation_errors.LocationService.addVenueFloor.FloorNameAlreadyExists', - [ - 'venue_id' => $venue_id, - 'floor_name' => trim($data['name']) - ] - ) - ); - } - - $former_floor = $venue->getFloorByNumber(intval($data['number'])); - - if (!is_null($former_floor)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addVenueFloor.FloorNumberAlreadyExists', - [ - 'venue_id' => $venue_id, - 'floor_number' => intval($data['number']) - ] - ) - ); - } - - $floor = SummitVenueFloorFactory::build($data); - - $venue->addFloor($floor); - - return $floor; - }); - - Event::fire - ( - new FloorInserted - ( - $floor->getVenue()->getSummitId(), - $floor->getVenueId(), - $floor->getId() - ) - ); - - return $floor; - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $floor_id - * @param array $data - * @return SummitVenueFloor - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateVenueFloor(Summit $summit, $venue_id, $floor_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $floor_id, $data) { - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueFloor.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueFloor.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (isset($data['name'])) { - $former_floor = $venue->getFloorByName(trim($data['name'])); - - if (!is_null($former_floor) && $former_floor->getId() != $floor_id) { - throw new ValidationException( - trans - ( - 'validation_errors.LocationService.addVenueFloor.FloorNameAlreadyExists', - [ - 'venue_id' => $venue_id, - 'floor_name' => trim($data['name']) - ] - ) - ); - } - } - - if (isset($data['number'])) { - $former_floor = $venue->getFloorByNumber(intval($data['number'])); - - if (!is_null($former_floor) && $former_floor->getId() != $floor_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addVenueFloor.FloorNumberAlreadyExists', - [ - 'venue_id' => $venue_id, - 'floor_number' => intval($data['number']) - ] - ) - ); - } - - } - - $floor = $venue->getFloor($floor_id); - if (is_null($floor)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueFloor.FloorNotFound', - [ - 'floor_id' => $floor_id, - 'venue_id' => $venue_id - ] - ) - ); - } - - $floor = SummitVenueFloorFactory::populate($floor, $data); - - Event::fire - ( - new FloorUpdated - ( - $floor->getVenue()->getSummitId(), - $floor->getVenueId(), - $floor->getId() - ) - ); - - return $floor; - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $floor_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteVenueFloor(Summit $summit, $venue_id, $floor_id) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $floor_id) { - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteVenueFloor.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteVenueFloor.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteVenueFloor.FloorNotFound', - [ - 'floor_id' => $floor_id, - 'venue_id' => $venue_id - ] - ) - ); - } - - Event::fire(new FloorDeleted - ( - $floor->getVenue()->getSummitId(), - $floor->getVenueId(), - $floor->getId() - ) - ); - - $venue->removeFloor($floor); - }); - } - - /** - * @param Summit $summit - * @param $venue_id - * @param array $data - * @return SummitVenueRoom - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addVenueRoom(Summit $summit, $venue_id, array $data) - { - $room = $this->tx_service->transaction(function () use ($summit, $venue_id, $data) { - - if (isset($data['name'])) { - $old_location = $summit->getLocationByName(trim($data['name'])); - - if (!is_null($old_location)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addVenueRoom.LocationNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - ) - ); - } - } - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - $data['class_name'] = SummitVenueRoom::ClassName; - $room = SummitLocationFactory::build($data); - - if (is_null($room)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addVenueRoom.InvalidClassName' - ) - ); - } - - if (isset($data['floor_id'])) { - $floor_id = intval($data['floor_id']); - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueRoom.FloorNotFound', - [ - 'floor_id' => $floor_id, - 'venue_id' => $venue_id - ] - ) - ); - } - - $floor->addRoom($room); - } - - $summit->addLocation($room); - $venue->addRoom($room); - - return $room; - }); - - Event::fire - ( - new SummitVenueRoomInserted - ( - $room->getSummitId(), - $room->getId(), - $room->getClassName() - ) - ); - - return $room; - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @param array $data - * @return SummitVenueRoom - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateVenueRoom(Summit $summit, $venue_id, $room_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id, $data) { - - if (isset($data['name'])) { - $old_location = $summit->getLocationByName(trim($data['name'])); - - if (!is_null($old_location) && $old_location->getId() != $room_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.updateVenueRoom.LocationNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - ) - ); - } - } - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - $room = $summit->getLocation($room_id); - if (is_null($room)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.RoomNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - 'room_id' => $room_id, - ] - ) - ); - } - - if (!$room instanceof SummitVenueRoom) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.RoomNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - 'room_id' => $room_id, - ] - ) - ); - } - - $old_floor_id = $room->getFloorId(); - $new_floor_id = $room->getFloorId(); - SummitLocationFactory::populate($room, $data); - $floor = null; - - if (isset($data['floor_id'])) { - $old_floor_id = intval($room->getFloorId()); - $new_floor_id = intval($data['floor_id']); - if ($old_floor_id != $new_floor_id) { - $floor = $venue->getFloor($new_floor_id); - if (is_null($floor)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.FloorNotFound', - [ - 'floor_id' => $new_floor_id, - 'venue_id' => $venue_id - ] - ) - ); - } - if ($old_floor_id > 0) { - // remove from old floor - $room->getFloor()->removeRoom($room); - - } - $floor->addRoom($room); - } - } - - // request to update order - if (isset($data['order']) && intval($data['order']) != $room->getOrder()) { - - if (!is_null($floor)) { - $floor->recalculateRoomsOrder($room, intval($data['order'])); - } else { - $venue->recalculateRoomsOrder($room, intval($data['order'])); - } - } - - Event::fire - ( - new SummitVenueRoomUpdated - ( - $room->getSummitId(), - $room->getId(), - $summit->getScheduleEventsIdsPerLocation($room), - $old_floor_id, - $new_floor_id - ) - ); - - return $room; - }); - - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteVenueRoom(Summit $summit, $venue_id, $room_id) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id) { - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - $room = $venue->getRoom($room_id); - - if (is_null($room)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteVenueRoom.RoomNotFound', - [ - 'room_id' => $room_id, - 'venue_id' => $venue_id - ] - ) - ); - } - - $venue->removeRoom($room); - - if ($room->hasFloor()) { - $floor = $room->getFloor(); - $floor->removeRoom($room); - } - - Event::fire - ( - new SummitVenueRoomDeleted - ( - $room->getSummitId(), - $room->getId(), - 'SummitVenueRoom', - $summit->getScheduleEventsIdsPerLocation($room) - ) - ); - }); - } - - /** - * @param Summit $summit - * @param int $location_id - * @param array $data - * @return SummitLocationBanner - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addLocationBanner(Summit $summit, $location_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $data) { - - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addLocationBanner.LocationNotFound', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - $banner = SummitLocationBannerFactory::build($summit, $location, $data); - - if (is_null($banner)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addLocationBanner.InvalidClassName' - ) - ); - } - - $location->addBanner($banner); - - return $banner; - }); - } - - /** - * @param Summit $summit - * @param int $location_id - * @param int $banner_id - * @param array $data - * @return SummitLocationBanner - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateLocationBanner(Summit $summit, $location_id, $banner_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $banner_id, $data) { - - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateLocationBanner.LocationNotFound', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - $banner = $location->getBannerById($banner_id); - - if (is_null($banner)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateLocationBanner.BannerNotFound', - [ - 'location_id' => $location_id, - 'banner_id' => $banner_id, - ] - ) - ); - } - - $banner = SummitLocationBannerFactory::populate($summit, $location, $banner, $data); - $location->validateBanner($banner); - return $banner; - }); - } - - /** - * @param Summit $summit - * @param int $location_id - * @param int $banner_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteLocationBanner(Summit $summit, $location_id, $banner_id) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $banner_id) { - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationBanner.LocationNotFound', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - $banner = $location->getBannerById($banner_id); - - if (is_null($banner)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationBanner.BannerNotFound', - [ - 'location_id' => $location_id, - 'banner_id' => $banner_id, - ] - ) - ); - } - - $location->removeBanner($banner); - }); - } - - /** - * @param Summit $summit - * @param int $location_id - * @param array $metadata - * @param $file - * @return SummitLocationImage - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addLocationMap(Summit $summit, $location_id, array $metadata, UploadedFile $file) - { - $map = $this->tx_service->transaction(function () use ($summit, $location_id, $metadata, $file) { - $max_file_size = config('file_upload.max_file_upload_size'); - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.addLocationMap.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - if (!$location instanceof SummitGeoLocatedLocation) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.addLocationMap.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException - ( - trans( - 'validation_errors.LocationService.addLocationMap.FileNotAllowedExtension', - [ - 'allowed_extensions' => implode(", ", $allowed_extensions), - ] - ) - ); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addLocationMap.FileMaxSize', - [ - 'max_file_size' => (($max_file_size / 1024) / 1024) - ] - ) - ); - } - - $pic = $this->file_uploader->build($file, sprintf('summits/%s/locations/%s/maps', $location->getSummitId(), $location->getId()), true); - $map = SummitLocationImageFactory::buildMap($metadata); - $map->setPicture($pic); - $location->addMap($map); - return $map; - }); - - Event::fire - ( - new LocationImageInserted - ( - $map->getId(), - $map->getLocationId(), - $map->getLocation()->getSummitId(), - $map->getClassName() - ) - ); - - return $map; - } - - /** - * @param Summit $summit - * @param int $location_id - * @param int $map_id - * @param array $metadata - * @param UploadedFile|null $file - * @return SummitLocationImage - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateLocationMap(Summit $summit, $location_id, $map_id, array $metadata, UploadedFile $file = null) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $map_id, $metadata, $file) { - $max_file_size = config('file_upload.max_file_upload_size'); - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.updateLocationMap.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - if (!$location instanceof SummitGeoLocatedLocation) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.updateLocationMap.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - $map = $location->getMap($map_id); - - if (is_null($map)) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.updateLocationMap.MapNotFound', - [ - 'map_id' => $map_id, - 'location_id' => $location_id, - ] - ) - ); - } - - if (!is_null($file)) { - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException - ( - trans( - 'validation_errors.LocationService.updateLocationMap.FileNotAllowedExtension', - [ - 'allowed_extensions' => implode(", ", $allowed_extensions), - ] - ) - ); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.updateLocationMap.FileMaxSize', - [ - 'max_file_size' => (($max_file_size / 1024) / 1024) - ] - ) - ); - } - - $pic = $this->file_uploader->build($file, sprintf('summits/%s/locations/%s/maps', $location->getSummitId(), $location->getId()), true); - $map->setPicture($pic); - } - - $map = SummitLocationImageFactory::populate($map, $metadata); - - if (isset($metadata['order']) && intval($metadata['order']) != $map->getOrder()) { - // request to update order - $location->recalculateMapOrder($map, intval($metadata['order'])); - } - - Event::fire - ( - new LocationImageUpdated - ( - $map->getId(), - $map->getLocationId(), - $map->getLocation()->getSummitId(), - $map->getClassName() - ) - ); - - return $map; - }); - } - - /** - * @param Summit $summit - * @param int $location_id - * @param int $map_id - * @return SummitAbstractLocation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteLocationMap(Summit $summit, $location_id, $map_id) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $map_id) { - - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationMap.LocationNotFound', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - if (!$location instanceof SummitGeoLocatedLocation) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationMap.LocationNotFound', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - $map = $location->getMap($map_id); - - if (is_null($map)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationMap.MapNotFound', - [ - 'location_id' => $location_id, - 'map_id' => $map_id, - ] - ) - ); - } - - Event::fire - ( - new LocationImageDeleted - ( - $map->getId(), - $map->getLocationId(), - $map->getLocation()->getSummitId(), - $map->getClassName() - ) - ); - - $location->removeMap($map); - - }); - } - - /** - * @param Summit $summit - * @param int $location_id - * @param array $metadata - * @param $file - * @return SummitLocationImage - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addLocationImage(Summit $summit, $location_id, array $metadata, UploadedFile $file) - { - $image = $this->tx_service->transaction(function () use ($summit, $location_id, $metadata, $file) { - $max_file_size = config('file_upload.max_file_upload_size'); - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.addLocationImage.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - if (!$location instanceof SummitGeoLocatedLocation) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.addLocationImage.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException - ( - trans( - 'validation_errors.LocationService.addLocationImage.FileNotAllowedExtension', - [ - 'allowed_extensions' => implode(", ", $allowed_extensions), - ] - ) - ); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addLocationImage.FileMaxSize', - [ - 'max_file_size' => (($max_file_size / 1024) / 1024) - ] - ) - ); - } - - $pic = $this->file_uploader->build($file, sprintf('summits/%s/locations/%s/images', $location->getSummitId(), $location->getId()), true); - $image = SummitLocationImageFactory::buildImage($metadata); - $image->setPicture($pic); - $location->addImage($image); - return $image; - }); - - Event::fire - ( - new LocationImageInserted - ( - $image->getId(), - $image->getLocationId(), - $image->getLocation()->getSummitId(), - $image->getClassName() - ) - ); - - return $image; - } - - /** - * @param Summit $summit - * @param int $location_id - * @param int $image_id - * @param array $metadata - * @param UploadedFile|null $file - * @return SummitLocationImage - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateLocationImage(Summit $summit, $location_id, $image_id, array $metadata, UploadedFile $file = null) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $image_id, $metadata, $file) { - $max_file_size = config('file_upload.max_file_upload_size'); - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.updateLocationImage.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - if (!$location instanceof SummitGeoLocatedLocation) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.updateLocationImage.LocationNotFound', - [ - 'location_id' => $location_id, - ] - ) - ); - } - - $image = $location->getImage($image_id); - - if (is_null($image)) { - throw new EntityNotFoundException - ( - trans( - 'not_found_errors.LocationService.updateLocationImage.ImageNotFound', - [ - 'image_id' => $image, - 'location_id' => $location_id, - ] - ) - ); - } - - if (!is_null($file)) { - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException - ( - trans( - 'validation_errors.LocationService.updateLocationImage.FileNotAllowedExtension', - [ - 'allowed_extensions' => implode(", ", $allowed_extensions), - ] - ) - ); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.updateLocationImage.FileMaxSize', - [ - 'max_file_size' => (($max_file_size / 1024) / 1024) - ] - ) - ); - } - - $pic = $this->file_uploader->build($file, sprintf('summits/%s/locations/%s/images', $location->getSummitId(), $location->getId()), true); - $image->setPicture($pic); - } - - $image = SummitLocationImageFactory::populate($image, $metadata); - - if (isset($metadata['order']) && intval($metadata['order']) != $image->getOrder()) { - // request to update order - $location->recalculateImageOrder($image, intval($metadata['order'])); - } - - Event::fire - ( - new LocationImageUpdated - ( - $image->getId(), - $image->getLocationId(), - $image->getLocation()->getSummitId(), - $image->getClassName() - ) - ); - - return $image; - }); - } - - /** - * @param Summit $summit - * @param int $location_id - * @param int $image_id - * @return SummitAbstractLocation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteLocationImage(Summit $summit, $location_id, $image_id) - { - return $this->tx_service->transaction(function () use ($summit, $location_id, $image_id) { - - $location = $summit->getLocation($location_id); - - if (is_null($location)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationImage.LocationNotFound', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - if (!$location instanceof SummitGeoLocatedLocation) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationImage.LocationNotFound', - [ - 'summit_id' => $summit->getId(), - 'location_id' => $location_id, - ] - ) - ); - } - - $image = $location->getImage($image_id); - - if (is_null($image)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.deleteLocationImage.ImageNotFound', - [ - 'location_id' => $location_id, - 'image_id' => $image_id, - ] - ) - ); - } - - Event::fire - ( - new LocationImageDeleted - ( - $image->getId(), - $image->getLocationId(), - $image->getLocation()->getSummitId(), - $image->getClassName() - ) - ); - - $location->removeImage($image); - - }); - } - - /** - * @param Summit $summit - * @param int $room_id - * @param array $payload - * @return SummitRoomReservation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addBookableRoomReservation(Summit $summit, int $room_id, array $payload): SummitRoomReservation - { - return $this->tx_service->transaction(function () use ($summit, $room_id, $payload) { - - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeBookableRooms, - $this->default_payment_gateway_strategy - ); - - if(is_null($payment_gateway)) - throw new ValidationException(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - - $room = $this->location_repository->getByIdExclusiveLock($room_id); - - if (is_null($room)) { - throw new EntityNotFoundException("room not found"); - } - - if (!$room instanceof SummitBookableVenueRoom) { - throw new EntityNotFoundException("room not found"); - } - - $owner_id = $payload["owner_id"]; - - $owner = $this->member_repository->getById($owner_id); - - if (is_null($owner)) { - throw new EntityNotFoundException('member not found'); - } - - if ($owner->getReservationsCountBySummit($summit) >= $summit->getMeetingRoomBookingMaxAllowed()) - throw new ValidationException(sprintf("member %s already reached maximun quantity of reservations (%s)", $owner->getId(), $summit->getMeetingRoomBookingMaxAllowed())); - - $payload['owner'] = $owner; - - $currency = trim($payload['currency']); - - if ($room->getCurrency() != $currency) { - throw new ValidationException - ( - sprintf - ( - "currency set %s is not allowed for room %s", - $currency, - $room->getId() - ) - ); - } - - $amount = intval($payload['amount']); - - if ($room->getTimeSlotCost() != $amount) { - throw new ValidationException - ( - sprintf - ( - "amount set %s does not match with time slot cost %s for room %s", - $amount, - $room->getTimeSlotCost(), - $room->getId() - ) - ); - } - - $reservation = SummitRoomReservationFactory::build($summit, $payload); - - $room->addReservation($reservation); - - $result = $payment_gateway->generatePayment - ( - [ - "amount" => $reservation->getAmount(), - "currency" => $reservation->getCurrency(), - "receipt_email" => $reservation->getOwner()->getEmail(), - "metadata" => [ - "type" => IPaymentConstants::ApplicationTypeBookableRooms, - "room_id" => $room->getId(), - "summit_id" => $summit->getId(), - ] - ] - ); - - if (!isset($result['cart_id'])) - throw new ValidationException("payment gateway error"); - - if (!isset($result['client_token'])) - throw new ValidationException("payment gateway error"); - - $reservation->setPaymentGatewayCartId($result['cart_id']); - $reservation->setPaymentGatewayClientToken($result['client_token']); - Event::fire(new CreatedBookableRoomReservation($reservation->getId())); - return $reservation; - }); - } - - /** - * @param array $payload - * @param Summit|null $summit - * @throws \Exception - */ - public function processPayment(array $payload, ?Summit $summit = null): void - { - $this->tx_service->transaction(function () use ($summit, $payload) { - - Log::debug(sprintf("SummitLocationService::processPayment cart_id %s", $payload['cart_id'])); - - $reservation = $this->reservation_repository->getByPaymentGatewayCartIdExclusiveLock($payload['cart_id']); - - if (is_null($reservation)) { - throw new EntityNotFoundException(sprintf("There is no reservation with cart_id %s.", $payload['cart_id'])); - } - - if(!is_null($summit) && $reservation->getRoom()->getSummitId() != $summit->getId()){ - throw new EntityNotFoundException(sprintf("There is no reservation with cart_id %s.", $payload['cart_id'])); - } - - $summit = $reservation->getRoom()->getSummit(); - - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeBookableRooms, - $this->default_payment_gateway_strategy - ); - - if(is_null($payment_gateway)){ - throw new ValidationException(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - } - - if ($payment_gateway->isSuccessFullPayment($payload)) { - Log::debug("SummitLocationService::processPayment: payment is successful"); - $reservation->setPaid(); - return; - } - - $reservation->setPaymentError($payment_gateway->getPaymentError($payload)); - }); - } - - /** - * @param Summit $summit - * @param Member $owner - * @param int $reservation_id - * @return SummitRoomReservation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function cancelReservation(Summit $summit, Member $owner, int $reservation_id): SummitRoomReservation - { - return $this->tx_service->transaction(function () use ($summit, $owner, $reservation_id) { - - $reservation = $owner->getReservationById($reservation_id); - - if (is_null($reservation)) { - throw new EntityNotFoundException(); - } - - if ($reservation->getRoom()->getSummitId() != $summit->getId()) { - throw new EntityNotFoundException(); - } - - if ($reservation->getStatus() == SummitRoomReservation::ReservedStatus) - throw new ValidationException("can not request a refund on a reserved booking!"); - - if ($reservation->getStatus() == SummitRoomReservation::RequestedRefundStatus || - $reservation->getStatus() == SummitRoomReservation::RefundedStatus - ) - throw new ValidationException("can not request a refund on an already refunded booking!"); - - $reservation->requestRefund(); - - return $reservation; - }); - } - - /** - * @param SummitBookableVenueRoom $room - * @param int $reservation_id - * @param int $amount - * @return SummitRoomReservation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function refundReservation(SummitBookableVenueRoom $room, int $reservation_id, int $amount): SummitRoomReservation - { - return $this->tx_service->transaction(function () use ($room, $reservation_id, $amount) { - - $reservation = $room->getReservationById($reservation_id); - - if (is_null($reservation)) { - throw new EntityNotFoundException(); - } - $summit = $room->getSummit(); - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeBookableRooms, - $this->default_payment_gateway_strategy - ); - if(is_null($payment_gateway)) - throw new ValidationException(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - - $status = $reservation->getStatus(); - $validStatuses = [SummitRoomReservation::RequestedRefundStatus, SummitRoomReservation::PaidStatus]; - if (!in_array($status, $validStatuses)) - throw new ValidationException - ( - sprintf - ( - "can not request a refund on a %s booking!", - $status - ) - ); - - if ($amount <= 0) { - throw new ValidationException("can not refund an amount lower than zero!"); - } - - if ($amount > intval($reservation->getAmount())) { - throw new ValidationException("can not refund an amount greater than paid one!"); - } - - try { - $payment_gateway->refundPayment($reservation->getPaymentGatewayCartId(), $amount, $reservation->getCurrency()); - } catch (\Exception $ex) { - throw new ValidationException($ex->getMessage()); - } - - $reservation->refund($amount); - - return $reservation; - }); - } - - /** - * @param Summit $summit - * @param $venue_id - * @param array $data - * @return SummitBookableVenueRoom - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addVenueBookableRoom(Summit $summit, $venue_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $data) { - - if (isset($data['name'])) { - $old_location = $summit->getLocationByName(trim($data['name'])); - - if (!is_null($old_location)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addVenueRoom.LocationNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - ) - ); - } - } - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - $data['class_name'] = SummitBookableVenueRoom::ClassName; - $room = SummitLocationFactory::build($data); - - if (is_null($room)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.addVenueRoom.InvalidClassName' - ) - ); - } - - if (isset($data['floor_id'])) { - $floor_id = intval($data['floor_id']); - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.addVenueRoom.FloorNotFound', - [ - 'floor_id' => $floor_id, - 'venue_id' => $venue_id - ] - ) - ); - } - - $floor->addRoom($room); - } - - $summit->addLocation($room); - $venue->addRoom($room); - - return $room; - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @param array $data - * @return SummitBookableVenueRoom - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateVenueBookableRoom(Summit $summit, $venue_id, $room_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id, $data) { - - if (isset($data['name'])) { - $old_location = $summit->getLocationByName(trim($data['name'])); - - if (!is_null($old_location) && $old_location->getId() != $room_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.LocationService.updateVenueRoom.LocationNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - ) - ); - } - } - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.VenueNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - ] - ) - ); - } - - $room = $summit->getLocation($room_id); - if (is_null($room)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.RoomNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - 'room_id' => $room_id, - ] - ) - ); - } - - if (!$room instanceof SummitBookableVenueRoom) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.RoomNotFound', - [ - 'summit_id' => $summit->getId(), - 'venue_id' => $venue_id, - 'room_id' => $room_id, - ] - ) - ); - } - - SummitLocationFactory::populate($room, $data); - $floor = null; - - if (isset($data['floor_id'])) { - $old_floor_id = intval($room->getFloorId()); - $new_floor_id = intval($data['floor_id']); - if ($old_floor_id != $new_floor_id) { - $floor = $venue->getFloor($new_floor_id); - if (is_null($floor)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.LocationService.updateVenueRoom.FloorNotFound', - [ - 'floor_id' => $new_floor_id, - 'venue_id' => $venue_id - ] - ) - ); - } - if ($old_floor_id > 0) { - // remove from old floor - $room->getFloor()->removeRoom($room); - - } - $floor->addRoom($room); - } - } - - // request to update order - if (isset($data['order']) && intval($data['order']) != $room->getOrder()) { - - if (!is_null($floor)) { - $floor->recalculateRoomsOrder($room, intval($data['order'])); - } else { - $venue->recalculateRoomsOrder($room, intval($data['order'])); - } - } - - return $room; - }); - - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteVenueBookableRoom(Summit $summit, $venue_id, $room_id) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id) { - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - "venue not found" - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - "venue not found" - ); - } - - $room = $venue->getRoom($room_id); - - if (is_null($room)) { - throw new EntityNotFoundException("room not found"); - } - - $venue->removeRoom($room); - - if ($room->hasFloor()) { - $floor = $room->getFloor(); - $floor->removeRoom($room); - } - - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @param int $attribute_id - * @return SummitBookableVenueRoom - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addVenueBookableRoomAttribute(Summit $summit, int $venue_id, int $room_id, int $attribute_id): SummitBookableVenueRoom - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id, $attribute_id) { - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException("venue not found"); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException("venue not found"); - } - - $room = $venue->getRoom($room_id); - - if (is_null($room) || !$room instanceof SummitBookableVenueRoom) { - throw new EntityNotFoundException("room not found"); - } - - $attribute = $summit->getMeetingBookingRoomAllowedAttributeValueById($attribute_id); - - if (is_null($attribute)) { - throw new EntityNotFoundException("attribute not found"); - } - - $room->addAttribute($attribute); - - return $room; - - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @param int $attribute_id - * @return SummitBookableVenueRoom - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteVenueBookableRoomAttribute(Summit $summit, int $venue_id, int $room_id, int $attribute_id): SummitBookableVenueRoom - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id, $attribute_id) { - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ("venue not found"); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ("venue not found"); - } - - $room = $venue->getRoom($room_id); - - if (is_null($room) || !$room instanceof SummitBookableVenueRoom) { - throw new EntityNotFoundException - ("room not found"); - } - - $attribute = $summit->getMeetingBookingRoomAllowedAttributeValueById($attribute_id); - - if (is_null($attribute)) { - throw new EntityNotFoundException - ("attribute not found"); - } - - $room->removeAttribute($attribute); - - return $room; - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @param UploadedFile $file - * @param int $max_file_size - * @return mixed|File - * @throws \Exception - */ - public function addRoomImage(Summit $summit, int $venue_id, $room_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - - $room = $summit->getLocation($room_id); - if (is_null($room)) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - if (!$room instanceof SummitVenueRoom) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif','pdf')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $image = $this->file_uploader->build($file, sprintf('summits/%s/locations/%s/rooms', $summit->getId(), $venue_id), true); - $room->setImage($image); - - return $image; - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $room_id - * @throws EntityNotFoundException - * @throws ValidationException - * @return SummitVenueRoom - */ - public function removeRoomImage(Summit $summit, int $venue_id, int $room_id): SummitVenueRoom - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $room_id) { - - - $room = $summit->getLocation($room_id); - if (is_null($room)) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - if (!$room instanceof SummitVenueRoom) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - if (!$room->hasImage()) - throw new ValidationException("room has no image set"); - - $room->clearImage(); - - return $room; - }); - } - - /** - * @param int $minutes - */ - public function revokeBookableRoomsReservedOlderThanNMinutes(int $minutes): void - { - // this is done in this way to avoid db lock contentions - $reservations = $this->tx_service->transaction(function () use ($minutes) { - return $this->reservation_repository->getAllReservedOlderThanXMinutes($minutes); - }); - - foreach ($reservations as $reservation) { - - $this->tx_service->transaction(function () use ($reservation) { - - try { - $reservation = $this->reservation_repository->getByIdExclusiveLock($reservation->getId()); - if (!$reservation instanceof SummitRoomReservation) return; - - $summit = $reservation->getRoom()->getSummit(); - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeBookableRooms, - $this->default_payment_gateway_strategy - ); - - if(is_null($payment_gateway)){ - Log::warning(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - return; - } - - Log::debug(sprintf("[SummitLocationService::revokeBookableRoomsReservedOlderThanNMinutes] cancelling reservation %s created at %s", $reservation->getId(), $reservation->getCreated()->format("Y-m-d h:i:sa"))); - $status = $payment_gateway->getCartStatus($reservation->getPaymentGatewayCartId()); - if(!is_null($status)) { - Log::debug(sprintf("[SummitLocationService::revokeBookableRoomsReservedOlderThanNMinutes] got status %s for reservation %s", $status, $reservation->getId())); - if (!$payment_gateway->canAbandon($status)) { - Log::warning(sprintf("[SummitLocationService::revokeBookableRoomsReservedOlderThanNMinutes] reservation %s created at %s can not be cancelled external status %s", $reservation->getId(), $reservation->getCreated()->format("Y-m-d h:i:sa"), $status)); - if ($payment_gateway->isSucceeded($status)) { - Log::debug(sprintf("[SummitLocationService::revokeBookableRoomsReservedOlderThanNMinutes] set reservation %s as paid", $status, $reservation->getId())); - $reservation->setPaid(); - } - return; - } - - $payment_gateway->abandonCart($reservation->getPaymentGatewayCartId()); - } - - $reservation->cancel(); - - Log::debug(sprintf("[SummitLocationService::revokeBookableRoomsReservedOlderThanNMinutes] reservation %s created at %s canceled", $reservation->getId(), $reservation->getCreated()->format("Y-m-d h:i:sa"))); - } catch (\Exception $ex) { - Log::warning($ex); - } - - }); - } - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $floor_id - * @param UploadedFile $file - * @param int $max_file_size - * @return mixed|File - * @throws \Exception - */ - public function addFloorImage(Summit $summit, int $venue_id, int $floor_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $floor_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) - throw new EntityNotFoundException - ( - 'floor not found' - ); - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif','pdf')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $image = $this->file_uploader->build($file, sprintf('summits/%s/locations/%s/floors', $summit->getId(), $venue_id), true); - $floor->setImage($image); - - return $image; - }); - } - - /** - * @param Summit $summit - * @param int $venue_id - * @param int $floor_id - * @throws EntityNotFoundException - * @throws ValidationException - * @return SummitVenueFloor - */ - public function removeFloorImage(Summit $summit, int $venue_id, int $floor_id): SummitVenueFloor - { - return $this->tx_service->transaction(function () use ($summit, $venue_id, $floor_id) { - - $venue = $summit->getLocation($venue_id); - - if (is_null($venue)) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - if (!$venue instanceof SummitVenue) { - throw new EntityNotFoundException - ( - 'room not found' - ); - } - - $floor = $venue->getFloor($floor_id); - - if (is_null($floor)) - throw new EntityNotFoundException - ( - 'floor not found' - ); - - if (!$floor->hasImage()) - throw new ValidationException("floor has no image set"); - - $floor->clearImage(); - - return $floor; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitMediaFileTypeService.php b/app/Services/Model/Imp/SummitMediaFileTypeService.php deleted file mode 100644 index 772471af..00000000 --- a/app/Services/Model/Imp/SummitMediaFileTypeService.php +++ /dev/null @@ -1,99 +0,0 @@ -repository = $repository; - } - - /** - * @inheritDoc - */ - public function add(array $payload): SummitMediaFileType - { - return $this->tx_service->transaction(function() use($payload){ - $type = $this->repository->getByName(trim($payload['name'])); - if(!is_null($type)) - throw new ValidationException(sprintf("Name %s already exists.", $payload['name'])); - $type = SummitMediaFileTypeFactory::build($payload); - $this->repository->add($type); - return $type; - }); - } - - /** - * @inheritDoc - */ - public function update(int $id, array $payload): SummitMediaFileType - { - return $this->tx_service->transaction(function() use($id, $payload){ - $type = $this->repository->getById($id); - if(is_null($type)) - throw new EntityNotFoundException(); - if($type->IsSystemDefined()) - throw new ValidationException("You can not modify a system defined type."); - - if(isset($payload['name'])){ - $type = $this->repository->getByName(trim($payload['name'])); - if(!is_null($type) && $type->getId() != $id) - throw new ValidationException(sprintf("Name %s already exists.", $payload['name'])); - } - - return SummitMediaFileTypeFactory::populate($type, $payload); - }); - } - - /** - * @inheritDoc - */ - public function delete(int $id): void - { - $this->tx_service->transaction(function() use($id){ - $type = $this->repository->getById($id); - if(is_null($type)) - throw new EntityNotFoundException(); - if($type->IsSystemDefined()) - throw new ValidationException("You can not delete a system defined type."); - - $this->repository->delete($type); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitMediaUploadTypeService.php b/app/Services/Model/Imp/SummitMediaUploadTypeService.php deleted file mode 100644 index 2bd597b3..00000000 --- a/app/Services/Model/Imp/SummitMediaUploadTypeService.php +++ /dev/null @@ -1,248 +0,0 @@ -media_file_type_repository = $media_file_type_repository; - } - - /** - * @inheritDoc - */ - public function add(Summit $summit, array $data): SummitMediaUploadType - { - return $this->tx_service->transaction(function() use($summit, $data){ - - // name should be unique per summit - if(isset($data['name'])) { - $media_upload = $summit->getMediaUploadTypeByName($data['name']); - if(!is_null($media_upload)){ - throw new ValidationException(sprintf("Media upload name %s already exists at summit %s", $data['name'], $summit->getId())); - } - } - - $type = $this->media_file_type_repository->find(intval($data['type_id'])); - if(is_null($type)) - throw new EntityNotFoundException("Media File Type not found."); - - $media_upload = SummitMediaUploadTypeFactory::build($data); - - if(!$media_upload->hasStorageSet()){ - throw new ValidationException("You must set a Public or Private Storage Type."); - } - - $media_upload->setType($type); - - $summit->addMediaUploadType($media_upload); - - if(isset($data['presentation_types'])){ - foreach($data['presentation_types'] as $event_type_id){ - $presentation_type = $summit->getEventType(intval($event_type_id)); - if(is_null($presentation_type) || !$presentation_type instanceof PresentationType) - throw new EntityNotFoundException(sprintf("Presentation Type %s not found", $event_type_id)); - $media_upload->addPresentationType($presentation_type); - } - } - - return $media_upload; - }); - } - - /** - * @inheritDoc - */ - public function update(Summit $summit, int $media_upload_type_id, array $data): SummitMediaUploadType - { - return $this->tx_service->transaction(function() use($summit, $media_upload_type_id, $data){ - - // name should be unique per summit - if(isset($data['name'])) { - $media_upload = $summit->getMediaUploadTypeByName($data['name']); - if(!is_null($media_upload) && $media_upload->getId() != $media_upload_type_id){ - throw new ValidationException(sprintf("Media upload name %s already exists at summit %s", $data['name'], $summit->getId())); - } - } - - $media_upload = $summit->getMediaUploadTypeById($media_upload_type_id); - if(is_null($media_upload)) - throw new EntityNotFoundException(sprintf("Media upload %s not found at summit %s", $media_upload_type_id, $summit->getId())); - - $media_upload = SummitMediaUploadTypeFactory::populate($media_upload, $data); - - if(!$media_upload->hasStorageSet()){ - throw new ValidationException("You must set a Public or Private Storage Type."); - } - - if(isset($data['type_id'])) { - $type = $this->media_file_type_repository->find(intval($data['type_id'])); - if (is_null($type)) - throw new EntityNotFoundException("Media File Type not found."); - $media_upload->setType($type); - } - - if(isset($data['presentation_types'])){ - $media_upload->clearPresentationTypes(); - foreach($data['presentation_types'] as $event_type_id){ - $presentation_type = $summit->getEventType(intval($event_type_id)); - if(is_null($presentation_type) || !$presentation_type instanceof PresentationType) - throw new EntityNotFoundException(sprintf("Presentation Type %s not found", $event_type_id)); - $media_upload->addPresentationType($presentation_type); - } - } - - return $media_upload; - }); - } - - /** - * @inheritDoc - */ - public function delete(Summit $summit, int $media_upload_type_id): void - { - $this->tx_service->transaction(function() use($summit, $media_upload_type_id){ - $media_upload = $summit->getMediaUploadTypeById($media_upload_type_id); - if(is_null($media_upload)) - throw new EntityNotFoundException(sprintf("Media upload %s not found at summit %s", $media_upload_type_id, $summit->getId())); - - $summit->removeMediaUploadType($media_upload); - }); - } - - /** - * @inheritDoc - */ - public function addToPresentationType(Summit $summit, int $media_upload_type_id, int $presentation_type_id): SummitMediaUploadType - { - return $this->tx_service->transaction(function() use($summit, $media_upload_type_id, $presentation_type_id){ - $media_upload = $summit->getMediaUploadTypeById($media_upload_type_id); - if(is_null($media_upload)) - throw new EntityNotFoundException(sprintf("Media upload %s not found at summit %s", $media_upload_type_id, $summit->getId())); - - $presentation_type = $summit->getEventType(intval($presentation_type_id)); - if(is_null($presentation_type) || !$presentation_type instanceof PresentationType) - throw new EntityNotFoundException(sprintf("Presentation Type %s not found", $presentation_type_id)); - - $media_upload->addPresentationType($presentation_type); - - return $media_upload; - }); - } - - /** - * @inheritDoc - */ - public function deleteFromPresentationType(Summit $summit, int $media_upload_type_id, int $presentation_type_id): SummitMediaUploadType - { - return $this->tx_service->transaction(function() use($summit, $media_upload_type_id, $presentation_type_id){ - $media_upload = $summit->getMediaUploadTypeById($media_upload_type_id); - if(is_null($media_upload)) - throw new EntityNotFoundException(sprintf("Media upload %s not found at summit %s", $media_upload_type_id, $summit->getId())); - - $presentation_type = $summit->getEventType(intval($presentation_type_id)); - if(is_null($presentation_type) || !$presentation_type instanceof PresentationType) - throw new EntityNotFoundException(sprintf("Presentation Type %s not found", $presentation_type_id)); - - $media_upload->removePresentationType($presentation_type); - - return $media_upload; - }); - } - - /** - * @param Summit $fromSummit - * @param Summit $toSummit - * @return Summit - * @throws \Exception - */ - public function cloneMediaUploadTypes(Summit $fromSummit, Summit $toSummit): Summit - { - return $this->tx_service->transaction(function() use($fromSummit, $toSummit){ - - foreach($fromSummit->getMediaUploadTypes() as $mediaUploadType){ - if($toSummit->getMediaUploadTypeByName($mediaUploadType->getName())) continue; - - $newMediaUploadType = new SummitMediaUploadType(); - $newMediaUploadType->setName($mediaUploadType->getName()); - $newMediaUploadType->setDescription($mediaUploadType->getDescription()); - $newMediaUploadType->setType($mediaUploadType->getType()); - $newMediaUploadType->setMaxSize($mediaUploadType->getMaxSize()); - $newMediaUploadType->setPublicStorageType($mediaUploadType->getPublicStorageType()); - $newMediaUploadType->setPrivateStorageType($mediaUploadType->getPrivateStorageType()); - - foreach ($mediaUploadType->getPresentationTypes() as $presentationType){ - $newPresentationType = $toSummit->getEventTypeByType($presentationType->getType()); - if(is_null($newPresentationType)){ - $newPresentationType = new PresentationType(); - $newPresentationType->setType($presentationType->getType()); - $newPresentationType->setColor($presentationType->getColor()); - $newPresentationType->setIsPrivate($presentationType->isPrivate()); - $newPresentationType->setAllowsAttachment($presentationType->isAllowsAttachment()); - $newPresentationType->setAreSpeakersMandatory($presentationType->isAreSpeakersMandatory()); - $newPresentationType->setUseSpeakers($presentationType->isUseSpeakers()); - $newPresentationType->setAreSponsorsMandatory($presentationType->isAreSponsorsMandatory()); - $newPresentationType->setUseSponsors($presentationType->isUseSponsors()); - $newPresentationType->setBlackoutTimes($presentationType->isBlackoutTimes()); - $newPresentationType->setShouldBeAvailableOnCfp($presentationType->isShouldBeAvailableOnCfp()); - $newPresentationType->setIsModeratorMandatory($presentationType->isModeratorMandatory()); - $newPresentationType->setUseModerator($presentationType->isUseModerator()); - $newPresentationType->setMaxModerators($presentationType->getMaxModerators()); - $newPresentationType->setMaxSpeakers($presentationType->getMaxSpeakers()); - $newPresentationType->setMinModerators($presentationType->getMinModerators()); - $newPresentationType->setMinSpeakers($presentationType->getMinSpeakers()); - $newPresentationType->setModeratorLabel($presentationType->getModeratorLabel()); - $toSummit->addEventType($newPresentationType); - } - $newMediaUploadType->addPresentationType($newPresentationType); - } - - $toSummit->addMediaUploadType($newMediaUploadType); - } - - return $toSummit; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitMetricService.php b/app/Services/Model/Imp/SummitMetricService.php deleted file mode 100644 index c3b3edff..00000000 --- a/app/Services/Model/Imp/SummitMetricService.php +++ /dev/null @@ -1,163 +0,0 @@ -repository = $repository; - $this->event_repository = $event_repository; - } - - /** - * @param Summit $summit - * @param Member $current_member - * @param array $payload - * @return SummitMetric - * @throws \Exception - */ - public function enter(Summit $summit, Member $current_member, array $payload): SummitMetric - { - Log::debug(sprintf("SummitMetricService::enter summit %s member %s payload %s", $summit->getId(), $current_member->getId(), json_encode($payload))); - $metric = $this->tx_service->transaction(function () use ($summit, $current_member, $payload) { - $metric = SummitMetricFactory::build($current_member, $payload); - $metric->setMember($current_member); - - $source_id = null; - if(isset($payload['source_id'])) - $source_id = intval($payload['source_id']); - - $formerMetric = $this->repository->getNonAbandoned($current_member, $metric->getType(), $source_id); - - if(!is_null($formerMetric)){ - // mark as leave - Log::debug(sprintf("SummitMetricService::enter there is a former metric (%s)", $formerMetric->getId())); - $formerMetric->abandon(); - } - - Log::debug(sprintf("SummitMetricService::enter continuing")); - if($metric instanceof SummitEventAttendanceMetric){ - Log::debug(sprintf("SummitMetricService::enter SummitEventAttendanceMetric")); - if(!isset($payload['source_id'])){ - throw new ValidationException("source_id param is missing."); - } - $event_id = intval($payload['source_id']); - $event = $this->event_repository->getById($event_id); - - if (is_null($event) || !$event instanceof SummitEvent) { - throw new EntityNotFoundException(sprintf("Event %s does not belongs to summit %s.", $event_id, $summit->getId())); - } - - if (!$event->isPublished()) { - throw new ValidationException(sprintf("Event %s is not published.", $event->getId())); - } - - $metric->setEvent($event); - } - - if($metric instanceof SummitSponsorMetric){ - Log::debug(sprintf("SummitMetricService::enter SummitSponsorMetric")); - if(!isset($payload['source_id'])){ - throw new ValidationException("source_id param is missing."); - } - $sponsor_id = intval($payload['source_id']); - - $sponsor = $summit->getSummitSponsorById($sponsor_id); - - if (is_null($sponsor)) { - throw new EntityNotFoundException(sprintf("Sponsor %s does not belongs to summit %s.", $sponsor_id, $summit->getId())); - } - $metric->setSponsor($sponsor); - } - - Log::debug(sprintf("SummitMetricService::enter adding")); - $metric->setSummit($summit); - $this->repository->add($metric); - return $metric; - }); - - Log::debug(sprintf("SummitMetricService::enter summit %s member %s payload %s created metric %s", $summit->getId(), $current_member->getId(), json_encode($payload), $metric->getId())); - - return $metric; - } - - /** - * @param Summit $summit - * @param Member $current_member - * @param array $payload - * @return SummitMetric - * @throws \Exception - */ - public function leave(Summit $summit, Member $current_member, array $payload): SummitMetric - { - Log::debug(sprintf("SummitMetricService::leave summit %s member %s payload %s", $summit->getId(), $current_member->getId(), json_encode($payload))); - - return $this->tx_service->transaction(function () use ($summit, $current_member, $payload) { - - $source_id = null; - if(isset($payload['source_id'])) - $source_id = intval($payload['source_id']); - $formerMetric = $this->repository->getNonAbandoned($current_member, trim($payload['type']), $source_id); - if(!$formerMetric) - throw new ValidationException(sprintf("User %s has not a pending %s metric", $current_member->getId(), $payload['type'])); - - $formerMetric->abandon(); - - return $formerMetric; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitOrderExtraQuestionTypeService.php b/app/Services/Model/Imp/SummitOrderExtraQuestionTypeService.php deleted file mode 100644 index d70f6b97..00000000 --- a/app/Services/Model/Imp/SummitOrderExtraQuestionTypeService.php +++ /dev/null @@ -1,197 +0,0 @@ -repository = $repository; - } - - /** - * @param Summit $summit - * @param array $payload - * @return SummitOrderExtraQuestionType - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function addOrderExtraQuestion(Summit $summit, array $payload): SummitOrderExtraQuestionType - { - return $this->tx_service->transaction(function () use ($summit, $payload) { - $name = trim($payload['name']); - $former_question = $summit->getOrderExtraQuestionByName($name); - if (!is_null($former_question)) - throw new ValidationException("Question Name already exists for Summit."); - - $label = trim($payload['label']); - $former_question = $summit->getOrderExtraQuestionByLabel($label); - if (!is_null($former_question)) - throw new ValidationException("Question Label already exists for Summit."); - - $question = SummitOrderExtraQuestionTypeFactory::build($payload); - - $summit->addOrderExtraQuestion($question); - - return $question; - }); - } - - /** - * @param Summit $summit - * @param int $question_id - * @param array $payload - * @return SummitOrderExtraQuestionType - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateOrderExtraQuestion(Summit $summit, int $question_id, array $payload): SummitOrderExtraQuestionType - { - return $this->tx_service->transaction(function () use ($summit, $question_id, $payload) { - - $question = $summit->getOrderExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not Found."); - - if (isset($payload['name'])) { - $name = trim($payload['name']); - $former_question = $summit->getOrderExtraQuestionByName($name); - if (!is_null($former_question) && $former_question->getId() != $question_id) - throw new ValidationException("Question Name already exists for Summit."); - } - - if (isset($payload['label'])) { - $label = trim($payload['label']); - $former_question = $summit->getOrderExtraQuestionByLabel($label); - if (!is_null($former_question) && $former_question->getId() != $question_id) - throw new ValidationException("Question Label already exists for Summit."); - } - - if (isset($payload['order']) && intval($payload['order']) != $question->getOrder()) { - // request to update order - $summit->recalculateQuestionOrder($question, intval($payload['order'])); - } - - return SummitOrderExtraQuestionTypeFactory::populate($question, $payload); - }); - } - - /** - * @param Summit $summit - * @param int $question_id - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteOrderExtraQuestion(Summit $summit, int $question_id): void - { - $this->tx_service->transaction(function () use ($summit, $question_id) { - - $question = $summit->getOrderExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - // check if question has answers - - if ($this->repository->hasAnswers($question)) { - //throw new ValidationException(sprintf("you can not delete question %s bc already has answers from attendees", $question_id)); - $this->repository->deleteAnswersFrom($question); - } - - $summit->removeOrderExtraQuestion($question); - }); - } - - /** - * @param Summit $summit - * @param int $question_id - * @param array $payload - * @return ExtraQuestionTypeValue - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function addOrderExtraQuestionValue(Summit $summit, int $question_id, array $payload): ExtraQuestionTypeValue - { - return $this->tx_service->transaction(function () use ($summit, $question_id, $payload) { - - $question = $summit->getOrderExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - return parent::_addOrderExtraQuestionValue($question, $payload); - }); - } - - /** - * @param Summit $summit - * @param int $question_id - * @param int $value_id - * @param array $payload - * @return ExtraQuestionTypeValue - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateOrderExtraQuestionValue(Summit $summit, int $question_id, int $value_id, array $payload): ExtraQuestionTypeValue - { - return $this->tx_service->transaction(function () use ($summit, $question_id, $value_id, $payload) { - $question = $summit->getOrderExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - return parent::_updateOrderExtraQuestionValue($question, $value_id, $payload); - }); - } - - /** - * @param Summit $summit - * @param int $question_id - * @param int $value_id - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteOrderExtraQuestionValue(Summit $summit, int $question_id, int $value_id): void - { - $this->tx_service->transaction(function () use ($summit, $question_id, $value_id) { - $question = $summit->getOrderExtraQuestionById($question_id); - if (is_null($question)) - throw new EntityNotFoundException("Question not found."); - - parent::_deleteOrderExtraQuestionValue($question, $value_id); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitOrderService.php b/app/Services/Model/Imp/SummitOrderService.php deleted file mode 100644 index 7e4eacdc..00000000 --- a/app/Services/Model/Imp/SummitOrderService.php +++ /dev/null @@ -1,3467 +0,0 @@ -tasks[] = $task; - return $this; - } - - private function markAsRan(AbstractTask $task) - { - $this->already_run_tasks[] = $task; - } - - - private function abort() - { - foreach (array_reverse($this->already_run_tasks) as $task) { - $task->undo(); - } - } - - /** - * @throws \Exception - */ - public function run(): array - { - try { - $formerState = []; - foreach ($this->tasks as $task) { - $formerState = $task->run($formerState); - $this->markAsRan($task); - } - return $formerState; - } catch (\Exception $ex) { - Log::warning($ex); - $this->abort(); - throw $ex; - } - } -} - -/** - * Class ReserveOrderTask - * @package App\Services\Model - */ -final class ReserveOrderTask extends AbstractTask -{ - - /** - * @var ITransactionService - */ - private $tx_service; - - /** - * @var Summit - */ - private $summit; - - /** - * @var array - */ - private $formerState; - - /** - * @var array - */ - private $payload; - - /** - * @var IMemberRepository - */ - private $member_repository; - - /** - * @var ISummitAttendeeRepository - */ - private $attendee_repository; - - /** - * @var ISummitAttendeeTicketRepository - */ - private $ticket_repository; - - /** - * @var Member - */ - private $owner; - - /** - * @var IBuildDefaultPaymentGatewayProfileStrategy - */ - private $default_payment_gateway_strategy; - - /** - * ReserveOrderTask constructor. - * @param Member|null $owner - * @param Summit $summit - * @param array $payload - * @param IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy - * @param IMemberRepository $member_repository - * @param ISummitAttendeeRepository $attendee_repository - * @param ISummitAttendeeTicketRepository $ticket_repository - * @param ITransactionService $tx_service - */ - public function __construct - ( - ?Member $owner, - Summit $summit, - array $payload, - IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy, - IMemberRepository $member_repository, - ISummitAttendeeRepository $attendee_repository, - ISummitAttendeeTicketRepository $ticket_repository, - ITransactionService $tx_service) - { - - $this->tx_service = $tx_service; - $this->summit = $summit; - $this->payload = $payload; - $this->member_repository = $member_repository; - $this->attendee_repository = $attendee_repository; - $this->ticket_repository = $ticket_repository; - $this->default_payment_gateway_strategy = $default_payment_gateway_strategy; - $this->owner = $owner; - } - - public function run(array $formerState): array - { - $this->formerState = $formerState; - - return $this->tx_service->transaction(function () { - - $owner_email = $this->payload['owner_email']; - $owner_first_name = $this->payload['owner_first_name']; - $owner_last_name = $this->payload['owner_last_name']; - $owner_company = $this->payload['owner_company'] ?? null; - $tickets = $this->payload['tickets']; - - if (!is_null($this->owner) && strtolower($this->owner->getEmail()) != strtolower($owner_email)) { - throw new ValidationException(sprintf("owner email differs from logged user email")); - } - - $payment_gateway = $this->summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $this->default_payment_gateway_strategy - ); - if (is_null($payment_gateway)) { - throw new ValidationException(sprintf("Payment configuration is not set for summit %s", $this->summit->getId())); - } - - Log::info(sprintf("ReserveOrderTask::run - email %s first_name %s last_name %s company %s", $owner_email, $owner_first_name, $owner_last_name, $owner_company)); - $order = SummitOrderFactory::build($this->summit, $this->payload); - - $order->generateNumber(); - - do { - if (!$this->summit->existOrderNumber($order->getNumber())) - break; - $order->generateNumber(); - } while (1); - - $default_badge_type = $this->summit->getDefaultBadgeType(); - // local tx attendees storage - $local_attendees = []; - // tickets - foreach ($tickets as $ticket_dto) { - - if (!isset($ticket_dto['type_id'])) - throw new ValidationException('type_id is mandatory'); - - $type_id = $ticket_dto['type_id']; - $promo_code_value = isset($ticket_dto['promo_code']) ? $ticket_dto['promo_code'] : null; - $attendee_first_name = isset($ticket_dto['attendee_first_name']) ? $ticket_dto['attendee_first_name'] : null; - $attendee_last_name = isset($ticket_dto['attendee_last_name']) ? $ticket_dto['attendee_last_name'] : null; - $attendee_email = isset($ticket_dto['attendee_email']) ? $ticket_dto['attendee_email'] : null; - $attendee_company = isset($ticket_dto['attendee_company']) ? $ticket_dto['attendee_company'] : null; - - // if attendee is order owner , and company is null , set the company order - if (!empty($attendee_email) && $attendee_email == $owner_email) { - if (empty($attendee_company)) - $attendee_company = $owner_company; - if (empty($attendee_first_name)) - $attendee_first_name = $owner_first_name; - if (empty($attendee_last_name)) - $attendee_last_name = $owner_last_name; - } - - $ticket_type = $this->summit->getTicketTypeById($type_id); - if (is_null($ticket_type)) { - throw new EntityNotFoundException('ticket type not found'); - } - - $ticket = new SummitAttendeeTicket(); - $ticket->setOrder($order); - $ticket->generateNumber(); - - do { - - if (!$this->ticket_repository->existNumber($ticket->getNumber())) - break; - $ticket->generateNumber(); - } while (1); - - $ticket->setTicketType($ticket_type); - - if (!$ticket->hasBadge()) { - $ticket->setBadge(SummitBadgeType::buildBadgeFromType($default_badge_type)); - } - - $promo_code = !empty($promo_code_value) ? $this->summit->getPromoCodeByCode($promo_code_value) : null; - if (!is_null($promo_code)) { - $promo_code->applyTo($ticket); - } - - $ticket->applyTaxes($this->summit->getTaxTypes()->toArray()); - - if (!empty($attendee_email)) { - - $attendee_email = strtolower(trim($attendee_email)); - Log::debug(sprintf("ReserveOrderTask::run - attendee_email %s", $attendee_email)); - // assign attendee - // check if we have already an attendee on this summit - $attendee = $this->attendee_repository->getBySummitAndEmail($this->summit, $attendee_email); - // check on local reservation - - if (is_null($attendee) && isset($local_attendees[$attendee_email])) { - Log::debug(sprintf("ReserveOrderTask::run - attendee_email %s not fund in repo getting it from local tx", $attendee_email)); - $attendee = $local_attendees[$attendee_email]; - } - - if (is_null($attendee)) { - Log::debug(sprintf("ReserveOrderTask::run - creating attendee %s for summit %s", $attendee_email, $this->summit->getId())); - $attendee = SummitAttendeeFactory::build($this->summit, [ - 'first_name' => $attendee_first_name, - 'last_name' => $attendee_last_name, - 'email' => $attendee_email, - 'company' => $attendee_company - ], $this->member_repository->getByEmail($attendee_email)); - } - - $attendee = SummitAttendeeFactory::populate - ( - $this->summit, - $attendee, - [ - 'first_name' => $attendee_first_name, - 'last_name' => $attendee_last_name, - 'email' => $attendee_email, - 'company' => $attendee_company - ], - $this->member_repository->getByEmail($attendee_email) - ); - $attendee->updateStatus(); - $local_attendees[$attendee_email] = $attendee; - $ticket->setOwner($attendee); - } - - $order->addTicket($ticket); - $ticket->generateQRCode(); - $ticket->generateHash(); - } - - if (is_null($this->owner)) { - Log::debug(sprintf("ReserveOrderTask::run is null trying to get owner by email %s", $owner_email)); - $this->owner = $this->member_repository->getByEmail($owner_email); - } - - if (!is_null($this->owner)) { - Log::debug(sprintf("ReserveOrderTask::run owner is set to owner id %s", $this->owner->getId())); - $this->owner->addSummitRegistrationOrder($order); - } - - $this->summit->addOrder($order); - // generate payment if cost > 0 - if ($order->getFinalAmount() > 0) { - $result = $payment_gateway->generatePayment( - [ - "amount" => $order->getFinalAmount(), - "currency" => $order->getCurrency(), - "receipt_email" => $order->getOwnerEmail(), - "metadata" => [ - "type" => IPaymentConstants::ApplicationTypeRegistration, - "summit_id" => $this->summit->getId(), - ] - ] - ); - - if (!isset($result['cart_id'])) - throw new ValidationException("payment gateway error"); - - if (!isset($result['client_token'])) - throw new ValidationException("payment gateway error"); - - $order->setPaymentGatewayCartId($result['cart_id']); - $order->setPaymentGatewayClientToken($result['client_token']); - } - - // generate the key to access - $order->generateHash(); - $order->generateQRCode(); - Event::fire(new CreatedSummitRegistrationOrder($order->getId())); - return ['order' => $order]; - }); - } - - public function undo() - { - // TODO: Implement undo() method. - } -} - -/** - * Class ApplyPromoCodeTask - * @package App\Services\Model - */ -final class ApplyPromoCodeTask extends AbstractTask -{ - - /** - * @var ITransactionService - */ - private $tx_service; - - /** - * @var Summit - */ - private $summit; - - /** - * @var array - */ - private $formerState; - - /** - * @var array - */ - private $payload; - - /** - * @var ISummitRegistrationPromoCodeRepository - */ - private $promo_code_repository; - - /** - * ApplyPromoCodeTask constructor. - * @param Summit $summit - * @param array $payload - * @param ISummitRegistrationPromoCodeRepository $promo_code_repository - * @param ITransactionService $tx_service - */ - public function __construct - ( - Summit $summit, - array $payload, - ISummitRegistrationPromoCodeRepository $promo_code_repository, - ITransactionService $tx_service - ) - { - $this->tx_service = $tx_service; - $this->summit = $summit; - $this->payload = $payload; - $this->promo_code_repository = $promo_code_repository; - } - - /** - * @param array $formerState - * @return array - * @throws \Exception - */ - public function run(array $formerState): array - { - $this->formerState = $formerState; - $promo_codes_usage = $this->formerState['promo_codes_usage']; - $owner_email = $this->payload['owner_email']; - $owner_company = $this->payload['owner_company'] ?? null; - - foreach ($promo_codes_usage as $promo_code_value => $info) { - - $this->tx_service->transaction(function () use ($owner_email, $owner_company, $promo_code_value, $info) { - - $promo_code = $this->promo_code_repository->getByValueExclusiveLock($this->summit, $promo_code_value); - - if (is_null($promo_code) || !$promo_code instanceof SummitRegistrationPromoCode) { - throw new EntityNotFoundException(sprintf('The Promo Code “%s” is not a valid code.', $promo_code_value)); - } - - if ($promo_code->getSummitId() != $this->summit->getId()) { - throw new EntityNotFoundException(sprintf("promo code %s not found on summit %s", $promo_code->getCode(), $this->summit->getId())); - } - - $qty = $info['qty']; - - $promo_code->checkSubject($owner_email, $owner_company); - - if (!$promo_code->canUse()) { - throw new ValidationException(sprintf('The Promo Code “%s” is not a valid code.', $promo_code->getCode())); - } - - foreach ($info['types'] as $ticket_type_id) { - $ticket_type = $this->summit->getTicketTypeById($ticket_type_id); - if (is_null($ticket_type)) { - throw new ValidationException(sprintf("ticket type %s not found on summit %s", $ticket_type_id, $this->summit->getId())); - } - if (!$promo_code->canBeAppliedTo($ticket_type)) { - throw new ValidationException(sprintf("promo code %s can not be applied to ticket type %s", $promo_code->getCode(), $ticket_type->getName())); - } - } - Log::debug(sprintf("adding %s usage to promo code %s", $qty, $promo_code->getId())); - $promo_code->addUsage($qty); - }); - // mark a done - $promo_codes_usage[$promo_code_value]['redeem'] = true; - } - - return $this->formerState; - } - - public function undo() - { - Log::info("ApplyPromoCodeTask::undo: compensating transaction"); - $promo_codes_usage = $this->formerState['promo_codes_usage']; - foreach ($promo_codes_usage as $code => $info) { - $this->tx_service->transaction(function () use ($code, $info) { - $promo_code = $this->promo_code_repository->getByValueExclusiveLock($this->summit, $code); - if (is_null($promo_code)) return; - if (!isset($info['redeem'])) return; - $promo_code->removeUsage($info['qty']); - }); - } - } -} - -/** - * Class ReserveTicketsTask - * @package App\Services\Model - */ -final class ReserveTicketsTask extends AbstractTask -{ - - /** - * @var ITransactionService - */ - private $tx_service; - - /** - * @var Summit - */ - private $summit; - - /** - * @var array - */ - private $formerState; - - /** - * @var ISummitTicketTypeRepository - */ - private $ticket_type_repository; - - /** - * ReserveTicketsTask constructor. - * @param Summit $summit - * @param ISummitTicketTypeRepository $ticket_type_repository - * @param ITransactionService $tx_service - */ - public function __construct(Summit $summit, ISummitTicketTypeRepository $ticket_type_repository, ITransactionService $tx_service) - { - $this->tx_service = $tx_service; - $this->summit = $summit; - $this->ticket_type_repository = $ticket_type_repository; - } - - public function run(array $formerState): array - { - $this->formerState = $formerState; - // reserve all tix on a tx ( all or nothing) - $this->tx_service->transaction(function () { - $ticket_types_ids = $this->formerState['ticket_types_ids']; - $reservations = $this->formerState['reservations']; - $ticket_types = $this->ticket_type_repository->getByIdsExclusiveLock($this->summit, $ticket_types_ids); - $former_currency = null; - - foreach ($ticket_types as $ticket_type) { - - if (!empty($former_currency) && $ticket_type->getCurrency() != $former_currency) { - throw new ValidationException("order should have tickets with same currency"); - } - - $former_currency = $ticket_type->getCurrency(); - if (!$ticket_type instanceof SummitTicketType) { - throw new EntityNotFoundException("ticket type not found"); - } - if (!$ticket_type->canSell()) { - throw new ValidationException(sprintf('The ticket “%s” is not available. Please go back and select a different ticket.', $ticket_type->getName())); - } - $ticket_type->sell($reservations[$ticket_type->getId()]); - } - }); - return $formerState; - } - - public function undo() - { - Log::info("ReserveTicketsTask::undo: compensating transaction"); - $reservations = $this->formerState['reservations']; - foreach ($reservations as $ticket_id => $qty) { - $this->tx_service->transaction(function () use ($ticket_id, $qty) { - $ticket_type = $this->ticket_type_repository->getByIdExclusiveLock($ticket_id); - if (is_null($ticket_type)) return; - $ticket_type->restore($qty); - }); - } - } -} - -/** - * Class PreProcessReservationTask - * @package App\Services\Model - */ -final class PreProcessReservationTask extends AbstractTask -{ - - /** - * @var array - */ - private $payload; - - /** - * PreProcessReservationTask constructor. - * @param array $payload - */ - public function __construct(array $payload) - { - $this->payload = $payload; - } - - /** - * @param array $formerState - * @return array - */ - public function run(array $formerState): array - { - $reservations = []; - $promo_codes_usage = []; - $ticket_types_ids = []; - - // sum reservations by tix types to check availability - $tickets = $this->payload['tickets']; - - foreach ($tickets as $ticket_dto) { - if (!isset($ticket_dto['type_id'])) - throw new ValidationException('type_id is mandatory'); - - $type_id = intval($ticket_dto['type_id']); - - if (!in_array($type_id, $ticket_types_ids)) - $ticket_types_ids[] = $type_id; - - $promo_code_value = isset($ticket_dto['promo_code']) ? strtoupper(trim($ticket_dto['promo_code'])) : null; - - if (!isset($reservations[$type_id])) - $reservations[$type_id] = 0; - - $reservations[$type_id] = $reservations[$type_id] + 1; - - if (!empty($promo_code_value)) { - - if (!isset($promo_codes_usage[$promo_code_value])) { - $promo_codes_usage[$promo_code_value] = [ - 'qty' => 0, - 'types' => [], - ]; - } - - $info = $promo_codes_usage[$promo_code_value]; - $info['qty'] = $info['qty'] + 1; - - if (!in_array($type_id, $info['types'])) - $info['types'] = array_merge($info['types'], [$type_id]); - - $promo_codes_usage[$promo_code_value] = $info; - } - } - return [ - "reservations" => $reservations, - "promo_codes_usage" => $promo_codes_usage, - "ticket_types_ids" => $ticket_types_ids, - ]; - } - - public function undo() - { - // TODO: Implement undo() method. - } -} - -/** - * Class PreOrderValidationTask - * @package App\Services\Model - */ -final class PreOrderValidationTask extends AbstractTask -{ - /** - * @var ITransactionService - */ - private $tx_service; - - /** - * @var Summit - */ - private $summit; - - /** - * @var array - */ - private $payload; - - /** - * PreOrderValidationTask constructor. - * @param Summit $summit - * @param array $payload - * @param ITransactionService $tx_service - */ - public function __construct(Summit $summit, array $payload, ITransactionService $tx_service) - { - $this->tx_service = $tx_service; - $this->summit = $summit; - $this->payload = $payload; - } - - public function run(array $formerState): array - { - // pre checks - $this->tx_service->transaction(function () { - $extra_questions = isset($this->payload['extra_questions']) ? $this->payload['extra_questions'] : []; - // check if we have at least a default badge template - if (!$this->summit->hasDefaultBadgeType()) - throw new ValidationException(sprintf("Summit %s has not default badge type set", $this->summit->getId())); - // check if we are on registration period - if (!$this->summit->isRegistrationPeriodOpen()) - throw new ValidationException(sprintf("Summit %s registration period is closed", $this->summit->getId())); - $owner_email = $this->payload['owner_email']; - - if (!$this->summit->canBuyRegistrationTickets($owner_email)) { - throw new ValidationException(sprintf("email %s can not buy registration tickets for summit %s", $owner_email, $this->summit->getId())); - } - - // check extra question for order ( if they exists and if they are mandatory) - - $mandatory_per_order = $this->summit->getMandatoryOrderExtraQuestionsByUsage(SummitOrderExtraQuestionTypeConstants::OrderQuestionUsage); - - if ($mandatory_per_order->count() != count($extra_questions)) { - throw new ValidationException("extra_questions is mandatory"); - } - - if ($mandatory_per_order->count() > 0) { - // check if we have all mandatories filled up - foreach ($mandatory_per_order as $question) { - $found = false; - foreach ($extra_questions as $question_answer) { - if ($question_answer['question_id'] == $question->getId() && !empty($question_answer['answer'])) { - $found = true; - break; - } - } - - if (!$found) { - throw new ValidationException(sprintf("question %s is mandatory", $question->getId())); - } - } - } - - }); - return []; - } - - public function undo() - { - // TODO: Implement undo() method. - } -} - -/** - * Class SummitOrderService - * @package App\Services\Model - */ -final class SummitOrderService - extends AbstractService implements ISummitOrderService -{ - /** - * @var IMemberRepository - */ - private $member_repository; - - /** - * @var ISummitTicketTypeRepository - */ - private $ticket_type_repository; - - /** - * @var ISummitRegistrationPromoCodeRepository - */ - private $promo_code_repository; - - /** - * @var ISummitAttendeeRepository - */ - private $attendee_repository; - - /** - * @var ISummitOrderRepository - */ - private $order_repository; - - /** - * @var ISummitAttendeeTicketRepository - */ - private $ticket_repository; - - /** - * @var ISummitAttendeeBadgeRepository - */ - private $badge_repository; - - /** - * @var ISummitRepository - */ - private $summit_repository; - - /** - * @var ISummitAttendeeBadgePrintRuleRepository - */ - private $print_rules_repository; - - /** - * @var IMemberService - */ - private $member_service; - - /** - * @var IBuildDefaultPaymentGatewayProfileStrategy - */ - private $default_payment_gateway_strategy; - - /** - * SummitOrderService constructor. - * @param ISummitTicketTypeRepository $ticket_type_repository - * @param IMemberRepository $member_repository - * @param ISummitRegistrationPromoCodeRepository $promo_code_repository - * @param ISummitAttendeeRepository $attendee_repository - * @param ISummitOrderRepository $order_repository - * @param ISummitAttendeeTicketRepository $ticket_repository - * @param ISummitAttendeeBadgeRepository $badge_repository - * @param ISummitRepository $summit_repository - * @param ISummitAttendeeBadgePrintRuleRepository $print_rules_repository - * @param IMemberService $member_service - * @param IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy - * @param ITransactionService $tx_service - */ - public function __construct - ( - ISummitTicketTypeRepository $ticket_type_repository, - IMemberRepository $member_repository, - ISummitRegistrationPromoCodeRepository $promo_code_repository, - ISummitAttendeeRepository $attendee_repository, - ISummitOrderRepository $order_repository, - ISummitAttendeeTicketRepository $ticket_repository, - ISummitAttendeeBadgeRepository $badge_repository, - ISummitRepository $summit_repository, - ISummitAttendeeBadgePrintRuleRepository $print_rules_repository, - IMemberService $member_service, - IBuildDefaultPaymentGatewayProfileStrategy $default_payment_gateway_strategy, - ITransactionService $tx_service - ) - { - parent::__construct($tx_service); - $this->member_repository = $member_repository; - $this->ticket_type_repository = $ticket_type_repository; - $this->promo_code_repository = $promo_code_repository; - $this->attendee_repository = $attendee_repository; - $this->order_repository = $order_repository; - $this->ticket_repository = $ticket_repository; - $this->badge_repository = $badge_repository; - $this->summit_repository = $summit_repository; - $this->print_rules_repository = $print_rules_repository; - $this->member_service = $member_service; - $this->default_payment_gateway_strategy = $default_payment_gateway_strategy; - } - - /** - * @param Member|null $owner - * @param Summit $summit - * @param array $payload - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function reserve(?Member $owner, Summit $summit, array $payload): SummitOrder - { - - try { - $owner = $this->tx_service->transaction(function () use ($owner, $payload) { - if (is_null($owner)) return null; - - $owner = $this->member_repository->getByIdExclusiveLock($owner->getId()); - - if (empty($owner->getFirstName())) { - $owner->setFirstName($payload['owner_first_name']); - } - - if (empty($owner->getLastName())) { - $owner->setLastName($payload['owner_last_name']); - } - - return $owner; - }); - $state = Saga::start() - ->addTask(new PreOrderValidationTask($summit, $payload, $this->tx_service)) - ->addTask(new PreProcessReservationTask($payload)) - ->addTask(new ReserveTicketsTask($summit, $this->ticket_type_repository, $this->tx_service)) - ->addTask(new ApplyPromoCodeTask($summit, $payload, $this->promo_code_repository, $this->tx_service)) - ->addTask(new ReserveOrderTask - ( - $owner, - $summit, - $payload, - $this->default_payment_gateway_strategy, - $this->member_repository, - $this->attendee_repository, - $this->ticket_repository, - $this->tx_service - ) - ) - ->run(); - - return $state['order']; - } catch (ValidationException $ex) { - Log::warning($ex); - throw $ex; - } catch (\Exception $ex) { - Log::error($ex); - throw $ex; - } - } - - /** - * @param Summit $summit - * @param string $order_hash - * @param array $payload - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function checkout(Summit $summit, string $order_hash, array $payload): SummitOrder - { - return $this->tx_service->transaction(function () use ($summit, $order_hash, $payload) { - $order = $this->order_repository->getByHashLockExclusive($order_hash); - - if (is_null($order) || !$order instanceof SummitOrder || $summit->getId() != $order->getSummitId()) - throw new EntityNotFoundException("order not found."); - - SummitOrderFactory::populate($summit, $order, $payload); - if ($order->isFree()) { - // free order - $order->setPaid(); - return $order; - } - - // validation of zip code its only for paid events - if(!$order->isFree() && empty($order->getBillingAddressZipCode())) - throw new ValidationException(sprintf("Zip Code is mandatory.")); - - $order->setConfirmed(); - - return $order; - - }); - } - - /** - * @param Member $current_user - * @param int $order_id - * @param array $payload - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateMyOrder(Member $current_user, int $order_id, array $payload): SummitOrder - { - return $this->tx_service->transaction(function () use ($current_user, $order_id, $payload) { - $order = $this->order_repository->getByIdExclusiveLock($order_id); - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - if (!$order->hasOwner() && $order->getOwnerEmail() == $current_user->getEmail()) { - $current_user->addSummitRegistrationOrder($order); - } - - if (!$order->hasOwner()) { - throw new EntityNotFoundException("order not found"); - } - - if ($order->getOwner()->getId() != $current_user->getId()) { - throw new EntityNotFoundException("order not found"); - } - - SummitOrderFactory::populate($order->getSummit(), $order, $payload); - - return $order; - }); - } - - /** - * @param Member $current_user - * @param int $order_id - * @param int $ticket_id - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function revokeTicket(Member $current_user, int $order_id, int $ticket_id): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($current_user, $order_id, $ticket_id) { - $order = $this->order_repository->getByIdExclusiveLock($order_id); - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - if (!$order->hasOwner() && $order->getOwnerEmail() == $current_user->getEmail()) { - $current_user->addSummitRegistrationOrder($order); - } - - if (!$order->hasOwner()) { - throw new EntityNotFoundException("order not found"); - } - - if ($order->getOwner()->getId() != $current_user->getId()) { - throw new EntityNotFoundException("order not found"); - } - - $summit = $order->getSummit(); - if ($summit->hasReassignTicketLimit()) { - $now = new \DateTime('now', new \DateTimeZone('UTC')); - if ($now > $summit->getReassignTicketTillDate()) { - throw new ValidationException('revoked ticket period expired'); - } - } - - $ticket = $order->getTicketById($ticket_id); - - if (is_null($ticket)) - throw new EntityNotFoundException("ticket not found"); - - if (!$ticket->hasOwner()) { - throw new ValidationException("You attempted to assign or reassign a ticket that you don’t have permission to assign."); - } - - $attendee = $ticket->getOwner(); - - if ($ticket->hasBadge() && $ticket->getBadge()->isPrinted()) { - throw new ValidationException("ticket can not be revoked due badge its already printed"); - } - - $attendee->sendRevocationTicketEmail($ticket); - - $attendee->removeTicket($ticket); - - return $ticket; - - }); - } - - /** - * @param Member $current_user - * @param int $order_id - * @param int $ticket_id - * @param array $payload - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function ownerAssignTicket(Member $current_user, int $order_id, int $ticket_id, array $payload): SummitAttendeeTicket - { - Log::debug("SummitOrderService::ownerAssignTicket"); - return $this->_assignTicket($order_id, $ticket_id, $payload, - function (array $payload) { - $first_name = $payload['attendee_first_name'] ?? null; - $last_name = $payload['attendee_last_name'] ?? null; - $company = $payload['attendee_company'] ?? null; - $email = $payload['attendee_email'] ?? ''; - $extra_questions = $payload['extra_questions'] ?? []; - - $basic_payload = [ - 'email' => trim($email), - 'extra_questions' => $extra_questions - ]; - - if (!is_null($first_name)) - $basic_payload['first_name'] = trim($first_name); - - if (!is_null($last_name)) - $basic_payload['last_name'] = trim($last_name); - - if (!is_null($company)) - $basic_payload['company'] = trim($company); - - return $basic_payload; - }, - function (SummitOrder $order) use ($current_user) { - - if (!$order->hasOwner() && $order->getOwnerEmail() == $current_user->getEmail()) { - $current_user->addSummitRegistrationOrder($order); - } - if (!$order->hasOwner()) { - throw new EntityNotFoundException("order not found"); - } - - if ($order->getOwner()->getId() != $current_user->getId()) { - throw new EntityNotFoundException("order not found"); - } - - $summit = $order->getSummit(); - if ($summit->hasReassignTicketLimit()) { - $now = new \DateTime('now', new \DateTimeZone('UTC')); - if ($now > $summit->getReassignTicketTillDate()) { - throw new ValidationException('reassign ticket period expired'); - } - } - } - ); - } - - /** - * @param int $order_id - * @param int $ticket_id - * @param array $payload - * @param callable $getPayloadFn - * @param callable|null $validationFn - * @return SummitAttendeeTicket - * @throws \Exception - */ - private function _assignTicket - ( - int $order_id, - int $ticket_id, - array $payload, - callable $getPayloadFn, - ?callable $validationFn = null - ): SummitAttendeeTicket - { - - return $this->tx_service->transaction(function () use ($order_id, $ticket_id, $payload, $getPayloadFn, $validationFn) { - - Log::debug(sprintf("SummitOrderService::_assignTicket order id %s ticket id %s", $order_id, $ticket_id)); - // lock and get the order - $order = $this->order_repository->getByIdExclusiveLock($order_id); - - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - // apply validation rules - if (!is_null($validationFn)) { - call_user_func($validationFn, $order); - } - - $summit = $order->getSummit(); - $ticket = $order->getTicketById($ticket_id); - - if (is_null($ticket)) - throw new EntityNotFoundException("ticket not found"); - - if (!$ticket->isPaid()) - throw new ValidationException("ticket is not paid"); - - // check attendee email - $email = $payload['attendee_email'] ?? ''; - - if ($ticket->hasOwner()) { - $owner = $ticket->getOwner(); - if ($owner->getEmail() != $email) - throw new ValidationException("ticket already had been assigned to another attendee, please revoke it before to assign it again."); - } - // try to get member and attendee by email - $member = $this->member_repository->getByEmail($email); - $attendee = $summit->getAttendeeByEmail($email); - - if (is_null($attendee) && !is_null($member)) { - // if we have a member, try to get attendee by member - $attendee = $summit->getAttendeeByMember($member); - } - - if (is_null($attendee)) { - // if attendee does not exists , create a new one - Log::debug(sprintf("SummitOrderService::_assignTicket - attendee does not exists for email %s creating it", $email)); - $attendee = SummitAttendeeFactory::build($summit, [ - 'email' => trim($email), - ], $member); - } - // update attendee data with custom payload - $attendee = SummitAttendeeFactory::populate - ( - $summit, - $attendee, - call_user_func($getPayloadFn, $payload), - $member - ); - - $attendee->addTicket($ticket); - - $ticket->generateQRCode(); - $ticket->generateHash(); - $attendee->updateStatus(); - $attendee->sendInvitationEmail($ticket); - - return $ticket; - - }); - } - - /** - * @param int $order_id - * @param int $ticket_id - * @return SummitAttendeeTicket - * @throws \Exception - */ - public function reInviteAttendee(int $order_id, int $ticket_id): SummitAttendeeTicket - { - - return $this->tx_service->transaction(function () use ($order_id, $ticket_id) { - - $order = $this->order_repository->getByIdExclusiveLock($order_id); - - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - $ticket = $order->getTicketById($ticket_id); - - if (is_null($ticket)) - throw new EntityNotFoundException("ticket not found"); - - if (!$ticket->isPaid()) - throw new ValidationException("ticket is not paid"); - - $attendee = $ticket->getOwner(); - - if (is_null($attendee)) - throw new EntityNotFoundException("attendee not found"); - - $ticket->generateQRCode(); - $ticket->generateHash(); - - $attendee->sendInvitationEmail($ticket); - - return $ticket; - }); - } - - /** - * @param int $order_id - * @return SummitOrder - * @throws \Exception - */ - public function reSendOrderEmail(int $order_id):SummitOrder { - - return $this->tx_service->transaction(function () use ($order_id) { - - $order = $this->order_repository->getByIdExclusiveLock($order_id); - - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - Log::debug(sprintf("SummitOrderService:: reSendOrderEmail order %s", $order_id)); - - if (!$order->hasOwner()) { - // owner is not registered ... - Log::debug("SummitOrderService::reSendOrderEmail - order has not owner set"); - $ownerEmail = $order->getOwnerEmail(); - // check if we have a member on db - Log::debug(sprintf("SummitOrderService::reSendOrderEmail - trying to get email %s from db", $ownerEmail)); - $member = $this->member_repository->getByEmail($ownerEmail); - - if (!is_null($member)) { - // its turns out that email was registered as a member - // set the owner and move on - Log::debug(sprintf("SummitOrderService::reSendOrderEmail - member %s found at db", $ownerEmail)); - $order->setOwner($member); - - Log::debug("SummitOrderService::reSendOrderEmail - sending email to owner"); - // send email to owner; - $this->sendExistentSummitOrderOwnerEmail($order); - - return $order; - } - - Log::debug(sprintf("SummitOrderService::reSendOrderEmail trying to get external user %s", $ownerEmail)); - - $user = $this->member_service->checkExternalUser($ownerEmail); - - if (is_null($user)) { - - Log::debug - ( - sprintf - ( - "SummitOrderService::reSendOrderEmail - user %s does not exist at IDP, emiting a registration request on idp", - $ownerEmail - ) - ); - - // user does not exists , emit a registration request - // need to send email with set password link - - $this->sendSummitOrderOwnerInvitationEmail($order, $this->member_service->emitRegistrationRequest - ( - $ownerEmail, - $order->getOwnerFirstName(), - $order->getOwnerSurname() - )); - - return $order; - } - - Log::debug - ( - sprintf - ( - "SummitOrderService::reSendOrderEmail - Creating a local user for %s", - $ownerEmail - ) - ); - $external_id = $user['id']; - try { - // we have an user on idp - $member = $this->member_service->registerExternalUser - ( - new ExternalUserDTO - ( - $external_id, - $user['email'], - $user['first_name'], - $user['last_name'], - boolval($user['active']), - boolval($user['email_verified']) - ) - ); - } - catch (\Exception $ex){ - Log::warning($ex); - // race condition lost - $member = $this->member_repository->getByExternalIdExclusiveLock(intval($external_id)); - $order = $this->order_repository->getByIdExclusiveLock($order_id); - } - - // add the order to newly created member - $member->addSummitRegistrationOrder($order); - } - - // send email to owner - $this->sendExistentSummitOrderOwnerEmail($order); - return $order; - }); - } - - /** - * @param Member $current_user , - * @param int $order_id - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function requestRefundOrder(Member $current_user, int $order_id): SummitOrder - { - return $this->tx_service->transaction(function () use ($current_user, $order_id) { - $order = $current_user->getSummitRegistrationOrderById($order_id); - if (is_null($order)) - throw new EntityNotFoundException('order not found'); - if ($order->isFree()) { - throw new ValidationException("you can not request a refund because order is free"); - } - $order->requestRefund(); - - // recalculate order status - $order->recalculateOrderStatus(); - - return $order; - }); - } - - /** - * @param int $order_id - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function cancelRequestRefundOrder(int $order_id): SummitOrder - { - return $this->tx_service->transaction(function () use ($order_id) { - $order = $this->order_repository->getById($order_id); - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException('order not found'); - - $order->cancelRefundRequest(); - - return $order; - }); - } - - /** - * @param int $order_id - * @param int $ticket_id - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function cancelRequestRefundTicket(int $order_id,int $ticket_id): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($order_id, $ticket_id) { - - $order = $this->order_repository->getById($order_id); - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException('order not found'); - - $ticket = $order->getTicketById($ticket_id); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - $ticket->cancelRefundRequest(); - - return $ticket; - }); - } - - /** - * @param Member $current_user , - * @param int $order_id - * @param int $ticket_id - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function requestRefundTicket(Member $current_user, int $order_id, int $ticket_id): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($current_user, $order_id, $ticket_id) { - $order = $current_user->getSummitRegistrationOrderById($order_id); - if (is_null($order)) - throw new EntityNotFoundException('order not found'); - - $ticket = $order->getTicketById($ticket_id); - if (is_null($ticket)) - throw new EntityNotFoundException('ticket not found'); - - if ($ticket->isFree()) { - throw new ValidationException("you can not request a refund because ticket is free"); - } - - $ticket->requestRefund(); - - // recalculate order status - $order->recalculateOrderStatus(); - - return $ticket; - }); - } - - /** - * @param Summit $summit - * @param string $order_hash - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function cancel(Summit $summit, string $order_hash): SummitOrder - { - return $this->tx_service->transaction(function () use ($summit, $order_hash) { - - $order = $this->order_repository->getByHashLockExclusive($order_hash); - - if (is_null($order) || !$order instanceof SummitOrder || $summit->getId() != $order->getSummitId()) - throw new EntityNotFoundException("order not found"); - - $order->setCancelled(false); - - return $order; - }); - } - - /** - * @param array $payload - * @param Summit|null $summit - * @throws \Exception - */ - public function processPayment(array $payload, ?Summit $summit = null): void - { - $this->tx_service->transaction(function () use ($summit, $payload) { - - Log::debug(sprintf("SummitOrderService::processPayment cart_id %s", $payload['cart_id'])); - - $order = $this->order_repository->getByPaymentGatewayCartIdExclusiveLock($payload['cart_id']); - - if (is_null($order) || !$order instanceof SummitOrder || (!is_null($summit) && $order->getSummitId() != $summit->getId())) { - throw new EntityNotFoundException - ( - sprintf("There is no order with cart_id %s.", $payload['cart_id']) - ); - } - - $summit = $order->getSummit(); - - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $this->default_payment_gateway_strategy - ); - - if (is_null($payment_gateway)) { - throw new ValidationException(sprintf("Payment configuration is not set for summit %s.", $summit->getId())); - } - - if ($payment_gateway->isSuccessFullPayment($payload)) { - Log::debug("SummitOrderService::processPayment: payment is successful"); - $order->setPaid(); - return; - } - - $order->setPaymentError($payment_gateway->getPaymentError($payload)); - }); - } - - /** - * @param int $minutes - * @param int $max - * @throws \Exception - */ - public function confirmOrdersOlderThanNMinutes(int $minutes, int $max = 100): void - { - // done in this way to avoid db lock contention - $orders = $this->tx_service->transaction(function () use ($minutes, $max) { - return $this->order_repository->getAllConfirmedOlderThanXMinutes($minutes, $max); - }); - - foreach ($orders as $order) { - $this->tx_service->transaction(function () use ($order) { - - try { - if (!$order instanceof SummitOrder) return; - - $order = $this->order_repository->getByIdExclusiveLock($order->getId()); - if (!$order instanceof SummitOrder) return; - Log::debug(sprintf("SummitOrderService::confirmOrdersOlderThanNMinutes processing order %s", $order->getId())); - $summit = $order->getSummit(); - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $this->default_payment_gateway_strategy - ); - if (is_null($payment_gateway)) { - Log::warning(sprintf("SummitOrderService::confirmOrdersOlderThanNMinutes Payment configuration is not set for summit %s", $summit->getId())); - return; - } - - $cart_id = $order->getPaymentGatewayCartId(); - if (!empty($cart_id)) { - - $status = $payment_gateway->getCartStatus($cart_id); - - if (!is_null($status) && $payment_gateway->isSucceeded($status)) { - Log::info(sprintf("SummitOrderService::confirmOrdersOlderThanNMinutes marking as paid order %s create at %s", $order->getNumber(), $order->getCreated()->format("Y-m-d h:i:sa"))); - $order->setPaid(); - } - - } - } catch (\Exception $ex) { - Log::warning($ex); - } - }); - } - } - - /** - * @param int $minutes - * @param int $max - * @throws \Exception - */ - public function revokeReservedOrdersOlderThanNMinutes(int $minutes, int $max = 100): void - { - // done in this way to avoid db lock contention - $orders = $this->tx_service->transaction(function () use ($minutes, $max) { - return $this->order_repository->getAllReservedOlderThanXMinutes($minutes, $max); - }); - - foreach ($orders as $order) { - $this->tx_service->transaction(function () use ($order) { - - try { - if (!$order instanceof SummitOrder) return; - - $order = $this->order_repository->getByIdExclusiveLock($order->getId()); - if (!$order instanceof SummitOrder) return; - $summit = $order->getSummit(); - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $this->default_payment_gateway_strategy - ); - if (is_null($payment_gateway)) { - Log::warning(sprintf("SummitOrderService::revokeReservedOrdersOlderThanNMinutes Payment configuration is not set for summit %s", $summit->getId())); - return; - } - - Log::warning(sprintf("SummitOrderService::revokeReservedOrdersOlderThanNMinutes cancelling order reservation %s create at %s", $order->getNumber(), $order->getCreated()->format("Y-m-d h:i:sa"))); - - $cart_id = $order->getPaymentGatewayCartId(); - if (!empty($cart_id)) { - - $status = $payment_gateway->getCartStatus($cart_id); - if (!is_null($status)) { - if (!$payment_gateway->canAbandon($status)) { - Log::warning(sprintf("SummitOrderService::revokeReservedOrdersOlderThanNMinutes reservation %s created at %s can not be cancelled external status %s", $order->getId(), $order->getCreated()->format("Y-m-d h:i:sa"), $status)); - if ($payment_gateway->isSucceeded($status)) { - $order->setPaid(); - } - return; - } - $payment_gateway->abandonCart($cart_id); - } - } - - $order->setCancelled(); - Log::warning(sprintf("SummitOrderService::revokeReservedOrdersOlderThanNMinutes order %s got cancelled", $order->getId())); - } catch (\Exception $ex) { - Log::warning($ex); - } - }); - } - } - - /** - * @param $ticket_id - * @param string $format - * @param Member|null $current_user - * @param int|null $order_id - * @param Summit|null $summit - * @return string - */ - public function renderTicketByFormat($ticket_id, string $format = "pdf", ?Member $current_user = null, ?int $order_id = null, ?Summit $summit = null): string - { - return $this->tx_service->transaction(function () use ($ticket_id, $current_user, $format, $order_id, $summit) { - - //try first by id - $ticket = null; - if (is_integer($ticket_id)) { - Log::debug(sprintf("SummitOrderService::renderTicketByFormattrying to get ticket by id %s", $ticket_id)); - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - } - - if (is_null($ticket) && is_null($current_user)) { - // try to get by hash - Log::debug(sprintf("SummitOrderService::renderTicketByFormat trying to get ticket by hash %s", $ticket_id)); - $ticket = $this->ticket_repository->getByHashExclusiveLock(strval($ticket_id)); - - if (is_null($ticket) || !$ticket->hasOwner()) - throw new EntityNotFoundException("ticket not found"); - - if (!$ticket->canPubliclyEdit()) { - // check hash lifetime - throw new ValidationException("ticket hash is not valid"); - } - } - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException("ticket not found"); - - Log::debug(sprintf("SummitOrderService::renderTicketByFormat ticket id %s ticket status %s", $ticket->getId(), $ticket->getStatus())); - if (!is_null($summit) && $ticket->getOrder()->getSummitId() !== $summit->getId()) - throw new EntityNotFoundException("ticket not found"); - - if (!is_null($order_id) && $ticket->getOrderId() !== $order_id) - throw new EntityNotFoundException("ticket not found"); - - - if (!$ticket->isPaid()) - throw new ValidationException("ticket is not paid"); - - if (!is_null($current_user)) { - // if current user is present - // check rendering permissions ( order owner or ticket owner only) - $allow_2_render = false; - $order = $ticket->getOrder(); - - if ($order->hasOwner() && $order->getOwnerEmail() == $current_user->getEmail()) { - $allow_2_render = true; - } - - if ($ticket->hasOwner() && $ticket->getOwnerEmail() == $current_user->getEmail()) { - $allow_2_render = true; - } - - if (!$allow_2_render) - throw new ValidationException("ticket does not belong to member"); - - } - - $renderer = new SummitAttendeeTicketPDFRenderer($ticket); - return $renderer->render(); - }); - } - - /** - * @param string $hash - */ - public function regenerateTicketHash(string $hash): void - { - $this->tx_service->transaction(function () use ($hash) { - - $ticket = $this->ticket_repository->getByHashExclusiveLock($hash); - - if (is_null($ticket)) { - $ticket = $this->ticket_repository->getByFormerHashExclusiveLock($hash); - } - - if (is_null($ticket)) - throw new EntityNotFoundException("ticket not found"); - - $ticket->sendPublicEditEmail(); - }); - } - - /** - * @param string $hash - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function getTicketByHash(string $hash): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($hash) { - $ticket = $this->ticket_repository->getByHashExclusiveLock($hash); - - if (is_null($ticket)) { - $ticket = $this->ticket_repository->getByFormerHashExclusiveLock($hash); - if (!is_null($ticket)) - throw new ValidationException("ticket hash is not valid"); - } - - if (is_null($ticket)) - throw new EntityNotFoundException("ticket not found"); - - if (!$ticket->isPaid()) - throw new ValidationException("ticket is not paid"); - - if (!$ticket->hasOwner()) - throw new ValidationException("ticket must have an assigned owner"); - - if (!$ticket->canPubliclyEdit()) - throw new ValidationException("ticket hash is not valid"); - - return $ticket; - }); - } - - /** - * @param Summit $summit - * @param array $payload - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function createOrderSingleTicket(Summit $summit, array $payload): SummitOrder - { - $order = $this->tx_service->transaction(function () use ($summit, $payload) { - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket summit %s payload %s", $summit->getId(), json_encode($payload))); - // lock ticket type stock - $owner = null; - $ticket_type = $this->ticket_type_repository->getByIdExclusiveLock(intval($payload['ticket_type_id'])); - - if (is_null($ticket_type) || !$ticket_type instanceof SummitTicketType || $ticket_type->getSummitId() != $summit->getId()) { - Log::warning("SummitOrderService::createOrderSingleTicket ticket type not found"); - throw new EntityNotFoundException("ticket type not found"); - } - - // check owner - if (isset($payload['owner_id'])) { - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket trying to get member by id %s", $payload['owner_id'])); - $owner = $this->member_repository->getById(intval($payload['owner_id'])); - if (is_null($owner)) { - Log::warning("SummitOrderService::createOrderSingleTicket owner not found"); - throw new EntityNotFoundException("owner not found"); - } - } - - if (is_null($owner) && isset($payload['owner_email'])) { - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket trying to get member by email %s", $payload['owner_email'])); - // if not try by email - $owner = $this->member_repository->getByEmail(trim($payload['owner_email'])); - } - - // try to get attendee - $attendee = !is_null($owner) ? $summit->getAttendeeByMember($owner) : null; - - if (is_null($attendee) && isset($payload['owner_email'])) { - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket trying to get attendee by email %s", $payload['owner_email'])); - $attendee = $this->attendee_repository->getBySummitAndEmail($summit, trim($payload['owner_email'])); - } - - if(is_null($attendee) && isset($payload['attendee'])){ - $attendee = $payload['attendee']; - } - - if (is_null($attendee)) { - // create it - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket attendee is null")); - //first name - $first_name = isset($payload['owner_first_name']) ? trim($payload['owner_first_name']) : null; - if (empty($first_name) && !is_null($owner) && !empty($owner->getFirstName())) $first_name = $owner->getFirstName(); - if (empty($first_name)) { - Log::warning("SummitOrderService::createOrderSingleTicket owner firstname is null"); - throw new ValidationException("you must provide an owner_first_name or a valid owner_id"); - } - // surname - $surname = isset($payload['owner_last_name']) ? trim($payload['owner_last_name']) : null; - if (empty($surname) && !is_null($owner) && !empty($owner->getLastName())) $surname = $owner->getLastName(); - if (empty($surname)) { - Log::warning("SummitOrderService::createOrderSingleTicket owner surname is null"); - throw new ValidationException("you must provide an owner_last_name or a valid owner_id"); - } - // mail - $email = isset($payload['owner_email']) ? trim($payload['owner_email']) : null; - - $company = isset($payload['owner_company']) ? trim($payload['owner_company']) : null; - - if (empty($email) && !is_null($owner)) $email = $owner->getEmail(); - if (empty($email)) { - Log::warning("SummitOrderService::createOrderSingleTicket owner email is null"); - throw new ValidationException("you must provide an owner_email or a valid owner_id"); - } - - $attendee = SummitAttendeeFactory::build($summit, [ - 'first_name' => $first_name, - 'last_name' => $surname, - 'email' => $email, - 'company' => $company - ], $owner); - } - - // create order - - $order = SummitOrderFactory::build($summit, $payload); - $order->generateNumber(); - do { - if (!$summit->existOrderNumber($order->getNumber())) - break; - $order->generateNumber(); - } while (1); - - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket order number %s", $order->getNumber())); - $default_badge_type = $summit->getDefaultBadgeType(); - - if (is_null($default_badge_type)) { - Log::warning("SummitOrderService::createOrderSingleTicket default_badge_type is null"); - throw new ValidationException(sprintf("summit %s does not has a default badge type", $summit->getId())); - } - - $order->setPaymentMethodOffline(); - - // create ticket - - $ticket = new SummitAttendeeTicket(); - $ticket->setOrder($order); - $ticket->setOwner($attendee); - $ticket->setTicketType($ticket_type); - $ticket->generateNumber(); - $ticket_type->sell(1); - - do { - if (!$this->ticket_repository->existNumber($ticket->getNumber())) - break; - $ticket->generateNumber(); - } while (1); - - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket ticket number %s", $ticket->getNumber())); - - if (!$ticket->hasBadge()) { - $ticket->setBadge(SummitBadgeType::buildBadgeFromType($default_badge_type)); - } - - // promo code usage - $promo_code = isset($payload['promo_code']) ? $this->promo_code_repository->getByValueExclusiveLock($summit, trim($payload['promo_code'])) : null; - if (!is_null($promo_code)) { - $promo_code->addUsage(1); - $promo_code->applyTo($ticket); - } - - $ticket->applyTaxes($summit->getTaxTypes()->toArray()); - $order->addTicket($ticket); - if (!is_null($owner)) { - $owner->addSummitRegistrationOrder($order); - } - - $ticket->generateHash(); - $ticket->generateQRCode(); - - $summit->addAttendee($attendee); - $summit->addOrder($order); - $order->generateHash(); - $order->generateQRCode(); - - return $order; - }); - - return $this->tx_service->transaction(function () use ($order) { - $order->setPaid(); - Log::debug(sprintf("SummitOrderService::createOrderSingleTicket order number %s mark as paid", $order->getNumber())); - return $order; - }); - } - - /** - * @param Summit $summit - * @param int $order_id - * @param array $payload - * @return SummitOrder - */ - public function updateOrder(Summit $summit, int $order_id, array $payload): SummitOrder - { - return $this->tx_service->transaction(function () use ($summit, $order_id, $payload) { - $order = $this->order_repository->getByIdExclusiveLock($order_id); - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - SummitOrderFactory::populate($summit, $order, $payload); - - return $order; - }); - } - - /** - * @param Summit $summit - * @param int $order_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteOrder(Summit $summit, int $order_id) - { - $this->tx_service->transaction(function () use ($summit, $order_id) { - $order = $this->order_repository->getByIdExclusiveLock($order_id); - - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - list($tickets_to_return, $promo_codes_to_return) = $order->calculateTicketsAndPromoCodesToReturn(); - - foreach ($order->getTickets() as $ticket) { - $ticket->setCancelled(); - } - - $summit->removeOrder($order); - - Event::fire(new OrderDeleted($order->getId(), $summit->getId(), $tickets_to_return, $promo_codes_to_return)); - - }); - } - - /** - * @param Summit $summit - * @param int $order_id - * @param float $amount - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function refundOrder(Summit $summit, int $order_id, float $amount): SummitOrder - { - return $this->tx_service->transaction(function () use ($summit, $order_id, $amount) { - $order = $this->order_repository->getByIdExclusiveLock($order_id); - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException('order not found'); - - if ($amount <= 0.0) { - throw new ValidationException("can not refund an amount lower than zero!"); - } - - if ($amount > intval($order->getFinalAmount())) { - throw new ValidationException("can not refund an amount greater than paid one!"); - } - - if (!$order->canRefund()) - throw new ValidationException - ( - sprintf - ( - "can not emit a refund on order %s", - $order->getId() - ) - ); - - $summit = $order->getSummit(); - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $this->default_payment_gateway_strategy - ); - if (is_null($payment_gateway)) { - throw new ValidationException(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - } - - $cart_id = $order->getPaymentGatewayCartId(); - - if (!empty($cart_id)) { - try { - $payment_gateway->refundPayment($order->getPaymentGatewayCartId(), $amount, $order->getCurrency()); - } catch (\Exception $ex) { - throw new ValidationException($ex->getMessage()); - } - } - - $order->refund($amount); - - // recalculate order status - $order->recalculateOrderStatus(); - - return $order; - }); - } - - /** - * @param Summit $summit - * @param $ticket_id - * @return SummitAttendeeTicket - * @throws \Exception - */ - public function getTicket(Summit $summit, $ticket_id): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($summit, $ticket_id) { - $ticket = $this->ticket_repository->getById(intval($ticket_id)); - if (is_null($ticket)) { - $ticket = $this->ticket_repository->getByNumber(strval($ticket_id)); - } - if (is_null($ticket)) { - // get by qr code - $qr_code = strval($ticket_id); - $fields = SummitAttendeeBadge::parseQRCode($qr_code); - $prefix = $fields['prefix']; - if ($summit->getBadgeQRPrefix() != $prefix) - throw new ValidationException - ( - sprintf - ( - "%s qr code is not valid for summit %s", - $qr_code, - $summit->getId() - ) - ); - - $ticket_number = $fields['ticket_number']; - $ticket = $this->ticket_repository->getByNumber($ticket_number); - } - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException("ticket not found"); - if ($ticket->getOrder()->getSummitId() != $summit->getId()) { - throw new ValidationException("ticket does not belong to summit"); - } - return $ticket; - }); - } - - /** - * @param Summit $summit - * @param int|string $ticket_id - * @param float $amount - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function refundTicket(Summit $summit, $ticket_id, float $amount): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($summit, $ticket_id, $amount) { - - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - - if (is_null($ticket)) - $this->ticket_repository->getByNumberExclusiveLock(strval($ticket_id)); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - if ($amount <= 0.0) { - throw new ValidationException("can not refund an amount lower than zero!"); - } - - if ($amount > intval($ticket->getFinalAmount())) { - throw new ValidationException("can not refund an amount greater than paid one!"); - } - - $order = $ticket->getOrder(); - - if ($order->getSummitId() != $summit->getId()) - throw new EntityNotFoundException('ticket not found'); - - if (!$ticket->canRefund()) - throw new ValidationException - ( - sprintf - ( - "can not emit a refund on ticket %s", - $ticket->getId() - ) - ); - - $cart_id = $order->getPaymentGatewayCartId(); - - $payment_gateway = $summit->getPaymentGateWayPerApp - ( - IPaymentConstants::ApplicationTypeRegistration, - $this->default_payment_gateway_strategy - ); - if (is_null($payment_gateway)) { - throw new ValidationException(sprintf("Payment configuration is not set for summit %s", $summit->getId())); - } - - if (!empty($cart_id)) { - try { - $payment_gateway->refundPayment($cart_id, $amount, $ticket->getOrder()->getCurrency()); - } catch (\Exception $ex) { - throw new ValidationException($ex->getMessage()); - } - } - - $ticket->refund($amount); - - // recalculate order status - $order->recalculateOrderStatus(); - - return $ticket; - }); - } - - /** - * @param Summit $summit - * @param int|string $ticket_id - * @param int $type_id - * @return SummitAttendeeBadge - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateBadgeType(Summit $summit, $ticket_id, int $type_id): SummitAttendeeBadge - { - return $this->tx_service->transaction(function () use ($summit, $ticket_id, $type_id) { - $badge_type = $summit->getBadgeTypeById($type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - if (is_null($ticket)) - $this->ticket_repository->getByNumberExclusiveLock(strval($ticket_id)); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - $order = $ticket->getOrder(); - - if ($order->getSummitId() != $summit->getId()) - throw new EntityNotFoundException('ticket not found'); - - if (!$ticket->hasBadge()) - throw new EntityNotFoundException('badge not found'); - - $badge = $ticket->getBadge(); - - $badge->setType($badge_type); - - return $badge; - }); - } - - /** - * @param Summit $summit - * @param int $ticket_id - * @param int $feature_id - * @return SummitAttendeeBadge - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addAttendeeBadgeFeature(Summit $summit, $ticket_id, int $feature_id): SummitAttendeeBadge - { - return $this->tx_service->transaction(function () use ($summit, $ticket_id, $feature_id) { - $feature_type = $summit->getFeatureTypeById($feature_id); - if (is_null($feature_type)) - throw new EntityNotFoundException("feature type not found"); - - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - if (is_null($ticket)) - $this->ticket_repository->getByNumberExclusiveLock(strval($ticket_id)); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - $order = $ticket->getOrder(); - - if ($order->getSummitId() != $summit->getId()) - throw new EntityNotFoundException('ticket not found'); - - if (!$ticket->hasBadge()) - throw new EntityNotFoundException('badge not found'); - - $badge = $ticket->getBadge(); - - $badge->addFeature($feature_type); - - return $badge; - }); - } - - /** - * @param Summit $summit - * @param int|string $ticket_id - * @param int $feature_id - * @return SummitAttendeeBadge - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removeAttendeeBadgeFeature(Summit $summit, $ticket_id, int $feature_id): SummitAttendeeBadge - { - return $this->tx_service->transaction(function () use ($summit, $ticket_id, $feature_id) { - $feature_type = $summit->getFeatureTypeById($feature_id); - if (is_null($feature_type)) - throw new EntityNotFoundException("feature type not found"); - - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - if (is_null($ticket)) - $this->ticket_repository->getByNumberExclusiveLock(strval($ticket_id)); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - $order = $ticket->getOrder(); - - if ($order->getSummitId() != $summit->getId()) - throw new EntityNotFoundException('ticket not found'); - - if (!$ticket->hasBadge()) - throw new EntityNotFoundException('badge not found'); - - $badge = $ticket->getBadge(); - - $badge->removeFeature($feature_type); - - return $badge; - }); - } - - /** - * @param Summit $summit - * @param int|string $ticket_id - * @param Member $requestor - * @return SummitAttendeeBadge - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function printAttendeeBadge(Summit $summit, $ticket_id, Member $requestor): SummitAttendeeBadge - { - return $this->tx_service->transaction(function () use ($summit, $ticket_id, $requestor) { - $ticket = null; - // check by numeric id - if (is_numeric($ticket_id)) - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - - if (is_null($ticket) && is_string($ticket_id)) { - // check by ticket number - $ticket = $this->ticket_repository->getByNumberExclusiveLock(strval($ticket_id)); - // if not found ... check by external ticket id - if (is_null($ticket)) - $ticket = $this->ticket_repository->getByExternalAttendeeIdExclusiveLock($summit, strval($ticket_id)); - } - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - - if ($order->getSummitId() != $summit->getId()) - throw new EntityNotFoundException('ticket not found'); - - if (!$ticket->hasBadge()) - throw new EntityNotFoundException('badge not found'); - - $badge = $this->badge_repository->getByIdExclusiveLock($ticket->getBadgeId()); - - if (is_null($badge) && !$badge instanceof SummitAttendeeBadge) - throw new EntityNotFoundException('badge not found'); - - // check rules - - if (!$requestor->isAdmin()) { - - $rules = $this->print_rules_repository->getByGroupsSlugs($requestor->getGroupsCodes()); - if (count($rules) == 0) - throw new ValidationException("Your user has no rights to print badges."); - - $canPrint = false; - - foreach ($rules as $rule) { - if (!$rule instanceof SummitAttendeeBadgePrintRule) continue; - $canPrint = $rule->canPrintBadge($badge); - if ($canPrint) - break; - } - - if (!$canPrint) { - throw new ValidationException("This badge has already been printed."); - } - } - - $badge->printIt($requestor); - - // do checkin on print - $attendee = $ticket->getOwner(); - if (!$attendee->hasCheckedIn()) { - $attendee->setSummitHallCheckedIn(true); - } - return $badge; - }); - } - - /** - * @param Summit $summit - * @param int|string $ticket_id - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteBadge(Summit $summit, $ticket_id): void - { - $this->tx_service->transaction(function () use ($summit, $ticket_id) { - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - if (is_null($ticket)) - $this->ticket_repository->getByNumberExclusiveLock(strval($ticket_id)); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - - if ($order->getSummitId() != $summit->getId()) - throw new EntityNotFoundException('ticket not found'); - - if (!$ticket->hasBadge()) - throw new EntityNotFoundException('badge not found'); - - $badge = $this->badge_repository->getByIdExclusiveLock($ticket->getBadgeId()); - - $this->badge_repository->delete($badge); - }); - } - - /** - * @param Summit $summit - * @param int|string $ticket_id - * @param array $payload - * @return SummitAttendeeBadge - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function createBadge(Summit $summit, $ticket_id, array $payload): SummitAttendeeBadge - { - return $this->tx_service->transaction(function () use ($summit, $ticket_id, $payload) { - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($ticket_id)); - if (is_null($ticket)) - $this->ticket_repository->getByNumberExclusiveLock(strval($ticket_id)); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException('ticket not found'); - - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - - if ($order->getSummitId() != $summit->getId()) - throw new EntityNotFoundException('ticket not found'); - - if ($ticket->hasBadge()) - throw new ValidationException('ticket already has a badge'); - - $badge = new SummitAttendeeBadge(); - $badge_type = $summit->getDefaultBadgeType(); - if (isset($payload['badge_type_id'])) { - $badge_type = $summit->getBadgeTypeById(intval($payload['badge_type_id'])); - - } - if (is_null($badge_type)) { - throw new EntityNotFoundException("badge type not found"); - } - $badge->setType($badge_type); - if (isset($payload['features'])) { - foreach ($payload['features'] as $feature_id) { - $feature = $summit->getFeatureTypeById($feature_id); - if (is_null($feature)) - throw new EntityNotFoundException("feature type not found"); - $badge->addFeature($feature); - } - } - $ticket->setBadge($badge); - return $badge; - }); - } - - /** - * @param Summit $summit - * @param int $order_id - * @param array $payload - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTicket(Summit $summit, int $order_id, array $payload): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($summit, $order_id, $payload) { - - }); - } - - /** - * @param Summit $summit - * @param int $order_id - * @param int $ticket_id - * @param array $payload - * @return SummitAttendeeTicket - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTicket(Summit $summit, int $order_id, int $ticket_id, array $payload): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($summit, $order_id, $ticket_id, $payload) { - $ticket = $this->_assignTicket($order_id, $ticket_id, $payload, - function (array $payload) { - $first_name = $payload['attendee_first_name'] ?? null; - $last_name = $payload['attendee_last_name'] ?? null; - $company = $payload['attendee_company'] ?? null; - $extra_questions = $payload['extra_questions'] ?? []; - - $basic_payload = [ - 'extra_questions' => $extra_questions - ]; - - if (!is_null($first_name)) - $basic_payload['first_name'] = trim($first_name); - - if (!is_null($last_name)) - $basic_payload['last_name'] = trim($last_name); - - if (!is_null($company)) - $basic_payload['company'] = trim($company); - - return array_merge($payload, $basic_payload); - }, - function (SummitOrder $order) use ($summit) { - if ($order->getSummitId() != $summit->getId()) { - throw new EntityNotFoundException("order not found"); - } - }); - - if (isset($payload['ticket_type_id'])) { - // set ticket type - $ticket_type_id = intval($payload['ticket_type_id']); - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - if (is_null($ticket_type)) - throw new EntityNotFoundException("ticket type not found"); - - $ticket_type->applyTo($ticket); - } - - if (isset($payload['badge_type_id'])) { - // set badge type - $badge_type_id = intval($payload['badge_type_id']); - $badge_type = $summit->getBadgeTypeById($badge_type_id); - if (is_null($badge_type)) - throw new EntityNotFoundException("badge type not found"); - $badge = $ticket->hasBadge() ? $ticket->getBadge() : new SummitAttendeeBadge(); - $badge->setType($badge_type); - $ticket->setBadge($badge); - } - - return $ticket; - }); - } - - - /** - * @param string $hash - * @param array $payload - * @return SummitAttendeeTicket - * @throws \Exception - */ - public function updateTicketByHash(string $hash, array $payload): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($hash, $payload) { - - $ticket = $this->ticket_repository->getByHashExclusiveLock($hash); - - if (is_null($ticket) && !$ticket->isActive()) - throw new EntityNotFoundException("ticket not found"); - - if (!$ticket->isPaid()) - throw new ValidationException("ticket is not paid"); - - if (!$ticket->hasOwner()) - throw new ValidationException("ticket must have an assigned owner"); - - if (!$ticket->canPubliclyEdit()) - throw new ValidationException("ticket hash is not valid"); - - $attendee = $ticket->getOwner(); - $summit = $ticket->getOrder()->getSummit(); - - if ($summit->isRegistrationDisclaimerMandatory()) { - $disclaimer_accepted = boolval($payload['disclaimer_accepted'] ?? false); - if (!$disclaimer_accepted) - throw new ValidationException("disclaimer_accepted is mandatory"); - } - - $first_name = $payload['attendee_first_name'] ?? ''; - $company = $payload['attendee_company'] ?? ''; - $last_name = $payload['attendee_last_name'] ?? ''; - $extra_questions = $payload['extra_questions'] ?? []; - - $disclaimer_accepted = $payload['disclaimer_accepted'] ?? null; - $reduced_payload = [ - 'first_name' => $first_name, - 'last_name' => $last_name, - 'company' => $company, - 'extra_questions' => $extra_questions - ]; - - if (!is_null($disclaimer_accepted)) { - $reduced_payload['disclaimer_accepted'] = boolval($disclaimer_accepted); - } - - // update it - SummitAttendeeFactory::populate($summit, $attendee, $reduced_payload); - $attendee->updateStatus(); - $attendee->sendInvitationEmail($ticket); - - return $ticket; - }); - } - - /** - * @param Member $current_user - * @param int $ticket_id - * @param array $payload - * @return SummitAttendeeTicket - * @throws \Exception - */ - public function updateTicketById(Member $current_user, int $ticket_id, array $payload): SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($current_user, $ticket_id, $payload) { - $ticket = $this->ticket_repository->getByIdExclusiveLock($ticket_id); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket || !$ticket->isActive()) - throw new EntityNotFoundException("ticket not found"); - - if (!$ticket->canEditTicket($current_user)) { - throw new ValidationException(sprintf("Ticket %s can not be edited by current member", $ticket_id)); - } - - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - $first_name = $payload['attendee_first_name'] ?? null; - $last_name = $payload['attendee_last_name'] ?? null; - $email = $payload['attendee_email'] ?? null; - $company = $payload['attendee_company'] ?? null; - $extra_questions = $payload['extra_questions'] ?? []; - $disclaimer_accepted = $payload['disclaimer_accepted'] ?? null; - - if ($summit->isRegistrationDisclaimerMandatory()) { - $disclaimer_accepted = boolval($payload['disclaimer_accepted'] ?? false); - if (!$disclaimer_accepted) - throw new ValidationException("Disclaimer is Mandatory."); - } - - $attendee = $ticket->getOwner(); - - $payload = [ - 'first_name' => $first_name, - 'last_name' => $last_name, - 'company' => $company, - 'email' => $email, - 'extra_questions' => $extra_questions - ]; - - if (!is_null($disclaimer_accepted)) { - $payload['disclaimer_accepted'] = boolval($disclaimer_accepted); - } - - if (is_null($attendee) && !empty($attendee_email)) { - // try to create it - $attendee = $this->attendee_repository->getBySummitAndEmail($summit, $attendee_email); - if (is_null($attendee)) { - $attendee = new SummitAttendee(); - } - } - - if(!is_null($attendee)) { - // update it - SummitAttendeeFactory::populate($summit, $attendee, $payload, !empty($email) ? $this->member_repository->getByEmail($email) : null); - $attendee->addTicket($ticket); - $attendee->updateStatus(); - $attendee->sendInvitationEmail($ticket); - } - - return $ticket; - }); - } - - - /** - * @param string $order_hash - * @param array $payload - * @return SummitOrder - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTicketsByOrderHash(string $order_hash, array $payload): SummitOrder - { - return $this->tx_service->transaction(function () use ($order_hash, $payload) { - - Log::debug(sprintf("SummitOrderService::updateTicketsByOrderHash order hash %s", $order_hash)); - - $tickets = $payload['tickets'] ?? []; - $order = $this->order_repository->getByHashLockExclusive($order_hash); - if (is_null($order)) - throw new EntityNotFoundException("order not found"); - - if (!$order->canPubliclyEdit()) { - // check hash lifetime - throw new ValidationException("order hash is not valid"); - } - - foreach ($tickets as $ticket_payload) { - - Log::debug - ( - sprintf - ( - "SummitOrderService::updateTicketsByOrderHash order hash %s ticket payload %s", - $order_hash, - json_encode($ticket_payload) - ) - ); - - $ticket_id = intval($ticket_payload['id']); - $ticket = $order->getTicketById($ticket_id); - - if (is_null($ticket) || !$ticket instanceof SummitAttendeeTicket) - throw new EntityNotFoundException("ticket not found"); - - $summit = $order->getSummit(); - - $first_name = $ticket_payload['attendee_first_name'] ?? null; - $last_name = $ticket_payload['attendee_last_name'] ?? null; - $email = $ticket_payload['attendee_email'] ?? null; - $company = $ticket_payload['attendee_company'] ?? null; - $extra_questions = $ticket_payload['extra_questions'] ?? []; - $disclaimer_accepted = $ticket_payload['disclaimer_accepted'] ?? null; - - if ($summit->isRegistrationDisclaimerMandatory()) { - $disclaimer_accepted = boolval($ticket_payload['disclaimer_accepted'] ?? false); - if (!$disclaimer_accepted) - throw new ValidationException("Disclaimer is Mandatory."); - } - - $attendee = $ticket->getOwner(); - - $payload = [ - 'first_name' => $first_name, - 'last_name' => $last_name, - 'company' => $company, - 'email' => $email, - 'extra_questions' => $extra_questions - ]; - - if (!is_null($disclaimer_accepted)) { - $payload['disclaimer_accepted'] = boolval($disclaimer_accepted); - } - - if (is_null($attendee) && !empty($email)) { - Log::debug(sprintf("SummitOrderService::updateTicketsByOrderHash attendee does not exists")); - // try to create it - $attendee = $this->attendee_repository->getBySummitAndEmail($summit, $email); - if (is_null($attendee)) { - Log::debug(sprintf("SummitOrderService::updateTicketsByOrderHash creating new attendee for email %s", $email)); - $attendee = new SummitAttendee(); - } - } - - if(!is_null($attendee)) { - // update it - SummitAttendeeFactory::populate($summit, $attendee, $payload, !empty($email) ? $this->member_repository->getByEmail($email) : null); - $attendee->updateStatus(); - $attendee->addTicket($ticket); - } - } - - return $order; - }); - } - - /** - * @param Summit $summit - * @param UploadedFile $csv_file - * @throws ValidationException - */ - public function importTicketData(Summit $summit, UploadedFile $csv_file): void - { - - Log::debug(sprintf("SummitOrderService::importTicketData - summit %s", $summit->getId())); - - $allowed_extensions = ['txt']; - - if (!in_array($csv_file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('csv')."); - } - - $real_path = $csv_file->getRealPath(); - $filename = pathinfo($real_path); - $filename = $filename['filename'] ?? sprintf("file%s", time()); - $basename = sprintf("%s_%s.csv", $filename, time()); - $filename = $csv_file->storeAs(sprintf("%s/tickets_imports", sys_get_temp_dir()), $basename); - $csv_data = File::get($real_path); - if (empty($csv_data)) - throw new ValidationException("file content is empty!"); - - $reader = CSVReader::buildFrom($csv_data); - - // check needed columns (headers names) - /* - columns - * id - * number - * attendee_email ( mandatory if id and number are missing) - * attendee_first_name (mandatory) - * attendee_last_name (mandatory) - * attendee_company (optional) - * ticket_type_name ( mandatory if id and number are missing) - * ticket_type_id ( mandatory if id and number are missing) - * badge_type_id (optional) - * badge_type_name (optional) - * one col per feature - */ - - // validate format with col names - $ticket_data_present = $reader->hasColumn("id") || $reader->hasColumn("number"); - $attendee_data_present = $reader->hasColumn("attendee_email") || - $reader->hasColumn("attendee_first_name") || - $reader->hasColumn("attendee_last_name"); - - if (!$ticket_data_present && !$attendee_data_present) - throw new ValidationException - ( - "you must define a ticket id [id], ticket number [number] or - attendee data [attendee_email, attendee_first_name, attendee_last_name] on csv columns" - ); - - ProcessTicketDataImport::dispatch($summit->getId(), $filename); - } - - /** - * @param int $summit_id - * @param string $filename - * @throws EntityNotFoundException - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function processTicketData(int $summit_id, string $filename) - { - - Log::debug(sprintf("SummitOrderService::processTicketData summit %s filename %s", $summit_id, $filename)); - - if (!Storage::disk('local')->exists($filename)) { - throw new ValidationException(sprintf("file %s does not exists.", $filename)); - } - - $csv_data = Storage::disk('local')->get($filename); - - $summit = $this->tx_service->transaction(function () use($summit_id) { - $summit = $this->summit_repository->getById($summit_id); - if (is_null($summit) || !$summit instanceof Summit) - throw new EntityNotFoundException(sprintf("summit %s does not exists.", $summit_id)); - return $summit; - }); - - $reader = CSVReader::buildFrom($csv_data); - - $ticket_data_present = $reader->hasColumn("id") || $reader->hasColumn("number"); - $attendee_data_present = $reader->hasColumn("attendee_email") || - $reader->hasColumn("attendee_first_name") || - $reader->hasColumn("attendee_last_name"); - - $badge_data_present = $reader->hasColumn("badge_type_id") || $reader->hasColumn("badge_type_name"); - - foreach ($reader as $idx => $row) { - - $this->tx_service->transaction(function () use ($summit, $reader, $row, $ticket_data_present, $attendee_data_present, $badge_data_present) { - - Log::debug(sprintf("SummitOrderService::processTicketData processing row %s", json_encode($row))); - $ticket = null; - $attendee = null; - - if ($ticket_data_present) { - Log::debug("SummitOrderService::processTicketData - has ticket data present ... trying to get ticket"); - - // edit already existent ticket ( could be assigned or not) - if ($reader->hasColumn("number")) { - Log::debug(sprintf("SummitOrderService::processTicketData trying to get ticket by number %s", $row['number'])); - $ticket = $this->ticket_repository->getByNumberExclusiveLock($row['number']); - } - - if (is_null($ticket) && $reader->hasColumn("id")) { - Log::debug(sprintf("SummitOrderService::processTicketData trying to get ticket by id %s", $row['id'])); - $ticket = $this->ticket_repository->getByIdExclusiveLock(intval($row['id'])); - } - - if (!is_null($ticket) && !$ticket->isPaid()) { - Log::warning("SummitOrderService::processTicketData - ticket is not paid"); - return; - } - - if (!is_null($ticket) && !$ticket->isActive()) { - Log::warning("SummitOrderService::processTicketData - ticket is not active"); - return; - } - } - - if ($attendee_data_present) { - Log::debug(sprintf("SummitOrderService::processTicketData - has attendee data present ... trying to get attendee %s", $row['attendee_email'])); - // check if attendee exists - $attendee = $this->attendee_repository->getBySummitAndEmail($summit, $row['attendee_email']); - $member = $this->member_repository->getByEmail($row['attendee_email']); - - if (is_null($attendee)) { - - Log::debug(sprintf("SummitOrderService::processTicketData - attendee %s does not exists", $row['attendee_email'])); - // create attendee ( populate payload) - $payload = [ - 'email' => $row['attendee_email'], - 'first_name' => $row['attendee_first_name'], - 'last_name' => $row['attendee_last_name'], - ]; - - if ($reader->hasColumn('attendee_company')) { - $payload['company'] = $row['attendee_company']; - } - - Log::debug(sprintf("SummitOrderService::processTicketData creating attendee with payload %s", json_encode($payload))); - - $attendee = SummitAttendeeFactory::build($summit, $payload, $member); - - //$this->attendee_repository->add($attendee, true); - $this->attendee_repository->add($attendee); - } - } - - if(!is_null($attendee)) { - if (is_null($ticket)) { - Log::debug(sprintf("SummitOrderService::processTicketData ticket is null, trying to create a new one")); - - if ($attendee->hasTickets()) { - Log::debug(sprintf("SummitOrderService::processTicketData - attendee %s already has ticket", $row['attendee_email'])); - return; - } - - Log::debug("SummitOrderService::processTicketData - ticket does not exists, creating it ..."); - // create ticket - // first try to get ticket type - $ticket_type = null; - - if ($reader->hasColumn('ticket_type_name')) { - Log::debug(sprintf("SummitOrderService::importTicketData trying to get ticket type by name %s", $row['ticket_type_name'])); - $ticket_type = $this->ticket_type_repository->getByType($summit, $row['ticket_type_name']); - } - - if (is_null($ticket_type) && $reader->hasColumn('ticket_type_id')) { - Log::debug(sprintf("SummitOrderService::processTicketData trying to get ticket type by id %s", $row['ticket_type_id'])); - $ticket_type = $this->ticket_type_repository->getById(intval($row['ticket_type_id'])); - } - - if (is_null($ticket_type)) { - Log::debug(sprintf("SummitOrderService::processTicketData - ticket type is not provide, ticket can not be created for attendee")); - return; - } - - $order = $this->createOrderSingleTicket($summit, - [ - 'ticket_type_id' => $ticket_type->getId(), - 'attendee' => $attendee, - 'owner_email' => $attendee->getEmail(), - 'owner_first_name' => $attendee->getFirstName(), - 'owner_last_name' => $attendee->getSurname(), - 'owner_company' => $attendee->getCompanyName(), - ] - ); - - $ticket = $order->getFirstTicket(); - - } else { - // ticket exists try to re assign it - Log::debug(sprintf("SummitOrderService::processTicketData ticket exists. trying to re assign it ...")); - - if ($ticket->hasOwner() && $ticket->getOwnerEmail() != $attendee->getEmail()) { - Log::debug(sprintf("SummitOrderService::processTicketData - reasigning ticket to attendee %s", $attendee->getEmail())); - $ticket->getOwner()->sendRevocationTicketEmail($ticket); - - $ticket->getOwner()->removeTicket($ticket); - } - - Log::debug(sprintf("SummitOrderService::processTicketData assigning ticket %s to attendee %s", $ticket->getNumber(), $attendee->getEmail())); - - $attendee->addTicket($ticket); - - $ticket->generateQRCode(); - $ticket->generateHash(); - - Log::debug(sprintf("SummitOrderService::processTicketData sending invitation email to attendee %s", $attendee->getEmail())); - $attendee->sendInvitationEmail($ticket); - } - } - - - if (is_null($ticket)) { - Log::warning("SummitOrderService::processTicketData ticket is null stop current row processing."); - return; - } - - Log::debug(sprintf("SummitOrderService::processTicketData - got ticket %s (%s)", $ticket->getId(), $ticket->getNumber())); - - // badge data - if (!$badge_data_present) { - Log::warning("SummitOrderService::processTicketData badge data is not present stop current row processing."); - return; - } - - $badge_type = null; - - if ($reader->hasColumn("badge_type_id")) { - Log::debug(sprintf("SummitOrderService::processTicketData trying to get badge type by id %s", $row['badge_type_id'])); - $badge_type = $summit->getBadgeTypeById(intval($row['badge_type_id'])); - } - - if (is_null($badge_type) && $reader->hasColumn("badge_type_name")) { - Log::debug(sprintf("SummitOrderService::processTicketData trying to get badge type by name %s", $row['badge_type_name'])); - $badge_type = $summit->getBadgeTypeByName(trim($row['badge_type_name'])); - } - - if (!is_null($badge_type)) - Log::debug(sprintf("SummitOrderService::processTicketData - got badge type %s (%s)", $badge_type->getId(), $badge_type->getName())); - - if (!$ticket->hasBadge()) { - // create it - if (!is_null($badge_type)) { - Log::warning("SummitOrderService::processTicketData badge type is null stop current row processing."); - return; - } - Log::debug(sprintf("SummitOrderService::processTicketData - ticket %s (%s) has not badge ... creating it", $ticket->getId(), $ticket->getNumber())); - $badge = SummitBadgeType::buildBadgeFromType($badge_type); - $ticket->setBadge($badge); - } - - $badge = $ticket->getBadge(); - - if (!is_null($badge_type)) - $badge->setType($badge_type); - - $clearedFeatures = false; - // check if we are setting any badge feature - Log::debug("SummitOrderService::processTicketData processing badge type features"); - foreach ($summit->getBadgeFeaturesTypes() as $featuresType) { - $feature_name = $featuresType->getName(); - Log::debug(sprintf("SummitOrderService::processTicketData processing badge type feature %s for ticket %s", $feature_name, $ticket->getId())); - if (!$reader->hasColumn($feature_name)) { - Log::debug(sprintf("SummitOrderService::processTicketData badge type feature %s does not exists as column", $feature_name)); - continue; - } - - if (!$clearedFeatures) { - $badge->clearFeatures(); - $clearedFeatures = true; - } - - $mustAdd = intval($row[$feature_name]) === 1; - if (!$mustAdd) { - Log::debug(sprintf("SummitOrderService::processTicketData badge type feature %s not set for ticket %s", $feature_name, $ticket->getId())); - continue; - } - Log::debug(sprintf("SummitOrderService::processTicketData - ticket %s (%s) - trying to add new features to ticket badge (%s)", $ticket->getId(), $ticket->getNumber(), $feature_name)); - $feature = $summit->getFeatureTypeByName(trim($feature_name)); - if (is_null($feature)){ - Log::warning(sprintf("SummitOrderService::processTicketData feature %s does not exist on summit %s", $feature, $summit->getId())); - continue; - } - Log::debug(sprintf("SummitOrderService::processTicketData badge type feature %s set for ticket %s", $feature_name, $ticket->getId())); - $badge->addFeature($feature); - } - }); - } - } - - /** - * @param Summit $summit - * @param array $payload - * @throws ValidationException - */ - public function ingestExternalTicketData(Summit $summit, array $payload): void - { - - $email_to = $payload['email_to'] ?? null; - - if (!$summit->hasDefaultBadgeType()) { - throw new ValidationException("need to define a default badge type"); - } - - if (empty($summit->getExternalSummitId())) { - throw new ValidationException("need to set a value for external_summit_id"); - } - - if (empty($summit->getExternalRegistrationFeedType())) { - throw new ValidationException("need to set a value for external_registration_feed_type"); - } - - if (empty($summit->getExternalRegistrationFeedApiKey())) { - throw new ValidationException("need to set a value for external_registration_feed_api_key"); - } - - IngestSummitExternalRegistrationData::dispatch - ( - $summit->getId(), - $email_to - ); - } - - - public function processAllOrderReminder(): void - { - $summits = $this->tx_service->transaction(function () { - return $this->summit_repository->getNotEnded(); - }); - - foreach ($summits as $summit) { - Log::debug - ( - sprintf - ( - "SummitOrderService::processAllOrderReminder calling processSummitOrderReminders for summit %s", - $summit->getId() - ) - ); - $this->processSummitOrderReminders($summit); - } - } - - /** - * @param Summit $summit - * @throws \Exception - */ - public function processSummitOrderReminders(Summit $summit): void - { - - Log::debug(sprintf("SummitOrderService::processSummitOrderReminders summit %s", $summit->getId())); - - if ($summit->isEnded()) { - Log::warning(sprintf("SummitOrderService::processSummitOrderReminders - summit %s has ended already", $summit->getId())); - return; - } - - $page = 1; - $has_more_items = true; - - do { - // done in this way to avoid db lock contention - - $orders = $this->tx_service->transaction(function () use ($summit, $page) { - return $this->order_repository->getAllOrderThatNeedsEmailActionReminder($summit, new PagingInfo($page, 100)); - }); - - $has_more_items = $orders->hasMoreItems(); - - foreach ($orders->getItems() as $order) { - if (!$order instanceof SummitOrder) continue; - Log::debug(sprintf("SummitOrderService::processSummitOrderReminders - summit %s order %s", $summit->getId(), $order->getId())); - try { - $this->processOrderReminder($order); - } catch (\Exception $ex) { - Log::error($ex); - } - foreach ($order->getTickets() as $ticket) { - try { - if(!$ticket->isActive()){ - Log::warning(sprintf("SummitOrderService::processSummitOrderReminders - summit %s order %s skipping ticket %s ( not active)", $summit->getId(), $order->getId(), $ticket->getId())); - continue; - } - $this->processTicketReminder($ticket); - } catch (\Exception $ex) { - Log::error($ex); - } - } - } - - ++$page; - - } while ($has_more_items); - } - - /** - * @param SummitOrder $order - * @throws \Exception - */ - public function processOrderReminder(SummitOrder $order): void - { - $this->tx_service->transaction(function () use ($order) { - - $summit = $order->getSummit(); - if ($summit->isEnded()) { - Log::warning(sprintf("SummitOrderService::processOrderReminder - summit %s has ended already", $summit->getId())); - return; - } - - if (!$order->isPaid()) { - Log::warning(sprintf("SummitOrderService::processOrderReminder - order %s no need email reminder", $order->getId())); - return; - } - - $needs_action = false; - - foreach ($order->getTickets() as $ticket) { - if(!$ticket->isActive()){ - Log::warning(sprintf("SummitOrderService::processOrderReminder - order %s skipping ticket %s ( NOT ACTIVE ).", $order->getId(), $ticket->getId())); - continue; - } - if (!$ticket->hasOwner()) { - $needs_action = true; - break; - } - $attendee = $ticket->getOwner(); - $attendee->updateStatus(); - if (!$attendee->isComplete()) { - $needs_action = true; - break; - } - } - - if (!$needs_action) { - Log::warning(sprintf("SummitOrderService::processOrderReminder - order %s no need email reminder", $order->getId())); - return; - } - - $last_action_date = $order->getLastReminderEmailSentDate(); - $summit = $order->getSummit(); - $days_interval = $summit->getRegistrationReminderEmailDaysInterval(); - - if ($days_interval <= 0) return; - $utc_now = new \DateTime('now', new \DateTimeZone('UTC')); - Log::debug(sprintf("SummitOrderService::processOrderReminder - last_action_date %s utc_now %s", $last_action_date->format("Y-m-d H:i:s"), $utc_now->format("Y-m-d H:i:s"))); - $last_action_date->add(new \DateInterval("P" . $days_interval . 'D')); - Log::debug(sprintf("SummitOrderService::processOrderReminder - last action date plus %s days %s utc_now %s", $days_interval, $last_action_date->format("Y-m-d H:i:s"), $utc_now->format("Y-m-d H:i:s"))); - - if ($last_action_date <= $utc_now) { - - $order->setLastReminderEmailSentDate($utc_now); - Log::debug(sprintf("SummitOrderService::processOrderReminder - sending reminder email for order %s", $order->getId())); - SummitOrderReminderEmail::dispatch($order); - } - }); - } - - /** - * @param SummitAttendeeTicket $ticket - * @throws \Exception - */ - public function processTicketReminder(SummitAttendeeTicket $ticket): void - { - $this->tx_service->transaction(function () use ($ticket) { - - if (!$ticket->hasOwner()) { - Log::warning(sprintf("SummitOrderService::processTicketReminder ticket %s no need email reminder ( no owner )", $ticket->getId())); - return; - } - - if (!$ticket->isPaid()) { - Log::warning(sprintf("SummitOrderService::processTicketReminder ticket %s no need email reminder (not paid )", $ticket->getId())); - return; - } - - if (!$ticket->hasTicketType()) { - Log::warning(sprintf("SummitOrderService::processTicketReminder ticket %s no need email reminder ( no type )", $ticket->getId())); - return; - } - - $attendee = $ticket->getOwner(); - - if ($attendee->isComplete()) { - Log::warning(sprintf("SummitOrderService::processTicketReminder ticket %s no need email reminder", $ticket->getId())); - return; - } - - $last_action_date = $attendee->getLastReminderEmailSentDate(); - $order = $ticket->getOrder(); - $summit = $order->getSummit(); - - if ($summit->isEnded()) { - Log::warning(sprintf("SummitOrderService::processTicketReminder - summit %s has ended already", $summit->getId())); - return; - } - - $days_interval = $summit->getRegistrationReminderEmailDaysInterval(); - Log::debug(sprintf("SummitOrderService::processTicketReminder days_interval is %s for summit %s", $days_interval, $summit->getId())); - if ($days_interval <= 0) return; - $utc_now = new \DateTime('now', new \DateTimeZone('UTC')); - $last_action_date->add(new \DateInterval("P" . $days_interval . 'D')); - Log::debug(sprintf("SummitOrderService::processTicketReminder last_action_date %s now %s", $last_action_date->format("Y-m-d H:i:s"), $utc_now->format("Y-m-d H:i:s"))); - if ($last_action_date <= $utc_now) { - - $attendee->setLastReminderEmailSentDate($utc_now); - Log::debug(sprintf("SummitOrderService::processTicketReminder sending reminder email for ticket %s", $ticket->getId())); - // regenerate hash - $ticket->generateHash(); - SummitTicketReminderEmail::dispatch($ticket); - } - }); - } - /** - * @param Summit $summit - * @param string $order_hash - * @return SummitAttendeeTicket|null - */ - public function getMyTicketByOrderHash(Summit $summit, string $order_hash): ?SummitAttendeeTicket - { - return $this->tx_service->transaction(function () use ($summit, $order_hash) { - $order = $this->order_repository->getByHashLockExclusive($order_hash); - - if (is_null($order) || !$order instanceof SummitOrder || $summit->getId() != $order->getSummitId()) - throw new EntityNotFoundException("order not found"); - - if (!$order->isSingleOrder()) { - throw new ValidationException("order is not single ticket or owner is equal to attendee"); - } - - $ticket = $order->getTickets()->first(); - if (!$ticket instanceof SummitAttendeeTicket) { - throw new EntityNotFoundException("ticket not found"); - } - - if (!$ticket->canPubliclyEdit()) { - Log::debug(sprintf("SummitOrderService::getMyTicketByOrderHash regenerating hash for ticket %s", $ticket->getId())); - $ticket->generateHash(); - } - - return $ticket; - }); - } - - /** - * @param SummitOrder $order - */ - private function sendAttendeesInvitationEmail(SummitOrder $order) - { - Log::debug(sprintf("SummitOrderService::sendAttendeesInvitationEmail order %s", $order->getId())); - foreach ($order->getTickets() as $ticket) { - try { - Log::debug(sprintf("SummitOrderService::sendAttendeesInvitationEmail order %s ticket %s", $order->getId(), $ticket->getNumber())); - if (!$ticket->hasOwner()) { - Log::debug(sprintf("SummitOrderService::sendAttendeesInvitationEmail ticket %s has not owner set", $ticket->getNumber())); - continue; - } - $ticket->generateQRCode(); - $ticket->generateHash(); - $ticket->getOwner()->sendInvitationEmail($ticket); - } catch (\Exception $ex) { - Log::warning($ex); - } - } - } - - /** - * @param SummitOrder $order - */ - private function sendExistentSummitOrderOwnerEmail(SummitOrder $order) - { - Log::debug(sprintf("SummitOrderService::sendExistentSummitOrderOwnerEmail for order %s", $order->getId())); - RegisteredMemberOrderPaidMail::dispatch($order); - } - - /** - * @param SummitOrder $order - * @param array $user_registration_request - */ - private function sendSummitOrderOwnerInvitationEmail(SummitOrder $order, array $user_registration_request) - { - Log::debug(sprintf("SummitOrderService::sendSummitOrderOwnerInvitationEmail for order %s", $order->getId())); - UnregisteredMemberOrderPaidMail::dispatch($order, $user_registration_request['set_password_link']); - } - - /** - * @param int $orderId - * @throws \Exception - */ - public function processOrderPaymentConfirmation(int $orderId): void - { - - $this->tx_service->transaction(function () use ($orderId) { - - Log::debug(sprintf("SummitOrderService::processOrderPaymentConfirmation - trying to get order id %s", $orderId)); - - $order = $this->order_repository->getByIdExclusiveLock($orderId); - if (is_null($order) || !$order instanceof SummitOrder){ - Log::warning(sprintf("SummitOrderService::processOrderPaymentConfirmation order %s not found.", $orderId)); - } - - Log::debug(sprintf("SummitOrderService::processOrderPaymentConfirmation - got order id %s nbr %s", $orderId, $order->getNumber())); - $order->generateQRCode(); - - if (!$order->hasOwner()) { - // owner is not registered ... - Log::debug("SummitOrderService::processOrderPaymentConfirmation - order has not owner set"); - $ownerEmail = $order->getOwnerEmail(); - // check if we have a member on db - Log::debug(sprintf("SummitOrderService::processOrderPaymentConfirmation - trying to get email %s from db", $ownerEmail)); - $member = $this->member_repository->getByEmail($ownerEmail); - - if (!is_null($member)) { - // its turns out that email was registered as a member - // set the owner and move on - Log::debug(sprintf("SummitOrderService::processOrderPaymentConfirmation - member %s found at db", $ownerEmail)); - $order->setOwner($member); - - Log::debug("SummitOrderService::processOrderPaymentConfirmation - sending email to owner"); - // send email to owner; - $this->sendExistentSummitOrderOwnerEmail($order); - - Log::debug("SummitOrderService::processOrderPaymentConfirmation - sending email to attendees"); - $this->sendAttendeesInvitationEmail($order); - return; - } - - $user = $this->member_service->checkExternalUser($ownerEmail); - - if (is_null($user)) { - - Log::debug - ( - sprintf - ( - "SummitOrderService::processOrderPaymentConfirmation - user %s does not exist at IDP, emiting a registration request on idp", - $ownerEmail - ) - ); - - // user does not exists , emit a registration request - // need to send email with set password link - - $this->sendSummitOrderOwnerInvitationEmail($order, $this->member_service->emitRegistrationRequest - ( - $ownerEmail, - $order->getOwnerFirstName(), - $order->getOwnerSurname() - )); - - $this->sendAttendeesInvitationEmail($order); - return; - } - - Log::debug - ( - sprintf - ( - "SummitOrderService::processOrderPaymentConfirmation - Creating a local user for %s", - $ownerEmail - ) - ); - - // we have an user on idp - $external_id = $user['id']; - try { - $member = $this->member_service->registerExternalUser - ( - new ExternalUserDTO - ( - $external_id, - $user['email'], - $user['first_name'], - $user['last_name'], - boolval($user['active']), - boolval($user['email_verified']) - ) - ); - } - catch (\Exception $ex){ - // race condition lost, try to get it - Log::warning($ex); - $member = $this->member_repository->getByExternalIdExclusiveLock(intval($external_id)); - $order = $this->order_repository->getByIdExclusiveLock($orderId); - } - // add the order to newly created member - $member->addSummitRegistrationOrder($order); - } - - // send email to owner - $this->sendExistentSummitOrderOwnerEmail($order); - // send email to owner; - $this->sendAttendeesInvitationEmail($order); - - $summit = $order->getSummit(); - if ($summit->isInviteOnlyRegistration()) { - // we should mark the associated invitation as processed - $invitation = $summit->getSummitRegistrationInvitationByEmail($order->getOwnerEmail()); - if (is_null($invitation)) { - Log::warning(sprintf("order %s has not valid invitation for email %s.", $order->getId(), $order->getOwnerEmail())); - return; - } - $invitation->setOrder($order); - $invitation->markAsAccepted(); - } - }); - } - - /** - * @inheritDoc - */ - public function activateTicket(Summit $summit, int $order_id, int $ticket_id): SummitAttendeeTicket - { - return $this->tx_service->transaction(function() use($summit, $order_id, $ticket_id){ - // lock and get the order - $order = $this->order_repository->getByIdExclusiveLock($order_id); - - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - $ticket = $order->getTicketById($ticket_id); - - if (is_null($ticket)) - throw new EntityNotFoundException("ticket not found"); - - $ticket->activate(); - - return $ticket; - }); - } - - /** - * @inheritDoc - */ - public function deActivateTicket(Summit $summit, int $order_id, int $ticket_id): SummitAttendeeTicket - { - return $this->tx_service->transaction(function() use($summit, $order_id, $ticket_id){ - // lock and get the order - $order = $this->order_repository->getByIdExclusiveLock($order_id); - - if (is_null($order) || !$order instanceof SummitOrder) - throw new EntityNotFoundException("order not found"); - - $ticket = $order->getTicketById($ticket_id); - - if (is_null($ticket)) - throw new EntityNotFoundException("ticket not found"); - - $ticket->deActivate(); - - return $ticket; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitPresentationActionService.php b/app/Services/Model/Imp/SummitPresentationActionService.php deleted file mode 100644 index 17bad25d..00000000 --- a/app/Services/Model/Imp/SummitPresentationActionService.php +++ /dev/null @@ -1,68 +0,0 @@ -tx_service->transaction(function() use($summit, $selection_plan_id, $presentation_id, $action_id, $isCompleted){ - - $performer = ResourceServerContext::getCurrentUser(false); - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if(is_null($selection_plan)) - throw new EntityNotFoundException(sprintf("Selection Plan %s not found.", $selection_plan_id)); - - $presentation = $selection_plan->getPresentation($presentation_id); - - if(is_null($presentation)) - throw new EntityNotFoundException(sprintf("Presentation %s not found.", $presentation_id)); - - $action = $presentation->getActionById($action_id); - - if(is_null($action)) - throw new EntityNotFoundException(sprintf("Action %s not found.", $action_id)); - - $action->setUpdatedBy($performer); - $action->setIsCompleted($isCompleted); - $message = sprintf("%s has marked status '%s' as %s", $performer->getFullName(), $action->getType()->getLabel(), ($isCompleted? "Completed":"Uncompleted")); - if(!$action->hasCreatedBy()){ - $action->setCreatedBy($performer); - } - - // emit notification - $presentation->addTrackChairComment($performer, $message, true); - - $presentation->setUpdatedBy($performer); - - return $action; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitPresentationActionTypeService.php b/app/Services/Model/Imp/SummitPresentationActionTypeService.php deleted file mode 100644 index f6598731..00000000 --- a/app/Services/Model/Imp/SummitPresentationActionTypeService.php +++ /dev/null @@ -1,98 +0,0 @@ -repository = $repository; - } - - /** - * @inheritDoc - */ - public function add(Summit $summit, array $payload): PresentationActionType - { - return $this->tx_service->transaction(function() use($summit, $payload){ - $action = PresentationActionTypeFactory::build($payload); - $max_order = $summit->getPresentationActionTypeMaxOrder(); - $action->setOrder($max_order + 1); - $summit->addPresentationActionType($action); - return $action; - }); - } - - /** - * @inheritDoc - */ - public function update(Summit $summit, int $action_type_id, array $payload): ?PresentationActionType - { - return $this->tx_service->transaction(function() use($summit, $action_type_id, $payload){ - - $action = $summit->getPresentationActionTypeById($action_type_id); - if(is_null($action)){ - throw new EntityNotFoundException(sprintf("PresentationActionType %s not found.", $action_type_id)); - } - $action = PresentationActionTypeFactory::populate($action, $payload); - if (isset($payload['order']) && intval($payload['order']) != $action->getOrder()) { - // request to update order - self::recalculateOrderForCollection($summit->getPresentationActionTypes()->toArray(), $action, intval($payload['order'])); - } - return $action; - }); - } - - /** - * @inheritDoc - */ - public function delete(Summit $summit, int $action_type_id): void - { - $this->tx_service->transaction(function() use($summit, $action_type_id){ - $action = $summit->getPresentationActionTypeById($action_type_id); - if(is_null($action)){ - throw new EntityNotFoundException(sprintf("PresentationActionType %s not found.", $action_type_id)); - } - - $summit->removePresentationActionType($action); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitPromoCodeService.php b/app/Services/Model/Imp/SummitPromoCodeService.php deleted file mode 100644 index 073a78e8..00000000 --- a/app/Services/Model/Imp/SummitPromoCodeService.php +++ /dev/null @@ -1,383 +0,0 @@ -member_repository = $member_repository; - $this->company_repository = $company_repository; - $this->speaker_repository = $speaker_repository; - } - - /** - * @param Summit $summit - * @param array $data - * @return array - * @throws EntityNotFoundException - */ - private function getPromoCodeParams(Summit $summit, array $data){ - $params = []; - - if(isset($data['allowed_ticket_types'])){ - $allowed_ticket_types = []; - foreach($data['allowed_ticket_types'] as $ticket_type_id){ - $ticket_type = $summit->getTicketTypeById(intval($ticket_type_id)); - if(is_null($ticket_type)) - throw new EntityNotFoundException(sprintf("ticket type %s not found", $ticket_type_id)); - $allowed_ticket_types[] = $ticket_type; - - } - $params['allowed_ticket_types'] = $allowed_ticket_types; - } - - if(isset($data['badge_features'])){ - $badge_features = []; - foreach($data['badge_features'] as $feature_id){ - $feature = $summit->getFeatureTypeById(intval($feature_id)); - if(is_null($feature)) - throw new EntityNotFoundException(sprintf("badge feature %s not found", $feature_id)); - $badge_features[] = $feature; - - } - $params['badge_features'] = $badge_features; - } - - if(isset($data['owner_id'])){ - $owner = $this->member_repository->getById(intval($data['owner_id'])); - if(is_null($owner)) - throw new EntityNotFoundException(sprintf("owner_id %s not found", $data['owner_id'])); - $params['owner'] = $owner; - } - - if(isset($data['speaker_id'])){ - $speaker = $this->speaker_repository->getById(intval($data['speaker_id'])); - if(is_null($speaker)) - throw new EntityNotFoundException(sprintf("speaker_id %s not found", $data['speaker_id'])); - $params['speaker'] = $speaker; - } - - if(isset($data['sponsor_id'])){ - $sponsor = $this->company_repository->getById(intval($data['sponsor_id'])); - if(is_null($sponsor)) - throw new EntityNotFoundException(sprintf("sponsor_id %s not found", $data['sponsor_id'])); - $params['sponsor'] = $sponsor; - } - - return $params; - } - /** - * @param Summit $summit - * @param array $data - * @param Member $current_user - * @return SummitRegistrationPromoCode - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addPromoCode(Summit $summit, array $data, Member $current_user = null) - { - return $this->tx_service->transaction(function() use($summit, $data, $current_user){ - - $code = trim($data['code']); - if(empty($code)) - { - throw new ValidationException("code can not be empty!"); - } - - $old_promo_code = $summit->getPromoCodeByCode($code); - - if(!is_null($old_promo_code)) - throw new ValidationException(sprintf("promo code %s already exits on summit id %s", trim($data['code']), $summit->getId())); - - $promo_code = SummitPromoCodeFactory::build($summit, $data, $this->getPromoCodeParams($summit, $data)); - if(is_null($promo_code)) - throw new ValidationException(sprintf("class_name %s is invalid", $data['class_name'])); - - if(!is_null($current_user)) - $promo_code->setCreator($current_user); - - $promo_code->setSourceAdmin(); - - return $promo_code; - }); - } - - /** - * @param Summit $summit - * @param int $promo_code_id - * @param array $data - * @param Member $current_user - * @return SummitRegistrationPromoCode - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updatePromoCode(Summit $summit, $promo_code_id, array $data, Member $current_user = null) - { - return $this->tx_service->transaction(function() use($promo_code_id, $summit, $data, $current_user){ - - $promo_code = $summit->getPromoCodeById($promo_code_id); - if(is_null($promo_code)) - throw new EntityNotFoundException(sprintf("promo code id %s does not belongs to summit id %s", $promo_code_id, $summit->getId())); - - if(isset($data['code'])) { - $old_promo_code = $summit->getPromoCodeByCode(trim($data['code'])); - - if (!is_null($old_promo_code) && $old_promo_code->getId() != $promo_code_id) - throw new ValidationException(sprintf("promo code %s already exits on summit id %s for promo code id %s", trim($data['code']), $summit->getId(), $old_promo_code->getId())); - - } - - $promo_code = SummitPromoCodeFactory::populate($promo_code, $summit, $data, $this->getPromoCodeParams($summit, $data)); - - if(!is_null($current_user)) - $promo_code->setCreator($current_user); - $promo_code->setSourceAdmin(); - - return $promo_code; - }); - } - - /** - * @param Summit $summit - * @param int $promo_code_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deletePromoCode(Summit $summit, $promo_code_id) - { - $this->tx_service->transaction(function() use($promo_code_id, $summit){ - - $promo_code = $summit->getPromoCodeById($promo_code_id); - if(is_null($promo_code)) - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.promo_code_delete_code_not_found', - [ 'promo_code_id' => $promo_code_id, 'summit_id' => $summit->getId()] - ) - ); - - if ($promo_code->isEmailSent()) - throw new ValidationException(trans('validation_errors.promo_code_delete_already_sent')); - - if ($promo_code->isRedeemed()) - throw new ValidationException(trans('validation_errors.promo_code_delete_already_redeemed')); - - $summit->removePromoCode($promo_code); - - }); - } - - /** - * @param Summit $summit - * @param int $promo_code_id - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function sendPromoCodeMail(Summit $summit, $promo_code_id) - { - $this->tx_service->transaction(function() use($promo_code_id, $summit){ - - $promo_code = $summit->getPromoCodeById($promo_code_id); - if(is_null($promo_code)) - throw new EntityNotFoundException(trans('not_found_errors.promo_code_email_code_not_found', [ 'promo_code_id' => $promo_code_id, 'summit_id' => $summit->getId()])); - - $name = null; - $email = null; - - if($promo_code instanceof IOwnablePromoCode && $promo_code->hasOwner()){ - $name = $promo_code->getOwnerFullname(); - $email = $promo_code->getOwnerEmail(); - } - - if(empty($email)){ - throw new ValidationException(trans("validation_errors.promo_code_email_send_empty_email")); - } - - if(empty($name)){ - throw new ValidationException(trans("validation_errors.promo_code_email_send_empty_name")); - } - - PromoCodeEmailFactory::send($promo_code); - $promo_code->setEmailSent(true); - }); - } - - /** - * @param Summit $summit - * @param int $promo_code_id - * @param int $ticket_type_id - * @param array $data - * @return SummitRegistrationPromoCode - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addPromoCodeTicketTypeRule(Summit $summit, int $promo_code_id, int $ticket_type_id, array $data): SummitRegistrationPromoCode - { - return $this->tx_service->transaction(function() use($summit, $promo_code_id, $ticket_type_id, $data){ - $promo_code = $summit->getPromoCodeById($promo_code_id); - if(is_null($promo_code)) - throw new EntityNotFoundException("promo code not found"); - - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - if(is_null($ticket_type)) - throw new EntityNotFoundException("ticket type not found"); - - if($promo_code instanceof SummitRegistrationDiscountCode){ - $data['ticket_type'] = $ticket_type; - $rule = SummitRegistrationDiscountCodeTicketTypeRuleFactory::build($data); - $promo_code->addTicketTypeRule($rule); - - return $promo_code; - } - - $promo_code->addAllowedTicketType($ticket_type); - - return $promo_code; - - }); - } - - /** - * @param Summit $summit - * @param int $promo_code_id - * @param int $ticket_type_id - * @return SummitRegistrationPromoCode - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removePromoCodeTicketTypeRule(Summit $summit, int $promo_code_id, int $ticket_type_id): SummitRegistrationPromoCode - { - return $this->tx_service->transaction(function() use($summit, $promo_code_id, $ticket_type_id){ - $promo_code = $summit->getPromoCodeById($promo_code_id); - if(is_null($promo_code)) - throw new EntityNotFoundException("promo code not found"); - - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - if(is_null($ticket_type)) - throw new EntityNotFoundException("ticket type not found"); - - if($promo_code instanceof SummitRegistrationDiscountCode){ - $promo_code->removeTicketTypeRuleForTicketType($ticket_type); - return $promo_code; - } - - $promo_code->removeAllowedTicketType($ticket_type); - - return $promo_code; - }); - } - - /** - * @param Summit $summit - * @param int $promo_code_id - * @param int $badge_feature_id - * @return SummitRegistrationPromoCode - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addPromoCodeBadgeFeature(Summit $summit, int $promo_code_id, int $badge_feature_id): SummitRegistrationPromoCode - { - return $this->tx_service->transaction(function() use($summit, $promo_code_id, $badge_feature_id){ - $promo_code = $summit->getPromoCodeById($promo_code_id); - if(is_null($promo_code)) - throw new EntityNotFoundException("promo code not found"); - - $badge_feature = $summit->getFeatureTypeById($badge_feature_id); - if(is_null($badge_feature)) - throw new EntityNotFoundException("badge feature not found"); - - $promo_code->addBadgeFeatureType($badge_feature); - - return $promo_code; - }); - } - - /** - * @param Summit $summit - * @param int $promo_code_id - * @param int $badge_feature_id - * @return SummitRegistrationPromoCode - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removePromoCodeBadgeFeature(Summit $summit, int $promo_code_id, int $badge_feature_id): SummitRegistrationPromoCode - { - return $this->tx_service->transaction(function() use($summit, $promo_code_id, $badge_feature_id){ - $promo_code = $summit->getPromoCodeById($promo_code_id); - if(is_null($promo_code)) - throw new EntityNotFoundException("promo code not found"); - - $badge_feature = $summit->getFeatureTypeById($badge_feature_id); - if(is_null($badge_feature)) - throw new EntityNotFoundException("badge feature not found"); - - $promo_code->removeBadgeFeatureType($badge_feature); - - return $promo_code; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitPushNotificationService.php b/app/Services/Model/Imp/SummitPushNotificationService.php deleted file mode 100644 index e2235551..00000000 --- a/app/Services/Model/Imp/SummitPushNotificationService.php +++ /dev/null @@ -1,272 +0,0 @@ -group_repository = $group_repository; - $this->member_repository = $member_repository; - } - - /** - * @param Summit $summit - * @param Member|null $current_member - * @param array $data - * @return SummitPushNotification - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function addPushNotification(Summit $summit, Member $current_member, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $current_member, $data) { - $params = []; - if (!is_null($current_member)) - $params['owner'] = $current_member; - - if (isset($data['event_id'])) { - $event = $summit->getScheduleEvent(intval($data['event_id'])); - if (is_null($event)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.SummitPushNotificationService.addPushNotification.EventNotFound', - [ - 'summit_id' => $summit->getId(), - 'event_id' => $data['event_id'] - ] - ) - ); - } - $params['event'] = $event; - } - - if (isset($data['group_id'])) { - $group = $this->group_repository->getById(intval($data['group_id'])); - if (is_null($group)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.SummitPushNotificationService.addPushNotification.GroupNotFound', - [ - 'summit_id' => $summit->getId(), - 'group_id' => $data['group_id'] - ] - ) - ); - } - $params['group'] = $group; - } - - if (isset($data['recipient_ids'])) { - - $recipients = []; - foreach ($data['recipient_ids'] as $recipient_id) { - $recipient = $this->member_repository->getById(intval($recipient_id)); - - if (is_null($recipient)) { - throw new EntityNotFoundException - ( - 'not_found_errors.SummitPushNotificationService.addPushNotification.MemberNotFound', - [ - 'summit_id' => $summit->getId(), - 'member_id' => $recipient_id - ] - ); - } - - if(!$recipient->isActive()){ - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitPushNotificationService.addPushNotification.MemberNotActive', - [ - 'summit_id' => $summit->getId(), - 'member_id' => $recipient_id - ] - ) - ); - } - $recipients[] = $recipient; - } - - $params['recipients'] = $recipients; - - } - - $notification = SummitPushNotificationFactory::build($summit, $data, $params); - - if($notification->getChannel() == SummitPushNotificationChannel::Members){ - // auto approve for members - $notification->approve($current_member); - } - - $summit->addNotification($notification); - - return $notification; - - }); - } - - - /** - * @param Summit $summit - * @param Member|null $current_member - * @param int $notification_id - * @return SummitPushNotification - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function approveNotification(Summit $summit, Member $current_member, $notification_id) - { - return $this->tx_service->transaction(function() use($summit, $current_member, $notification_id){ - $notification = $summit->getNotificationById($notification_id); - if(is_null($notification)){ - throw new EntityNotFoundException - ( - trans - ( - "not_found_errors.SummitPushNotificationService.approveNotification.NotificationNotFound", - [ - 'summit_id' => $summit->getId(), - 'notification_id' => $notification_id - ] - ) - - ); - } - - return $notification->approve($current_member); - }); - } - - /** - * @param Summit $summit - * @param Member|null $current_member - * @param int $notification_id - * @return SummitPushNotification - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function unApproveNotification(Summit $summit, Member $current_member, $notification_id) - { - return $this->tx_service->transaction(function() use($summit, $current_member, $notification_id){ - $notification = $summit->getNotificationById($notification_id); - if(is_null($notification)){ - throw new EntityNotFoundException - ( - trans - ( - "not_found_errors.SummitPushNotificationService.unApproveNotification.NotificationNotFound", - [ - 'summit_id' => $summit->getId(), - 'notification_id' => $notification_id - ] - ) - - ); - } - - return $notification->unApprove(); - }); - } - - /** - * @param Summit $summit - * @param int $notification_id - * @return void - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteNotification(Summit $summit, $notification_id) - { - return $this->tx_service->transaction(function() use($summit, $notification_id){ - $notification = $summit->getNotificationById($notification_id); - if(is_null($notification)){ - throw new EntityNotFoundException - ( - trans - ( - "not_found_errors.SummitPushNotificationService.deleteNotification.NotificationNotFound", - [ - 'summit_id' => $summit->getId(), - 'notification_id' => $notification_id - ] - ) - - ); - } - - if($notification->isSent()){ - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitPushNotificationService.deleteNotification.NotificationAlreadySent', - [ - 'summit_id' => $summit->getId(), - 'notification_id' => $notification_id - ] - ) - ); - } - - $summit->removeNotification($notification); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitRefundPolicyTypeService.php b/app/Services/Model/Imp/SummitRefundPolicyTypeService.php deleted file mode 100644 index c0ad836d..00000000 --- a/app/Services/Model/Imp/SummitRefundPolicyTypeService.php +++ /dev/null @@ -1,107 +0,0 @@ -tx_service->transaction(function() use($summit, $payload){ - $name = trim($payload['name']); - $days = intval($payload['until_x_days_before_event_starts']); - $former_policy = $summit->getRefundPolicyByName($name); - if(!is_null($former_policy)) - throw new ValidationException(sprintf("%s refund policy name already exists", $name)); - $former_policy = $summit->getRefundPolicyByDays($days); - if(!is_null($former_policy)) - throw new ValidationException(sprintf("refund policy for %s days already exists", $days)); - - $policy = SummitRefundPolicyTypeFactory::build($payload); - - $summit->addRefundPolicy($policy); - - return $policy; - }); - } - - /** - * @param Summit $summit - * @param int $policy_id - * @param array $payload - * @return SummitRefundPolicyType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updatePolicy(Summit $summit, int $policy_id, array $payload): SummitRefundPolicyType - { - return $this->tx_service->transaction(function() use($summit, $policy_id, $payload){ - $policy = $summit->getRefundPolicyById($policy_id); - if(is_null($policy)) - throw new EntityNotFoundException("policy not found"); - - if(isset($payload['name'])) { - $name = trim($payload['name']); - $former_policy = $summit->getRefundPolicyByName($name); - if (!is_null($former_policy) && $former_policy->getId() != $policy_id) - throw new ValidationException(sprintf("%s refund policy name already exists", $name)); - } - - if(isset($payload['until_x_days_before_event_starts'])) { - $days = intval($payload['until_x_days_before_event_starts']); - $former_policy = $summit->getRefundPolicyByDays($days); - if (!is_null($former_policy) && $former_policy->getId() != $policy_id) - throw new ValidationException(sprintf("refund policy for %s days already exists", $days)); - } - - return SummitRefundPolicyTypeFactory::populate($policy, $payload); - }); - } - - /** - * @param Summit $summit - * @param int $policy_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deletePolicy(Summit $summit, int $policy_id): void - { - $this->tx_service->transaction(function() use($summit, $policy_id){ - $policy = $summit->getRefundPolicyById($policy_id); - if(is_null($policy)) - throw new EntityNotFoundException("policy not found"); - - $summit->removeRefundPolicy($policy); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitRegistrationInvitationService.php b/app/Services/Model/Imp/SummitRegistrationInvitationService.php deleted file mode 100644 index 40229a8d..00000000 --- a/app/Services/Model/Imp/SummitRegistrationInvitationService.php +++ /dev/null @@ -1,412 +0,0 @@ -member_repository = $member_repository; - $this->external_user_api = $external_user_api; - $this->invitation_repository = $invitation_repository; - $this->member_service = $member_service; - } - - /** - * @param Summit $summit - * @param UploadedFile $csv_file - * @throws ValidationException - */ - public function importInvitationData(Summit $summit, UploadedFile $csv_file): void - { - Log::debug(sprintf("SummitRegistrationInvitationService::importInvitationData - summit %s", $summit->getId())); - - $allowed_extensions = ['txt']; - - if (!in_array($csv_file->extension(), $allowed_extensions)) { - throw new ValidationException("File does not has a valid extension ('csv')."); - } - - $csv_data = File::get($csv_file->getRealPath()); - - if (empty($csv_data)) - throw new ValidationException("File content is empty."); - - $reader = CSVReader::buildFrom($csv_data); - - // check needed columns (headers names) - /*********************************************************** - columns - * email (mandatory) - * first_name (mandatory) - * last_name (mandatory) - ***********************************************************/ - - if(!$reader->hasColumn("email")) - throw new ValidationException("File is missing email column."); - if(!$reader->hasColumn("first_name")) - throw new ValidationException("File is missing first_name column."); - if(!$reader->hasColumn("last_name")) - throw new ValidationException("File is missing last_name column."); - - foreach ($reader as $idx => $row) { - $this->tx_service->transaction(function () use ($summit, $reader, $row) { - try{ - $this->add($summit, $row); - } - catch (\Exception $ex){ - Log::warning($ex); - } - }); - } - - } - - /** - * @inheritDoc - */ - public function delete(Summit $summit, int $invitation_id): void - { - $this->tx_service->transaction(function() use($summit, $invitation_id){ - $invitation = $summit->getSummitRegistrationInvitationById($invitation_id); - if(is_null($invitation)){ - throw new EntityNotFoundException("Invitation not found."); - } - - $summit->removeRegistrationInvitation($invitation); - }); - } - - /** - * @inheritDoc - */ - public function add(Summit $summit, array $payload): SummitRegistrationInvitation - { - return $this->tx_service->transaction(function() use($summit, $payload){ - $email = trim($payload['email']); - $former_invitation = $summit->getSummitRegistrationInvitationByEmail($email); - if(!is_null($former_invitation)){ - throw new ValidationException(sprintf("Email %s already has been invited for summit %s", $email, $summit->getId())); - } - - $invitation = SummitRegistrationInvitationFactory::build($payload); - - $invitation = $this->setInvitationMember($invitation, $email); - - $summit->addRegistrationInvitation($invitation); - - return $invitation; - }); - } - - /** - * @param SummitRegistrationInvitation $invitation - * @param string $email - * @return SummitRegistrationInvitation - * @throws \Exception - */ - private function setInvitationMember(SummitRegistrationInvitation $invitation, string $email):SummitRegistrationInvitation { - return $this->tx_service->transaction(function() use($invitation, $email){ - $member = $this->member_repository->getByEmail($email); - // try to get an user externally , user does not exits locally - if(is_null($member)){ - // check if user exists by email at idp - Log::debug(sprintf("SummitRegistrationInvitationService::setInvitationMember - trying to get member %s from user api", $email)); - $user = $this->external_user_api->getUserByEmail($email); - // check if primary email is the same if not disregard - $primary_email = $user['email'] ?? null; - if(strcmp(strtolower($primary_email), strtolower($email)) !== 0){ - Log::debug - ( - sprintf - ( - "SummitRegistrationInvitationService::setInvitationMember primary email %s differs from order owner email %s", - $primary_email, - $email - ) - ); - - // email are not equals , then is not the user bc primary emails differs ( could be a - // match on a secondary email) - $user = null; // set null on user and proceed to emit a registration request. - } - - if(is_null($user)){ - - Log::debug - ( - sprintf - ( - "SummitRegistrationInvitationService::setInvitationMember - user %s does not exist at IDP, emiting a registration request on idp", - $email - ) - ); - - // user does not exists , emit a registration request - $user_registration_request = $this->external_user_api->registerUser - ( - $email, - $invitation->getFirstName(), - $invitation->getLastName() - ); - - $invitation->setSetPasswordLink($user_registration_request['set_password_link']); - } - - if(!is_null($user)) { - Log::debug - ( - sprintf - ( - "SummitRegistrationInvitationService::setInvitationMember - Creating a local user for %s", - $email - ) - ); - $external_id = $user['id']; - try { - - // we have an user on idp - $member = $this->member_service->registerExternalUser - ( - new ExternalUserDTO - ( - $external_id, - $user['email'], - $user['first_name'], - $user['last_name'], - boolval($user['active']), - boolval($user['email_verified']) - ) - ); - } - catch (\Exception $ex){ - Log::warning($ex); - // race condition lost - $member = $this->member_repository->getByExternalIdExclusiveLock(intval($external_id)); - $invitation = $this->invitation_repository->getByIdExclusiveLock($invitation->getId()); - } - } - } - - if(!is_null($member)) - $invitation->setMember($member); - - return $invitation; - }); - } - /** - * @inheritDoc - */ - public function update(Summit $summit, int $invitation_id, array $payload): SummitRegistrationInvitation - { - return $this->tx_service->transaction(function() use($summit, $payload, $invitation_id){ - $invitation = $summit->getSummitRegistrationInvitationById($invitation_id); - if(is_null($invitation)) - throw new EntityNotFoundException(sprintf("Invitation %s not found at Summit %s", $invitation_id, $summit->getId())); - - if(isset($payload['email'])) { - $email = trim($payload['email']); - $former_invitation = $summit->getSummitRegistrationInvitationByEmail($email); - if (!is_null($former_invitation) && $former_invitation->getId() !== $invitation_id) { - throw new ValidationException(sprintf("Email %s already has been invited for summit %s", $email, $summit->getId())); - } - } - - $invitation = SummitRegistrationInvitationFactory::populate($invitation, $payload); - - if(isset($payload['email'])) { - $email = trim($payload['email']); - $invitation = $this->setInvitationMember($invitation, $email); - } - - return $invitation; - }); - } - - /** - * @param Member $current_member - * @param string $token - * @return SummitRegistrationInvitation - * @throws \Exception - */ - public function getInvitationByToken(Member $current_member, string $token): SummitRegistrationInvitation - { - return $this->tx_service->transaction(function () use ($current_member, $token) { - - $invitation = $this->invitation_repository->getByHashExclusiveLock(SummitRegistrationInvitation::HashConfirmationToken($token)); - - if(is_null($invitation)) - throw new EntityNotFoundException("Invitation not found."); - Log::debug(sprintf("got invitation %s for email %s", $invitation->getId(), $invitation->getEmail())); - if($invitation->getEmail() !== $current_member->getEmail()) - throw new ValidationException("Invitation belongs to another User."); - - $invitation->setMember($current_member); - - if($invitation->isAccepted()){ - throw new ValidationException("Invitation is already accepted."); - } - - return $invitation; - }); - } - - /** - * @param Summit $summit - * @param string $email - * @return SummitRegistrationInvitation|null - * @throws \Exception - */ - public function getInvitationByEmail(Summit $summit, string $email):?SummitRegistrationInvitation - { - return $this->tx_service->transaction(function () use ($summit, $email) { - if(!$summit->isInviteOnlyRegistration()) - throw new ValidationException(sprintf("Summit %s is not invite only.", $summit->getId())); - - return $summit->getSummitRegistrationInvitationByEmail($email); - }); - } - - /** - * @inheritDoc - */ - public function deleteAll(Summit $summit): void - { - $this->tx_service->transaction(function() use($summit){ - $summit->clearRegistrationInvitations(); - }); - } - - /** - * @param Summit $summit - * @param array $payload - * @param Filter|null $filter - */ - public function triggerSend(Summit $summit, array $payload, $filter = null): void - { - ProcessRegistrationInvitationsJob::dispatch($summit, $payload, $filter); - } - - /** - * @inheritDoc - */ - public function send(int $summit_id, array $payload, Filter $filter = null): void - { - $flow_event = trim($payload['email_flow_event']); - - Log::debug(sprintf("SummitRegistrationInvitationService::send summit id %s flow_event %s", $summit_id, $flow_event)); - - $ids = $this->tx_service->transaction(function() use($summit_id, $payload, $filter){ - if(isset($payload['invitations_ids'])) { - Log::debug(sprintf("SummitRegistrationInvitationService::send summit id %s invitations_ids %s", $summit_id, json_encode($payload['invitations_ids']))); - return $payload['invitations_ids']; - } - Log::debug(sprintf("SummitRegistrationInvitationService::send summit id %s getting by filter", $summit_id)); - if(is_null($filter)){ - $filter = new Filter(); - } - $filter->addFilterCondition(FilterElement::makeEqual('summit_id', $summit_id)); - return $this->invitation_repository->getAllIdsByPage(new PagingInfo(1, PHP_INT_MAX), $filter); - }); - - foreach ($ids as $invitation_id) - $this->tx_service->transaction(function() use($flow_event, $invitation_id){ - - Log::debug(sprintf("SummitRegistrationInvitationService::send processing invitation id %s", $invitation_id)); - - $invitation = $this->invitation_repository->getByIdExclusiveLock(intval($invitation_id)); - if(is_null($invitation) || !$invitation instanceof SummitRegistrationInvitation) return; - - $summit = $invitation->getSummit(); - - while(true) { - $invitation->generateConfirmationToken(); - $former_invitation = $summit->getSummitRegistrationInvitationByHash($invitation->getHash()); - if(is_null($former_invitation) || $former_invitation->getId() == $invitation->getId()) break; - } - - // send email - if($flow_event == InviteSummitRegistrationEmail::EVENT_SLUG) - InviteSummitRegistrationEmail::dispatch($invitation); - if($flow_event == ReInviteSummitRegistrationEmail::EVENT_SLUG) - ReInviteSummitRegistrationEmail::dispatch($invitation); - - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitSelectedPresentationListService.php b/app/Services/Model/Imp/SummitSelectedPresentationListService.php deleted file mode 100644 index 1c0ab03c..00000000 --- a/app/Services/Model/Imp/SummitSelectedPresentationListService.php +++ /dev/null @@ -1,468 +0,0 @@ -summit_repository = $summit_repository; - $this->member_repository = $member_repository; - $this->resource_server_ctx = $resource_server_ctx; - parent::__construct($tx_service); - } - - /** - * @inheritDoc - */ - public function getTeamSelectionList(Summit $summit, int $track_id): SummitSelectedPresentationList - { - return $this->tx_service->transaction(function () use ($summit, $track_id) { - $category = $summit->getPresentationCategory(intval($track_id)); - if (is_null($category)) throw new EntityNotFoundException("track not found."); - - $current_member = $this->resource_server_ctx->getCurrentUser(); - - if(is_null($current_member)) - throw new AuthzException("Current Member not found."); - - $auth = $summit->isTrackChair($current_member, $category); - if(!$auth){ - throw new AuthzException("Current user is not allowed to perform this operation."); - } - - $selection_list = $category->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Group); - if (is_null($selection_list)) throw new EntityNotFoundException("list not found."); - - return $selection_list; - }); - } - - /** - * @inheritDoc - */ - public function createTeamSelectionList(Summit $summit, int $track_id): SummitSelectedPresentationList - { - return $this->tx_service->transaction(function () use ($summit, $track_id) { - - $category = $summit->getPresentationCategory(intval($track_id)); - if (is_null($category)) throw new EntityNotFoundException("track not found."); - - $current_member = $this->resource_server_ctx->getCurrentUser(); - - if(is_null($current_member)) - throw new AuthzException("Current Member not found."); - - $auth = $summit->isTrackChair($current_member, $category); - if(!$auth){ - throw new AuthzException("Current user is not allowed to perform this operation."); - } - - return $category->createTeamSelectionList(); - }); - } - - /** - * @inheritDoc - */ - public function getIndividualSelectionList(Summit $summit, int $track_id, int $owner_id): SummitSelectedPresentationList - { - return $this->tx_service->transaction(function () use ($summit, $track_id, $owner_id) { - $category = $summit->getPresentationCategory(intval($track_id)); - if (is_null($category)) throw new EntityNotFoundException("track not found."); - - $current_member = $this->resource_server_ctx->getCurrentUser(); - - if(is_null($current_member)) - throw new AuthzException("Current Member not found."); - - $auth = $summit->isTrackChair($current_member, $category); - if(!$auth){ - throw new AuthzException("Current user is not allowed to perform this operation."); - } - - $member = $this->member_repository->getById(intval($owner_id)); - if (is_null($member)) throw new EntityNotFoundException("member not found."); - - $selection_list = $category->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Individual, $member); - if (is_null($selection_list)) throw new EntityNotFoundException("list not found."); - - return $selection_list; - }); - } - - /** - * @inheritDoc - */ - public function createIndividualSelectionList(Summit $summit, int $track_id): SummitSelectedPresentationList - { - return $this->tx_service->transaction(function () use ($summit, $track_id) { - - $category = $summit->getPresentationCategory(intval($track_id)); - if (is_null($category)) throw new EntityNotFoundException("track not found."); - - $current_member = $this->resource_server_ctx->getCurrentUser(); - - if(is_null($current_member)) - throw new AuthzException("Current Member not found."); - - $auth = $summit->isTrackChair($current_member, $category); - if(!$auth){ - throw new AuthzException("Current user is not allowed to perform this operation."); - } - - return $category->createIndividualSelectionList($current_member); - }); - } - - /** - * @inheritDoc - */ - public function reorderList(Summit $summit, int $track_id, int $list_id, array $payload): SummitSelectedPresentationList - { - return $this->tx_service->transaction(function () use ($summit, $track_id, $list_id, $payload) { - - Log::debug(sprintf("SummitSelectedPresentationListService::reorderList track %s list %s payload %s.", $track_id, $list_id, json_encode($payload))); - - $selection_plan = $summit->getCurrentSelectionPlanByStatus(SelectionPlan::STATUS_SELECTION); - - if(is_null($selection_plan)) - throw new ValidationException(sprintf("There is not current Selection Plan active on Selection Phase.")); - - $category = $summit->getPresentationCategory(intval($track_id)); - - if (is_null($category) || !$category instanceof PresentationCategory || !$category->isChairVisible()) throw new EntityNotFoundException("Track not found."); - - $selection_list = $category->getSelectionListById($list_id); - if (is_null($selection_list)) - throw new EntityNotFoundException("List not found."); - - $current_member = $this->resource_server_ctx->getCurrentUser(); - - if(is_null($current_member)) - throw new AuthzException("Current Member not found."); - - $auth = $summit->isTrackChair($current_member, $category); - if(!$auth){ - throw new AuthzException("Current user is not allowed to perform this operation."); - } - - // check if we can edit it - - if(!$selection_list->canEdit($current_member)){ - throw new AuthzException(sprintf("Member %s can not edit list %s", $current_member->getId(), $selection_list->getId())); - } - - if (count($payload['presentations']) > $category->getTrackChairAvailableSlots() && trim($payload['collection']) == SummitSelectedPresentation::CollectionSelected) { - throw new ValidationException(sprintf("You can not add more presentations (%s).", $category->getTrackChairAvailableSlots())); - } - - if ($selection_list->isGroup()){ - - $hash = $payload['hash'] ?? ""; - - if(!$selection_list->compareHash(trim($hash))) - throw new ValidationException("The Teams List was modified by someone else. Please refresh the page."); - } - - /** - * Remove selections that are not on the provided new list - * ex - * current selection [1,3] - * provided selection [3,4,5] - * final state [3] - */ - foreach($selection_list->getSelectedPresentationsByCollection(trim($payload['collection'])) as $selection){ - if(!in_array($selection->getPresentationId(), $payload['presentations'])){ - $selection_list->removeSelection($selection); - } - } - - foreach ($payload['presentations'] as $order => $id) { - // get the presentation - - $presentation = $summit->getEvent(intval($id)); - - if (is_null($presentation) - || !$presentation instanceof Presentation - || $presentation->getStatus() !== Presentation::STATUS_RECEIVED - || $presentation->getProgress() !== Presentation::PHASE_COMPLETE - || $presentation->getSelectionPlanId() !== $selection_plan->getId()) - throw new EntityNotFoundException(sprintf("Presentation %s not found.", $id)); - - if($category->getId() !== $presentation->getCategoryId()){ - throw new ValidationException(sprintf("Current member can not assign Presentation %s to his/her list [Presentation does not belong to category].", $id)); - } - - // check if the selection already exists on the current list - $selection = $selection_list->getSelectionByPresentation($presentation); - - if(!is_null($selection) && $selection->getCollection() !== trim($payload['collection'])){ - // we should remove it from original collection - $selection_list->removeSelection($selection); - $selection = null; - } - - if(is_null($selection)) { - // selection does not exists , create it - $selection = SummitSelectedPresentation::create - ( - $selection_list, - $presentation, - trim($payload['collection']), - $selection_list->isGroup() ? null : $current_member - ); - - $selection_list->addSelection($selection); - - if ($selection_list->isGroup()) { - $presentation->addTrackChairNotification($current_member, '{member} added this presentation to the team list'); - } - } - - $selection->setOrder($order + 1); - } - - if($selection_list->isGroup()) - $selection_list->recalculateHash(); - - return $selection_list; - }); - } - - /** - * @param Summit $summit - * @param int $track_id - * @param string $collection - * @param int $presentation_id - * @return SummitSelectedPresentationList - * @throws \Exception - */ - public function assignPresentationToMyIndividualList - ( - Summit $summit, - int $track_id, - string $collection, - int $presentation_id - ): SummitSelectedPresentationList - { - return $this->tx_service->transaction(function () use ($summit, $track_id, $collection, $presentation_id) { - - Log::debug - ( - sprintf - ( - "SummitSelectedPresentationListService::assignPresentationToMyIndividualList summit %s track %s collection %s presentation %s", - $summit->getId(), - $track_id, - $collection, - $presentation_id - ) - ); - - $current_member = $this->resource_server_ctx->getCurrentUser(); - if(is_null($current_member)) - throw new AuthzException("User is missing."); - - $selection_plan = $summit->getCurrentSelectionPlanByStatus(SelectionPlan::STATUS_SELECTION); - - if(is_null($selection_plan)) - throw new ValidationException(sprintf("There is not current Selection Plan active on Selection Phase.")); - - $category = $summit->getPresentationCategory(intval($track_id)); - if (is_null($category) || !$category instanceof PresentationCategory || !$category->isChairVisible()) - throw new EntityNotFoundException("Track not found."); - - $authz = $summit->isTrackChair($current_member, $category); - - if(!$authz) - throw new AuthzException("User is not authorized to perform this action"); - - $selection_list = $category->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Individual, $current_member); - if (is_null($selection_list)) - throw new EntityNotFoundException(sprintf("Individual List not found for member %s and category %s", $current_member->getId(), $category->getId())); - - if(!$selection_list->canEdit($current_member)){ - throw new ValidationException(sprintf("Member %s can not edit list %s", $current_member->getId(), $selection_list->getId())); - } - - $presentation = $summit->getEvent($presentation_id); - - if (is_null($presentation) - || !$presentation instanceof Presentation - || $presentation->getStatus() !== Presentation::STATUS_RECEIVED - || $presentation->getProgress() !== Presentation::PHASE_COMPLETE - || $presentation->getSelectionPlanId() !== $selection_plan->getId()) - throw new EntityNotFoundException(sprintf("Presentation %s not found.", $presentation_id)); - - if($category->getId() !== $presentation->getCategoryId()){ - throw new ValidationException(sprintf("Current member can not assign Presentation %s to his/her list [Presentation does not belong to category].", $presentation_id)); - } - - $available_slots = $category->getTrackChairAvailableSlots(); - $highest_order_in_list = $selection_list->getHighestOrderInListByCollection($collection); - - if($collection == SummitSelectedPresentation::CollectionSelected && $highest_order_in_list >= $available_slots) { - // will not add this presentation, list is full - throw new ValidationException(sprintf("Presentation Selection list is full. Currently at %s. Limit is %s.", $highest_order_in_list, $available_slots)); - } - - Log::debug - ( - sprintf - ( - "SummitSelectedPresentationListService::assignPresentationToMyIndividualList list %s available_slots %s highest_order_in_list %s", - $selection_list->getId(), - $available_slots, - $highest_order_in_list - ) - ); - - $selected_presentation = $selection_list->getSelectionByPresentation($presentation); - - if (is_null($selected_presentation)) { - $selected_presentation = new SummitSelectedPresentation; - $selected_presentation->setPresentation($presentation); - $selected_presentation->setMember($current_member); - } - - $former_collection = $selected_presentation->getCollection(); - $selected_presentation->setCollection($collection); - $selected_presentation->setOrder($highest_order_in_list + 1); - $selection_list->addSelection($selected_presentation); - - // reorder list from where it was removed - if (!empty($former_collection) && $former_collection != SummitSelectedPresentation::CollectionPass) { - $left_selections = $selection_list->getSelectedPresentationsByCollection($former_collection); - foreach ($left_selections as $order => $selection) { - $selection->setOrder($order+1); - } - } - - return $selection_list; - }); - } - - /** - * @param Summit $summit - * @param int $track_id - * @param int $presentation_id - * @return SummitSelectedPresentationList - * @throws \Exception - */ - public function removePresentationFromMyIndividualList(Summit $summit, int $track_id, int $presentation_id): SummitSelectedPresentationList - { - return $this->tx_service->transaction(function () use ($summit, $track_id, $presentation_id) { - Log::debug - ( - sprintf - ( - "SummitSelectedPresentationListService::removePresentationFromMyIndividualList summit %s track %s presentation %s", - $summit->getId(), - $track_id, - $presentation_id - ) - ); - - $selection_plan = $summit->getCurrentSelectionPlanByStatus(SelectionPlan::STATUS_SELECTION); - - if(is_null($selection_plan)) - throw new ValidationException(sprintf("There is not current Selection Plan active on Selection Phase.")); - - $category = $summit->getPresentationCategory(intval($track_id)); - if (is_null($category) || !$category instanceof PresentationCategory) throw new EntityNotFoundException("Track not found."); - - $current_member = $this->resource_server_ctx->getCurrentUser(); - - if(is_null($current_member)) - throw new AuthzException("Current Member not found."); - - $auth = $summit->isTrackChair($current_member, $category); - if(!$auth){ - throw new AuthzException("Current user is not allowed to perform this operation."); - } - - $selection_list = $category->getSelectionListByTypeAndOwner(SummitSelectedPresentationList::Individual, $current_member); - if (is_null($selection_list)) - throw new EntityNotFoundException(sprintf("Individual List not found for member %s and category %s", $current_member->getId(), $category->getId())); - - if(!$selection_list->canEdit($current_member)){ - throw new ValidationException(sprintf("Member %s can not edit list %s", $current_member->getId(), $selection_list->getId())); - } - - $presentation = $summit->getEvent($presentation_id); - - if (is_null($presentation) || !$presentation instanceof Presentation) - throw new EntityNotFoundException(sprintf("Presentation %s not found.", $presentation_id)); - - $selection = $selection_list->getSelectionByPresentation($presentation); - if(is_null($selection)) - throw new EntityNotFoundException("Selection not found."); - - $selection_list->removeSelection($selection); - - return $selection_list; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitSelectionPlanService.php b/app/Services/Model/Imp/SummitSelectionPlanService.php deleted file mode 100644 index 9f5498bd..00000000 --- a/app/Services/Model/Imp/SummitSelectionPlanService.php +++ /dev/null @@ -1,497 +0,0 @@ -summit_repository = $summit_repository; - parent::__construct($tx_service); - $this->resource_server_ctx = $resource_server_ctx; - } - - /** - * @param Summit $summit - * @param array $payload - * @return SelectionPlan - * @throws ValidationException - */ - public function addSelectionPlan(Summit $summit, array $payload) - { - return $this->tx_service->transaction(function () use ($summit, $payload) { - - $selection_plan = SummitSelectionPlanFactory::build($payload, $summit); - - $former_selection_plan = $summit->getSelectionPlanByName($selection_plan->getName()); - - if (!is_null($former_selection_plan)) { - throw new ValidationException(trans( - 'validation_errors.SummitSelectionPlanService.addSelectionPlan.alreadyExistName', - [ - 'summit_id' => $summit->getId() - ] - )); - } - - // validate selection plan - - $summit->checkSelectionPlanConflicts($selection_plan); - - $summit->addSelectionPlan($selection_plan); - - return $selection_plan; - }); - } - - /** - * @param Summit $summit - * @param int $selection_plan_id - * @param array $payload - * @return SelectionPlan - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateSelectionPlan(Summit $summit, $selection_plan_id, array $payload) - { - return $this->tx_service->transaction(function () use ($summit, $selection_plan_id, $payload) { - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) - throw new EntityNotFoundException(trans - ('not_found_errors.SummitSelectionPlanService.updateSelectionPlan.SelectionPlanNotFound', - [ - 'selection_plan_id' => $selection_plan_id, - 'summit_id' => $summit->getId() - ] - )); - - if (isset($payload['name'])) { - $former_selection_plan = $summit->getSelectionPlanByName($payload['name']); - if (!is_null($former_selection_plan) && $former_selection_plan->getId() != $selection_plan_id) { - throw new ValidationException(trans( - 'validation_errors.SummitSelectionPlanService.updateSelectionPlan.alreadyExistName', - [ - 'summit_id' => $summit->getId() - ] - )); - } - } - - SummitSelectionPlanFactory::populate($selection_plan, $payload, $summit); - // check conflict on current summits ( selections plans can not conflict inside summit) - $summit->checkSelectionPlanConflicts($selection_plan); - - return $selection_plan; - }); - } - - /** - * @param Summit $summit - * @param int $selection_plan_id - * @return void - * @throws EntityNotFoundException - */ - public function deleteSelectionPlan(Summit $summit, $selection_plan_id) - { - return $this->tx_service->transaction(function () use ($summit, $selection_plan_id) { - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) - throw new EntityNotFoundException(trans - ('not_found_errors.SummitSelectionPlanService.deleteSelectionPlan.SelectionPlanNotFound', - [ - 'selection_plan_id' => $selection_plan_id, - 'summit_id' => $summit->getId() - ] - )); - - $summit->removeSelectionSelectionPlan($selection_plan); - }); - } - - /** - * @param Summit $summit - * @param int $selection_plan_id - * @param int $track_group_id - * @return void - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function addTrackGroupToSelectionPlan(Summit $summit, $selection_plan_id, $track_group_id) - { - return $this->tx_service->transaction(function () use ($summit, $selection_plan_id, $track_group_id) { - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) - throw new EntityNotFoundException(trans - ('not_found_errors.SummitSelectionPlanService.addTrackGroupToSelectionPlan.SelectionPlanNotFound', - [ - 'selection_plan_id' => $selection_plan_id, - 'summit_id' => $summit->getId() - ] - )); - - $track_group = $summit->getCategoryGroupById($track_group_id); - if (is_null($track_group)) - throw new EntityNotFoundException(trans - ('not_found_errors.SummitSelectionPlanService.addTrackGroupToSelectionPlan.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - )); - $selection_plan->addTrackGroup($track_group); - }); - } - - /** - * @param Summit $summit - * @param int $selection_plan_id - * @param int $track_group_id - * @return void - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteTrackGroupToSelectionPlan(Summit $summit, $selection_plan_id, $track_group_id) - { - return $this->tx_service->transaction(function () use ($summit, $selection_plan_id, $track_group_id) { - - $selection_plan = $summit->getSelectionPlanById($selection_plan_id); - if (is_null($selection_plan)) - throw new EntityNotFoundException(trans - ('not_found_errors.SummitSelectionPlanService.deleteTrackGroupToSelectionPlan.SelectionPlanNotFound', - [ - 'selection_plan_id' => $selection_plan_id, - 'summit_id' => $summit->getId() - ] - )); - - $track_group = $summit->getCategoryGroupById($track_group_id); - if (is_null($track_group)) - throw new EntityNotFoundException(trans - ('not_found_errors.SummitSelectionPlanService.deleteTrackGroupToSelectionPlan.TrackGroupNotFound', - [ - 'track_group_id' => $track_group_id, - 'summit_id' => $summit->getId() - ] - )); - $selection_plan->removeTrackGroup($track_group); - }); - } - - /** - * @param Summit $summit - * @param string $status - * @return SelectionPlan|null - * @throws \Exception - */ - public function getCurrentSelectionPlanByStatus(Summit $summit, $status) - { - return $this->tx_service->transaction(function () use ($summit, $status) { - $selection_plan = $summit->getCurrentSelectionPlanByStatus($status); - if (is_null($selection_plan)) - throw new EntityNotFoundException("Selection Plan not found."); - if (!$selection_plan->IsEnabled()) - throw new EntityNotFoundException("Selection Plan not found."); - return $selection_plan; - }); - } - - /** - * @param Summit $summit - * @param int $selection_plan_id - * @param int $presentation_id - * @return Presentation - * @throws \Exception - */ - public function markPresentationAsViewed(Summit $summit, int $selection_plan_id, int $presentation_id): Presentation - { - return $this->tx_service->transaction(function() use($summit, $selection_plan_id, $presentation_id){ - - $current_member = $this->resource_server_ctx->getCurrentUser(); - if(is_null($current_member)) - throw new AuthzException("User not Found"); - - $selection_plan = $summit->getSelectionPlanById(intval($selection_plan_id)); - if (is_null($selection_plan)) - throw new EntityNotFoundException("Selection Plan not found."); - - if(!$selection_plan->isSelectionOpen()) - throw new ValidationException(sprintf("Selection period is not open for selection plan %s", $selection_plan->getId())); - - $presentation = $selection_plan->getPresentation(intval($presentation_id)); - - if(is_null($presentation)) - throw new EntityNotFoundException("Presentation not found."); - - $category = $presentation->getCategory(); - - $summit = $presentation->getSummit(); - - $isAuth = $summit->isTrackChairAdmin($current_member) || $summit->isTrackChair($current_member, $category); - - if(!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - $presentation->addTrackChairView($current_member); - - return $presentation; - }); - } - - /** - * @inheritDoc - */ - public function addPresentationComment - ( - Summit $summit, - int $selection_plan_id, - int $presentation_id, - array $payload - ): SummitPresentationComment - { - return $this->tx_service->transaction(function() use($summit, $selection_plan_id, $presentation_id, $payload){ - - $current_member = $this->resource_server_ctx->getCurrentUser(); - - if(is_null($current_member)) - throw new AuthzException("User not Found"); - - $selection_plan = $summit->getSelectionPlanById(intval($selection_plan_id)); - if (is_null($selection_plan)) - throw new EntityNotFoundException("Selection Plan not found."); - - if(!$selection_plan->isSelectionOpen()) - throw new ValidationException(sprintf("Selection period is not open for selection plan %s", $selection_plan->getId())); - - $presentation = $selection_plan->getPresentation(intval($presentation_id)); - - if(is_null($presentation)) - throw new EntityNotFoundException("Presentation not found."); - - $category = $presentation->getCategory(); - - $summit = $presentation->getSummit(); - - $isAuth = $summit->isTrackChairAdmin($current_member) || $summit->isTrackChair($current_member, $category); - - if(!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - return $presentation->addTrackChairComment($current_member, trim($payload['body']), boolval($payload['is_public'])); - }); - } - - - /** - * @inheritDoc - */ - public function createPresentationCategoryChangeRequest(Summit $summit, int $selection_plan_id, int $presentation_id, int $new_category_id): ?SummitCategoryChange - { - return $this->tx_service->transaction(function() use($summit, $selection_plan_id, $presentation_id, $new_category_id){ - - $current_member = $this->resource_server_ctx->getCurrentUser(); - if(is_null($current_member)) - throw new AuthzException("User not Found"); - - $selection_plan = $summit->getSelectionPlanById(intval($selection_plan_id)); - if (is_null($selection_plan)) - throw new EntityNotFoundException("Selection Plan not found."); - - if(!$selection_plan->isSelectionOpen()) - throw new ValidationException(sprintf("Selection period is not open for selection plan %s", $selection_plan->getId())); - - $presentation = $selection_plan->getPresentation(intval($presentation_id)); - - if(is_null($presentation)) - throw new EntityNotFoundException("Presentation not found."); - - $category = $presentation->getCategory(); - - $summit = $presentation->getSummit(); - - $new_category = $summit->getPresentationCategory($new_category_id); - - if(is_null($new_category) || !$new_category->isChairVisible()) - throw new EntityNotFoundException("New Category not found."); - - $isAuth = $summit->isTrackChairAdmin($current_member) || $summit->isTrackChair($current_member, $category); - - if(!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - $change_request = $presentation->addCategoryChangeRequest($current_member, $new_category); - - $presentation->addTrackChairNotification - ( - $current_member, - sprintf - ( - "%s submitted a request to change the category from %s to %s", - $current_member->getFullName(), - $category->getTitle(), - $new_category->getTitle() - ) - ); - - PresentationCategoryChangeRequestCreatedEmail::dispatch($change_request); - - return $change_request; - }); - - } - - /** - * @inheritDoc - */ - public function resolvePresentationCategoryChangeRequest(Summit $summit, int $selection_plan_id, int $presentation_id, int $category_change_request_id, array $payload): ?SummitCategoryChange - { - return $this->tx_service->transaction(function() use($summit, $selection_plan_id, $presentation_id, $category_change_request_id, $payload){ - - $current_member = $this->resource_server_ctx->getCurrentUser(); - if(is_null($current_member)) - throw new AuthzException("User not Found"); - - $selection_plan = $summit->getSelectionPlanById(intval($selection_plan_id)); - if (is_null($selection_plan)) - throw new EntityNotFoundException("Selection Plan not found."); - - if(!$selection_plan->isSelectionOpen()) - throw new ValidationException(sprintf("Selection period is not open for selection plan %s", $selection_plan->getId())); - - $presentation = $selection_plan->getPresentation(intval($presentation_id)); - - if(is_null($presentation)) - throw new EntityNotFoundException("Presentation not found."); - - $category = $presentation->getCategory(); - - $summit = $presentation->getSummit(); - - $change_request = $presentation->getCategoryChangeRequest($category_change_request_id); - - if(is_null($change_request)) - throw new EntityNotFoundException("Category Change Request not found."); - - if(!$change_request->isPending()){ - throw new ValidationException("Change request has already been approved/rejected."); - } - - $newCategory = $change_request->getNewCategory(); - - $isAuth = $summit->isTrackChairAdmin($current_member) || $summit->isTrackChair($current_member, $newCategory); - - if(!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - if ($presentation->isSelectedByAnyone()) { - throw new ValidationException("The presentation has already been selected by chairs."); - } - - if ($presentation->isGroupSelected()) { - throw new ValidationException("The presentation is on the Team List."); - } - - if ($category->getId() == $newCategory->getId()) { - throw new ValidationException("The presentation is already in this category."); - } - - $approved = (boolean) $payload['approved']; - $reason = $payload['reason'] ?? 'No reason.'; - - if($approved){ - $change_request->approve($current_member, $reason); - $presentation->clearViews();; - $presentation->setCategory($newCategory); - $presentation->addTrackChairNotification - ( - $current_member, - sprintf - ( - "{member} approved %s's request to move this presentation from %s to %s", - $change_request->getRequester()->getFullName(), - $category->getTitle(), - $newCategory->getTitle() - ) - ); - - foreach($presentation->getPendingCategoryChangeRequests() as $pending_request){ - if($pending_request->getId() == $change_request->getId()) continue; - $pending_request->reject($current_member, sprintf( "Request ID %s was approved instead.", $change_request->getId())); - } - } - - else{ - $change_request->reject($current_member, $reason); - $presentation->addTrackChairNotification( - $current_member, - sprintf( - "{member} rejected %s's request to move this presentation from %s to %s because : %s" , - $change_request->getRequester()->getFullName(), - $category->getTitle(), - $newCategory->getTitle(), - $reason - ) - ); - } - - PresentationCategoryChangeRequestResolvedEmail::dispatch($change_request); - - return $change_request; - - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitService.php b/app/Services/Model/Imp/SummitService.php deleted file mode 100644 index fe2f4311..00000000 --- a/app/Services/Model/Imp/SummitService.php +++ /dev/null @@ -1,3191 +0,0 @@ -summit_repository = $summit_repository; - $this->event_repository = $event_repository; - $this->speaker_repository = $speaker_repository; - $this->entity_events_repository = $entity_events_repository; - $this->ticket_repository = $ticket_repository; - $this->member_repository = $member_repository; - $this->attendee_repository = $attendee_repository; - $this->tag_repository = $tag_repository; - $this->rsvp_repository = $rsvp_repository; - $this->calendar_sync_work_request_repository = $calendar_sync_work_request_repository; - $this->eventbrite_api = $eventbrite_api; - $this->company_repository = $company_repository; - $this->group_repository = $group_repository; - $this->default_event_types_repository = $default_event_types_repository; - $this->permissions_manager = $permissions_manager; - $this->file_uploader = $file_uploader; - $this->speaker_service = $speaker_service; - $this->member_service = $member_service; - } - - /** - * @param Summit $summit - * @param Member $member - * @param int $event_id - * @param bool $check_rsvp - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addEventToMemberSchedule(Summit $summit, Member $member, $event_id, $check_rsvp = true) - { - try { - $this->tx_service->transaction(function () use ($summit, $member, $event_id, $check_rsvp) { - - $event = $summit->getScheduleEvent($event_id); - - if (is_null($event)) { - throw new EntityNotFoundException('event not found on summit!'); - } - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException('event not found on summit!'); - - if ($check_rsvp && $event->hasRSVP() && !$event->isExternalRSVP()) - throw new ValidationException("event has rsvp set on it!"); - - $member->add2Schedule($event); - - if ($member->hasSyncInfoFor($summit)) { - Log::info(sprintf("synching externally event id %s", $event_id)); - $sync_info = $member->getSyncInfoBy($summit); - $request = new MemberEventScheduleSummitActionSyncWorkRequest(); - $request->setType(AbstractCalendarSyncWorkRequest::TypeAdd); - $request->setSummitEvent($event); - $request->setOwner($member); - $request->setCalendarSyncInfo($sync_info); - $this->calendar_sync_work_request_repository->add($request); - } - - }); - Event::fire(new MyScheduleAdd($member, $summit, $event_id)); - } catch (UniqueConstraintViolationException $ex) { - throw new ValidationException - ( - sprintf('Event %s already belongs to member %s schedule.', $event_id, $member->getId()) - ); - } - } - - /** - * @param Summit $summit - * @param Member $member - * @param int $event_id - * @param boolean $check_rsvp - * @return void - * @throws \Exception - */ - public function removeEventFromMemberSchedule(Summit $summit, Member $member, $event_id, $check_rsvp = true) - { - $this->tx_service->transaction(function () use ($summit, $member, $event_id, $check_rsvp) { - $event = $summit->getScheduleEvent($event_id); - if (is_null($event)) - throw new EntityNotFoundException('event not found on summit!'); - - if ($check_rsvp && $event->hasRSVP() && !$event->isExternalRSVP()) - throw new ValidationException("event has rsvp set on it!"); - - $member->removeFromSchedule($event); - - if ($member->hasSyncInfoFor($summit)) { - Log::info(sprintf("unsynching externally event id %s", $event_id)); - $sync_info = $member->getSyncInfoBy($summit); - $request = new MemberEventScheduleSummitActionSyncWorkRequest(); - $request->setType(AbstractCalendarSyncWorkRequest::TypeRemove); - $request->setSummitEvent($event); - $request->setOwner($member); - $request->setCalendarSyncInfo($sync_info); - $this->calendar_sync_work_request_repository->add($request); - } - }); - - Event::fire(new MyScheduleRemove($member, $summit, $event_id)); - } - - /** - * @param Summit $summit - * @param Member $member - * @param int $event_id - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function addEventToMemberFavorites(Summit $summit, Member $member, $event_id) - { - try { - $this->tx_service->transaction(function () use ($summit, $member, $event_id) { - $event = $summit->getScheduleEvent($event_id); - if (is_null($event)) { - throw new EntityNotFoundException('event not found on summit!'); - } - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException('event not found on summit!'); - $member->addFavoriteSummitEvent($event); - }); - - Event::fire(new MyFavoritesAdd($member, $summit, $event_id)); - } catch (UniqueConstraintViolationException $ex) { - throw new ValidationException - ( - sprintf('Event %s already belongs to member %s favorites.', $event_id, $member->getId()) - ); - } - } - - /** - * @param Summit $summit - * @param Member $member - * @param int $event_id - * @throws EntityNotFoundException - */ - public function removeEventFromMemberFavorites(Summit $summit, Member $member, $event_id) - { - $this->tx_service->transaction(function () use ($summit, $member, $event_id) { - $event = $summit->getScheduleEvent($event_id); - if (is_null($event)) - throw new EntityNotFoundException('event not found on summit!'); - $member->removeFavoriteSummitEvent($event); - }); - - Event::fire(new MyFavoritesRemove($member, $summit, $event_id)); - } - - /** - * @param Member $member - * @param Summit $summit - * @param int $event_id - * @param array $payload - * @return SummitEventFeedback - * @throws Exception - */ - public function addMyEventFeedback(Member $member, Summit $summit, int $event_id, array $payload): SummitEventFeedback - { - return $this->tx_service->transaction(function () use ($member, $summit, $event_id, $payload) { - - $event = $summit->getScheduleEvent($event_id); - if (is_null($event)) - throw new EntityNotFoundException("Event not found."); - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException("Event not found."); - - if (!$event->isAllowFeedback()) - throw new ValidationException(sprintf("Event id %s does not allow feedback.", $event->getIdentifier())); - - // check older feedback - $former_feedback = $member->getFeedbackByEvent($event); - - if (!is_null($former_feedback)) - throw new ValidationException(sprintf("You already sent feedback for event id %s!.", $event->getIdentifier())); - - $newFeedback = SummitEventFeedbackFactory::build($payload); - $newFeedback->setOwner($member); - $event->addFeedBack($newFeedback); - return $newFeedback; - }); - } - - /** - * @param Member $member - * @param Summit $summit - * @param int $event_id - * @param array $payload - * @return SummitEventFeedback - * @throws Exception - */ - public function updateMyEventFeedback(Member $member, Summit $summit, int $event_id, array $payload): SummitEventFeedback - { - return $this->tx_service->transaction(function () use ($member, $summit, $event_id, $payload) { - - $event = $summit->getScheduleEvent($event_id); - - if (is_null($event)) - throw new EntityNotFoundException("Event not found."); - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException("Event not found."); - - if (!$event->isAllowFeedback()) - throw new ValidationException(sprintf("Event id %s does not allow feedback.", $event->getIdentifier())); - - // check older feedback - $feedback = $member->getFeedbackByEvent($event); - - if (is_null($feedback)) - throw new ValidationException(sprintf("you dont have feedback for event id %s!.", $event->getIdentifier())); - - return SummitEventFeedbackFactory::populate($feedback, $payload); - }); - } - - /** - * @param Member $member - * @param Summit $summit - * @param int $event_id - * @return SummitEventFeedback - * @throws Exception - */ - public function getMyEventFeedback(Member $member, Summit $summit, int $event_id): SummitEventFeedback - { - return $this->tx_service->transaction(function () use ($member, $summit, $event_id) { - - $event = $summit->getScheduleEvent($event_id); - - if (is_null($event)) - throw new EntityNotFoundException("Event not found."); - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException("Event not found."); - - if (!$event->isAllowFeedback()) - throw new ValidationException(sprintf("Event id %s does not allow feedback.", $event->getIdentifier())); - - // check older feedback - $feedback = $member->getFeedbackByEvent($event); - - if (is_null($feedback)) - throw new ValidationException(sprintf("you dont have feedback for event id %s!.", $event->getIdentifier())); - - return $feedback; - }); - } - - /** - * @param Member $member - * @param Summit $summit - * @param int $event_id - * @throws Exception - */ - public function deleteMyEventFeedback(Member $member, Summit $summit, int $event_id): void - { - $this->tx_service->transaction(function () use ($member, $summit, $event_id) { - - $event = $summit->getScheduleEvent($event_id); - if (is_null($event)) - throw new EntityNotFoundException("Event not found."); - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException("Event not found."); - - if (!$event->isAllowFeedback()) - throw new ValidationException(sprintf("Event id %s does not allow feedback.", $event->getIdentifier())); - - // check older feedback - $feedback = $member->getFeedbackByEvent($event); - - $member->removeFeedback($feedback); - - }); - } - - /** - * @param Summit $summit - * @param null|int $member_id - * @param null|\DateTime $from_date - * @param null|int $from_id - * @param int $limit - * @return array - */ - public function getSummitEntityEvents(Summit $summit, $member_id = null, DateTime $from_date = null, $from_id = null, $limit = 25) - { - return $this->tx_service->transaction(function () use ($summit, $member_id, $from_date, $from_id, $limit) { - - $global_last_id = $this->entity_events_repository->getLastEntityEventId($summit); - $from_id = !is_null($from_id) ? intval($from_id) : null; - $member = !is_null($member_id) && $member_id > 0 ? $this->member_repository->getById($member_id) : null; - $ctx = new SummitEntityEventProcessContext($member); - - do { - - $last_event_id = 0; - $last_event_date = 0; - // if we got a from id and its greater than the last one, then break - if (!is_null($from_id) && $global_last_id <= $from_id) break; - - $events = $this->entity_events_repository->getEntityEvents - ( - $summit, - $member_id, - $from_id, - $from_date, - $limit - ); - - foreach ($events as $e) { - - if ($ctx->getListSize() === $limit) break; - - $last_event_id = $e->getId(); - $last_event_date = $e->getCreated(); - try { - $entity_event_type_processor = EntityEventTypeFactory::getInstance()->build($e, $ctx); - $entity_event_type_processor->process(); - } catch (\InvalidArgumentException $ex1) { - Log::info($ex1); - } catch (\Exception $ex) { - Log::error($ex); - } - } - // reset if we do not get any data so far, to get next batch - $from_id = $last_event_id; - $from_date = null; - //post process for summit events , we should send only te last one - $ctx->postProcessList(); - // we do not have any any to process - if ($last_event_id == 0 || $global_last_id <= $last_event_id) break; - } while ($ctx->getListSize() < $limit); - - return array($last_event_id, $last_event_date, $ctx->getListValues()); - }); - } - - /** - * @param Summit $summit - * @param array $data - * @return SummitEvent - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addEvent(Summit $summit, array $data) - { - return $this->saveOrUpdateEvent($summit, $data, null); - } - - /** - * @param Summit $summit - * @param int $event_id - * @param array $data - * @return SummitEvent - */ - public function updateEvent(Summit $summit, $event_id, array $data) - { - return $this->saveOrUpdateEvent($summit, $data, $event_id); - } - - /** - * @param array $data - * @param Summit $summit - * @param SummitEvent $event - * @return SummitEvent - * @throws ValidationException - */ - private function updateEventDates(array $data, Summit $summit, SummitEvent $event) - { - - if (isset($data['start_date']) && isset($data['end_date'])) { - $event->setSummit($summit); - $start_datetime = intval($data['start_date']); - $start_datetime = new \DateTime("@$start_datetime"); - $start_datetime->setTimezone($summit->getTimeZone()); - $end_datetime = intval($data['end_date']); - $end_datetime = new \DateTime("@$end_datetime"); - $end_datetime->setTimezone($summit->getTimeZone()); - $interval_seconds = $end_datetime->getTimestamp() - $start_datetime->getTimestamp(); - $minutes = $interval_seconds / 60; - if ($minutes < self::MIN_EVENT_MINUTES) - throw new ValidationException - ( - sprintf - ( - "event should last at least %s minutes - current duration %s", - self::MIN_EVENT_MINUTES, - $minutes - ) - ); - - // set local time from UTC - $event->setStartDate($start_datetime); - $event->setEndDate($end_datetime); - } - - return $event; - - } - - /** - * @param SummitEventType $old_event_type - * @param SummitEventType $event_type - * @return bool - */ - private function canPerformEventTypeTransition(SummitEventType $old_event_type, SummitEventType $event_type) - { - - if ($old_event_type->getId() == $event_type->getId()) return true; - // cant upgrade from raw event to presentation and vice versa - if ($old_event_type->getClassName() != $event_type->getClassName()) { - return false; - } - - $old_is_private = $old_event_type->isPrivate(); - $new_is_private = $event_type->isPrivate(); - - if ((!$old_is_private && $new_is_private) || ($old_is_private && !$new_is_private)) - return false; - - $old_allow_attach = $old_event_type->isAllowsAttachment(); - $new_allow_attach = $event_type->isAllowsAttachment(); - - if ((!$old_allow_attach && $new_allow_attach) || ($old_allow_attach && !$new_allow_attach)) - return false; - - return true; - } - - - /** - * @param Summit $summit - * @param array $data - * @param null|int $event_id - * @param Member|null $current_member - * @return SummitEvent - * @throws EntityNotFoundException - * @throws ValidationException - * @throws Exception - */ - private function saveOrUpdateEvent(Summit $summit, array $data, $event_id = null) - { - - return $this->tx_service->transaction(function () use ($summit, $data, $event_id) { - - $current_member = ResourceServerContext::getCurrentUser(false); - - if (!is_null($current_member) && !$this->permissions_manager->canEditFields($current_member, 'SummitEvent', $data)) { - throw new ValidationException(sprintf("user %s cant set requested summit event fields", $current_member->getEmail())); - } - - $event_type = null; - - if (isset($data['type_id'])) { - $event_type = $summit->getEventType(intval($data['type_id'])); - if (is_null($event_type)) { - throw new EntityNotFoundException(sprintf("event type id %s does not exists!", $data['type_id'])); - } - } - - $track = null; - - if (isset($data['track_id'])) { - $track = $summit->getPresentationCategory(intval($data['track_id'])); - if (is_null($track)) { - throw new EntityNotFoundException(sprintf("track id %s does not exists!", $data['track_id'])); - } - } - - $location = null; - if (isset($data['location_id'])) { - $location = $summit->getLocation(intval($data['location_id'])); - if (is_null($location) && intval($data['location_id']) > 0) { - throw new EntityNotFoundException(sprintf("location id %s does not exists!", $data['location_id'])); - } - } - - $event = null; - // existing event - - if (!is_null($event_id) && intval($event_id) > 0) { - $event = $this->event_repository->getById($event_id); - if (is_null($event)) - throw new ValidationException(sprintf("event id %s does not exists!", $event_id)); - $old_event_type = $event->getType(); - - // check event type transition ... - - if (!is_null($event_type) && !$this->canPerformEventTypeTransition($old_event_type, $event_type)) { - throw new ValidationException - ( - sprintf - ( - "invalid event type transition for event id %s ( from %s to %s)", - $event_id, - $old_event_type->getType(), - $event_type->getType() - ) - ); - } - if (is_null($event_type)) $event_type = $old_event_type; - } - - - if (is_null($event_id) && is_null($event_type)) { - // is event is new one and we dont provide an event type ... - throw new ValidationException('type_id is mandatory!'); - } - - // new event - if (is_null($event)) { - $event = SummitEventFactory::build($event_type, $summit, $data); - $event->setCreatedBy($current_member); - } - else{ - $event->setSummit($summit); - if (!is_null($event_type)) - $event->setType($event_type); - SummitEventFactory::populate($event, $data); - } - - $event->setUpdatedBy($current_member); - - if (isset($data['rsvp_template_id'])) { - - $rsvp_template = $summit->getRSVPTemplateById(intval($data['rsvp_template_id'])); - - if (is_null($rsvp_template)) - throw new EntityNotFoundException(sprintf('rsvp template id %s does not belongs to summit id %s', $data['rsvp_template_id'], $summit->getId())); - - if (!$rsvp_template->isEnabled()) - throw new ValidationException(sprintf('rsvp template id %s is not enabled', $data['rsvp_template_id'])); - - $event->setRSVPTemplate($rsvp_template); - - $event->setRSVPMaxUserNumber(intval($data['rsvp_max_user_number'])); - $event->setRSVPMaxUserWaitListNumber(intval($data['rsvp_max_user_wait_list_number'])); - } - - if (!is_null($track)) { - $event->setCategory($track); - } - - if (!is_null($location)) - $event->setLocation($location); - - if (is_null($location) && isset($data['location_id'])) { - // clear location - $event->clearLocation(); - } - - $this->updateEventDates($data, $summit, $event); - - if (isset($data['tags'])) { - $event->clearTags(); - foreach ($data['tags'] as $str_tag) { - $tag = $this->tag_repository->getByTag($str_tag); - if ($tag == null) $tag = new Tag($str_tag); - $event->addTag($tag); - } - } - - // sponsors - - $sponsors = ($event_type->isUseSponsors() && isset($data['sponsors'])) ? - $data['sponsors'] : []; - - if ($event_type->isAreSponsorsMandatory() && count($sponsors) == 0) { - throw new ValidationException('sponsors are mandatory!'); - } - - if (isset($data['sponsors'])) { - $event->clearSponsors(); - foreach ($sponsors as $sponsor_id) { - $sponsor = $this->company_repository->getById(intval($sponsor_id)); - if (is_null($sponsor)) throw new EntityNotFoundException(sprintf('sponsor id %s', $sponsor_id)); - $event->addSponsor($sponsor); - } - } - - $this->saveOrUpdatePresentationData($event, $event_type, $data); - $this->saveOrUpdateSummitGroupEventData($event, $event_type, $data); - - if ($event->isPublished()) { - $this->validateBlackOutTimesAndTimes($event); - $event->unPublish(); - $event->publish(); - } - - $this->event_repository->add($event); - - return $event; - }); - } - - private function saveOrUpdateSummitGroupEventData(SummitEvent $event, SummitEventType $event_type, array $data) - { - if (!$event instanceof SummitGroupEvent) return; - - if (!isset($data['groups']) || count($data['groups']) == 0) - throw new ValidationException('groups is required'); - $event->clearGroups(); - - foreach ($data['groups'] as $group_id) { - $group = $this->group_repository->getById(intval($group_id)); - if (is_null($group)) throw new EntityNotFoundException(sprintf('group id %s', $group_id)); - $event->addGroup($group); - } - } - - /** - * @param SummitEvent $event - * @param SummitEventType $event_type - * @param array $data - * @throws EntityNotFoundException - * @throws ValidationException - */ - private function saveOrUpdatePresentationData(SummitEvent $event, SummitEventType $event_type, array $data) - { - if (!$event instanceof Presentation) return; - - // if we are creating the presentation from admin, then - // we should mark it as received and complete - $event->setStatus(Presentation::STATUS_RECEIVED); - $event->setProgress(Presentation::PHASE_COMPLETE); - - // speakers - - if ($event_type instanceof PresentationType && $event_type->isUseSpeakers()) { - $shouldClearSpeakers = isset($data['speakers']) && count($data['speakers']) == 0; - $speakers = $data['speakers'] ?? []; - - if ($event_type->isAreSpeakersMandatory() && count($speakers) == 0) { - throw new ValidationException('Speakers are mandatory.'); - } - - if($shouldClearSpeakers){ - $event->clearSpeakers(); - } - - if (count($speakers) > 0 && $event instanceof Presentation) { - $event->clearSpeakers(); - foreach ($speakers as $speaker_id) { - $speaker = $this->speaker_repository->getById(intval($speaker_id)); - if (is_null($speaker) || !$speaker instanceof PresentationSpeaker) - throw new EntityNotFoundException(sprintf('Speaker id %s.', $speaker_id)); - $event->addSpeaker($speaker); - } - } - } - - // moderator - - if ($event_type instanceof PresentationType && $event_type->isUseModerator()) { - $moderator_id = isset($data['moderator_speaker_id']) ? intval($data['moderator_speaker_id']) : 0; - - if ($event_type->isModeratorMandatory() && $moderator_id == 0) { - throw new ValidationException('moderator_speaker_id is mandatory.'); - } - - if ($moderator_id > 0) { - $speaker_id = intval($data['moderator_speaker_id']); - if ($speaker_id === 0) $event->unsetModerator(); - else { - $moderator = $this->speaker_repository->getById($speaker_id); - if (is_null($moderator) || !$moderator instanceof PresentationSpeaker) - throw new EntityNotFoundException(sprintf('speaker id %s', $speaker_id)); - $event->setModerator($moderator); - } - } - } - - // selection plan - - if (isset($data['selection_plan_id'])) { - $selection_plan_id = intval($data['selection_plan_id']); - $selection_plan = $event->getSummit()->getSelectionPlanById($selection_plan_id); - if (!is_null($selection_plan)) { - $track = $event->getCategory(); - if (!$selection_plan->hasTrack($track)) { - throw new ValidationException - ( - sprintf - ( - "Track %s (%s) does not belongs to Selection Plan %s (%s).", - $track->getTitle(), - $track->getId(), - $selection_plan->getName(), - $selection_plan->getId() - ) - ); - } - $event->setSelectionPlan($selection_plan); - } - } - - PresentationFactory::populate($event, $data, true); - } - - /** - * @param Summit $summit - * @param int $event_id - * @param array $data - * @return SummitEvent - */ - public function publishEvent(Summit $summit, $event_id, array $data) - { - - return $this->tx_service->transaction(function () use ($summit, $data, $event_id) { - - $event = $this->event_repository->getById($event_id); - - if (is_null($event) || !$event instanceof SummitEvent) - throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id)); - - if (is_null($event->getType())) - throw new EntityNotFoundException(sprintf("event type its not assigned to event id %s!", $event_id)); - - if (is_null($event->getSummit())) - throw new EntityNotFoundException(sprintf("summit its not assigned to event id %s!", $event_id)); - - if ($event->getSummit()->getIdentifier() !== $summit->getIdentifier()) - throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier())); - - $this->updateEventDates($data, $summit, $event); - - $start_datetime = $event->getStartDate(); - $end_datetime = $event->getEndDate(); - - if (is_null($start_datetime)) - throw new ValidationException(sprintf("start_date its not assigned to event id %s!", $event_id)); - - if (is_null($end_datetime)) - throw new ValidationException(sprintf("end_date its not assigned to event id %s!", $event_id)); - - if (isset($data['location_id'])) { - $location_id = intval($data['location_id']); - $event->clearLocation(); - if ($location_id > 0) { - $location = $summit->getLocation($location_id); - if (is_null($location)) - throw new EntityNotFoundException(sprintf("location id %s does not exists!", $data['location_id'])); - $event->setLocation($location); - } - } - - $this->validateBlackOutTimesAndTimes($event); - $event->unPublish(); - $event->publish(); - $event->setUpdatedBy(ResourceServerContext::getCurrentUser(false)); - $this->event_repository->add($event); - return $event; - }); - } - - private function validateBlackOutTimesAndTimes(SummitEvent $event) - { - $current_event_location = $event->getLocation(); - - // validate blackout times - $conflict_events = $this->event_repository->getPublishedOnSameTimeFrame($event); - if (!is_null($conflict_events)) { - foreach ($conflict_events as $c_event) { - // if the published event is BlackoutTime or if there is a BlackoutTime event in this timeframe - if ((!is_null($current_event_location) && !$current_event_location->isOverrideBlackouts()) && ($event->getType()->isBlackoutTimes() || $c_event->getType()->isBlackoutTimes()) && $event->getId() != $c_event->getId()) { - throw new ValidationException - ( - sprintf - ( - "You can't publish on this time frame, it conflicts with event id %s", - $c_event->getId() - ) - ); - } - // if trying to publish an event on a slot occupied by another event - if (!is_null($current_event_location) && !is_null($c_event->getLocation()) && $current_event_location->getId() == $c_event->getLocation()->getId() && $event->getId() != $c_event->getId()) { - throw new ValidationException - ( - sprintf - ( - "You can't publish on this time frame, it conflicts with event id %s", - $c_event->getId() - ) - ); - } - - // check speakers collisions - if ($event instanceof Presentation && $c_event instanceof Presentation && $event->getId() != $c_event->getId()) { - foreach ($event->getSpeakers() as $current_speaker) { - foreach ($c_event->getSpeakers() as $c_speaker) { - if (intval($c_speaker->getId()) === intval($current_speaker->getId())) { - throw new ValidationException - ( - sprintf - ( - "You can't publish Event %s (%s) on this timeframe, speaker %s its presention in room %s at this time.", - $event->getTitle(), - $event->getId(), - $current_speaker->getFullName(), - $c_event->getLocationName() - ) - ); - } - } - } - } - - } - } - } - - /** - * @param Summit $summit - * @param int $event_id - * @return mixed - */ - public function unPublishEvent(Summit $summit, $event_id) - { - return $this->tx_service->transaction(function () use ($summit, $event_id) { - - $event = $this->event_repository->getById($event_id); - - if (is_null($event)) - throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id)); - - if ($event->getSummit()->getIdentifier() !== $summit->getIdentifier()) - throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier())); - - $event->unPublish(); - - $event->setUpdatedBy(ResourceServerContext::getCurrentUser(false)); - - return $event; - }); - } - - /** - * @param Summit $summit - * @param int $event_id - * @return mixed - */ - public function deleteEvent(Summit $summit, $event_id) - { - - return $this->tx_service->transaction(function () use ($summit, $event_id) { - - $event = $this->event_repository->getById($event_id); - - if (is_null($event)) - throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id)); - - if ($event->getSummit()->getIdentifier() !== $summit->getIdentifier()) - throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier())); - - - if($event instanceof Presentation){ - $event->clearMediaUploads(); - } - - $this->event_repository->delete($event); - - return true; - }); - } - - /** - * @param Summit $summit - * @param $external_order_id - * @return array - * @throws ValidationException - * @throws EntityNotFoundException - * @throws Exception - */ - public function getExternalOrder(Summit $summit, $external_order_id) - { - try { - $external_order = $this->eventbrite_api->getOrder($external_order_id); - - if (isset($external_order['attendees'])) { - $status = $external_order['status']; - $summit_external_id = $external_order['event_id']; - - if (intval($summit->getSummitExternalId()) !== intval($summit_external_id)) - throw new ValidationException('order %s does not belongs to current summit!', $external_order_id); - - if ($status !== 'placed') - throw new ValidationException(sprintf('invalid order status %s for order %s', $status, $external_order_id)); - - $attendees = array(); - foreach ($external_order['attendees'] as $a) { - - $ticket_external_id = intval($a['ticket_class_id']); - $ticket_type = $summit->getTicketTypeByExternalId($ticket_external_id); - $external_attendee_id = $a['id']; - - if (is_null($ticket_type)) - throw new EntityNotFoundException(sprintf('external ticket type %s not found!', $ticket_external_id)); - - $old_ticket = $this->ticket_repository->getByExternalOrderIdAndExternalAttendeeId - ( - trim($external_order_id), $external_attendee_id - ); - - if (!is_null($old_ticket)) continue; - - $attendees[] = [ - 'external_id' => intval($a['id']), - 'first_name' => $a['profile']['first_name'], - 'last_name' => $a['profile']['last_name'], - 'email' => $a['profile']['email'], - 'company' => isset($a['profile']['company']) ? $a['profile']['company'] : null, - 'job_title' => isset($a['profile']['job_title']) ? $a['profile']['job_title'] : null, - 'status' => $a['status'], - 'ticket_type' => [ - 'id' => intval($ticket_type->getId()), - 'name' => $ticket_type->getName(), - 'external_id' => $ticket_external_id, - ] - ]; - } - if (count($attendees) === 0) - throw new ValidationException(sprintf('order %s already redeem!', $external_order_id)); - - return array('id' => intval($external_order_id), 'attendees' => $attendees); - } - } catch (ClientException $ex1) { - if ($ex1->getCode() === 400) - throw new EntityNotFoundException('external order does not exists!'); - if ($ex1->getCode() === 403) - throw new EntityNotFoundException('external order does not exists!'); - throw $ex1; - } catch (Exception $ex) { - throw $ex; - } - } - - /** - * @param ConfirmationExternalOrderRequest $request - * @return SummitAttendee - */ - public function confirmExternalOrderAttendee(ConfirmationExternalOrderRequest $request) - { - return $this->tx_service->transaction(function () use ($request) { - - try { - - $external_order = $this->eventbrite_api->getOrder($request->getExternalOrderId()); - - if (isset($external_order['attendees'])) { - - $summit_external_id = $external_order['event_id']; - - if (intval($request->getSummit()->getSummitExternalId()) !== intval($summit_external_id)) - throw new ValidationException('order %s does not belongs to current summit!', $request->getExternalOrderId()); - - $external_attendee = null; - foreach ($external_order['attendees'] as $a) { - if (intval($a['id']) === intval($request->getExternalAttendeeId())) { - $external_attendee = $a; - break; - } - } - - if (is_null($external_attendee)) - throw new EntityNotFoundException(sprintf('attendee %s not found!', $request->getExternalAttendeeId())); - - $ticket_external_id = intval($external_attendee['ticket_class_id']); - $ticket_type = $request->getSummit()->getTicketTypeByExternalId($ticket_external_id); - - if (is_null($ticket_type)) - throw new EntityNotFoundException(sprintf('ticket type %s not found!', $ticket_external_id));; - - $status = $external_order['status']; - if ($status !== 'placed') - throw new ValidationException(sprintf('invalid order status %s for order %s', $status, $request->getExternalOrderId())); - - $old_attendee = $request->getSummit()->getAttendeeByMemberId($request->getMemberId()); - - if (!is_null($old_attendee)) - throw new ValidationException - ( - 'attendee already exists for current summit!' - ); - - $old_ticket = $this->ticket_repository->getByExternalOrderIdAndExternalAttendeeId( - $request->getExternalOrderId(), - $request->getExternalAttendeeId() - ); - - if (!is_null($old_ticket)) - throw new ValidationException - ( - sprintf - ( - 'order %s already redeem for attendee id %s !', - $request->getExternalOrderId(), - $request->getExternalAttendeeId() - ) - ); - - $ticket = new SummitAttendeeTicket; - $ticket->setExternalOrderId($request->getExternalOrderId()); - $ticket->setExternalAttendeeId($request->getExternalAttendeeId()); - $ticket->setBoughtDate(new DateTime($external_attendee['created'])); - $ticket->setChangedDate(new DateTime($external_attendee['changed'])); - $ticket->setTicketType($ticket_type); - - $attendee = new SummitAttendee; - $attendee->setMember($this->member_repository->getById($request->getMemberId())); - $attendee->setSummit($request->getSummit()); - $attendee->addTicket($ticket); - $attendee->updateStatus(); - $this->attendee_repository->add($attendee); - - return $attendee; - } - } catch (ClientException $ex1) { - if ($ex1->getCode() === 400) - throw new EntityNotFoundException('external order does not exists!'); - if ($ex1->getCode() === 403) - throw new EntityNotFoundException('external order does not exists!'); - throw $ex1; - } catch (Exception $ex) { - throw $ex; - } - - }); - } - - /** - * @param Summit $summit - * @param int $event_id - * @param UploadedFile $file - * @param int $max_file_size - * @return File - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addEventAttachment(Summit $summit, $event_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($summit, $event_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - - $event = $summit->getEvent($event_id); - - if (is_null($event)) { - throw new EntityNotFoundException('event not found on summit!'); - } - - if (!$event instanceof SummitEventWithFile) { - throw new ValidationException(sprintf("event id %s does not allow attachments!", $event_id)); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif','pdf')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $attachment = $this->file_uploader->build($file, 'summit-event-attachments', true); - $event->setAttachment($attachment); - - return $attachment; - }); - } - - /** - * @param Summit $summit - * @param Filter $filter - * @return SummitScheduleEmptySpot[] - */ - public function getSummitScheduleEmptySpots - ( - Summit $summit, - Filter $filter - ) - { - return $this->tx_service->transaction(function () use ( - $summit, - $filter - ) { - $gaps = []; - $order = new Order([ - OrderElement::buildAscFor("location_id"), - OrderElement::buildAscFor("start_date"), - ]); - - // parse locations ids - - if (!$filter->hasFilter('location_id')) - throw new ValidationException("missing required filter location_id"); - - $location_ids = $filter->getFilterCollectionByField('location_id'); - - // parse start_date filter - $start_datetime_filter = $filter->getFilter('start_date'); - if (is_null($start_datetime_filter)) - throw new ValidationException("missing required filter start_date"); - $start_datetime_unix = intval($start_datetime_filter[0]->getValue()); - $start_datetime = new \DateTime("@$start_datetime_unix"); - // parse end_date filter - $end_datetime_filter = $filter->getFilter('end_date'); - if (is_null($end_datetime_filter)) - throw new ValidationException("missing required filter end_date"); - $end_datetime_unix = intval($end_datetime_filter[0]->getValue()); - $end_datetime = new \DateTime("@$end_datetime_unix"); - // gap size filter - - $gap_size_filter = $filter->getFilter('gap'); - if (is_null($end_datetime_filter)) - throw new ValidationException("missing required filter gap"); - - $gap_size = $gap_size_filter[0]; - - $summit_time_zone = $summit->getTimeZone(); - $start_datetime->setTimezone($summit_time_zone); - $end_datetime->setTimezone($summit_time_zone); - - $intervals = IntervalParser::getInterval($start_datetime, $end_datetime); - - foreach ($location_ids as $location_id) { - - foreach ($intervals as $interval) { - - $events_filter = new Filter(); - $events_filter->addFilterCondition(FilterParser::buildFilter('published', '==', '1')); - $events_filter->addFilterCondition(FilterParser::buildFilter('summit_id', '==', $summit->getId())); - $events_filter->addFilterCondition(FilterParser::buildFilter('location_id', '==', intval($location_id))); - - $events_filter->addFilterCondition(FilterParser::buildFilter('start_date', '<', $interval[1]->getTimestamp())); - $events_filter->addFilterCondition(FilterParser::buildFilter('end_date', '>', $interval[0]->getTimestamp())); - - $paging_response = $this->event_repository->getAllByPage - ( - new PagingInfo(1, PHP_INT_MAX), - $events_filter, - $order - ); - - $gap_start_date = $interval[0]; - $gap_end_date = clone $gap_start_date; - // check published items - foreach ($paging_response->getItems() as $event) { - - while - ( - ( - $gap_end_date->getTimestamp() + (self::MIN_EVENT_MINUTES * 60) - ) - <= $event->getLocalStartDate()->getTimestamp() - ) { - $max_gap_end_date = clone $gap_end_date; - $max_gap_end_date->setTime(23, 59, 59); - if ($gap_end_date->getTimestamp() + (self::MIN_EVENT_MINUTES * 60) > $max_gap_end_date->getTimestamp()) break; - $gap_end_date->add(new DateInterval('PT' . self::MIN_EVENT_MINUTES . 'M')); - } - - if ($gap_start_date->getTimestamp() == $gap_end_date->getTimestamp()) { - // no gap! - $gap_start_date = $event->getLocalEndDate(); - $gap_end_date = clone $gap_start_date; - continue; - } - - // check min gap ... - if (self::checkGapCriteria($gap_size, $gap_end_date->diff($gap_start_date))) - $gaps[] = new SummitScheduleEmptySpot($location_id, $gap_start_date, $gap_end_date); - $gap_start_date = $event->getLocalEndDate(); - $gap_end_date = clone $gap_start_date; - } - - // check last possible gap ( from last $gap_start_date till $interval[1] - - if ($gap_start_date < $interval[1]) { - // last possible gap - if (self::checkGapCriteria($gap_size, $interval[1]->diff($gap_start_date))) - $gaps[] = new SummitScheduleEmptySpot($location_id, $gap_start_date, $interval[1]); - } - } - } - - return $gaps; - - }); - } - - - /** - * @param FilterElement $gap_size_criteria - * @param DateInterval $interval - * @return bool - */ - private static function checkGapCriteria - ( - FilterElement $gap_size_criteria, - DateInterval $interval - ) - { - $total_minutes = $interval->days * 24 * 60; - $total_minutes += $interval->h * 60; - $total_minutes += $interval->i; - - switch ($gap_size_criteria->getOperator()) { - case '=': - { - return intval($gap_size_criteria->getValue()) == $total_minutes; - } - break; - case '<': - { - return $total_minutes < intval($gap_size_criteria->getValue()); - } - break; - case '>': - { - return $total_minutes > intval($gap_size_criteria->getValue()); - } - break; - case '<=': - { - return $total_minutes <= intval($gap_size_criteria->getValue()); - } - break; - case '>=': - { - return $total_minutes >= intval($gap_size_criteria->getValue()); - } - break; - } - return false; - } - - /** - * @param Summit $summit - * @param array $data - * @return bool - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function unPublishEvents(Summit $summit, array $data) - { - return $this->tx_service->transaction(function () use ( - $summit, - $data - ) { - foreach ($data['events'] as $event_id) { - $this->unPublishEvent($summit, intval($event_id)); - } - - return true; - }); - } - - /** - * @param Summit $summit - * @param array $data - * @return bool - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateAndPublishEvents(Summit $summit, array $data) - { - return $this->tx_service->transaction(function () use ( - $summit, - $data - ) { - foreach ($data['events'] as $event_data) { - $this->updateEvent($summit, intval($event_data['id']), $event_data); - $this->publishEvent($summit, intval($event_data['id']), $event_data); - } - - return true; - }); - } - - /** - * @param Summit $summit - * @param array $data - * @return bool - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateEvents(Summit $summit, array $data) - { - return $this->tx_service->transaction(function () use ( - $summit, - $data - ) { - foreach ($data['events'] as $event_data) { - $this->updateEvent($summit, intval($event_data['id']), $event_data); - } - - return true; - }); - } - - /** - * @param array $data - * @return Summit - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addSummit(array $data) - { - return $this->tx_service->transaction(function () use ($data) { - - $name = trim($data['name']); - $former_summit = $this->summit_repository->getByName($name); - if (!is_null($former_summit)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitService.AddSummit.NameAlreadyExists', - ['name' => $name] - ) - ); - } - - $slug = $data['slug'] ?? null; - if (!empty($slug)) { - // check if exist another summit with that slug - - $old_summit = $this->summit_repository->getBySlug(trim($slug)); - if (!is_null($old_summit)) { - throw new ValidationException(sprintf("slug %s already belongs to another summit", $slug)); - } - } - - $summit = SummitFactory::build($data); - - // seed default event types - foreach ($this->default_event_types_repository->getAll() as $default_event_type) { - $summit->addEventType($default_event_type->buildType($summit)); - } - - $summit->seedDefaultEmailFlowEvents(); - - $summit->seedDefaultAccessLevelTypes(); - - $this->summit_repository->add($summit); - - return $summit; - - }); - } - - /** - * @param int $summit_id - * @param array $data - * @return Summit - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateSummit($summit_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit_id, $data) { - - if (isset($data['name'])) { - - $former_summit = $this->summit_repository->getByName(trim($data['name'])); - if (!is_null($former_summit) && $former_summit->getId() != $summit_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitService.updateSummit.NameAlreadyExists', - ['name' => $data['name']] - ) - ); - } - } - - if (isset($data['active'])) { - $active = boolval($data['active']); - $active_summit = $this->summit_repository->getActive(); - if ($active && !is_null($active_summit) && $active_summit->getId() != $summit_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitService.updateSummit.SummitAlreadyActive', - ['active_summit_id' => $active_summit->getId()] - ) - ); - } - } - - $slug = $data['slug'] ?? null; - if (!empty($slug)) { - // check if exist another summit with that slug - - $old_summit = $this->summit_repository->getBySlug(trim($slug)); - if (!is_null($old_summit) && $summit_id != $old_summit->getId()) { - throw new ValidationException(sprintf("slug %s already belongs to another summit", $slug)); - } - } - - $summit = $this->summit_repository->getById($summit_id); - - if (is_null($summit)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.SummitService.updateSummit.SummitNotFound', - ['summit_id' => $summit_id] - ) - ); - } - - $summit = SummitFactory::populate($summit, $data); - - Event::fire(new SummitUpdated($summit_id)); - - return $summit; - }); - } - - /** - * @param int $summit_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteSummit($summit_id) - { - return $this->tx_service->transaction(function () use ($summit_id) { - - $summit = $this->summit_repository->getById($summit_id); - - if (is_null($summit)) { - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.SummitService.deleteSummit.SummitNotFound', - ['summit_id' => $summit_id] - ) - ); - } - - $summit->markAsDeleted(); - $this->summit_repository->delete($summit); - - Event::fire(new SummitDeleted($summit_id)); - - }); - } - - /** - * @param int $current_member_id - * @param int $speaker_id - * @param int $presentation_id - * @return Presentation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addSpeaker2Presentation(int $current_member_id, int $speaker_id, int $presentation_id):Presentation - { - return $this->tx_service->transaction(function () use ($current_member_id, $speaker_id, $presentation_id) { - $current_member = $this->member_repository->getById($current_member_id); - if (is_null($current_member) || !($current_member instanceof Member)) - throw new EntityNotFoundException(sprintf("member %s not found", $current_member_id)); - - $current_speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($current_speaker)) - throw new EntityNotFoundException(sprintf("member %s does not has a speaker profile", $current_member_id)); - - $presentation = $this->event_repository->getById($presentation_id); - if (is_null($presentation)) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation->canEdit($current_speaker)) - throw new ValidationException(sprintf("member %s can not edit presentation %s", - $current_member_id, - $presentation_id - )); - - $speaker = $this->speaker_repository->getById(intval($speaker_id)); - if (is_null($speaker) || !($speaker instanceof PresentationSpeaker)) - throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - if (!$presentation->isCompleted()) - $presentation->setProgress(Presentation::PHASE_SPEAKERS); - - $presentation->addSpeaker($speaker); - - if($speaker->getMemberId() != $presentation->getCreatedById()) - PresentationSpeakerNotificationEmail::dispatch($speaker, $presentation); - - return $presentation; - }); - } - - /** - * @param int $current_member_id - * @param int $speaker_id - * @param int $presentation_id - * @return Presentation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removeSpeakerFromPresentation(int $current_member_id, int $speaker_id, int $presentation_id):Presentation - { - return $this->tx_service->transaction(function () use ($current_member_id, $speaker_id, $presentation_id) { - - $current_member = $this->member_repository->getById($current_member_id); - if (is_null($current_member) || !($current_member instanceof Member)) - throw new EntityNotFoundException(sprintf("member %s not found", $current_member_id)); - - $current_speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($current_speaker)) - throw new EntityNotFoundException(sprintf("member %s does not has a speaker profile", $current_member_id)); - - $presentation = $this->event_repository->getById($presentation_id); - if (is_null($presentation)) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation->canEdit($current_speaker)) - throw new ValidationException(sprintf("member %s can not edit presentation %s", - $current_member_id, - $presentation_id - )); - - $speaker = $this->speaker_repository->getById(intval($speaker_id)); - if (is_null($speaker) || !($speaker instanceof PresentationSpeaker)) - throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - - if (!$presentation->isCompleted()) - $presentation->setProgress(Presentation::PHASE_SPEAKERS); - - $presentation->removeSpeaker($speaker); - - return $presentation; - }); - } - - /** - * @param int $current_member_id - * @param int $speaker_id - * @param int $presentation_id - * @return Presentation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addModerator2Presentation(int $current_member_id, int $speaker_id, int $presentation_id):Presentation - { - return $this->tx_service->transaction(function () use ($current_member_id, $speaker_id, $presentation_id) { - $current_member = $this->member_repository->getById($current_member_id); - if (is_null($current_member) || !($current_member instanceof Member)) - throw new EntityNotFoundException(sprintf("member %s not found", $current_member_id)); - - $current_speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($current_speaker)) - throw new EntityNotFoundException(sprintf("member %s does not has a speaker profile", $current_member_id)); - - $presentation = $this->event_repository->getById($presentation_id); - if (is_null($presentation)) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation->canEdit($current_speaker)) - throw new ValidationException(sprintf("member %s can not edit presentation %s", - $current_member_id, - $presentation_id - )); - - $speaker = $this->speaker_repository->getById(intval($speaker_id)); - if (is_null($speaker) || !($speaker instanceof PresentationSpeaker)) - throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - - if (!$presentation->isCompleted()) - $presentation->setProgress(Presentation::PHASE_SPEAKERS); - - $presentation->setModerator($speaker); - - if($speaker->getMemberId() != $presentation->getCreatedById()) - PresentationModeratorNotificationEmail::dispatch($speaker, $presentation); - - return $presentation; - }); - } - - /** - * @param int $current_member_id - * @param int $speaker_id - * @param int $presentation_id - * @return Presentation - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removeModeratorFromPresentation(int $current_member_id, int $speaker_id, int $presentation_id):Presentation - { - return $this->tx_service->transaction(function () use ($current_member_id, $speaker_id, $presentation_id) { - - $current_member = $this->member_repository->getById($current_member_id); - if (is_null($current_member) || !($current_member instanceof Member)) - throw new EntityNotFoundException(sprintf("member %s not found", $current_member_id)); - - $current_speaker = $this->speaker_repository->getByMember($current_member); - if (is_null($current_speaker)) - throw new EntityNotFoundException(sprintf("member %s does not has a speaker profile", $current_member_id)); - - $presentation = $this->event_repository->getById($presentation_id); - if (is_null($presentation)) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation instanceof Presentation) - throw new EntityNotFoundException(sprintf("presentation %s not found", $presentation_id)); - - if (!$presentation->canEdit($current_speaker)) - throw new ValidationException(sprintf("member %s can not edit presentation %s", - $current_member_id, - $presentation_id - )); - - $speaker = $this->speaker_repository->getById(intval($speaker_id)); - if (is_null($speaker) || !($speaker instanceof PresentationSpeaker)) - throw new EntityNotFoundException(sprintf('speaker %s not found', $speaker_id)); - - if (!$presentation->isCompleted()) - $presentation->setProgress(Presentation::PHASE_SPEAKERS); - - $presentation->unsetModerator(); - - return $presentation; - }); - } - - /** - * @param Summit $summit - * @param int $event_id - * @return SummitEvent - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function cloneEvent(Summit $summit, int $event_id): SummitEvent - { - return $this->tx_service->transaction(function () use ($summit, $event_id) { - - $event = $this->event_repository->getById($event_id); - if (is_null($event)) - throw new EntityNotFoundException(sprintf("event %s not found!", $event_id)); - - if ($event instanceof Presentation) - throw new ValidationException(sprintf("event %s is not allowed to be cloned!", $event_id)); - - $eventClone = SummitEventFactory::build($event->getType(), $summit); - - $eventClone->setTitle($event->getTitle()); - $eventClone->setAbstract($event->getAbstract()); - $eventClone->setLocation($event->getLocation()); - $eventClone->setAllowFeedBack($event->getAllowFeedback()); - $eventClone->setSocialSummary($event->getSocialSummary()); - $eventClone->setStartDate($event->getLocalStartDate()); - $eventClone->setEndDate($event->getLocalEndDate()); - $eventClone->setCategory($event->getCategory()); - $eventClone->setEtherpadLink($event->getEtherpadLink()); - $eventClone->setStreamingUrl($event->getStreamingUrl()); - $eventClone->setCreatedBy(ResourceServerContext::getCurrentUser(false)); - $eventClone->setUpdatedBy(ResourceServerContext::getCurrentUser(false)); - - if ($event->hasRSVPTemplate()) { - $eventClone->setRSVPTemplate($event->getRSVPTemplate()); - } - - if ($event->isExternalRSVP()) { - $eventClone->setRSVPLink($event->getRSVPLink()); - } - - foreach ($event->getSponsors() as $sponsor) { - $eventClone->addSponsor($sponsor); - } - - foreach ($event->getTags() as $tag) { - $eventClone->addTag($tag); - } - - // check if SummitEventWithFile - - if ($event instanceof SummitEventWithFile && $event->hasAttachment()) { - $eventClone->setAttachment($event->getAttachment()); - } - - $this->event_repository->add($eventClone); - - return $eventClone; - - }); - } - - /** - * @param Summit $summit - * @param array $payload - * @return SummitBookableVenueRoomAttributeType - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function addBookableRoomAttribute(Summit $summit, array $payload): SummitBookableVenueRoomAttributeType - { - return $this->tx_service->transaction(function () use ($summit, $payload) { - - $type_name = trim($payload['type']); - $former_type = $summit->getBookableAttributeTypeByTypeName($type_name); - if (!is_null($former_type)) - throw new ValidationException(sprintf("bookable room attr type %s already exists on summit %s", $type_name, $summit->getId())); - - $type = new SummitBookableVenueRoomAttributeType(); - $type->setType($type_name); - - $summit->addMeetingBookingRoomAllowedAttribute($type); - - return $type; - - }); - } - - /** - * @param Summit $summit - * @param int $type_id - * @param array $payload - * @return SummitBookableVenueRoomAttributeType - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateBookableRoomAttribute(Summit $summit, int $type_id, array $payload): SummitBookableVenueRoomAttributeType - { - return $this->tx_service->transaction(function () use ($summit, $type_id, $payload) { - $type = $summit->getBookableAttributeTypeById($type_id); - if (is_null($type)) - throw new EntityNotFoundException(); - - $type_name = trim($payload['type']); - $former_type = $summit->getBookableAttributeTypeByTypeName($type_name); - if (!is_null($former_type) && $type_id != $former_type->getId()) - throw new ValidationException(sprintf("bookable room attr type %s already exists on summit %s", $type_name, $summit->getId())); - - $type->setType($type_name); - - return $type; - - }); - } - - /** - * @param Summit $summit - * @param int $type_id - * @return void - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteBookableRoomAttribute(Summit $summit, int $type_id): void - { - $this->tx_service->transaction(function () use ($summit, $type_id) { - $type = $summit->getBookableAttributeTypeById($type_id); - if (is_null($type)) - throw new EntityNotFoundException(); - - $summit->removeMeetingBookingRoomAllowedAttribute($type); - }); - } - - /** - * @param Summit $summit - * @param int $type_id - * @param array $payload - * @return SummitBookableVenueRoomAttributeValue - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function addBookableRoomAttributeValue(Summit $summit, int $type_id, array $payload): SummitBookableVenueRoomAttributeValue - { - return $this->tx_service->transaction(function () use ($summit, $type_id, $payload) { - - $type = $summit->getBookableAttributeTypeById($type_id); - if (is_null($type)) - throw new EntityNotFoundException(); - - $value_name = trim($payload['value']); - $former_value = $type->getValueByValue($value_name); - if (!is_null($former_value)) - throw new ValidationException(sprintf("bookable room attr value %s already exists on summit %s", $value_name, $summit->getId())); - - $value = new SummitBookableVenueRoomAttributeValue(); - $value->setValue($value_name); - $type->addValue($value); - - return $value; - - }); - } - - /** - * @param Summit $summit - * @param int $type_id - * @param int $value_id - * @param array $payload - * @return SummitBookableVenueRoomAttributeValue - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function updateBookableRoomAttributeValue(Summit $summit, int $type_id, int $value_id, array $payload): SummitBookableVenueRoomAttributeValue - { - return $this->tx_service->transaction(function () use ($summit, $type_id, $value_id, $payload) { - - $type = $summit->getBookableAttributeTypeById($type_id); - if (is_null($type)) - throw new EntityNotFoundException(); - - $value = $type->getValueById($value_id); - if (is_null($value)) - throw new EntityNotFoundException(); - - $value_name = trim($payload['value']); - $former_value = $type->getValueByValue($value_name); - if (!is_null($former_value) && $value_id != $former_value->getId()) - throw new ValidationException(sprintf("bookable room attr value %s already exists on summit %s", $value_name, $summit->getId())); - - $value->setValue($value_name); - - return $value; - - }); - } - - /** - * @param Summit $summit - * @param int $type_id - * @param int $value_id - * @return void - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteBookableRoomAttributeValue(Summit $summit, int $type_id, int $value_id): void - { - $this->tx_service->transaction(function () use ($summit, $type_id, $value_id) { - - $type = $summit->getBookableAttributeTypeById($type_id); - if (is_null($type)) - throw new EntityNotFoundException(); - - $value = $type->getValueById($value_id); - if (is_null($value)) - throw new EntityNotFoundException(); - - $type->removeValue($value); - - }); - } - - - /** - * @param int $summit_id - * @param UploadedFile $file - * @param int $max_file_size - * @return File - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addSummitLogo(int $summit_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($summit_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'jfif']; - - $summit = $this->summit_repository->getById($summit_id); - - if (is_null($summit) || !$summit instanceof Summit) { - throw new EntityNotFoundException('summit not found!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException(sprintf("file does not has a valid extension (%s).", implode(",", $allowed_extensions))); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $photo = $this->file_uploader->build($file, sprintf('summits/%s', $summit->getId()), true); - $summit->setLogo($photo); - - return $photo; - }); - } - - /** - * @param int $summit_id - * @throws ValidationException - * @throws EntityNotFoundException - */ - public function deleteSummitLogo(int $summit_id): void - { - $this->tx_service->transaction(function () use ($summit_id) { - - $summit = $this->summit_repository->getById($summit_id); - - if (is_null($summit) || !$summit instanceof Summit) { - throw new EntityNotFoundException('summit not found!'); - } - - $summit->clearLogo(); - }); - } - - /** - * @param Summit $summit - * @param Member $member - * @param int $event_id - * @param array $data - * @return RSVP - * @throws Exception - */ - public function addRSVP(Summit $summit, Member $member, int $event_id, array $data): RSVP - { - $rsvp = $this->tx_service->transaction(function () use ($summit, $member, $event_id, $data) { - - $event = $this->event_repository->getByIdExclusiveLock($event_id); - - if (is_null($event) || !$event instanceof SummitEvent) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - if ($event->getSummitId() != $summit->getId()) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException('Event not found on summit.'); - - if (!$event->hasRSVPTemplate()) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - // add to schedule the RSVP event - if (!$member->isOnSchedule($event)) { - $this->addEventToMemberSchedule($summit, $member, $event_id, false); - } - - $old_rsvp = $member->getRsvpByEvent($event_id); - - if (!is_null($old_rsvp)) - throw new ValidationException - ( - sprintf - ( - "Member %s already submitted an rsvp for event %s on summit %s.", - $member->getId(), - $event_id, - $summit->getId() - ) - ); - - // create RSVP - - return SummitRSVPFactory::build($event, $member, $data); - }); - - Event::fire(new RSVPCreated($rsvp)); - - return $rsvp; - } - - /** - * @param Summit $summit - * @param Member $member - * @param int $event_id - * @param array $data - * @return RSVP - * @throws Exception - */ - public function updateRSVP(Summit $summit, Member $member, int $event_id, array $data): RSVP - { - return $this->tx_service->transaction(function () use ($summit, $member, $event_id, $data) { - - $event = $this->event_repository->getByIdExclusiveLock($event_id); - - if (is_null($event) || !$event instanceof SummitEvent) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - if ($event->getSummitId() != $summit->getId()) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException('Event not found on summit.'); - - if (!$event->hasRSVPTemplate()) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - // add to schedule the RSVP event - if (!$member->isOnSchedule($event)) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - $rsvp = $member->getRsvpByEvent($event->getId()); - - if (is_null($rsvp)) - throw new ValidationException - ( - sprintf - ( - "Member %s did not submitted an rsvp for event %s on summit %s.", - $member->getId(), - $event_id, - $summit->getId() - ) - ); - - // update RSVP - - $rsvp = SummitRSVPFactory::populate($rsvp, $event, $member, $data); - - Event::fire(new RSVPUpdated($rsvp)); - - return $rsvp; - }); - } - - /** - * @param Summit $summit - * @param Member $member - * @param int $event_id - * @return bool|mixed - * @throws Exception - */ - public function unRSVPEvent(Summit $summit, Member $member, int $event_id) - { - return $this->tx_service->transaction(function () use ($summit, $member, $event_id) { - - $event = $this->event_repository->getByIdExclusiveLock($event_id); - - if (is_null($event) || !$event instanceof SummitEvent) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - if ($event->getSummitId() != $summit->getId()) { - throw new EntityNotFoundException('Event not found on summit.'); - } - - if (!Summit::allowToSee($event, $member)) - throw new EntityNotFoundException('Event not found on summit.'); - - $rsvp = $member->getRsvpByEvent($event_id); - - if (is_null($rsvp)) - throw new ValidationException(sprintf("RSVP for event id %s does not exist for your member.", $event_id)); - - $this->rsvp_repository->delete($rsvp); - - $this->removeEventFromMemberSchedule($summit, $member, $event_id, false); - - return true; - }); - } - - /** - * @param Summit $summit - * @param Member $member - * @return PersonalCalendarShareInfo|null - * @throws Exception - */ - public function createScheduleShareableLink(Summit $summit, Member $member): ?PersonalCalendarShareInfo - { - return $this->tx_service->transaction(function () use ($summit, $member) { - return $member->createScheduleShareableLink($summit); - }); - } - - /** - * @param Summit $summit - * @param Member $member - * @return PersonalCalendarShareInfo|null - * @throws Exception - */ - public function revokeScheduleShareableLink(Summit $summit, Member $member): ?PersonalCalendarShareInfo - { - return $this->tx_service->transaction(function () use ($summit, $member) { - $link = $member->getScheduleShareableLinkBy($summit); - if (is_null($link)) { - throw new EntityNotFoundException("Schedule shareable link not found for member."); - } - $link->revoke(); - return $link; - }); - } - - /** - * @param Summit $summit - * @param string $cid - * @return string - * @throws Exception - */ - public function buildICSFeed(Summit $summit, string $cid): string - { - - return $this->tx_service->transaction(function () use ($summit, $cid) { - $link = $summit->getScheduleShareableLinkById($cid); - if (is_null($link)) { - throw new EntityNotFoundException("Schedule shareable link not found for member."); - } - $owner = $link->getOwner(); - $timeZone = $summit->getTimeZone(); - - $vCalendar = ICalTimeZoneBuilder::build($timeZone, $summit->getName(), true); - foreach ($owner->getScheduleBySummit($summit) as $scheduled) { - $summitEvent = $scheduled->getEvent(); - $local_start_time = new DateTime($summitEvent->getStartDateNice(), $timeZone); - $local_end_time = new DateTime($summitEvent->getEndDateNice(), $timeZone); - $vEvent = new \Eluceo\iCal\Component\Event($summitEvent->getId()); - - $vEvent - ->setCreated(new DateTime()) - ->setDtStart($local_start_time) - ->setDtEnd($local_end_time) - ->setNoTime(false) - ->setSummary($summitEvent->getTitle()) - ->setDescription(strip_tags($summitEvent->getAbstract())) - ->setDescriptionHTML($summitEvent->getAbstract()); - - if ($timeZone->getName() == 'UTC') { - $vEvent->setUseUtc(true) - ->setUseTimezone(false); - } else { - $vEvent->setUseUtc(false) - ->setUseTimezone(true); - } - - if ($summitEvent->hasLocation()) { - $location = $summitEvent; - $geo = null; - if ($location instanceof SummitGeoLocatedLocation) { - $geo = sprintf("%s;%s", $location->getLat(), $location->getLng()); - } - $vEvent->setLocation($location->getTitle(), $location->getTitle(), $geo); - } - - $vCalendar->addComponent($vEvent); - } - - return $vCalendar->render(); - - }); - } - - /** - * @param Summit $summit - * @param int $event_id - * @param array $data - * @return void` - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function shareEventByEmail(Summit $summit, int $event_id, array $data): void - { - - $this->tx_service->transaction(function () use ($summit, $event_id, $data) { - - $event = $summit->getScheduleEvent($event_id); - if (is_null($event)) { - throw new EntityNotFoundException(sprintf("Event %s not found.", $event_id)); - } - - $event_uri = $data['event_uri'] ?? null; - - if (empty($event_uri)) { - Log::debug("event_uri not set on payload. trying to get from default one (summit)"); - $default_event_uri = $summit->getScheduleDefaultEventDetailUrl(); - if (!empty($default_event_uri)) { - Log::debug("default_event_uri set at summit level using it."); - $event_uri = str_replace(":event_id", $event_id, $default_event_uri); - } - } - - if (empty($event_uri)) { - throw new ValidationException(sprintf("Property event_url is empty.")); - } - - ShareEventEmail::dispatch( - trim($data['from']), - trim($data['to']), - $event_uri, - $event - ); - }); - } - - - public function calculateFeedbackAverageForOngoingSummits(): void - { - $ongoing_summits = $this->tx_service->transaction(function () { - return $this->summit_repository->getOnGoing(); - }); - - foreach ($ongoing_summits as $summit) { - - Log::debug(sprintf("SummitService::calculateFeedbackAverageForOngoingSummits processing summit %s", $summit->getId())); - - $event_ids = $this->tx_service->transaction(function () use ($summit) { - return $summit->getScheduleEventsIds(); - }); - - foreach ($event_ids as $event_id) { - $event_id = $event_id['id']; - $this->tx_service->transaction(function () use ($event_id) { - try { - Log::debug(sprintf("SummitService::calculateFeedbackAverageForOngoingSummits processing event %s", $event_id)); - $event = $this->event_repository->getById($event_id); - if (is_null($event) || !$event instanceof SummitEvent) { - Log::debug(sprintf("SummitService::calculateFeedbackAverageForOngoingSummits event %s not found", $event_id)); - return; - } - - $rate_sum = 0; - $rate_count = 0; - foreach ($event->getFeedback() as $feedback) { - $rate_count++; - $rate_sum = $rate_sum + $feedback->getRate(); - } - - $avg_rate = ($rate_count > 0) ? ($rate_sum / $rate_count) : 0; - $avg_rate = round($avg_rate, 2); - $old_avg_rate = $event->getAvgFeedbackRate(); - Log::debug(sprintf("SummitService::calculateFeedbackAverageForOngoingSummits new avg rate %s - old avg rate %s - for event id %s", $avg_rate, $old_avg_rate, $event->getId())); - $event->setAvgFeedbackRate($avg_rate); - } catch (Exception $ex) { - Log::error($ex); - } - }); - } - } - } - - /** - * @inheritDoc - */ - public function addEventImage(Summit $summit, $event_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($summit, $event_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif', 'pdf']; - - $event = $summit->getEvent($event_id); - - if (is_null($event) || !$event instanceof SummitEvent) { - throw new EntityNotFoundException('event not found on summit!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif','pdf')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $file = $this->file_uploader->build($file, 'summit-event-images', true); - $event->setImage($file); - - return $file; - }); - } - - /** - * @inheritDoc - */ - public function removeEventImage(Summit $summit, $event_id): void - { - $this->tx_service->transaction(function () use ($summit, $event_id) { - - $event = $summit->getEvent($event_id); - - if (is_null($event) || !$event instanceof SummitEvent) { - throw new EntityNotFoundException('event not found on summit!'); - } - $event->clearImage(); - - }); - } - - /** - * @param int $summit_id - * @param int $days - * @param bool $negative - * @param bool $check_summit_ends - * @throws Exception - */ - public function advanceSummit(int $summit_id, int $days, bool $negative = false, $check_summit_ends = true): void - { - $interval = new DateInterval(sprintf("P%sD", $days)); - - Log::debug(sprintf("SummitService::advanceSummit summit_id %s days %s negative %s check_summit_ends %s", $summit_id, $days, $negative, $check_summit_ends)); - - $events_ids = $this->tx_service->transaction(function () use ($summit_id, $interval, $negative, $check_summit_ends) { - - $summit = $this->summit_repository->getByIdExclusiveLock($summit_id); - - if (is_null($summit) || !$summit instanceof Summit) - throw new EntityNotFoundException("Summit not found"); - if ($check_summit_ends && !$summit->isEnded()) { - Log::debug(sprintf("SummitService::advanceSummit summit %s has not ended !.", $summit_id)); - return []; - } - - // summit period - $summitBeginDate = $summit->getBeginDate(); - $summitEndDate = $summit->getEndDate(); - - if (!is_null($summitBeginDate)) { - Log::debug(sprintf("SummitService::advanceSummit Current Summit begin date for summit %s is %s", $summit_id, $summitBeginDate->format("Ymd His"))); - if ($negative) { - $summit->setRawBeginDate(clone $summitBeginDate->sub($interval)); - } else { - $summit->setRawBeginDate(clone $summitBeginDate->add($interval)); - } - Log::debug(sprintf("SummitService::advanceSummit New Summit begin date for summit %s is %s", $summit_id, $summit->getBeginDate()->format("Ymd His"))); - } - - if (!is_null($summitEndDate)) { - Log::debug(sprintf("SummitService::advanceSummit Current Summit end date for summit %s is %s", $summit_id, $summitEndDate->format("Ymd His"))); - if ($negative) { - $summit->setRawEndDate(clone $summitEndDate->sub($interval)); - } else { - $summit->setRawEndDate(clone $summitEndDate->add($interval)); - } - Log::debug(sprintf("SummitService::advanceSummit New Summit end date for summit %s is %s", $summit_id, $summit->getEndDate()->format("Ymd His"))); - } - - // registration period - - $summitRegistrationBeginDate = $summit->getRegistrationBeginDate(); - $summitRegistrationEndDate = $summit->getRegistrationEndDate(); - - if (!is_null($summitRegistrationBeginDate)) { - Log::debug(sprintf("SummitService::advanceSummit Current Summit registration begin date for summit %s is %s", $summit_id, $summitRegistrationBeginDate->format("Ymd His"))); - if ($negative) { - $summit->setRawRegistrationBeginDate(clone $summitRegistrationBeginDate->add($interval)); - } else { - $summit->setRawRegistrationBeginDate(clone $summitRegistrationBeginDate->sub($interval)); - } - Log::debug(sprintf("SummitService::advanceSummit New Summit registration begin date for summit %s is %s", $summit_id, $summit->getRegistrationBeginDate()->format("Ymd His"))); - } - - if (!is_null($summitRegistrationEndDate)) { - Log::debug(sprintf("SummitService::advanceSummit Current Summit registration end date for summit %s is %s", $summit_id, $summitRegistrationEndDate->format("Ymd His"))); - $summit->setRawRegistrationEndDate(clone $summitRegistrationEndDate->add($interval)); - Log::debug(sprintf("SummitService::advanceSummit New Summit registration end date for summit %s is %s", $summit_id, $summit->getRegistrationEndDate()->format("Ymd His"))); - } - - // random dates - - $summitReassignTicketTillDate = $summit->getReassignTicketTillDate(); - if (!is_null($summitReassignTicketTillDate)) { - if ($negative) { - $summit->setRawReassignTicketTillDate(clone $summitReassignTicketTillDate->sub($interval)); - } else { - $summit->setRawReassignTicketTillDate(clone $summitReassignTicketTillDate->add($interval)); - } - } - - $summitStartShowingVenuesDate = $summit->getStartShowingVenuesDate(); - if (!is_null($summitStartShowingVenuesDate)) { - if ($negative) { - $summit->setRawStartShowingVenuesDate(clone $summitStartShowingVenuesDate->sub($interval)); - } else { - $summit->setRawStartShowingVenuesDate(clone $summitStartShowingVenuesDate->add($interval)); - } - } - - $summitScheduleDefaultStartDate = $summit->getScheduleDefaultStartDate(); - if (!is_null($summitScheduleDefaultStartDate)) { - if ($negative) { - $summit->setRawScheduleDefaultStartDate(clone $summitScheduleDefaultStartDate->sub($interval)); - } else { - $summit->setRawScheduleDefaultStartDate(clone $summitScheduleDefaultStartDate->add($interval)); - } - } - - $summitBeginAllowBookingDate = $summit->getBeginAllowBookingDate(); - if (!is_null($summitBeginAllowBookingDate)) { - if ($negative) { - $summit->setRawBeginAllowBookingDate(clone $summitBeginAllowBookingDate->sub($interval)); - } else { - $summit->setRawBeginAllowBookingDate(clone $summitBeginAllowBookingDate->add($interval)); - } - } - - $summitEndAllowBookingDate = $summit->getEndAllowBookingDate(); - if (!is_null($summitEndAllowBookingDate)) { - if ($negative) { - $summit->setRawEndAllowBookingDate(clone $summitEndAllowBookingDate->sub($interval)); - } else { - $summit->setRawEndAllowBookingDate(clone $summitEndAllowBookingDate->add($interval)); - } - - } - - // schedule - $event_ids = []; - foreach ($summit->getPublishedEvents() as $event) { - if (!$event instanceof SummitEvent) continue; - $event_ids[] = $event->getId(); - } - - return $event_ids; - }); - - foreach ($events_ids as $event_id) { - $this->tx_service->transaction(function () use ($summit_id, $event_id, $interval, $negative) { - $event = $this->event_repository->getByIdExclusiveLock($event_id); - $eventBeginDate = $event->getStartDate(); - $eventEndDate = $event->getEndDate(); - if (is_null($eventBeginDate) || is_null($eventEndDate)) { - Log::debug(sprintf("SummitService::advanceSummit summit id %s event id %s ( has not set dates but is published!), skipping it", $summit_id, $event->getId())); - return; - } - Log::debug(sprintf("SummitService::advanceSummit summit id %s event id %s current start date %s", $summit_id, $event->getId(), $eventBeginDate->format("Ymd His"))); - if ($negative) { - $event->setRawStartDate(clone $eventBeginDate->sub($interval)); - } else { - $event->setRawStartDate(clone $eventBeginDate->add($interval)); - } - Log::debug(sprintf("SummitService::advanceSummit summit id %s event id %s new start date %s", $summit_id, $event->getId(), $event->getStartDate()->format("Ymd His"))); - - Log::debug(sprintf("SummitService::advanceSummit summit id %s event id %s current end date %s", $summit_id, $event->getId(), $eventEndDate->format("Ymd His"))); - if ($negative) { - $event->setRawEndDate(clone $eventEndDate->sub($interval)); - } else { - $event->setRawEndDate(clone $eventEndDate->add($interval)); - } - Log::debug(sprintf("SummitService::advanceSummit summit id %s event id %s new end date %s", $summit_id, $event->getId(), $event->getEndDate()->format("Ymd His"))); - - }); - } - } - - /** - * @param Summit $summit - * @param UploadedFile $csv_file - * @param array $payload - * @throws ValidationException - */ - public function importEventData(Summit $summit, UploadedFile $csv_file, array $payload): void - { - - Log::debug(sprintf("SummitService::importEventData - summit %s", $summit->getId())); - - $allowed_extensions = ['txt']; - - if (!in_array($csv_file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('csv')."); - } - - $real_path = $csv_file->getRealPath(); - $filename = pathinfo($real_path); - $filename = $filename['filename'] ?? sprintf("file%s", time()); - $basename = sprintf("%s_%s.csv", $filename, time()); - $filename = $csv_file->storeAs(sprintf("%s/events_imports", sys_get_temp_dir()), $basename); - $csv_data = \Illuminate\Support\Facades\File::get($real_path); - if (empty($csv_data)) - throw new ValidationException("file content is empty!"); - - $csv = Reader::createFromString($csv_data); - $csv->setHeaderOffset(0); - - $header = $csv->getHeader(); //returns the CSV header record - - // check needed columns (headers names) - /* - columns ( min) - * title - * abstract - * type_id (int) or type (string type name) - * track_id (int) or track ( string track name) - */ - - if(!in_array("id", $header)) { - // validate format with col names - if (!in_array("title", $header)) - throw new ValidationException('title column missing'); - - if (!in_array("abstract", $header)) - throw new ValidationException('abstract column missing'); - - $type_data_present = in_array("type_id", $header) || - in_array("type", $header); - - if (!$type_data_present) { - throw new ValidationException('type_id / type column missing'); - } - - $track_present = in_array("track_id", $header) || - in_array("track", $header); - - if (!$track_present) { - throw new ValidationException('track_id / track column missing'); - } - } - - ProcessEventDataImport::dispatch($summit->getId(), $filename, $payload); - } - - /** - * @param int $summit_id - * @param string $filename - * @param bool $send_speaker_email - * @throws ValidationException - * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException - */ - public function processEventData(int $summit_id, string $filename, bool $send_speaker_email): void - { - Log::debug(sprintf("SummitService::processEventData summit %s filename %s", $summit_id, $filename)); - - if (!Storage::disk('local')->exists($filename)) { - throw new ValidationException(sprintf("file %s does not exists.", $filename)); - } - - $csv_data = Storage::disk('local')->get($filename); - - $summit = $this->tx_service->transaction(function () use ($summit_id) { - $summit = $this->summit_repository->getById($summit_id); - if (is_null($summit) || !$summit instanceof Summit) - throw new EntityNotFoundException(sprintf("summit %s does not exists.", $summit_id)); - return $summit; - }); - - $csv = Reader::createFromString($csv_data); - $csv->setHeaderOffset(0); - - $header = $csv->getHeader(); //returns the CSV header record - $records = $csv->getRecords(); - - foreach ($records as $idx => $row) { - try { - // variable to store only added speakers to event - $new_speakers = []; - - $event = $this->tx_service->transaction(function () use ($summit, $row, &$new_speakers) { - - Log::debug(sprintf("SummitService::processEventData processing row %s", json_encode($row))); - - // event type - $event_type = null; - if (isset($row['type_id'])) - $event_type = $summit->getEventType(intval($row['type_id'])); - if (isset($row['type'])) - $event_type = $summit->getEventTypeByType($row['type']); - - // track - $track = null; - if (isset($row['track_id'])) - $track = $summit->getPresentationCategory(intval($row['track_id'])); - if (isset($row['track'])) - $track = $summit->getPresentationCategoryByTitle($row['track']); - - if (is_null($event_type) && !isset($row['id'])) - throw new EntityNotFoundException("event type not found."); - - if (is_null($track) && !isset($row['id'])) - throw new EntityNotFoundException("track not found."); - - $event = null; - if (isset($row['id']) && !empty($row['id'])) { - Log::debug(sprintf("SummitService::processEventData trying to get event %s", $row['id'])); - $event = $summit->getEventById(intval($row['id'])); - if(is_null($event)){ - throw new EntityNotFoundException(sprintf("event %s not found.", $row['id'])); - } - if (is_null($event_type)) { - $event_type = $event->getType(); - } - if (is_null($track)) { - $track = $event->getCategory(); - } - } - - if (is_null($event)) // new event - $event = SummitEventFactory::build($event_type, $summit); - - // main data - - if (isset($row['title'])) { - $title = trim($row['title']); - Log::debug(sprintf("SummitService::processEventData setting title %s", $title)); - $event->setTitle(html_entity_decode($title)); - } - - if (isset($row['abstract'])) { - $abstract = trim($row['abstract']); - Log::debug(sprintf("SummitService::processEventData setting abstract %s", $abstract)); - $event->setAbstract(html_entity_decode($abstract)); - } - - if (isset($row['level'])) - $event->setLevel($row['level']); - - if (isset($row['social_summary'])) - $event->setSocialSummary($row['social_summary']); - - if (isset($row['allow_feedback'])) - $event->setAllowFeedBack(boolval($row['allow_feedback'])); - - if (!is_null($event_type)) - $event->setType($event_type); - - if (!is_null($track)) - $event->setCategory($track); - - if (isset($row['location']) && !empty($row['location'])) { - Log::debug(sprintf("SummitService::processEventData processing location %s", $row['location'])); - $location = $summit->getLocation(intval($row['location'])); - if (is_null($location)) - $location = $summit->getLocationByName(trim($row['location'])); - - if (is_null($location)) - throw new EntityNotFoundException("location not found."); - Log::debug(sprintf("SummitService::processEventData setting location %s", $location)); - $event->setLocation($location); - } - - if (isset($row['start_date']) && !empty($row['start_date']) && isset($row['end_date']) && !empty($row['end_date'])) { - Log::debug - ( - sprintf - ( - "SummitService::processEventData publishing event start_date %s end_date %s", - $row['start_date'], - $row['end_date'] - ) - ); - $start_date = DateTime::createFromFormat('Y-m-d H:i:s', $row['start_date'], $summit->getTimeZone()); - $end_date = DateTime::createFromFormat('Y-m-d H:i:s', $row['end_date'], $summit->getTimeZone()); - - // set local time from UTC - $event->setStartDate($start_date); - $event->setEndDate($end_date); - } - - // tags - - if (isset($row['tags'])) { - Log::debug(sprintf("SummitService::processEventData processing tags %s", $row['tags'])); - $tags = explode('|', $row['tags']); - $event->clearTags(); - foreach ($tags as $val) { - $tag = $this->tag_repository->getByTag($val); - if ($tag == null) { - Log::debug(sprintf("SummitService::processEventData creating tag %s", $val)); - $tag = new Tag($val); - } - $event->addTag($tag); - } - } - - // sponsors - if (!is_null($event_type)) { - $sponsors = ($event_type->isUseSponsors() && isset($row['sponsors'])) ? - $row['sponsors'] : ''; - $sponsors = explode('|', $sponsors); - if ($event_type->isAreSponsorsMandatory() && count($sponsors) == 0) { - throw new ValidationException('sponsors are mandatory!'); - } - - if (isset($row['sponsors'])) { - $event->clearSponsors(); - foreach ($sponsors as $sponsor_name) { - $sponsor = $this->company_repository->getByName(trim($sponsor_name)); - if (is_null($sponsor)) throw new EntityNotFoundException(sprintf('sponsor %s', $sponsor_name)); - $event->addSponsor($sponsor); - } - } - } - - if ($event instanceof Presentation) { - Log::debug(sprintf("SummitService::processEventData event %s is a presentation", $event->getId())); - if (isset($row['to_record'])) - $event->setToRecord(boolval($row['to_record'])); - - if (isset($row['attendees_expected_learnt'])) - $event->setAttendeesExpectedLearnt($row['attendees_expected_learnt']); - - if (isset($row['problem_addressed'])) - $event->setProblemAddressed($row['problem_addressed']); - - // speakers - - if (!is_null($event_type) && $event_type instanceof PresentationType && $event_type->isUseSpeakers()) { - - $speakers = isset($row['speakers']) ? $row['speakers'] : ''; - Log::debug(sprintf("SummitService::processEventData event %s processing speakers %s", $event->getId(), $row['speakers'])); - $speakers = explode('|', $speakers); - - $speakers_names = []; - if (isset($row["speakers_names"])) { - $speakers_names = isset($row['speakers_names']) ? - $row['speakers_names'] : ''; - Log::debug(sprintf("SummitService::processEventData event %s processing speakers_names %s", $event->getId(), $row['speakers_names'])); - $speakers_names = explode('|', $speakers_names); - } - - $speakers_companies = []; - if (isset($row["speakers_companies"])) { - $speakers_companies = isset($row['speakers_companies']) ? - $row['speakers_companies'] : ''; - Log::debug(sprintf("SummitService::processEventData event %s processing speakers_companies %s", $event->getId(), $row['speakers_companies'])); - $speakers_companies = explode('|', $speakers_companies); - } - - $speakers_titles = []; - if (isset($row["speakers_titles"])) { - $speakers_titles = isset($row['speakers_titles']) ? - $row['speakers_titles'] : ''; - Log::debug(sprintf("SummitService::processEventData event %s processing speakers_titles %s", $event->getId(), $row['speakers_titles'])); - $speakers_titles = explode('|', $speakers_titles); - } - - if (count($speakers_names) == 0) { - $speakers_names = $speakers; - } - - if (count($speakers_names) != count($speakers)) - throw new ValidationException("count of speakers and speakers_name should match."); - - if ($event_type->isAreSpeakersMandatory() && count($speakers) == 0) { - throw new ValidationException('speakers are mandatory!'); - } - - if (count($speakers) > 0) { - - foreach ($speakers as $idx => $speaker_email) { - $speaker_full_name = $speakers_names[$idx]; - $speaker_full_name_comps = explode(" ", $speaker_full_name, 2); - $speaker_first_name = trim($speaker_full_name_comps[0]); - $speaker_last_name = null; - - if (count($speaker_full_name_comps) > 1) { - $speaker_last_name = trim($speaker_full_name_comps[1]); - } - if (empty($speaker_last_name)) - $speaker_last_name = $speaker_first_name; - - Log::debug(sprintf("SummitService::processEventData processing speaker email %s speaker fullname %s", $speaker_email, $speaker_full_name)); - $speaker = $this->speaker_repository->getByEmail(trim($speaker_email)); - if (is_null($speaker)) { - Log::debug(sprintf("SummitService::processEventData speaker %s fname %s lname %s does not exists", $speaker_email, $speaker_first_name, $speaker_last_name)); - $payload = [ - 'first_name' => $speaker_first_name, - 'last_name' => $speaker_last_name, - 'email' => $speaker_email - ]; - - if(array_key_exists($idx ,$speakers_companies)){ - $payload['company'] = $speakers_companies[$idx]; - } - - if(array_key_exists($idx, $speakers_titles)){ - $payload['title'] = $speakers_titles[$idx]; - } - - Log::debug(sprintf("SummitService::processEventData adding speaker %s", json_encode($payload))); - $speaker = $this->speaker_service->addSpeaker($payload, null, false); - } else { - Log::debug(sprintf("SummitService::processEventData speaker %s already exists, updating ", $speaker_email)); - $payload = [ - 'first_name' => $speaker_first_name, - 'last_name' => $speaker_last_name, - 'email' => $speaker_email - ]; - - if(array_key_exists($idx ,$speakers_companies)){ - $payload['company'] = $speakers_companies[$idx]; - } - - if(array_key_exists($idx, $speakers_titles)){ - $payload['title'] = $speakers_titles[$idx]; - } - - Log::debug(sprintf("SummitService::processEventData updating speaker %s", json_encode($payload))); - $this->speaker_service->updateSpeaker($speaker, $payload); - } - - if(!$event->isSpeaker($speaker)) { - $new_speakers[] = $speaker; - Log::debug(sprintf("SummitService::processEventData adding speaker %s to event %s", $speaker->getEmail(), $event->getTitle())); - $event->addSpeaker($speaker); - } - } - } - } - - // moderator - - if (!is_null($event_type) && $event_type instanceof PresentationType && $event_type->isUseModerator() && isset($row['moderator'])) { - $moderator_email = trim($row['moderator']); - - if ($event_type->isModeratorMandatory() && !$event->hasModerator() && empty($moderator_email)) { - throw new ValidationException('moderator is mandatory!'); - } - - if(!empty($moderator_email)) { - - Log::debug(sprintf("SummitService::processEventData processing moderator %s", $moderator_email)); - $moderator = $this->speaker_repository->getByEmail($moderator_email); - if (is_null($moderator)) { - Log::debug(sprintf("SummitService::processEventData moderator %s does not exists", $moderator_email)); - $moderator = $this->speaker_service->addSpeaker(['email' => $moderator_email], null, false); - } - - $event->setModerator($moderator); - } - } - - // selection plan - - if (isset($row['selection_plan'])) { - $selection_plan = $summit->getSelectionPlanByName($row['selection_plan']); - if (!is_null($selection_plan)) { - Log::debug(sprintf("SummitService::processEventData processing selection plan %s", $row['selection_plan'])); - $track = $event->getCategory(); - if (!$selection_plan->hasTrack($track)) { - throw new ValidationException(sprintf("Track %s (%s) does not belongs to Selection Plan %s (%s)", $track->getTitle(), $track->getId(), $selection_plan->getName(), $selection_plan->getId())); - } - $event->setSelectionPlan($selection_plan); - } - } - } - - if (isset($row['is_published'])) { - $is_published = boolval($row['is_published']); - if ($is_published) { - if (!isset($row['start_date'])) throw new ValidationException("start_date is required."); - if (!isset($row['end_date'])) throw new ValidationException("end_date is required."); - if (!$event->isPublished()) - $event->publish(); - } else { - $event->unPublish(); - } - } - - $summit->addEvent($event); - - return $event; - }); - - if ($send_speaker_email && $event instanceof Presentation) { - // only send emails to added speakers - foreach ($new_speakers as $speaker) - $this->tx_service->transaction(function () use ($speaker, $event) { - $setPasswordLink = null; - if ($speaker instanceof PresentationSpeaker) { - if (!$speaker->hasMember()) { - Log::debug(sprintf("SummitService::processEventData speaker %s has not member set, checking at idp", $speaker->getEmail())); - $user = $this->member_service->checkExternalUser($speaker->getEmail()); - if (is_null($user)) { - - // user does not exist at idp so we need to generate a registration request - // and create the magic links to complete the registration request - Log::debug(sprintf("SummitService::processEventData speaker %s user not found at idp, creating registration request", $speaker->getEmail())); - $userRegistrationRequest = $this->member_service->emitRegistrationRequest - ( - $speaker->getEmail(), - $speaker->getFirstName(), - $speaker->getLastName() - ); - - $setPasswordLink = $userRegistrationRequest['set_password_link']; - $speaker_management_base_url = Config::get('cfp.base_url'); - - $setPasswordLink = sprintf( - "%s?client_id=%s&redirect_uri=%s", - $setPasswordLink, - Config::get("cfp.client_id"), - sprintf("%s/app/profile", $speaker_management_base_url) - ); - } - } - } - ImportEventSpeakerEmail::dispatch($event, $speaker, $setPasswordLink); - }); - } - } - catch(Exception $ex){ - Log::warning($ex); - } - } - } - - /** - * @inheritDoc - */ - public function addFeaturedSpeaker(int $summit_id, int $speaker_id): void - { - $this->tx_service->transaction(function() use($summit_id, $speaker_id){ - $summit = $this->summit_repository->getById($summit_id); - if(is_null($summit) || !$summit instanceof Summit) - throw new EntityNotFoundException("summit not found"); - - $speaker = $this->speaker_repository->getById($speaker_id); - if(is_null($speaker) || !$speaker instanceof PresentationSpeaker) - throw new EntityNotFoundException("speaker not found"); - - // validate it - if(!$this->speaker_repository->speakerBelongsToSummitSchedule($speaker_id, $summit_id)){ - throw new ValidationException(sprintf("Speaker %s does not belongs to Summit %s schedule.", $speaker_id, $summit_id)); - } - - $summit->addFeaturedSpeaker($speaker); - }); - } - - /** - * @inheritDoc - */ - public function removeFeaturedSpeaker(int $summit_id, int $speaker_id): void - { - $this->tx_service->transaction(function() use($summit_id, $speaker_id){ - $summit = $this->summit_repository->getById($summit_id); - if(is_null($summit) || !$summit instanceof Summit) - throw new EntityNotFoundException("summit not found"); - - $speaker = $this->speaker_repository->getById($speaker_id); - if(is_null($speaker) || !$speaker instanceof PresentationSpeaker) - throw new EntityNotFoundException("speaker not found"); - - $summit->removeFeaturedSpeaker($speaker); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitSponsorService.php b/app/Services/Model/Imp/SummitSponsorService.php deleted file mode 100644 index 4c8641c9..00000000 --- a/app/Services/Model/Imp/SummitSponsorService.php +++ /dev/null @@ -1,247 +0,0 @@ -member_repository = $member_repository; - $this->company_repository = $company_repository; - $this->sponsorship_type_repository = $sponsorship_type_repository; - } - - - /** - * @param Summit $summit - * @param array $payload - * @return Sponsor - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addSponsor(Summit $summit, array $payload): Sponsor - { - return $this->tx_service->transaction(function () use ($summit, $payload) { - $company_id = intval($payload['company_id']); - $sponsorship_id = intval($payload['sponsorship_id']); - $company = $this->company_repository->getById($company_id); - if (is_null($company)) - throw new EntityNotFoundException("company not found"); - $sponsorship_type = $this->sponsorship_type_repository->getById($sponsorship_id); - if (is_null($sponsorship_type)) - throw new EntityNotFoundException("sponsorship type not found"); - - $former_sponsor = $summit->getSummitSponsorByCompany($company); - if (!is_null($former_sponsor)) { - throw new ValidationException("company already is sponsor on summit"); - } - - $payload['company'] = $company; - $payload['sponsorship'] = $sponsorship_type; - $sponsor = SponsorFactory::build($payload); - - $summit->addSummitSponsor($sponsor); - - return $sponsor; - }); - } - - /** - * @param Summit $summit - * @param int $sponsor_id - * @param array $payload - * @return Sponsor - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateSponsor(Summit $summit, int $sponsor_id, array $payload): Sponsor - { - return $this->tx_service->transaction(function () use ($summit, $sponsor_id, $payload) { - $summit_sponsor = $summit->getSummitSponsorById($sponsor_id); - if (is_null($summit_sponsor)) - throw new EntityNotFoundException("sponsor not found"); - $company = null; - $sponsorship_type = null; - - if(isset($payload['company_id'])) { - $company_id = intval($payload['company_id']); - $company = $this->company_repository->getById($company_id); - if (is_null($company)) - throw new EntityNotFoundException("company not found"); - } - - if(isset($payload['sponsorship_id'])) { - $sponsorship_id = intval($payload['sponsorship_id']); - $sponsorship_type = $this->sponsorship_type_repository->getById($sponsorship_id); - if (is_null($sponsorship_type)) - throw new EntityNotFoundException("sponsorship type not found"); - } - - if(!is_null($company)) { - $former_sponsor = $summit->getSummitSponsorByCompany($company); - if (!is_null($former_sponsor) && $former_sponsor->getId() != $sponsor_id) { - throw new ValidationException("company already is sponsor on summit"); - } - } - if(!is_null($company)) - $payload['company'] = $company; - if(!is_null($sponsorship_type)) - $payload['sponsorship'] = $sponsorship_type; - $sponsor = SponsorFactory::populate($summit_sponsor, $payload); - - if (isset($payload['order']) && intval($payload['order']) != $sponsor->getOrder()) { - // request to update order - $summit->recalculateSummitSponsorOrder($sponsor, $payload['order']); - } - - return $sponsor; - }); - } - - /** - * @param Summit $summit - * @param int $sponsor_id - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteSponsor(Summit $summit, int $sponsor_id): void - { - $this->tx_service->transaction(function () use ($summit, $sponsor_id) { - $summit_sponsor = $summit->getSummitSponsorById($sponsor_id); - if (is_null($summit_sponsor)) - throw new EntityNotFoundException("sponsor not found"); - - $summit->removeSummitSponsor($summit_sponsor); - }); - } - - /** - * @param Summit $summit - * @param int $sponsor_id - * @param int $member_id - * @return Sponsor - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addSponsorUser(Summit $summit, int $sponsor_id, int $member_id): Sponsor - { - return $this->tx_service->transaction(function () use ($summit, $sponsor_id, $member_id) { - $summit_sponsor = $summit->getSummitSponsorById($sponsor_id); - - if (is_null($summit_sponsor)) - throw new EntityNotFoundException("sponsor not found"); - - $member = $this->member_repository->getById($member_id); - $current_summit_begin_date = $summit->getBeginDate(); - $current_summit_end_date = $summit->getEndDate(); - - if (is_null($member) || !$member instanceof Member) - throw new EntityNotFoundException("member not found"); - - foreach($member->getSponsorMemberships() as $former_sponsor){ - - $former_summit = $former_sponsor->getSummit(); - $former_summit_begin_date = $former_summit->getBeginDate(); - $former_summit_end_date = $former_summit->getEndDate(); - - // check that current summit does not intersect with a former one - // due a member could be on 2 diff places at same time ... - // (StartA <= EndB) and (EndA >= StartB) - - if($current_summit_begin_date <= $former_summit_end_date && $current_summit_end_date >=$former_summit_begin_date){ - throw new ValidationException - ( - sprintf - ( - "you can not add member %s as sponsor user on summit %s bc its already sponsor user on another concurrent summit (%s)", - $member_id, - $summit->getId(), - $former_summit->getId() - ) - ); - } - } - - $summit_sponsor->addUser($member); - - return $summit_sponsor; - - }); - } - - /** - * @param Summit $summit - * @param int $sponsor_id - * @param int $member_id - * @return Sponsor - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removeSponsorUser(Summit $summit, int $sponsor_id, int $member_id): Sponsor - { - return $this->tx_service->transaction(function () use ($summit, $sponsor_id, $member_id) { - $summit_sponsor = $summit->getSummitSponsorById($sponsor_id); - if (is_null($summit_sponsor)) - throw new EntityNotFoundException("sponsor not found"); - - $member = $this->member_repository->getById($member_id); - - if (is_null($member)) - throw new EntityNotFoundException("member not found"); - - $summit_sponsor->removeUser($member); - - return $summit_sponsor; - - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitTaxTypeService.php b/app/Services/Model/Imp/SummitTaxTypeService.php deleted file mode 100644 index f5fd7b83..00000000 --- a/app/Services/Model/Imp/SummitTaxTypeService.php +++ /dev/null @@ -1,172 +0,0 @@ -repository = $repository; - parent::__construct($tx_service); - } - - - /** - * @param Summit $summit - * @param array $data - * @return SummitTaxType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTaxType(Summit $summit, array $data): SummitTaxType - { - return $this->tx_service->transaction(function() use($summit, $data){ - $name = trim($data['name']); - - $former_tax = $summit->getTaxTypeByName($name); - - if(!is_null($former_tax)) throw new ValidationException("there is another tax type with same name!"); - - $tax_type = SummitTaxTypeFactory::build($data); - - $summit->addTaxType($tax_type); - - return $tax_type; - }); - } - - /** - * @param Summit $summit - * @param int $tax_type_id - * @param array $data - * @return SummitTicketType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTaxType(Summit $summit, int $tax_type_id, array $data): SummitTaxType - { - return $this->tx_service->transaction(function() use($summit, $tax_type_id, $data){ - - $tax_type = $summit->getTaxTypeById($tax_type_id); - if(is_null($tax_type)) - throw new EntityNotFoundException(); - - if(isset($data['name'])) { - $name = trim($data['name']); - - $former_tax = $summit->getTaxTypeByName($name); - - if (!is_null($former_tax)) throw new ValidationException("there is another tax type with same name!"); - } - - return SummitTaxTypeFactory::populate($tax_type, $data); - - }); - } - - /** - * @param Summit $summit - * @param int $tax_type - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteTaxType(Summit $summit, int $tax_type_id) - { - $this->tx_service->transaction(function() use($summit, $tax_type_id){ - $tax_type = $summit->getTaxTypeById($tax_type_id); - if(is_null($tax_type)) - throw new EntityNotFoundException(); - - $summit->removeTaxType($tax_type); - }); - } - - /** - * @param Summit $summit - * @param int $tax_type_id - * @param int $ticket_type_id - * @return SummitTaxType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTaxTypeToTicketType(Summit $summit, int $tax_type_id, int $ticket_type_id): SummitTaxType - { - return $this->tx_service->transaction(function() use($summit, $tax_type_id, $ticket_type_id){ - $tax_type = $summit->getTaxTypeById($tax_type_id); - if(is_null($tax_type)) - throw new EntityNotFoundException(); - - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - if(is_null($ticket_type)) - throw new EntityNotFoundException(); - - $tax_type->addTicketType($ticket_type); - - return $tax_type; - }); - } - - /** - * @param Summit $summit - * @param int $tax_type_id - * @param int $ticket_type_id - * @return SummitTaxType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removeTaxTypeFromTicketType(Summit $summit, int $tax_type_id, int $ticket_type_id): SummitTaxType - { - return $this->tx_service->transaction(function() use($summit, $tax_type_id, $ticket_type_id){ - $tax_type = $summit->getTaxTypeById($tax_type_id); - if(is_null($tax_type)) - throw new EntityNotFoundException(); - - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - if(is_null($ticket_type)) - throw new EntityNotFoundException(); - - $tax_type->removeTicketType($ticket_type); - - return $tax_type; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitTicketTypeService.php b/app/Services/Model/Imp/SummitTicketTypeService.php deleted file mode 100644 index 63629c7c..00000000 --- a/app/Services/Model/Imp/SummitTicketTypeService.php +++ /dev/null @@ -1,327 +0,0 @@ -eventbrite_api = $eventbrite_api; - } - - /** - * @param Summit $summit - * @param array $data - * @return array - * @throws EntityNotFoundException - */ - static private function getTicketTypeParams(Summit $summit, array $data):array{ - if(isset($data['badge_type_id'])){ - $badge_type = $summit->getBadgeTypeById(intval($data['badge_type_id'])); - if(is_null($badge_type)) - throw new EntityNotFoundException(sprintf("badge_type_id %s not found", $data['badge_type_id'])); - $data['badge_type'] = $badge_type; - } - return $data; - } - /** - * @param Summit $summit - * @param array $data - * @return SummitTicketType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTicketType(Summit $summit, array $data) - { - $ticket_type = $this->tx_service->transaction(function() use ($summit, $data){ - - $former_ticket_type = $summit->getTicketTypeByName(trim($data['name'])); - - if(!is_null($former_ticket_type)){ - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitTicketTypeService.addTicketType.NameAlreadyExists' - ), - [ - 'name' => trim($data['name']), - 'summit_id' => $summit->getId() - ] - ); - } - - if(isset($data['external_id'])) { - $former_ticket_type = $summit->getTicketTypeByExternalId(trim($data['external_id'])); - if (!is_null($former_ticket_type)) { - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitTicketTypeService.addTicketType.ExternalIdAlreadyExists' - ), - [ - 'external_id' => trim($data['external_id']), - 'summit_id' => $summit->getId() - ] - ); - } - } - - $ticket_type = SummitTicketTypeFactory::build($summit, self::getTicketTypeParams($summit, $data)); - - if($summit->hasTicketTypes()){ - // before add check if we have the same currency - $currency = $ticket_type->getCurrency(); - $summit_currency = $summit->getDefaultTicketTypeCurrency(); - if(!empty($currency) && !empty($summit_currency) && $summit_currency != $currency) - throw new ValidationException(sprintf("ticket type should have same currency as summit (%s)", $summit_currency)); - } - - $summit->addTicketType($ticket_type); - return $ticket_type; - }); - - Event::fire - ( - new SummitTicketTypeInserted - ( - $ticket_type->getId(), - $ticket_type->getSummitId() - ) - ); - - return $ticket_type; - - } - - /** - * @param Summit $summit - * @param int $ticket_type_id - * @param array $data - * @return SummitTicketType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTicketType(Summit $summit, $ticket_type_id, array $data) - { - return $this->tx_service->transaction(function() use ($summit, $ticket_type_id, $data){ - - if(isset($data['name'])) { - $former_ticket_type = $summit->getTicketTypeByName(trim($data['name'])); - - if (!is_null($former_ticket_type) && $former_ticket_type->getId() != $ticket_type_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitTicketTypeService.updateTicketType.NameAlreadyExists' - ), - [ - 'name' => trim($data['name']), - 'summit_id' => $summit->getId() - ] - ); - } - } - - if(isset($data['external_id'])) { - $former_ticket_type = $summit->getTicketTypeByExternalId(trim($data['external_id'])); - if (!is_null($former_ticket_type) && $former_ticket_type->getId() != $ticket_type_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitTicketTypeService.updateTicketType.ExternalIdAlreadyExists' - ), - [ - 'external_id' => trim($data['external_id']), - 'summit_id' => $summit->getId() - ] - ); - } - } - - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - - if(is_null($ticket_type)){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.SummitTicketTypeService.updateTicketType.TicketTypeNotFound', - [ - 'ticket_type_id' => $ticket_type_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $summit_currency = $summit->getDefaultTicketTypeCurrency(); - $currency = $ticket_type->getCurrency(); - if(!empty($currency) && !empty($summit_currency) && $summit_currency != $currency) - throw new ValidationException(sprintf("ticket type should have same currency as summit (%s)", $summit_currency)); - - $ticket_type = SummitTicketTypeFactory::populate($ticket_type, self::getTicketTypeParams($summit, $data)); - - Event::fire - ( - new SummitTicketTypeUpdated - ( - $ticket_type->getId(), - $ticket_type->getSummitId() - ) - ); - - return $ticket_type; - }); - } - - /** - * @param Summit $summit - * @param int $ticket_type_id - * @return SummitTicketType - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteTicketType(Summit $summit, $ticket_type_id) - { - return $this->tx_service->transaction(function() use ($summit, $ticket_type_id){ - - $ticket_type = $summit->getTicketTypeById($ticket_type_id); - - if(is_null($ticket_type)){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.SummitTicketTypeService.deleteTicketType.TicketTypeNotFound', - [ - 'ticket_type_id' => $ticket_type_id, - 'summit_id' => $summit->getId() - ] - ) - ); - } - - Event::fire - ( - new SummitTicketTypeDeleted - ( - $ticket_type->getId(), - $ticket_type->getSummitId() - ) - ); - - $summit->removeTicketType($ticket_type); - }); - } - - /** - * @param Summit $summit - * @return SummitTicketType[] - * @throws ValidationException - */ - public function seedSummitTicketTypesFromEventBrite(Summit $summit){ - - return $this->tx_service->transaction(function() use($summit){ - $res = []; - $external_summit_id = $summit->getExternalSummitId(); - - if(empty($external_summit_id)){ - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitTicketTypeService.seedSummitTicketTypesFromEventBrite.MissingExternalId', - [ - 'summit_id' => $summit->getId() - ] - ) - ); - } - - $response = $this->eventbrite_api->getTicketTypes($summit); - - if (!isset($response['ticket_classes'])) return $res; - - $ticket_classes = $response['ticket_classes']; - - foreach ($ticket_classes as $ticket_class) { - - $id = $ticket_class['id']; - $old_ticket_type = $summit->getTicketTypeByExternalId($id); - - if (!is_null($old_ticket_type)) { - - $old_ticket_type->setName(trim($ticket_class['name'])); - $old_ticket_type->setDescription(isset($ticket_class['description']) ? trim($ticket_class['description']) : ''); - continue; - } - - $new_ticket_type = new SummitTicketType(); - $new_ticket_type->setExternalId($id); - $new_ticket_type->setName($ticket_class['name']); - $new_ticket_type->setDescription(isset($ticket_class['description']) ? trim($ticket_class['description']) : ''); - $summit->addTicketType($new_ticket_type); - $res[] = $new_ticket_type; - } - - foreach ($res as $ticket_type){ - Event::fire - ( - new SummitTicketTypeInserted - ( - $ticket_type->getId(), - $ticket_type->getSummitId() - ) - ); - } - - return $res; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitTrackService.php b/app/Services/Model/Imp/SummitTrackService.php deleted file mode 100644 index 9b468d3c..00000000 --- a/app/Services/Model/Imp/SummitTrackService.php +++ /dev/null @@ -1,390 +0,0 @@ -tag_repository = $tag_repository; - $this->track_repository = $track_repository; - $this->track_question_template_repository = $track_question_template_repository; - $this->file_uploader = $file_uploader; - } - - /** - * @param Summit $summit - * @param array $data - * @return PresentationCategory - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTrack(Summit $summit, array $data) - { - $track = $this->tx_service->transaction(function () use ($summit, $data) { - - if (!empty($data['code'])) { - $former_track = $summit->getPresentationCategoryByCode(trim($data['code'])); - if (!is_null($former_track)) - throw new ValidationException(sprintf("track id %s already has code %s assigned on summit id %s", $former_track->getId(), $data['code'], $summit->getId())); - } - - $former_track = $summit->getPresentationCategoryByTitle($data['name']); - if (!is_null($former_track)) - throw new ValidationException(sprintf("track id %s already has title %s assigned on summit id %s", $former_track->getId(), $data['name'], $summit->getId())); - - $track = PresentationCategoryFactory::build($summit, $data); - - if(isset($data['allowed_tags'])){ - foreach($data['allowed_tags'] as $tag_value) { - $tackTagGroupAllowedTag = $summit->getAllowedTagOnTagTrackGroup($tag_value); - if(is_null($tackTagGroupAllowedTag)){ - throw new ValidationException( - sprintf("allowed_tags : tag value %s is not allowed on current track tag groups for summit %s", $tag_value, $summit->getId()) - ); - } - $track->addAllowedTag($tackTagGroupAllowedTag->getTag()); - } - } - - $summit->addPresentationCategory($track); - - return $track; - }); - - Event::fire(new TrackInserted($track->getSummitId(), $track->getId())); - - return $track; - } - - /** - * @param Summit $summit - * @param int $track_id - * @param array $data - * @return PresentationCategory - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTrack(Summit $summit, $track_id, array $data) - { - return $this->tx_service->transaction(function () use ($summit, $track_id, $data) { - - $track = $summit->getPresentationCategory($track_id); - - if (is_null($track)) - throw new EntityNotFoundException - ( - sprintf("track id %s does not belong to summit id %s", $track_id, $summit->getId()) - ); - - if (isset($data['code']) && !empty($data['code'])) { - $former_track = $summit->getPresentationCategoryByCode($data['code']); - if (!is_null($former_track) && $former_track->getId() != $track_id) - throw new ValidationException(sprintf("track id %s already has code %s assigned on summit id %s", $former_track->getId(), $data['code'], $summit->getId())); - } - - if (isset($data['name'])) { - $former_track = $summit->getPresentationCategoryByTitle($data['name']); - if (!is_null($former_track) && $former_track->getId() != $track_id) - throw new ValidationException(sprintf("track id %s already has title %s assigned on summit id %s", $former_track->getId(), $data['name'], $summit->getId())); - } - - $track = PresentationCategoryFactory::populate($track, $data); - - if(isset($data['allowed_tags'])){ - $track->clearAllowedTags(); - foreach($data['allowed_tags'] as $tag_value) { - $tackTagGroupAllowedTag = $summit->getAllowedTagOnTagTrackGroup($tag_value); - if(is_null($tackTagGroupAllowedTag)){ - throw new ValidationException( - sprintf("allowed_tags : tag value %s is not allowed on current track tag groups for summit %s", $tag_value, $summit->getId()) - ); - } - $track->addAllowedTag($tackTagGroupAllowedTag->getTag()); - } - } - - Event::fire(new TrackUpdated($track->getSummitId(), $track->getId())); - - return $track; - - }); - } - - /** - * @param Summit $summit - * @param int $track_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteTrack(Summit $summit, $track_id) - { - return $this->tx_service->transaction(function () use ($summit, $track_id) { - - $track = $summit->getPresentationCategory($track_id); - - if (is_null($track)) - throw new EntityNotFoundException - ( - sprintf("track id %s does not belong to summit id %s", $track_id, $summit->getId()) - ); - - $summit_events = $track->getRelatedPublishedSummitEventsIds(); - - if(count($summit_events) > 0){ - throw new ValidationException - ( - sprintf("track id %s could not be deleted bc its assigned to published events on summit id %s", $track_id, $summit->getId()) - ); - } - - Event::fire(new TrackDeleted($track->getSummitId(), $track->getId())); - - $this->track_repository->delete($track); - }); - } - - /** - * @param Summit $from_summit - * @param Summit $to_summit - * @return PresentationCategory[] - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function copyTracks(Summit $from_summit, Summit $to_summit) - { - $added_tracks = $this->tx_service->transaction(function () use ($from_summit, $to_summit) { - - if($from_summit->getId() == $to_summit->getId()){ - throw new ValidationException - ( - trans - ( - 'validation_errors.SummitTrackService.copyTracks.SameSummit' - ) - ); - } - - $added_tracks = []; - foreach($from_summit->getPresentationCategories() as $track_2_copy){ - $former_track = $to_summit->getPresentationCategoryByTitle($track_2_copy->getTitle()); - if(!is_null($former_track)) continue; - - $former_track = $to_summit->getPresentationCategoryByCode($track_2_copy->getCode()); - if(!is_null($former_track)) continue; - - $data = [ - 'name' => $track_2_copy->getTitle(), - 'code' => $track_2_copy->getCode(), - 'color' => $track_2_copy->getColor(), - 'description' => $track_2_copy->getDescription(), - 'session_count' => $track_2_copy->getSessionCount(), - 'alternate_count' => $track_2_copy->getAlternateCount(), - 'lightning_count' => $track_2_copy->getLightningCount(), - 'lightning_alternate_count' => $track_2_copy->getLightningAlternateCount(), - 'voting_visible' => $track_2_copy->isVotingVisible(), - 'chair_visible' => $track_2_copy->isChairVisible(), - ]; - - $new_track = PresentationCategoryFactory::build($to_summit, $data); - - $to_summit->addPresentationCategory($new_track); - $added_tracks[] = $new_track; - } - - return $added_tracks; - }); - - foreach ($added_tracks as $track){ - Event::fire(new TrackInserted($track->getSummitId(), $track->getId())); - } - - return $added_tracks; - } - - /** - * @param int $track_id - * @param int $question_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTrackExtraQuestion($track_id, $question_id) - { - return $this->tx_service->transaction(function() use($track_id, $question_id){ - $track = $this->track_repository->getById($track_id); - if(is_null($track)) - throw new EntityNotFoundException( - trans - ( - 'not_found_errors.SummitTrackService.addTrackExtraQuestion.TrackNotFound', - ['track_id' => $track_id ] - ) - ); - - $track_question_template = $this->track_question_template_repository->getById($question_id); - - if(is_null($track_question_template)) - throw new EntityNotFoundException( - trans - ( - 'not_found_errors.SummitTrackService.addTrackExtraQuestion.QuestionNotFound', - ['question_id' => $question_id ] - ) - ); - - $track->addExtraQuestion($track_question_template); - }); - } - - /** - * @param int $track_id - * @param int $question_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function removeTrackExtraQuestion($track_id, $question_id) - { - return $this->tx_service->transaction(function() use($track_id, $question_id){ - $track = $this->track_repository->getById($track_id); - if(is_null($track)) - throw new EntityNotFoundException( - trans - ( - 'not_found_errors.SummitTrackService.removeTrackExtraQuestion.TrackNotFound', - ['track_id' => $track_id ] - ) - ); - - $track_question_template = $this->track_question_template_repository->getById($question_id); - - if(is_null($track_question_template)) - throw new EntityNotFoundException( - trans - ( - 'not_found_errors.SummitTrackService.removeTrackExtraQuestion.QuestionNotFound', - ['question_id' => $question_id ] - ) - ); - - $track->removeExtraQuestion($track_question_template); - }); - } - - /** - * @inheritDoc - */ - public function addTrackIcon(Summit $summit, $track_id, UploadedFile $file, $max_file_size = 10485760) - { - return $this->tx_service->transaction(function () use ($summit, $track_id, $file, $max_file_size) { - - $allowed_extensions = ['png', 'jpg', 'jpeg', 'gif']; - - $track = $summit->getPresentationCategory($track_id); - - if (is_null($track) || !$track instanceof PresentationCategory) { - throw new EntityNotFoundException('track not found on summit!'); - } - - if (!in_array($file->extension(), $allowed_extensions)) { - throw new ValidationException("file does not has a valid extension ('png','jpg','jpeg','gif')."); - } - - if ($file->getSize() > $max_file_size) { - throw new ValidationException(sprintf("file exceeds max_file_size (%s MB).", ($max_file_size / 1024) / 1024)); - } - - $file = $this->file_uploader->build($file, 'summit-track-icon', true); - $track->setIcon($file); - - return $file; - }); - } - - /** - * @inheritDoc - */ - public function removeTrackIcon(Summit $summit, $track_id): void - { - $this->tx_service->transaction(function () use ($summit, $track_id) { - - $track = $summit->getPresentationCategory($track_id); - - if (is_null($track) || !$track instanceof PresentationCategory) { - throw new EntityNotFoundException('track not found on summit!'); - } - $track->clearIcon(); - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/SummitTrackTagGroupService.php b/app/Services/Model/Imp/SummitTrackTagGroupService.php deleted file mode 100644 index 38253f69..00000000 --- a/app/Services/Model/Imp/SummitTrackTagGroupService.php +++ /dev/null @@ -1,330 +0,0 @@ -tag_repository = $tag_repository; - $this->default_track_tag_group_repository = $default_track_tag_group_repository; - } - - /** - * @param Summit $summit - * @param array $data - * @return TrackTagGroup - * @throws EntityNotFoundException - * @throws ValidationException - * @throws \Exception - */ - public function addTrackTagGroup(Summit $summit, array $data) - { - return $this->tx_service->transaction(function() use($summit, $data) { - - if(isset($data['label'])){ - $former_group = $summit->getTrackTagGroupByLabel(trim($data['label'])); - if(!is_null($former_group)){ - throw new ValidationException(trans - ( - 'validation_errors.SummitTrackTagGroupService.addTrackTagGroup.TrackTagGroupLabelAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - )); - } - } - - if(isset($data['name'])){ - $former_group = $summit->getTrackTagGroupByName(trim($data['name'])); - if(!is_null($former_group)){ - throw new ValidationException(trans - ( - 'validation_errors.SummitTrackTagGroupService.addTrackTagGroup.TrackTagGroupNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - )); - } - } - - $track_tag_group = TrackTagGroupFactory::build($summit, $data); - - if (isset($data['allowed_tags'])) { - $track_tag_group->clearAllowedTags(); - foreach ($data['allowed_tags'] as $str_tag) { - $tag = $this->tag_repository->getByTag($str_tag); - if($tag == null) $tag = new Tag($str_tag); - $track_tag_group->addTag($tag); - } - } - - $summit->addTrackTagGroup($track_tag_group); - - return $track_tag_group; - }); - } - - /** - * @param Summit $summit - * @param int $track_tag_group_id - * @param array $data - * @return TrackTagGroup - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTrackTagGroup(Summit $summit, $track_tag_group_id, array $data) - { - return $this->tx_service->transaction(function() use($summit, $track_tag_group_id, $data) { - - if(isset($data['label'])){ - $former_group = $summit->getTrackTagGroupByLabel(trim($data['label'])); - if(!is_null($former_group) && $former_group->getId() != $track_tag_group_id ){ - throw new ValidationException(trans - ( - 'validation_errors.SummitTrackTagGroupService.updateTrackTagGroup.TrackTagGroupLabelAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - )); - } - } - - if(isset($data['name'])){ - $former_group = $summit->getTrackTagGroupByName(trim($data['name'])); - if(!is_null($former_group) && $former_group->getId() != $track_tag_group_id ){ - throw new ValidationException(trans - ( - 'validation_errors.SummitTrackTagGroupService.updateTrackTagGroup.TrackTagGroupNameAlreadyExists', - [ - 'summit_id' => $summit->getId() - ] - )); - } - } - - $track_tag_group = $summit->getTrackTagGroup($track_tag_group_id); - - if(is_null($track_tag_group)){ - throw new EntityNotFoundException - ( - trans("not_found_errors.SummitTrackTagGroupService.updateTrackTagGroup.TrackTagGroupNotFound", [ - 'summit_id' => $summit->getId(), - 'track_tag_group_id' => $track_tag_group_id, - ]) - ); - } - - if (isset($data['allowed_tags'])) { - $track_tag_group->clearAllowedTags(); - foreach ($data['allowed_tags'] as $str_tag) { - Log::debug("updating allowed tags for track group"); - Log::debug(sprintf("trying to get tag %s ...", $str_tag)); - $tag = $this->tag_repository->getByTag($str_tag); - if(is_null($tag)) { - Log::debug(sprintf("creating tag %s ...", $str_tag)); - $tag = new Tag(trim($str_tag)); - } - $track_tag_group->addTag($tag); - } - } - - $track_tag_group = TrackTagGroupFactory::populate($track_tag_group, $summit, $data); - - if (isset($data['order']) && intval($data['order']) != $track_tag_group->getOrder()) { - // request to update order - $summit->recalculateTrackTagGroupOrder($track_tag_group, intval($data['order'])); - } - - return $track_tag_group; - }); - } - - /** - * @param Summit $summit - * @param int $track_tag_group_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteTrackTagGroup(Summit $summit, $track_tag_group_id) - { - $this->tx_service->transaction(function() use($summit, $track_tag_group_id) { - $track_tag_group = $summit->getTrackTagGroup($track_tag_group_id); - - if(is_null($track_tag_group)){ - throw new EntityNotFoundException - ( - trans("not_found_errors.SummitTrackTagGroupService.deleteTrackTagGroup.TrackTagGroupNotFound", [ - 'summit_id' => $summit->getId(), - 'track_tag_group_id' => $track_tag_group_id, - ]) - ); - } - - $summit->removeTrackTagGroup($track_tag_group); - }); - } - - /** - * @param Summit $summit - * @return TrackTagGroup[] - * @throws \Exception - */ - public function seedDefaultTrackTagGroups(Summit $summit) - { - return $this->tx_service->transaction(function() use($summit) { - $added_track_tag_groups = []; - $default_groups = $this->default_track_tag_group_repository->getAll(); - foreach($default_groups as $default_track_tag_group){ - // if already exists ... - if($summit->getTrackTagGroupByLabel($default_track_tag_group->getLabel())) - continue; - - $new_group = new TrackTagGroup(); - $new_group->setName($default_track_tag_group->getName()); - $new_group->setLabel($default_track_tag_group->getLabel()); - $new_group->setOrder($default_track_tag_group->getOrder()); - $new_group->setIsMandatory($default_track_tag_group->isMandatory()); - $summit->addTrackTagGroup($new_group); - $added_track_tag_groups[] = $new_group; - foreach ($default_track_tag_group->getAllowedTags() as $default_allowed_tag){ - $new_group->addTag($default_allowed_tag->getTag()); - } - } - return $added_track_tag_groups; - }); - } - - /** - * @param Summit $summit - * @param int $tag_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function seedTagOnAllTrack(Summit $summit, $tag_id) - { - return $this->tx_service->transaction(function() use($summit, $tag_id) { - - $tag = $this->tag_repository->getById($tag_id); - if(is_null($tag)) - throw new EntityNotFoundException( - trans( - "not_found_errors.SummitTrackTagGroupService.seedTagOnAllTrack.TagNotFound", - [ - 'tag_id' => $tag_id - ] - ) - ); - - $tag_track_group = $summit->getTrackTagGroupForTag($tag); - - if(is_null($tag_track_group)) - throw new ValidationException( - trans( - 'validation_errors.SummitTrackTagGroupService.seedTagOnAllTrack.TagDoesNotBelongToTrackTagGroup', - [ - 'tag_id' => $tag_id, - 'summit_id' => $summit->getId() - ] - ) - ); - - foreach ($summit->getPresentationCategories() as $track){ - $track->addAllowedTag($tag); - } - }); - } - - /** - * @param Summit $summit - * @param int $track_tag_group_id - * @param int $track_id - * @return void - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function seedTagTrackGroupTagsOnTrack(Summit $summit, $track_tag_group_id, $track_id) - { - return $this->tx_service->transaction(function() use($summit, $track_tag_group_id, $track_id) { - - $track_tag_group = $summit->getTrackTagGroup($track_tag_group_id); - - if(is_null($track_tag_group)){ - throw new EntityNotFoundException - ( - trans("not_found_errors.SummitTrackTagGroupService.seedTagTrackGroupTagsOnTrack.TrackTagGroupNotFound", [ - 'summit_id' => $summit->getId(), - 'track_tag_group_id' => $track_tag_group_id, - ]) - ); - } - - $track = $summit->getPresentationCategory($track_id); - - if(is_null($track)){ - throw new EntityNotFoundException - ( - trans("not_found_errors.SummitTrackTagGroupService.seedTagTrackGroupTagsOnTrack.TrackNotFound", [ - 'summit_id' => $summit->getId(), - 'track_id' => $track_id, - ]) - ); - } - - foreach ($track_tag_group->getAllowedTags() as $allowedTag){ - $track->addAllowedTag($allowedTag->getTag()); - } - - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/TagService.php b/app/Services/Model/Imp/TagService.php deleted file mode 100644 index b8d223e3..00000000 --- a/app/Services/Model/Imp/TagService.php +++ /dev/null @@ -1,61 +0,0 @@ -tag_repository = $tag_repository; - } - - /** - * @param array $payload - * @return Tag - */ - public function addTag(array $payload): Tag - { - return $this->tx_service->transaction(function () use ($payload){ - $former_tag = $this->tag_repository->getByTag(trim($payload['tag'])); - if(!is_null($former_tag)){ - throw new ValidationException(sprintf("tag %s already exists!", $payload['tag'])); - } - - $tag = new Tag(trim($payload['tag'])); - - $this->tag_repository->add($tag); - - return $tag; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/TrackChairService.php b/app/Services/Model/Imp/TrackChairService.php deleted file mode 100644 index 484e0cac..00000000 --- a/app/Services/Model/Imp/TrackChairService.php +++ /dev/null @@ -1,275 +0,0 @@ -member_repository = $member_repository; - $this->group_repository = $group_repository; - $this->resource_server_ctx = $resource_server_ctx; - } - - /** - * @param Summit $summit - * @param array $payload - * @return SummitTrackChair - * @throws \Exception - */ - public function addTrackChair(Summit $summit, array $payload): SummitTrackChair - { - return $this->tx_service->transaction(function () use ($summit, $payload) { - - $current_member = $this->resource_server_ctx->getCurrentUser(); - if (is_null($current_member)) - throw new AuthzException("User not Found"); - - $isAuth = $summit->isTrackChairAdmin($current_member); - - if (!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - $member = $this->member_repository->getById(intval($payload['member_id'])); - if (is_null($member) || !$member instanceof Member) - throw new EntityNotFoundException(sprintf("Member %s not found.", $payload['member_id'])); - - $former_track_chair = $summit->getTrackChairByMember($member); - - if (!is_null($former_track_chair)) { - throw new ValidationException(sprintf("Member %s already is a track chair on summit %s", $payload['member_id'], $summit->getId())); - } - - $group = $this->group_repository->getBySlug(IGroup::TrackChairs); - if (is_null($group)) { - throw new EntityNotFoundException(sprintf("Group %s not found.", IGroup::TrackChairs)); - } - - $member->add2Group($group); - - $categories = []; - - foreach ($payload['categories'] as $track_id) { - $track = $summit->getPresentationCategory(intval($track_id)); - if (is_null($track) || !$track instanceof PresentationCategory || !$track->isChairVisible()) - throw new EntityNotFoundException(sprintf("Presentation Category %s not found.", $track_id)); - $categories[] = $track; - } - - $track_chair = $summit->addTrackChair($member, $categories); - - foreach ($categories as $category) { - $category->createIndividualSelectionList($track_chair->getMember()); - $category->createTeamSelectionList(); - } - - return $track_chair; - - }); - } - - /** - * @param Summit $summit - * @param int $track_chair_id - * @param array $payload - * @return SummitTrackChair - * @throws \Exception - */ - public function updateTrackChair(Summit $summit, int $track_chair_id, array $payload): SummitTrackChair - { - return $this->tx_service->transaction(function () use ($summit, $track_chair_id, $payload) { - $current_member = $this->resource_server_ctx->getCurrentUser(); - if (is_null($current_member)) - throw new AuthzException("User not Found"); - - $isAuth = $summit->isTrackChairAdmin($current_member); - - if (!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - $track_chair = $summit->getTrackChair($track_chair_id); - - if(is_null($track_chair)) - throw new EntityNotFoundException(sprintf("Track Chair %s not found.", $track_chair_id)); - - $categories_2_remove = []; - - foreach ($track_chair->getCategories() as $category) { - if (!in_array($category->getId(), $payload['categories'])) - $categories_2_remove[] = $category; - } - - foreach ($payload['categories'] as $track_id) { - $category = $summit->getPresentationCategory(intval($track_id)); - if (is_null($category) || !$category instanceof PresentationCategory || !$category->isChairVisible()) - throw new EntityNotFoundException(sprintf("Presentation Category %s not found.", $track_id)); - - $track_chair->addCategory($category); - - $category->createIndividualSelectionList($track_chair->getMember()); - $category->createTeamSelectionList(); - } - - foreach ($categories_2_remove as $category){ - $track_chair->removeCategory($category); - } - - return $track_chair; - }); - } - - /** - * @param Summit $summit - * @param int $track_chair_id - * @throws \Exception - */ - public function deleteTrackChair(Summit $summit, int $track_chair_id): void - { - $this->tx_service->transaction(function () use ($summit, $track_chair_id) { - $current_member = $this->resource_server_ctx->getCurrentUser(); - if (is_null($current_member)) - throw new AuthzException("User not Found"); - - $isAuth = $summit->isTrackChairAdmin($current_member); - - if (!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - $track_chair = $summit->getTrackChair($track_chair_id); - - if(is_null($track_chair)) - throw new EntityNotFoundException(sprintf("Track Chair %s not found.", $track_chair_id)); - - foreach($track_chair->getCategories() as $category){ - $track_chair->removeCategory($category); - } - - $summit->removeTrackChair($track_chair); - }); - } - - /** - * @inheritDoc - */ - public function addTrack2TrackChair(Summit $summit, int $track_chair_id, int $track_id): SummitTrackChair - { - return $this->tx_service->transaction(function () use ($summit, $track_chair_id, $track_id) { - $current_member = $this->resource_server_ctx->getCurrentUser(); - if (is_null($current_member)) - throw new AuthzException("User not Found"); - - $isAuth = $summit->isTrackChairAdmin($current_member); - - if (!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - $track_chair = $summit->getTrackChair($track_chair_id); - - if(is_null($track_chair)) - throw new EntityNotFoundException(sprintf("Track Chair %s not found.", $track_chair_id)); - - $track = $summit->getPresentationCategory($track_id); - if(is_null($track)) - throw new EntityNotFoundException(sprintf("Track %s not found.", $track_id)); - - - $track_chair->addCategory($track); - - $track->createIndividualSelectionList($track_chair->getMember()); - $track->createTeamSelectionList(); - - return $track_chair; - }); - } - - /** - * @inheritDoc - */ - public function removeFromTrackChair(Summit $summit, int $track_chair_id, int $track_id): SummitTrackChair - { - return $this->tx_service->transaction(function () use ($summit, $track_chair_id, $track_id) { - $current_member = $this->resource_server_ctx->getCurrentUser(); - if (is_null($current_member)) - throw new AuthzException("User not Found"); - - $isAuth = $summit->isTrackChairAdmin($current_member); - - if (!$isAuth) - throw new AuthzException(sprintf("User %s is not authorized to perform this action.", $current_member->getId())); - - $track_chair = $summit->getTrackChair($track_chair_id); - - if(is_null($track_chair)) - throw new EntityNotFoundException(sprintf("Track Chair %s not found.", $track_chair_id)); - - $track = $track_chair->getCategory($track_id); - if(is_null($track)) - throw new EntityNotFoundException(sprintf("Track %s not found.", $track_id)); - - $track_chair->removeCategory($track); - - return $track_chair; - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Imp/TrackQuestionTemplateService.php b/app/Services/Model/Imp/TrackQuestionTemplateService.php deleted file mode 100644 index 07d1cba5..00000000 --- a/app/Services/Model/Imp/TrackQuestionTemplateService.php +++ /dev/null @@ -1,412 +0,0 @@ -track_repository = $track_repository; - $this->track_question_template_repository = $track_question_template_repository; - } - - /** - * @param array $payload - * @return TrackQuestionTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTrackQuestionTemplate(array $payload) - { - return $this->tx_service->transaction(function() use($payload){ - $former_track_question_template = $this->track_question_template_repository->getByName($payload["name"]); - if(!is_null($former_track_question_template)){ - throw new ValidationException( - trans( - "validation_errors.TrackQuestionTemplateService.addTrackQuestionTemplate.TrackQuestionTemplateLabelAlreadyExist" - ) - ); - } - - $former_track_question_template = $this->track_question_template_repository->getByLabel($payload["label"]); - if(!is_null($former_track_question_template)){ - throw new ValidationException( - trans( - "validation_errors.TrackQuestionTemplateService.addTrackQuestionTemplate.TrackQuestionTemplateNameAlreadyExist" - ) - ); - } - - $track_question_template = TrackQuestionTemplateFactory::build($payload); - - if(isset($payload['tracks'])){ - foreach($payload['tracks'] as $track_id){ - $track = $this->track_repository->getById($track_id); - if(is_null($track)) - throw new EntityNotFoundException( - trans( - "not_found_errors.TrackQuestionTemplateService.addTrackQuestionTemplate.TrackNotFound" - ,['track_id' => $track_id]) - ); - $track_question_template->addTrack($track); - } - } - - $this->track_question_template_repository->add($track_question_template); - - return $track_question_template; - }); - } - - /** - * @param int $track_question_template_id - * @param array $payload - * @return TrackQuestionTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTrackQuestionTemplate($track_question_template_id, array $payload) - { - return $this->tx_service->transaction(function() use($payload, $track_question_template_id){ - $former_track_question_template = $this->track_question_template_repository->getByName($payload["name"]); - if(!is_null($former_track_question_template) && $former_track_question_template->getId() != $track_question_template_id){ - throw new ValidationException( - trans( - "validation_errors.TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackQuestionTemplateLabelAlreadyExist" - ) - ); - } - - $former_track_question_template = $this->track_question_template_repository->getByLabel($payload["label"]); - if(!is_null($former_track_question_template) && $former_track_question_template->getId() != $track_question_template_id){ - throw new ValidationException( - trans( - "validation_errors.TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackQuestionTemplateNameAlreadyExist" - ) - ); - } - - $track_question_template = $this->track_question_template_repository->getById($track_question_template_id); - - if(is_null($track_question_template)) - throw new EntityNotFoundException( - trans( - 'not_found_errors.TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackQuestionTemplateNotFound', - [ - 'track_question_template_id' => $track_question_template_id - ] - ) - ); - $class_name = $payload['class_name']; - - $reflect = new \ReflectionClass($track_question_template); - if ($reflect->getShortName() !== $class_name) { - throw new EntityNotFoundException( - trans( - 'not_found_errors.TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackQuestionTemplateNotFound', - [ - 'track_question_template_id' => $track_question_template_id - ] - ) - ); - } - - if(isset($payload['tracks'])){ - $track_question_template->clearTracks(); - foreach($payload['tracks'] as $track_id){ - $track = $this->track_repository->getById($track_id); - if(is_null($track)) - throw new EntityNotFoundException( - trans( - "not_found_errors.TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackNotFound" - ,['track_id' => $track_id]) - ); - $track_question_template->addTrack($track); - } - } - - if($track_question_template instanceof TrackMultiValueQuestionTemplate){ - if(isset($payload['default_value_id'])){ - $default_value = $track_question_template->getValueById(intval($payload['default_value_id'])); - if(is_null($default_value)) - throw new EntityNotFoundException( - trans( - "not_found_errors.TrackQuestionTemplateService.updateTrackQuestionTemplate.DefaultValueNotFound" - , - [ - 'default_value_id' => $payload['default_value_id'] - ] - ) - ); - $track_question_template->setDefaultValue($default_value); - } - } - - return TrackQuestionTemplateFactory::populate($track_question_template, $payload); - }); - } - - /** - * @param int $track_question_template_id - * @return void - * @throws EntityNotFoundException - */ - public function deleteTrackQuestionTemplate($track_question_template_id){ - return $this->tx_service->transaction(function() use($track_question_template_id){ - $track_question_template = $this->track_question_template_repository->getById($track_question_template_id); - - if(is_null($track_question_template)) - throw new EntityNotFoundException( - trans( - 'not_found_errors.TrackQuestionTemplateService.deleteTrackQuestionTemplate.TrackQuestionTemplateNotFound', - [ - 'track_question_template_id' => $track_question_template_id - ] - ) - ); - - $this->track_question_template_repository->delete($track_question_template); - }); - } - - /** - * @param int $track_question_template_id - * @param array $data - * @return TrackQuestionValueTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function addTrackQuestionValueTemplate($track_question_template_id, $data){ - return $this->tx_service->transaction(function() use($track_question_template_id, $data){ - $track_question_template = $this->track_question_template_repository->getById($track_question_template_id); - - if(is_null($track_question_template)) - throw new EntityNotFoundException(); - - if(!$track_question_template instanceof TrackMultiValueQuestionTemplate){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.TrackQuestionTemplateService.addTrackQuestionValueTemplate.TrackQuestionTemplateNotFound', - [ - 'track_question_template_id' => $track_question_template_id, - ] - ) - ); - } - - $former_value = $track_question_template->getValueByValue($data['value']); - if(!is_null($former_value)){ - throw new ValidationException - ( - trans - ( - 'validation_errors.TrackQuestionTemplateService.addTrackQuestionValueTemplate.ValueAlreadyExist', - [ - 'track_question_template_id' => $track_question_template_id, - 'value' => $data['value'] - ] - ) - ); - } - - $former_value = $track_question_template->getValueByLabel($data['label']); - if(!is_null($former_value)){ - throw new ValidationException - ( - trans - ( - 'validation_errors.TrackQuestionTemplateService.addTrackQuestionValueTemplate.LabelAlreadyExist', - [ - 'track_question_template_id' => $track_question_template_id, - 'label' => $data['label'] - ] - ) - ); - } - - $value = TrackQuestionValueTemplateFactory::build($data); - - $track_question_template->addValue($value); - - return $value; - }); - } - - /** - * @param int $track_question_template_id - * @param int $track_question_value_template_id - * @param array $data - * @return TrackQuestionValueTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function updateTrackQuestionValueTemplate($track_question_template_id, $track_question_value_template_id, $data){ - return $this->tx_service->transaction(function() use($track_question_template_id, $track_question_value_template_id, $data){ - $track_question_template = $this->track_question_template_repository->getById($track_question_template_id); - - if(is_null($track_question_template)) - throw new EntityNotFoundException(); - - if(!$track_question_template instanceof TrackMultiValueQuestionTemplate){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.TrackQuestionTemplateService.updateTrackQuestionValueTemplate.TrackQuestionTemplateNotFound', - [ - 'track_question_template_id' => $track_question_template_id, - ] - ) - ); - } - - if(isset($data['value'])) { - $former_value = $track_question_template->getValueByValue($data['value']); - if (!is_null($former_value) && $former_value->getId() != $track_question_value_template_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.TrackQuestionTemplateService.updateTrackQuestionValueTemplate.ValueAlreadyExist', - [ - 'track_question_template_id' => $track_question_template_id, - 'value' => $data['value'] - ] - ) - ); - } - } - - if(isset($data['label'])) { - $former_value = $track_question_template->getValueByLabel($data['label']); - if (!is_null($former_value) && $former_value->getId() != $track_question_value_template_id) { - throw new ValidationException - ( - trans - ( - 'validation_errors.TrackQuestionTemplateService.updateTrackQuestionValueTemplate.LabelAlreadyExist', - [ - 'track_question_template_id' => $track_question_template_id, - 'label' => $data['label'] - ] - ) - ); - } - } - - $value = $track_question_template->getValueById($track_question_value_template_id); - if(is_null($value)) - throw new EntityNotFoundException( - trans( - 'not_found_errors.TrackQuestionTemplateService.updateTrackQuestionValueTemplate.TrackQuestionTemplateValueNotFound', - [ - 'track_question_value_template_id' => $track_question_value_template_id, - ] - ) - ); - - TrackQuestionValueTemplateFactory::populate($value, $data); - - if (isset($data['order']) && intval($data['order']) != $value->getOrder()) { - // request to update order - $track_question_template->recalculateValueOrder($value, intval($data['order'])); - } - - return $value; - - }); - } - - /** - * @param int $track_question_template_id - * @param int $track_question_value_template_id - * @param array $data - * @return TrackQuestionValueTemplate - * @throws EntityNotFoundException - * @throws ValidationException - */ - public function deleteTrackQuestionValueTemplate($track_question_template_id, $track_question_value_template_id){ - return $this->tx_service->transaction(function() use($track_question_template_id, $track_question_value_template_id){ - $track_question_template = $this->track_question_template_repository->getById($track_question_template_id); - - if(is_null($track_question_template)) - throw new EntityNotFoundException(); - - if(!$track_question_template instanceof TrackMultiValueQuestionTemplate){ - throw new EntityNotFoundException - ( - trans - ( - 'not_found_errors.TrackQuestionTemplateService.deleteTrackQuestionValueTemplate.TrackQuestionTemplateNotFound', - [ - 'track_question_template_id' => $track_question_template_id, - ] - ) - ); - } - - $value = $track_question_template->getValueById($track_question_value_template_id); - if(is_null($value)) - throw new EntityNotFoundException( - trans( - 'not_found_errors.TrackQuestionTemplateService.deleteTrackQuestionValueTemplate.TrackQuestionTemplateValueNotFound', - [ - 'track_question_value_template_id' => $track_question_value_template_id, - ] - ) - ); - - $track_question_template->removeValue($value); - - }); - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/AdminActions/AdminSummitEventActionSyncWorkRequestDeleteStrategy.php b/app/Services/Model/Strategies/AdminActions/AdminSummitEventActionSyncWorkRequestDeleteStrategy.php deleted file mode 100644 index 8ee9d48b..00000000 --- a/app/Services/Model/Strategies/AdminActions/AdminSummitEventActionSyncWorkRequestDeleteStrategy.php +++ /dev/null @@ -1,71 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(!$request instanceof AdminSummitEventActionSyncWorkRequest) return null; - $summit_event_id = $request->getSummitEventId(); - $pending_requests = $this->queue_manager->getSummitEventRequestFor($summit_event_id); - if(count($pending_requests) > 0 ){ - // delete all former and pending ... - foreach ($pending_requests as $pending_request) { - if($this->queue_manager->removeRequest($pending_request)) - $this->work_request_repository->delete($pending_request); - } - } - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/AdminActions/AdminSummitEventActionSyncWorkRequestUpdateStrategy.php b/app/Services/Model/Strategies/AdminActions/AdminSummitEventActionSyncWorkRequestUpdateStrategy.php deleted file mode 100644 index 4509b16a..00000000 --- a/app/Services/Model/Strategies/AdminActions/AdminSummitEventActionSyncWorkRequestUpdateStrategy.php +++ /dev/null @@ -1,72 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - } - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(!$request instanceof AdminSummitEventActionSyncWorkRequest) return null; - $summit_event_id = $request->getSummitEventId(); - $pending_requests = $this->queue_manager->getSummitEventRequestFor($summit_event_id); - - if(count($pending_requests) > 0 ){ - // delete all former and pending ... - foreach ($pending_requests as $pending_request) { - if( $this->queue_manager->removeRequest($pending_request)) - $this->work_request_repository->delete($pending_request); - } - } - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/AdminActions/AdminSummitLocationActionSyncWorkRequestDeleteStrategy.php b/app/Services/Model/Strategies/AdminActions/AdminSummitLocationActionSyncWorkRequestDeleteStrategy.php deleted file mode 100644 index 377bb4cd..00000000 --- a/app/Services/Model/Strategies/AdminActions/AdminSummitLocationActionSyncWorkRequestDeleteStrategy.php +++ /dev/null @@ -1,70 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(!$request instanceof AdminSummitLocationActionSyncWorkRequest) return null; - $pending_requests = $this->queue_manager->getSummitLocationRequestFor($request->getLocationId()); - if(count($pending_requests) > 0 ){ - // delete all former and pending ... - foreach ($pending_requests as $pending_request) { - if($this->queue_manager->removeRequest($pending_request)) - $this->work_request_repository->delete($pending_request); - } - } - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/AdminActions/AdminSummitLocationActionSyncWorkRequestUpdateStrategy.php b/app/Services/Model/Strategies/AdminActions/AdminSummitLocationActionSyncWorkRequestUpdateStrategy.php deleted file mode 100644 index 96f00bbf..00000000 --- a/app/Services/Model/Strategies/AdminActions/AdminSummitLocationActionSyncWorkRequestUpdateStrategy.php +++ /dev/null @@ -1,71 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(!$request instanceof AdminSummitLocationActionSyncWorkRequest) return null; - $pending_requests = $this->queue_manager->getSummitLocationRequestFor($request->getLocationId()); - if(count($pending_requests) > 0 ){ - // delete all former and pending ... - foreach ($pending_requests as $pending_request) { - if($this->queue_manager->removeRequest($pending_request)) - $this->work_request_repository->delete($pending_request); - } - } - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/CalendarSyncWorkRequestPreProcessorStrategyFactory.php b/app/Services/Model/Strategies/CalendarSyncWorkRequestPreProcessorStrategyFactory.php deleted file mode 100644 index ff7c5586..00000000 --- a/app/Services/Model/Strategies/CalendarSyncWorkRequestPreProcessorStrategyFactory.php +++ /dev/null @@ -1,126 +0,0 @@ -work_request_repository = $work_request_repository; - $this->calendar_sync_repository = $calendar_sync_repository; - } - - /** - * @param ICalendarSyncWorkRequestQueueManager $queue_manager - * @param AbstractCalendarSyncWorkRequest $request - * @return ICalendarSyncWorkRequestPreProcessorStrategy|null - */ - public function build(ICalendarSyncWorkRequestQueueManager $queue_manager, AbstractCalendarSyncWorkRequest $request){ - if($request instanceof MemberEventScheduleSummitActionSyncWorkRequest) { - switch ($request->getType()) { - case AbstractCalendarSyncWorkRequest::TypeRemove: - return new MemberEventScheduleSummitActionSyncWorkRequestDeleteStrategy($queue_manager, $this->work_request_repository); - case AbstractCalendarSyncWorkRequest::TypeAdd: - return new MemberEventScheduleSummitActionSyncWorkRequestAddStrategy($queue_manager, $this->work_request_repository); - - case AbstractCalendarSyncWorkRequest::TypeUpdate: - return new MemberEventScheduleSummitActionSyncWorkRequestUpdateStrategy($queue_manager, $this->work_request_repository); - } - } - if($request instanceof MemberCalendarScheduleSummitActionSyncWorkRequest){ - switch ($request->getType()) { - case AbstractCalendarSyncWorkRequest::TypeRemove: - return new MemberCalendarScheduleSummitActionSyncWorkRequestDeleteStrategy - ( - $queue_manager, - $this->work_request_repository, - $this->calendar_sync_repository - ); - - case AbstractCalendarSyncWorkRequest::TypeAdd: - return new MemberCalendarScheduleSummitActionSyncWorkRequestAddStrategy(); - } - } - if($request instanceof AdminSummitEventActionSyncWorkRequest){ - switch ($request->getType()) { - case AbstractCalendarSyncWorkRequest::TypeRemove: - return new AdminSummitEventActionSyncWorkRequestDeleteStrategy( - $queue_manager, - $this->work_request_repository - ); - case AbstractCalendarSyncWorkRequest::TypeUpdate: - return new AdminSummitEventActionSyncWorkRequestUpdateStrategy( - $queue_manager, - $this->work_request_repository - ); - } - } - if($request instanceof AdminSummitLocationActionSyncWorkRequest){ - switch ($request->getType()) { - case AbstractCalendarSyncWorkRequest::TypeRemove: - return new AdminSummitLocationActionSyncWorkRequestDeleteStrategy( - $queue_manager, - $this->work_request_repository - ); - case AbstractCalendarSyncWorkRequest::TypeUpdate: - return new AdminSummitLocationActionSyncWorkRequestUpdateStrategy( - $queue_manager, - $this->work_request_repository - ); - } - } - - return null; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/GeoLocation/GeoLocationAddressInfoStrategy.php b/app/Services/Model/Strategies/GeoLocation/GeoLocationAddressInfoStrategy.php deleted file mode 100644 index dcf4e452..00000000 --- a/app/Services/Model/Strategies/GeoLocation/GeoLocationAddressInfoStrategy.php +++ /dev/null @@ -1,49 +0,0 @@ -getGeoCoordinates - ( - new AddressInfo - ( - $location->getAddress1(), - $location->getAddress2(), - $location->getZipCode(), - $location->getState(), - $location->getCity(), - $location->getCountry() - ) - ); - - $location->setLat($response->getLat()); - $location->setLng($response->getLng()); - - return $location; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/GeoLocation/GeoLocationReverseStrategy.php b/app/Services/Model/Strategies/GeoLocation/GeoLocationReverseStrategy.php deleted file mode 100644 index ea695685..00000000 --- a/app/Services/Model/Strategies/GeoLocation/GeoLocationReverseStrategy.php +++ /dev/null @@ -1,46 +0,0 @@ -getAddressInfo - ( - new GeoCoordinatesInfo - ( - $location->getLat(), - $location->getLng() - ) - ); - - $location->setAddress1($response->getAddress()[0]); - $location->setZipCode($response->getZipCode()); - $location->setState($response->getState()); - $location->setCity($response->getCity()); - $location->setCountry($response->getCountry()); - return $location; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/GeoLocation/GeoLocationStrategyFactory.php b/app/Services/Model/Strategies/GeoLocation/GeoLocationStrategyFactory.php deleted file mode 100644 index a21b264c..00000000 --- a/app/Services/Model/Strategies/GeoLocation/GeoLocationStrategyFactory.php +++ /dev/null @@ -1,30 +0,0 @@ -getAddress1())) - return new GeoLocationAddressInfoStrategy(); - return new GeoLocationReverseStrategy(); - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/GeoLocation/IGeoLocationStrategy.php b/app/Services/Model/Strategies/GeoLocation/IGeoLocationStrategy.php deleted file mode 100644 index eab19625..00000000 --- a/app/Services/Model/Strategies/GeoLocation/IGeoLocationStrategy.php +++ /dev/null @@ -1,28 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - $this->calendar_sync_repository = $calendar_sync_repository; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(! $request instanceof MemberCalendarScheduleSummitActionSyncWorkRequest) return null; - $calendar_sync_info = $request->getCalendarSyncInfo(); - //check if we have pending make calendar on this round ... - $pending_calendar_create_request = $this->queue_manager->getCalendarRequestFor($calendar_sync_info->getId(), AbstractCalendarSyncWorkRequest::TypeAdd); - $calendar_created = true; - if(!is_null($pending_calendar_create_request)){ - if($this->queue_manager->removeRequest($pending_calendar_create_request)) - $this->work_request_repository->delete($pending_calendar_create_request); - $calendar_created = false; - } - // delete all pending work ( calendar and events) - $pending_requests = $this->queue_manager->getPendingEventsForCalendar($calendar_sync_info->getId()); - if(count($pending_requests) > 0 ) { - foreach($pending_requests as $pending_request) { - if($this->queue_manager->removeRequest($pending_request)) - $this->work_request_repository->delete($pending_request); - } - } - - if(!$calendar_created){ - // delete the current request ( delete calendar, we never created it ) - $this->work_request_repository->delete($request); - $this->queue_manager->clearPendingEventsForCalendar($calendar_sync_info->getId()); - // delete revoked credentials; - $this->calendar_sync_repository->delete($calendar_sync_info); - return null; - } - - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestAddStrategy.php b/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestAddStrategy.php deleted file mode 100644 index 4352feaf..00000000 --- a/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestAddStrategy.php +++ /dev/null @@ -1,84 +0,0 @@ -work_queue_manager = $work_queue_manager; - $this->work_request_repository = $work_request_repository; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(!$request instanceof MemberEventScheduleSummitActionSyncWorkRequest) return null; - $summit_event_id = $request->getSummitEventId(); - $calendar_sync_info = $request->getCalendarSyncInfo(); - // check if there is a former add, disregard and omit - $pending_requests = $this->work_queue_manager->getSummitEventRequestFor($calendar_sync_info->getId(), $summit_event_id); - if(count($pending_requests) > 0 ) { - foreach ($pending_requests as $pending_request) { - if($request->getType() == AbstractCalendarSyncWorkRequest::TypeUpdate) - { - $this->work_queue_manager->registerRequestForDelete($request); - continue; - } - if($this->work_queue_manager->removeRequest($pending_request)) - $this->work_request_repository->delete($pending_request); - } - // if the event is not already synchronized disregard add - if($request->getOwner()->isEventSynchronized($calendar_sync_info, $summit_event_id)) { - $this->work_queue_manager->unRegisterRequestForDelete($request, AbstractCalendarSyncWorkRequest::TypeUpdate); - $this->work_request_repository->delete($request); - return null; - } - } - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestDeleteStrategy.php b/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestDeleteStrategy.php deleted file mode 100644 index 21f59f96..00000000 --- a/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestDeleteStrategy.php +++ /dev/null @@ -1,83 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - } - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(!$request instanceof MemberEventScheduleSummitActionSyncWorkRequest) return null; - $summit_event_id = $request->getSummitEventId(); - $calendar_sync_info = $request->getCalendarSyncInfo(); - // check if there is a former add, disregard and omit - $pending_requests = $this->queue_manager->getSummitEventRequestFor($calendar_sync_info->getId(), $summit_event_id); - if(count($pending_requests) > 0 ) { - foreach ($pending_requests as $pending_request) { - if($request->getType() == AbstractCalendarSyncWorkRequest::TypeUpdate) - { - $this->queue_manager->registerRequestForDelete($request); - continue; - } - if($this->queue_manager->removeRequest($pending_request)) - $this->work_request_repository->delete($pending_request); - } - // if the event is not already synchronized disregard delete - if(!$request->getOwner()->isEventSynchronized($calendar_sync_info, $summit_event_id)) { - $this->work_request_repository->delete($request); - return null; - } - } - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestUpdateStrategy.php b/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestUpdateStrategy.php deleted file mode 100644 index ff5d0f1e..00000000 --- a/app/Services/Model/Strategies/MemberActions/MemberEventScheduleSummitActionSyncWorkRequestUpdateStrategy.php +++ /dev/null @@ -1,74 +0,0 @@ -queue_manager = $queue_manager; - $this->work_request_repository = $work_request_repository; - } - - - /** - * @param AbstractCalendarSyncWorkRequest $request - * @return AbstractCalendarSyncWorkRequest|null - */ - public function process(AbstractCalendarSyncWorkRequest $request) - { - if(!$request instanceof MemberEventScheduleSummitActionSyncWorkRequest) return null; - $summit_event_id = $request->getSummitEventId(); - $calendar_sync_info = $request->getCalendarSyncInfo(); - // check if there is a former ones, disregard and omit - $pending_requests = $this->queue_manager->getSummitEventRequestFor($calendar_sync_info->getId(), $summit_event_id); - if(count($pending_requests) > 0 || !$request->getOwner()->isEventSynchronized($calendar_sync_info, $summit_event_id)) { - //$this->work_request_repository->delete($request); - $this->queue_manager->registerRequestForDelete($request); - return null; - } - return $request; - } -} \ No newline at end of file diff --git a/app/Services/Model/dto/ExternalUserDTO.php b/app/Services/Model/dto/ExternalUserDTO.php deleted file mode 100644 index 60737bba..00000000 --- a/app/Services/Model/dto/ExternalUserDTO.php +++ /dev/null @@ -1,116 +0,0 @@ -id = $id; - $this->email = $email; - $this->first_name = $first_name; - $this->last_name = $last_name; - $this->active = $active; - $this->email_verified = $email_verified; - } - - /** - * @return mixed - */ - public function getId() - { - return $this->id; - } - - /** - * @return string - */ - public function getEmail(): ?string - { - return $this->email; - } - - /** - * @return string|null - */ - public function getFirstName(): ?string - { - return $this->first_name; - } - - /** - * @return string|null - */ - public function getLastName(): ?string - { - return $this->last_name; - } - - /** - * @return bool - */ - public function isActive(): bool - { - return $this->active; - } - - /** - * @return bool - */ - public function isEmailVerified(): bool - { - return $this->email_verified; - } - -} \ No newline at end of file diff --git a/app/Services/ModelServicesProvider.php b/app/Services/ModelServicesProvider.php deleted file mode 100644 index f5adadfd..00000000 --- a/app/Services/ModelServicesProvider.php +++ /dev/null @@ -1,511 +0,0 @@ -needs(ICalendarSyncWorkRequestQueueManager::class) - ->give(MemberScheduleWorkQueueManager::class); - - App::when(AdminActionsCalendarSyncPreProcessor::class) - ->needs(ICalendarSyncWorkRequestQueueManager::class) - ->give(AdminScheduleWorkQueueManager::class); - - // work request process services - - App::when(MemberActionsCalendarSyncProcessingService::class) - ->needs(ICalendarSyncWorkRequestPreProcessor::class) - ->give(MemberActionsCalendarSyncPreProcessor::class); - - App::singleton - ( - IMemberActionsCalendarSyncProcessingService::class, - MemberActionsCalendarSyncProcessingService::class - ); - - App::when(AdminActionsCalendarSyncProcessingService::class) - ->needs(ICalendarSyncWorkRequestPreProcessor::class) - ->give(AdminActionsCalendarSyncPreProcessor::class); - - App::singleton - ( - IAdminActionsCalendarSyncProcessingService::class, - AdminActionsCalendarSyncProcessingService::class - ); - - App::singleton( - IMemberService::class, - MemberService::class - ); - - App::singleton - ( - ISummitPromoCodeService::class, - SummitPromoCodeService::class - ); - - App::singleton - ( - ISummitEventTypeService::class, - SummitEventTypeService::class - ); - - App::singleton - ( - ISummitTrackService::class, - SummitTrackService::class - ); - - App::singleton - ( - ILocationService::class, - SummitLocationService::class - ); - - App::singleton - ( - IRSVPTemplateService::class, - RSVPTemplateService::class - ); - - App::singleton - ( - ISummitTicketTypeService::class, - SummitTicketTypeService::class - ); - - App::singleton - ( - IPresentationCategoryGroupService::class, - PresentationCategoryGroupService::class - ); - - App::singleton( - ISummitPushNotificationService::class, - SummitPushNotificationService::class - ); - - App::singleton( - ISummitSelectionPlanService::class, - SummitSelectionPlanService::class - ); - - App::singleton( - IOrganizationService::class, - OrganizationService::class - ); - - App::singleton( - ICompanyService::class, - CompanyService::class - ); - - App::singleton( - ISummitTrackTagGroupService::class, - SummitTrackTagGroupService::class - ); - - App::singleton( - ITrackQuestionTemplateService::class, - TrackQuestionTemplateService::class - ); - - App::singleton( - ITagService::class, - TagService::class - ); - - App::singleton( - IExternalScheduleFeedFactory::class, - ExternalScheduleFeedFactory::class - ); - - App::singleton( - IScheduleIngestionService::class, - ScheduleIngestionService::class - ); - - App::singleton - ( - ISummitAccessLevelTypeService::class, - SummitAccessLevelTypeService::class - ); - - App::singleton - ( - ISummitTaxTypeService::class, - SummitTaxTypeService::class - ); - - App::singleton - ( - ISummitBadgeFeatureTypeService::class, - SummitBadgeFeatureTypeService::class - ); - - App::singleton - ( - ISummitBadgeTypeService::class, - SummitBadgeTypeService::class - ); - - App::singleton( - ISummitSponsorService::class, - SummitSponsorService::class - ); - - App::singleton( - ISummitRefundPolicyTypeService::class, - SummitRefundPolicyTypeService::class - ); - - App::singleton( - ISummitOrderExtraQuestionTypeService::class, - SummitOrderExtraQuestionTypeService::class - ); - - App::singleton( - ISponsorshipTypeService::class, - SponsorshipTypeService::class - ); - - App::singleton(ISummitOrderService::class, SummitOrderService::class); - - App::singleton(ISponsorUserInfoGrantService::class, - SponsorUserInfoGrantService::class); - - App::singleton( - IRegistrationIngestionService::class, - RegistrationIngestionService::class - ); - - App::singleton( - IExternalRegistrationFeedFactory::class, - ExternalRegistrationFeedFactory::class - ); - - App::singleton( - IPaymentGatewayProfileService::class, - PaymentGatewayProfileService::class - ); - - App::singleton( - IBuildDefaultPaymentGatewayProfileStrategy::class, - BuildDefaultPaymentGatewayProfileStrategy::class - ); - - App::singleton( - ISummitEmailEventFlowService::class, - SummitEmailEventFlowService::class - ); - - App::singleton( - ISummitDocumentService::class, - SummitDocumentService::class - ); - - App::singleton - ( - ISummitRegistrationInvitationService::class, - SummitRegistrationInvitationService::class - ); - - App::singleton - ( - ISummitAdministratorPermissionGroupService::class, - SummitAdministratorPermissionGroupService::class - ); - - App::singleton - ( - ISummitMediaFileTypeService::class, - SummitMediaFileTypeService::class - ); - - App::singleton - ( - ISummitMediaUploadTypeService::class, - SummitMediaUploadTypeService::class - ); - - App::singleton - ( - IPresentationVideoMediaUploadProcessor::class, - PresentationVideoMediaUploadProcessor::class - ); - - App::singleton - ( - ISummitMetricService::class, - SummitMetricService::class - ); - - App::singleton - ( - ISponsoredProjectService::class, - SponsoredProjectService::class - ); - - App::singleton - ( - ISummitSelectedPresentationListService::class, - SummitSelectedPresentationListService::class - ); - - App::singleton - ( - ITrackChairService::class, - TrackChairService::class - ); - - App::singleton( - ISummitPresentationActionTypeService::class, - SummitPresentationActionTypeService::class - ); - - App::singleton( - ISummitPresentationActionService::class, - SummitPresentationActionService::class - ); - - App::singleton( - ISelectionPlanExtraQuestionTypeService::class, - SelectionPlanOrderExtraQuestionTypeService::class - ); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return [ - ISummitService::class, - ISpeakerService::class, - IPresentationService::class, - IChatTeamService::class, - IAttendeeService::class, - ICalendarSyncRemoteFacadeFactory::class, - ICalendarSyncWorkRequestPreProcessorStrategyFactory::class, - ICalendarSyncWorkRequestQueueManager::class, - ICalendarSyncWorkRequestPreProcessor::class, - IMemberActionsCalendarSyncProcessingService::class, - ICalendarSyncWorkRequestPreProcessor::class, - IAdminActionsCalendarSyncProcessingService::class, - IMemberService::class, - ISummitPromoCodeService::class, - ISummitEventTypeService::class, - ISummitTrackService::class, - ILocationService::class, - IRSVPTemplateService::class, - ISummitTicketTypeService::class, - IPresentationCategoryGroupService::class, - ISummitPushNotificationService::class, - ISummitSelectionPlanService::class, - IOrganizationService::class, - ICompanyService::class, - ISummitTrackTagGroupService::class, - ITrackQuestionTemplateService::class, - ITagService::class, - IExternalScheduleFeedFactory::class, - IScheduleIngestionService::class, - ISummitAccessLevelTypeService::class, - ISummitTaxTypeService::class, - ISummitBadgeFeatureTypeService::class, - ISummitBadgeTypeService::class, - ISummitSponsorService::class, - ISummitRefundPolicyTypeService::class, - ISummitOrderExtraQuestionTypeService::class, - ISponsorshipTypeService::class, - ISummitOrderService::class, - IRegistrationIngestionService::class, - IExternalRegistrationFeedFactory::class, - IPaymentGatewayProfileService::class, - IBuildDefaultPaymentGatewayProfileStrategy::class, - ISummitEmailEventFlowService::class, - ISummitDocumentService::class, - ISummitRegistrationInvitationService::class, - ISummitAdministratorPermissionGroupService::class, - ISummitMediaFileTypeService::class, - ISummitMediaUploadTypeService::class, - IPresentationVideoMediaUploadProcessor::class, - ISummitMetricService::class, - ISummitSelectedPresentationListService::class, - ITrackChairService::class, - ISummitPresentationActionTypeService::class, - ISummitPresentationActionService::class, - ISelectionPlanExtraQuestionTypeService::class, - ]; - } -} \ No newline at end of file diff --git a/app/Services/Utils/CSVReader.php b/app/Services/Utils/CSVReader.php deleted file mode 100644 index d709a7b0..00000000 --- a/app/Services/Utils/CSVReader.php +++ /dev/null @@ -1,147 +0,0 @@ -header = $header; - $this->lines = $lines; - } - - /** - * @param string $content - * @return array - */ - public static function buildFrom(string $content):CSVReader - { - Log::debug(sprintf("CSVReader::buildFrom content %s", $content)); - $data = str_getcsv($content,"\n" ); - Log::debug(sprintf("CSVReader::buildFrom data %s", json_encode($data))); - $idx = 0; - $header = []; - $lines = []; - foreach($data as $row) - { - $row = str_getcsv($row, ","); - Log::debug(sprintf("CSVReader::buildFrom row %s", json_encode($row))); - ++$idx; - if($idx === 1) { - - foreach($row as $idx => $val){ - // check the encoding of the header values - if(mb_detect_encoding($val) == 'UTF-8') - $val = iconv('utf-8', 'ascii//TRANSLIT', $val); - $header[] = $val; - } - continue; - } - $line = []; - if(count($row) != count($header)) continue; - for($i = 0; $i < count($header); $i++){ - $line[$header[$i]] = trim($row[$i]); - } - $lines[] = $line; - - } //parse the items in rows - return new CSVReader($header, $lines); - } - - /** - * @param string $colName - * @return bool - */ - public function hasColumn(string $colName):bool { - if(mb_detect_encoding($colName) == 'UTF-8') - $colName = iconv('utf-8', 'ascii//TRANSLIT', $colName); - return in_array(trim($colName), $this->header); - } - - /** - * Return the current element - * @link https://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - * @since 5.0.0 - */ - public function current() - { - return $this->lines[$this->position]; - } - - /** - * Move forward to next element - * @link https://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. - * @since 5.0.0 - */ - public function next() - { - ++$this->position; - } - - /** - * Return the key of the current element - * @link https://php.net/manual/en/iterator.key.php - * @return mixed scalar on success, or null on failure. - * @since 5.0.0 - */ - public function key() - { - return $this->position; - } - - /** - * Checks if current position is valid - * @link https://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns true on success or false on failure. - * @since 5.0.0 - */ - public function valid() - { - return isset($this->lines[$this->position]); - } - - /** - * Rewind the Iterator to the first element - * @link https://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - * @since 5.0.0 - */ - public function rewind() - { - $this->position = 0; - } -} \ No newline at end of file diff --git a/app/Services/Utils/DoctrineTransactionService.php b/app/Services/Utils/DoctrineTransactionService.php deleted file mode 100644 index 920eadc0..00000000 --- a/app/Services/Utils/DoctrineTransactionService.php +++ /dev/null @@ -1,111 +0,0 @@ -manager_name = $manager_name; - } - - /** - * Execute a Closure within a transaction. - * - * @param Closure $callback - * @param int $isolationLevel - * @return mixed - * @see lib/Doctrine/ORM/EntityManager.php - * @throws \Exception - */ - public function transaction(Closure $callback, int $isolationLevel = TransactionIsolationLevel::READ_COMMITTED) - { - $retry = 0; - $done = false; - $result = null; - - while (!$done and $retry < self::MaxRetries) { - try { - $em = Registry::getManager($this->manager_name); - $con = $em->getConnection(); - - /** - * Some database systems close the connection after a period of time, in MySQL this is system variable - * `wait_timeout`. Given the daemon is meant to run indefinitely we need to make sure we have an open - * connection before working any job. Otherwise we would see `MySQL has gone away` type errors. - */ - - if ($con->ping() === false) { - $con->close(); - $con->connect(); - } - - if (!$em->isOpen()) { - Log::warning("DoctrineTransactionService::transaction: entity manager is closed!, trying to re open..."); - $em = Registry::resetManager($this->manager_name); - // new entity manager - $con = $em->getConnection(); - } - - $con->setTransactionIsolation($isolationLevel); - $con->beginTransaction(); // suspend auto-commit - $result = $callback($this); - $em->flush(); - $con->commit(); - $done = true; - } catch (RetryableException $ex) { - Log::warning("retrying ..."); - Registry::resetManager($this->manager_name); - Log::warning("DoctrineTransactionService::transaction con->rollBack"); - $con->rollBack(); - Log::warning($ex); - $retry++; - if ($retry === self::MaxRetries) { - $em->close(); - $con->rollBack(); - throw $ex; - } - } catch (Exception $ex) { - Log::warning("rolling back transaction"); - Log::warning($ex); - $em->close(); - $con->rollBack(); - throw $ex; - } - } - - return $result; - } -} \ No newline at end of file diff --git a/app/Services/Utils/EloquentTransactionService.php b/app/Services/Utils/EloquentTransactionService.php deleted file mode 100644 index 3db29a82..00000000 --- a/app/Services/Utils/EloquentTransactionService.php +++ /dev/null @@ -1,39 +0,0 @@ -enc = new Encrypter($key, $cipher); - } - - public function encrypt($value) - { - return $this->enc->encrypt($value); - } - - public function decrypt($payload) - { - return $this->enc->decrypt($payload); - } -} \ No newline at end of file diff --git a/app/Services/Utils/Facades/Encryption.php b/app/Services/Utils/Facades/Encryption.php deleted file mode 100644 index b3c21920..00000000 --- a/app/Services/Utils/Facades/Encryption.php +++ /dev/null @@ -1,27 +0,0 @@ -redis = Redis::connection(); - } - - public function boot() - { - if (is_null($this->redis)) - { - $this->redis = Redis::connection(); - } - } - /** - * @param $key - * @return mixed - */ - public function delete($key) - { - $res = 0; - if ($this->redis->exists($key)) - { - $res = $this->redis->del($key); - } - return $res; - } - - public function deleteArray(array $keys) - { - if (count($keys)>0) - { - $this->redis->del($keys); - } - } - - /** - * @param $key - * @return bool - */ - public function exists($key) - { - $res = $this->redis->exists($key); - return $res>0; - } - - /** - * @param $name - * @param array $values - * @return mixed - */ - public function getHash($name, array $values) - { - $res = array(); - if ($this->redis->exists($name)) - { - $cache_values = $this->redis->hmget($name, $values); - for ($i=0; $iredis->exists($name)) - { - $this->redis->hmset($name, $values); - $res = true; - //sets expiration time - if ($ttl>0) - { - $this->redis->expire($name, $ttl); - } - } - return $res; - } - - public function incCounter($counter_name, $ttl = 0) - { - if ($this->redis->setnx($counter_name, 1)) - { - $this->redis->expire($counter_name, $ttl); - return 1; - } - else - { - return (int)$this->redis->incr($counter_name); - } - } - - public function incCounterIfExists($counter_name) - { - $res = false; - if ($this->redis->exists($counter_name)) - { - $this->redis->incr($counter_name); - $res = true; - } - return $res; - } - - public function addMemberSet($set_name, $member) - { - return $this->redis->sadd($set_name, $member); - } - - public function deleteMemberSet($set_name, $member) - { - return $this->redis->srem($set_name, $member); - } - - public function getSet($set_name) - { - return $this->redis->smembers($set_name); - } - - public function getSingleValue($key) - { - return $this->redis->get($key); - } - - public function setSingleValue($key, $value, $ttl = 0) - { - if ($ttl>0) - { - return $this->redis->setex($key, $ttl, $value); - } - else - { - return $this->redis->set($key, $value); - } - } - - public function addSingleValue($key, $value, $ttl = 0) - { - $res = $this->redis->setnx($key, $value); - if ($res && $ttl>0) - { - $this->redis->expire($key, $ttl); - } - return $res; - } - - public function setKeyExpiration($key, $ttl) - { - $this->redis->expire($key, intval($ttl)); - } - - /**Returns the remaining time to live of a key that has a timeout. - * @param string $key - * @return int - */ - public function ttl($key) - { - return (int)$this->redis->ttl($key); - } -} \ No newline at end of file diff --git a/app/Services/Utils/UserClientHelper.php b/app/Services/Utils/UserClientHelper.php deleted file mode 100644 index 41f2bbd3..00000000 --- a/app/Services/Utils/UserClientHelper.php +++ /dev/null @@ -1,39 +0,0 @@ -make(Illuminate\Contracts\Console\Kernel::class); - -$status = $kernel->handle( - $input = new Symfony\Component\Console\Input\ArgvInput, - new Symfony\Component\Console\Output\ConsoleOutput -); - -/* -|-------------------------------------------------------------------------- -| Shutdown The Application -|-------------------------------------------------------------------------- -| -| Once Artisan has finished running. We will fire off the shutdown events -| so that any final work may be done by the application before we shut -| down the process. This is the last thing to happen to the request. -| -*/ - -$kernel->terminate($input, $status); - -exit($status); diff --git a/bindep.txt b/bindep.txt deleted file mode 100644 index aee48ba1..00000000 --- a/bindep.txt +++ /dev/null @@ -1,22 +0,0 @@ -php7.2 [platform:dpkg] - -php7.2-cli [platform:dpkg] - -php7.2-common [platform:dpkg] - -php7.2-curl [platform:dpkg] - -php7.2-gd [platform:dpkg] - -php7.2-json [platform:dpkg] - -php7.2-mysqlnd [platform:dpkg] - -php7.2-xml [platform:dpkg] - -php7.2-mbstring [platform:dpkg] - -php7.2-gmp [platform:dpkg] - -php7.2-ssh2 [platform:dpkg] - diff --git a/bootstrap/app.php b/bootstrap/app.php deleted file mode 100644 index f2801adf..00000000 --- a/bootstrap/app.php +++ /dev/null @@ -1,55 +0,0 @@ -singleton( - Illuminate\Contracts\Http\Kernel::class, - App\Http\Kernel::class -); - -$app->singleton( - Illuminate\Contracts\Console\Kernel::class, - App\Console\Kernel::class -); - -$app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - App\Exceptions\Handler::class -); - -/* -|-------------------------------------------------------------------------- -| Return The Application -|-------------------------------------------------------------------------- -| -| This script returns the application instance. The instance is given to -| the calling script so we can separate the building of the instances -| from the actual running of the application and sending responses. -| -*/ - -return $app; diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php deleted file mode 100644 index 38301379..00000000 --- a/bootstrap/autoload.php +++ /dev/null @@ -1,34 +0,0 @@ -=5.5" - }, - "require-dev": { - "andrewsville/php-token-reflection": "^1.4", - "aws/aws-php-sns-message-validator": "~1.0", - "behat/behat": "~3.0", - "doctrine/cache": "~1.4", - "ext-dom": "*", - "ext-openssl": "*", - "ext-pcntl": "*", - "ext-sockets": "*", - "nette/neon": "^2.3", - "paragonie/random_compat": ">= 2", - "phpunit/phpunit": "^4.8.35|^5.4.3", - "psr/cache": "^1.0", - "psr/simple-cache": "^1.0", - "sebastian/comparator": "^1.2.3" - }, - "suggest": { - "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", - "doctrine/cache": "To use the DoctrineCacheAdapter", - "ext-curl": "To send requests using cURL", - "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", - "ext-sockets": "To use client-side monitoring" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Aws\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Amazon Web Services", - "homepage": "http://aws.amazon.com" - } - ], - "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", - "homepage": "http://aws.amazon.com/sdkforphp", - "keywords": [ - "amazon", - "aws", - "cloud", - "dynamodb", - "ec2", - "glacier", - "s3", - "sdk" - ], - "time": "2021-06-25T18:19:14+00:00" - }, - { - "name": "bacon/bacon-qr-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/Bacon/BaconQrCode.git", - "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee", - "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "php": "^5.4|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "suggest": { - "ext-gd": "to generate QR code images" - }, - "type": "library", - "autoload": { - "psr-0": { - "BaconQrCode": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Ben Scholzen 'DASPRiD'", - "email": "mail@dasprids.de", - "homepage": "http://www.dasprids.de", - "role": "Developer" - } - ], - "description": "BaconQrCode is a QR code generator for PHP.", - "homepage": "https://github.com/Bacon/BaconQrCode", - "time": "2017-10-17T09:59:25+00:00" - }, - { - "name": "behat/transliterator", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/Behat/Transliterator.git", - "reference": "3c4ec1d77c3d05caa1f0bf8fb3aae4845005c7fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Transliterator/zipball/3c4ec1d77c3d05caa1f0bf8fb3aae4845005c7fc", - "reference": "3c4ec1d77c3d05caa1f0bf8fb3aae4845005c7fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "chuyskywalker/rolling-curl": "^3.1", - "php-yaoi/php-yaoi": "^1.0", - "phpunit/phpunit": "^4.8.36|^6.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "psr-4": { - "Behat\\Transliterator\\": "src/Behat/Transliterator" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Artistic-1.0" - ], - "description": "String transliterator", - "keywords": [ - "i18n", - "slug", - "transliterator" - ], - "time": "2020-01-14T16:39:13+00:00" - }, - { - "name": "cocur/slugify", - "version": "v2.5", - "source": { - "type": "git", - "url": "https://github.com/cocur/slugify.git", - "reference": "e8167e9a3236044afebd6e8ab13ebeb3ec9ca145" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cocur/slugify/zipball/e8167e9a3236044afebd6e8ab13ebeb3ec9ca145", - "reference": "e8167e9a3236044afebd6e8ab13ebeb3ec9ca145", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "laravel/framework": "~5.1", - "latte/latte": "~2.2", - "league/container": "^2.2.0", - "mikey179/vfsstream": "~1.6", - "mockery/mockery": "~0.9", - "nette/di": "~2.2", - "phpunit/phpunit": "~4.8|~5.2", - "pimple/pimple": "~1.1", - "plumphp/plum": "~0.1", - "silex/silex": "~1.3", - "symfony/config": "~2.4|~3.0", - "symfony/dependency-injection": "~2.4|~3.0", - "symfony/http-kernel": "~2.4|~3.0", - "twig/twig": "~1.26|~2.0", - "zendframework/zend-modulemanager": "~2.2", - "zendframework/zend-servicemanager": "~2.2", - "zendframework/zend-view": "~2.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Cocur\\Slugify\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ivo Bathke", - "email": "ivo.bathke@gmail.com" - }, - { - "name": "Florian Eckerstorfer", - "email": "florian@eckerstorfer.co", - "homepage": "https://florian.ec" - } - ], - "description": "Converts a string into a slug.", - "keywords": [ - "slug", - "slugify" - ], - "time": "2017-03-23T21:52:55+00:00" - }, - { - "name": "dnoegel/php-xdg-base-dir", - "version": "v0.1.1", - "source": { - "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" - }, - "type": "library", - "autoload": { - "psr-4": { - "XdgBaseDir\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "implementation of xdg base directory specification for php", - "time": "2019-12-04T15:06:13+00:00" - }, - { - "name": "doctrine/annotations", - "version": "1.13.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f", - "reference": "e6e7b7d5b45a2f2abc5460cc6396480b2b1d321f", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2021-05-16T18:07:53+00:00" - }, - { - "name": "doctrine/cache", - "version": "1.11.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "3bb5588cec00a0268829cc4a518490df6741af9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/3bb5588cec00a0268829cc4a518490df6741af9d", - "reference": "3bb5588cec00a0268829cc4a518490df6741af9d", - "shasum": "" - }, - "require": { - "php": "~7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4", - "psr/cache": ">=3" - }, - "require-dev": { - "alcaeus/mongo-php-adapter": "^1.1", - "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^8.0", - "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "predis/predis": "~1.0", - "psr/cache": "^1.0 || ^2.0", - "symfony/cache": "^4.4 || ^5.2" - }, - "suggest": { - "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", - "homepage": "https://www.doctrine-project.org/projects/cache.html", - "keywords": [ - "abstraction", - "apcu", - "cache", - "caching", - "couchdb", - "memcached", - "php", - "redis", - "xcache" - ], - "time": "2021-05-25T09:01:55+00:00" - }, - { - "name": "doctrine/collections", - "version": "1.6.7", - "source": { - "type": "git", - "url": "https://github.com/doctrine/collections.git", - "reference": "55f8b799269a1a472457bd1a41b4f379d4cfba4a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/55f8b799269a1a472457bd1a41b4f379d4cfba4a", - "reference": "55f8b799269a1a472457bd1a41b4f379d4cfba4a", - "shasum": "" - }, - "require": { - "php": "^7.1.3 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan-shim": "^0.9.2", - "phpunit/phpunit": "^7.0", - "vimeo/psalm": "^3.8.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.", - "homepage": "https://www.doctrine-project.org/projects/collections.html", - "keywords": [ - "array", - "collections", - "iterators", - "php" - ], - "time": "2020-07-27T17:53:49+00:00" - }, - { - "name": "doctrine/common", - "version": "2.12.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "2053eafdf60c2172ee1373d1b9289ba1db7f1fc6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/2053eafdf60c2172ee1373d1b9289ba1db7f1fc6", - "reference": "2053eafdf60c2172ee1373d1b9289ba1db7f1fc6", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.0", - "doctrine/cache": "^1.0", - "doctrine/collections": "^1.0", - "doctrine/event-manager": "^1.0", - "doctrine/inflector": "^1.0", - "doctrine/lexer": "^1.0", - "doctrine/persistence": "^1.1", - "doctrine/reflection": "^1.0", - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^1.0", - "phpstan/phpstan": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpunit/phpunit": "^7.0", - "squizlabs/php_codesniffer": "^3.0", - "symfony/phpunit-bridge": "^4.0.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.11.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, persistence interfaces, proxies, event system and much more.", - "homepage": "https://www.doctrine-project.org/projects/common.html", - "keywords": [ - "common", - "doctrine", - "php" - ], - "time": "2020-01-10T15:49:25+00:00" - }, - { - "name": "doctrine/dbal", - "version": "2.13.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/dbal.git", - "reference": "8dd39d2ead4409ce652fd4f02621060f009ea5e4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/8dd39d2ead4409ce652fd4f02621060f009ea5e4", - "reference": "8dd39d2ead4409ce652fd4f02621060f009ea5e4", - "shasum": "" - }, - "require": { - "doctrine/cache": "^1.0|^2.0", - "doctrine/deprecations": "^0.5.3", - "doctrine/event-manager": "^1.0", - "ext-pdo": "*", - "php": "^7.1 || ^8" - }, - "require-dev": { - "doctrine/coding-standard": "9.0.0", - "jetbrains/phpstorm-stubs": "2020.2", - "phpstan/phpstan": "0.12.81", - "phpunit/phpunit": "^7.5.20|^8.5|9.5.5", - "squizlabs/php_codesniffer": "3.6.0", - "symfony/cache": "^4.4", - "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", - "vimeo/psalm": "4.6.4" - }, - "suggest": { - "symfony/console": "For helpful console commands such as SQL execution and import of files." - }, - "bin": [ - "bin/doctrine-dbal" - ], - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\DBAL\\": "lib/Doctrine/DBAL" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - } - ], - "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", - "homepage": "https://www.doctrine-project.org/projects/dbal.html", - "keywords": [ - "abstraction", - "database", - "db2", - "dbal", - "mariadb", - "mssql", - "mysql", - "oci8", - "oracle", - "pdo", - "pgsql", - "postgresql", - "queryobject", - "sasql", - "sql", - "sqlanywhere", - "sqlite", - "sqlserver", - "sqlsrv" - ], - "time": "2021-06-18T21:48:39+00:00" - }, - { - "name": "doctrine/deprecations", - "version": "v0.5.3", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/9504165960a1f83cc1480e2be1dd0a0478561314", - "reference": "9504165960a1f83cc1480e2be1dd0a0478561314", - "shasum": "" - }, - "require": { - "php": "^7.1|^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0|^7.0|^8.0", - "phpunit/phpunit": "^7.0|^8.0|^9.0", - "psr/log": "^1.0" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "time": "2021-03-21T12:59:47+00:00" - }, - { - "name": "doctrine/event-manager", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/event-manager.git", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": "<2.9@dev" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", - "homepage": "https://www.doctrine-project.org/projects/event-manager.html", - "keywords": [ - "event", - "event dispatcher", - "event manager", - "event system", - "events" - ], - "time": "2020-05-29T18:28:51+00:00" - }, - { - "name": "doctrine/inflector", - "version": "1.4.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", - "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector", - "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", - "homepage": "https://www.doctrine-project.org/projects/inflector.html", - "keywords": [ - "inflection", - "inflector", - "lowercase", - "manipulation", - "php", - "plural", - "singular", - "strings", - "uppercase", - "words" - ], - "time": "2021-04-16T17:34:40+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2020-11-10T18:47:58+00:00" - }, - { - "name": "doctrine/lexer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", - "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" - ], - "time": "2020-05-25T17:44:05+00:00" - }, - { - "name": "doctrine/migrations", - "version": "v1.8.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/migrations.git", - "reference": "215438c0eef3e5f9b7da7d09c6b90756071b43e6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/215438c0eef3e5f9b7da7d09c6b90756071b43e6", - "reference": "215438c0eef3e5f9b7da7d09c6b90756071b43e6", - "shasum": "" - }, - "require": { - "doctrine/dbal": "~2.6", - "ocramius/proxy-manager": "^1.0|^2.0", - "php": "^7.1", - "symfony/console": "~3.3|^4.0" - }, - "require-dev": { - "doctrine/coding-standard": "^1.0", - "doctrine/orm": "~2.5", - "jdorn/sql-formatter": "~1.1", - "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "~7.0", - "squizlabs/php_codesniffer": "^3.0", - "symfony/yaml": "~3.3|^4.0" - }, - "suggest": { - "jdorn/sql-formatter": "Allows to generate formatted SQL with the diff command.", - "symfony/yaml": "Allows the use of yaml for migration configuration files." - }, - "bin": [ - "bin/doctrine-migrations" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "v1.8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\DBAL\\Migrations\\": "lib/Doctrine/DBAL/Migrations", - "Doctrine\\Migrations\\": "lib/Doctrine/Migrations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Michael Simonson", - "email": "contact@mikesimonson.com" - } - ], - "description": "Database Schema migrations using Doctrine DBAL", - "homepage": "https://www.doctrine-project.org/projects/migrations.html", - "keywords": [ - "database", - "migrations" - ], - "time": "2018-06-06T21:00:30+00:00" - }, - { - "name": "doctrine/orm", - "version": "v2.6.4", - "source": { - "type": "git", - "url": "https://github.com/doctrine/orm.git", - "reference": "b52ef5a1002f99ab506a5a2d6dba5a2c236c5f43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/b52ef5a1002f99ab506a5a2d6dba5a2c236c5f43", - "reference": "b52ef5a1002f99ab506a5a2d6dba5a2c236c5f43", - "shasum": "" - }, - "require": { - "doctrine/annotations": "~1.5", - "doctrine/cache": "~1.6", - "doctrine/collections": "^1.4", - "doctrine/common": "^2.7.1", - "doctrine/dbal": "^2.6", - "doctrine/instantiator": "~1.1", - "ext-pdo": "*", - "php": "^7.1", - "symfony/console": "~3.0|~4.0" - }, - "require-dev": { - "doctrine/coding-standard": "^5.0", - "phpunit/phpunit": "^7.5", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" - }, - "bin": [ - "bin/doctrine" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\ORM\\": "lib/Doctrine/ORM" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Object-Relational-Mapper for PHP", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "database", - "orm" - ], - "time": "2019-09-20T14:30:26+00:00" - }, - { - "name": "doctrine/persistence", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/persistence.git", - "reference": "3da7c9d125591ca83944f477e65ed3d7b4617c48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/3da7c9d125591ca83944f477e65ed3d7b4617c48", - "reference": "3da7c9d125591ca83944f477e65ed3d7b4617c48", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.0", - "doctrine/cache": "^1.0", - "doctrine/collections": "^1.0", - "doctrine/event-manager": "^1.0", - "doctrine/reflection": "^1.0", - "php": "^7.1" - }, - "conflict": { - "doctrine/common": "<2.10@dev" - }, - "require-dev": { - "doctrine/coding-standard": "^5.0", - "phpstan/phpstan": "^0.8", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.", - "homepage": "https://doctrine-project.org/projects/persistence.html", - "keywords": [ - "mapper", - "object", - "odm", - "orm", - "persistence" - ], - "time": "2019-04-23T08:28:24+00:00" - }, - { - "name": "doctrine/reflection", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/reflection.git", - "reference": "fa587178be682efe90d005e3a322590d6ebb59a5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/reflection/zipball/fa587178be682efe90d005e3a322590d6ebb59a5", - "reference": "fa587178be682efe90d005e3a322590d6ebb59a5", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.0", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/common": "<2.9" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0 || ^8.2.0", - "doctrine/common": "^2.10", - "phpstan/phpstan": "^0.11.0 || ^0.12.20", - "phpstan/phpstan-phpunit": "^0.11.0 || ^0.12.16", - "phpunit/phpunit": "^7.5 || ^9.1.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of the reflection functionality that comes with PHP. It allows you to get the reflection information about classes, methods and properties statically.", - "homepage": "https://www.doctrine-project.org/projects/reflection.html", - "keywords": [ - "reflection", - "static" - ], - "abandoned": "roave/better-reflection", - "time": "2020-10-27T21:46:55+00:00" - }, - { - "name": "dragonmantank/cron-expression", - "version": "v2.3.1", - "source": { - "type": "git", - "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/65b2d8ee1f10915efb3b55597da3404f096acba2", - "reference": "65b2d8ee1f10915efb3b55597da3404f096acba2", - "shasum": "" - }, - "require": { - "php": "^7.0|^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.4|^7.0|^8.0|^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "Cron\\": "src/Cron/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Chris Tankersley", - "email": "chris@ctankersley.com", - "homepage": "https://github.com/dragonmantank" - } - ], - "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", - "keywords": [ - "cron", - "schedule" - ], - "time": "2020-10-13T00:52:37+00:00" - }, - { - "name": "egulias/email-validator", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/egulias/EmailValidator.git", - "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c81f18a3efb941d8c4d2e025f6183b5c6d697307", - "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307", - "shasum": "" - }, - "require": { - "doctrine/lexer": "^1.2", - "php": ">=7.2", - "symfony/polyfill-intl-idn": "^1.15" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^8.5.8|^9.3.3", - "vimeo/psalm": "^4" - }, - "suggest": { - "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Egulias\\EmailValidator\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Eduardo Gulias Davis" - } - ], - "description": "A library for validating emails against several RFCs", - "homepage": "https://github.com/egulias/EmailValidator", - "keywords": [ - "email", - "emailvalidation", - "emailvalidator", - "validation", - "validator" - ], - "time": "2021-04-01T18:37:14+00:00" - }, - { - "name": "eluceo/ical", - "version": "0.15.1", - "source": { - "type": "git", - "url": "https://github.com/markuspoerschke/iCal.git", - "reference": "bdd24747587f6f9b10770a7b873a13e273f85f39" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/markuspoerschke/iCal/zipball/bdd24747587f6f9b10770a7b873a13e273f85f39", - "reference": "bdd24747587f6f9b10770a7b873a13e273f85f39", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-mbstring": "Massive performance enhancement of line folding" - }, - "type": "library", - "autoload": { - "psr-4": { - "Eluceo\\iCal\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Markus Poerschke", - "email": "markus@eluceo.de", - "role": "Developer" - } - ], - "description": "The eluceo/iCal package offers a abstraction layer for creating iCalendars. You can easily create iCal files by using PHP object instead of typing your *.ics file by hand. The output will follow RFC 5545 as best as possible.", - "homepage": "https://github.com/markuspoerschke/iCal", - "keywords": [ - "calendar", - "iCalendar", - "ical", - "ics", - "php calendar" - ], - "time": "2019-08-06T20:33:43+00:00" - }, - { - "name": "erusev/parsedown", - "version": "1.7.4", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown.git", - "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/cb17b6477dfff935958ba01325f2e8a2bfa6dab3", - "reference": "cb17b6477dfff935958ba01325f2e8a2bfa6dab3", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35" - }, - "type": "library", - "autoload": { - "psr-0": { - "Parsedown": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "Parser for Markdown.", - "homepage": "http://parsedown.org", - "keywords": [ - "markdown", - "parser" - ], - "time": "2019-12-30T22:54:17+00:00" - }, - { - "name": "ezyang/htmlpurifier", - "version": "v4.7.0", - "source": { - "type": "git", - "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "ae1828d955112356f7677c465f94f7deb7d27a40" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40", - "reference": "ae1828d955112356f7677c465f94f7deb7d27a40", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "HTMLPurifier": "library/" - }, - "files": [ - "library/HTMLPurifier.composer.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Edward Z. Yang", - "email": "admin@htmlpurifier.org", - "homepage": "http://ezyang.com" - } - ], - "description": "Standards compliant HTML filter written in PHP", - "homepage": "http://htmlpurifier.org/", - "keywords": [ - "html" - ], - "time": "2015-08-05T01:03:42+00:00" - }, - { - "name": "fideloper/proxy", - "version": "4.4.1", - "source": { - "type": "git", - "url": "https://github.com/fideloper/TrustedProxy.git", - "reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fideloper/TrustedProxy/zipball/c073b2bd04d1c90e04dc1b787662b558dd65ade0", - "reference": "c073b2bd04d1c90e04dc1b787662b558dd65ade0", - "shasum": "" - }, - "require": { - "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0", - "php": ">=5.4.0" - }, - "require-dev": { - "illuminate/http": "^5.0|^6.0|^7.0|^8.0|^9.0", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Fideloper\\Proxy\\TrustedProxyServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Fideloper\\Proxy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Chris Fidao", - "email": "fideloper@gmail.com" - } - ], - "description": "Set trusted proxies for Laravel", - "keywords": [ - "load balancing", - "proxy", - "trusted proxy" - ], - "time": "2020-10-22T13:48:01+00:00" - }, - { - "name": "firebase/php-jwt", - "version": "v5.4.0", - "source": { - "type": "git", - "url": "https://github.com/firebase/php-jwt.git", - "reference": "d2113d9b2e0e349796e72d2a63cf9319100382d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d2113d9b2e0e349796e72d2a63cf9319100382d2", - "reference": "d2113d9b2e0e349796e72d2a63cf9319100382d2", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": ">=4.8 <=9" - }, - "suggest": { - "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" - }, - "type": "library", - "autoload": { - "psr-4": { - "Firebase\\JWT\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Neuman Vong", - "email": "neuman+pear@twilio.com", - "role": "Developer" - }, - { - "name": "Anant Narayanan", - "email": "anant@php.net", - "role": "Developer" - } - ], - "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", - "homepage": "https://github.com/firebase/php-jwt", - "keywords": [ - "jwt", - "php" - ], - "time": "2021-06-23T19:00:23+00:00" - }, - { - "name": "glenscott/url-normalizer", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/glenscott/url-normalizer.git", - "reference": "b8e79d3360a1bd7182398c9956bd74d219ad1b3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/glenscott/url-normalizer/zipball/b8e79d3360a1bd7182398c9956bd74d219ad1b3c", - "reference": "b8e79d3360a1bd7182398c9956bd74d219ad1b3c", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "URL\\": "src/URL" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Glen Scott", - "email": "glen@glenscott.co.uk" - } - ], - "description": "Syntax based normalization of URL's", - "time": "2015-06-11T16:06:02+00:00" - }, - { - "name": "google/apiclient", - "version": "v2.10.1", - "source": { - "type": "git", - "url": "https://github.com/googleapis/google-api-php-client.git", - "reference": "11871e94006ce7a419bb6124d51b6f9ace3f679b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/11871e94006ce7a419bb6124d51b6f9ace3f679b", - "reference": "11871e94006ce7a419bb6124d51b6f9ace3f679b", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "~2.0||~3.0||~4.0||~5.0", - "google/apiclient-services": "~0.200", - "google/auth": "^1.10", - "guzzlehttp/guzzle": "~5.3.3||~6.0||~7.0", - "guzzlehttp/psr7": "^1.2", - "monolog/monolog": "^1.17|^2.0", - "php": "^5.6|^7.0|^8.0", - "phpseclib/phpseclib": "~2.0||^3.0.2" - }, - "require-dev": { - "cache/filesystem-adapter": "^0.3.2|^1.1", - "composer/composer": "^1.10.22", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7", - "phpcompatibility/php-compatibility": "^9.2", - "phpunit/phpunit": "^5.7||^8.5.13", - "squizlabs/php_codesniffer": "~2.3", - "symfony/css-selector": "~2.1", - "symfony/dom-crawler": "~2.1" - }, - "suggest": { - "cache/filesystem-adapter": "For caching certs and tokens (using Google\\Client::setCache)" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Google\\": "src/" - }, - "files": [ - "src/aliases.php" - ], - "classmap": [ - "src/aliases.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Client library for Google APIs", - "homepage": "http://developers.google.com/api-client-library/php", - "keywords": [ - "google" - ], - "time": "2021-06-25T14:25:44+00:00" - }, - { - "name": "google/apiclient-services", - "version": "v0.201.1", - "source": { - "type": "git", - "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "ee1072221acf7c32e3de9b18e11fec3ab23ec38f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ee1072221acf7c32e3de9b18e11fec3ab23ec38f", - "reference": "ee1072221acf7c32e3de9b18e11fec3ab23ec38f", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^5.7||^8.5.13" - }, - "type": "library", - "autoload": { - "psr-4": { - "Google\\Service\\": "src" - }, - "files": [ - "autoload.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Client library for Google APIs", - "homepage": "http://developers.google.com/api-client-library/php", - "keywords": [ - "google" - ], - "time": "2021-06-27T11:20:22+00:00" - }, - { - "name": "google/auth", - "version": "v1.16.0", - "source": { - "type": "git", - "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "c747738d2dd450f541f09f26510198fbedd1c8a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/c747738d2dd450f541f09f26510198fbedd1c8a0", - "reference": "c747738d2dd450f541f09f26510198fbedd1c8a0", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0", - "guzzlehttp/guzzle": "^5.3.1|^6.2.1|^7.0", - "guzzlehttp/psr7": "^1.2", - "php": ">=5.4", - "psr/cache": "^1.0|^2.0", - "psr/http-message": "^1.0" - }, - "require-dev": { - "guzzlehttp/promises": "0.1.1|^1.3", - "kelvinmo/simplejwt": "^0.2.5|^0.5.1", - "phpseclib/phpseclib": "^2.0.31", - "phpunit/phpunit": "^4.8.36|^5.7", - "sebastian/comparator": ">=1.2.3", - "squizlabs/php_codesniffer": "^3.5" - }, - "suggest": { - "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." - }, - "type": "library", - "autoload": { - "psr-4": { - "Google\\Auth\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Google Auth Library for PHP", - "homepage": "http://github.com/google/google-auth-library-php", - "keywords": [ - "Authentication", - "google", - "oauth2" - ], - "time": "2021-06-22T18:06:03+00:00" - }, - { - "name": "graham-campbell/guzzle-factory", - "version": "v5.0.0", - "source": { - "type": "git", - "url": "https://github.com/GrahamCampbell/Guzzle-Factory.git", - "reference": "5f6eae0dba2f2a02d72d42f11f3ff9f9f61e1cc8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Guzzle-Factory/zipball/5f6eae0dba2f2a02d72d42f11f3ff9f9f61e1cc8", - "reference": "5f6eae0dba2f2a02d72d42f11f3ff9f9f61e1cc8", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "^7.2", - "php": "^7.2.5 || ^8.0" - }, - "require-dev": { - "graham-campbell/analyzer": "^3.0.4", - "phpunit/phpunit": "^8.5.8 || ^9.3.7" - }, - "type": "library", - "autoload": { - "psr-4": { - "GrahamCampbell\\GuzzleFactory\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "graham@alt-three.com" - } - ], - "description": "Provides A Simple Guzzle Factory With Good Defaults", - "keywords": [ - "Graham Campbell", - "GrahamCampbell", - "Guzzle", - "Guzzle Factory", - "Guzzle-Factory", - "http" - ], - "time": "2021-01-24T20:39:09+00:00" - }, - { - "name": "guzzlehttp/guzzle", - "version": "7.3.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "7008573787b430c1c1f650e3722d9bba59967628" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7008573787b430c1c1f650e3722d9bba59967628", - "reference": "7008573787b430c1c1f650e3722d9bba59967628", - "shasum": "" - }, - "require": { - "ext-json": "*", - "guzzlehttp/promises": "^1.4", - "guzzlehttp/psr7": "^1.7 || ^2.0", - "php": "^7.2.5 || ^8.0", - "psr/http-client": "^1.0" - }, - "provide": { - "psr/http-client-implementation": "1.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "ext-curl": "*", - "php-http/client-integration-tests": "^3.0", - "phpunit/phpunit": "^8.5.5 || ^9.3.5", - "psr/log": "^1.1" - }, - "suggest": { - "ext-curl": "Required for CURL handler support", - "ext-intl": "Required for Internationalized Domain Name (IDN) support", - "psr/log": "Required for using the Log middleware" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.3-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" - } - ], - "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "psr-18", - "psr-7", - "rest", - "web service" - ], - "time": "2021-03-23T11:33:13+00:00" - }, - { - "name": "guzzlehttp/promises", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/promises.git", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", - "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle promises library", - "keywords": [ - "promise" - ], - "time": "2021-03-07T09:25:29+00:00" - }, - { - "name": "guzzlehttp/psr7", - "version": "1.8.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/psr7.git", - "reference": "dc960a912984efb74d0a90222870c72c87f10c91" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/dc960a912984efb74d0a90222870c72c87f10c91", - "reference": "dc960a912984efb74d0a90222870c72c87f10c91", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" - }, - "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" - }, - "suggest": { - "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Tobias Schultze", - "homepage": "https://github.com/Tobion" - } - ], - "description": "PSR-7 message implementation that also provides common utility methods", - "keywords": [ - "http", - "message", - "psr-7", - "request", - "response", - "stream", - "uri", - "url" - ], - "time": "2021-04-26T09:17:50+00:00" - }, - { - "name": "guzzlehttp/uri-template", - "version": "v0.2.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/uri-template.git", - "reference": "db46525d6d8fee71033b73cc07160f3e5271a8ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/db46525d6d8fee71033b73cc07160f3e5271a8ce", - "reference": "db46525d6d8fee71033b73cc07160f3e5271a8ce", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "symfony/polyfill-php80": "^1.17" - }, - "require-dev": { - "phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.3", - "uri-template/tests": "1.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\UriTemplate\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "George Mponos", - "email": "gmponos@gmail.com", - "homepage": "https://github.com/gmponos", - "role": "Developer" - } - ], - "description": "A polyfill class for uri_template of PHP", - "homepage": "https://github.com/guzzlehttp/uri-template", - "keywords": [ - "guzzlehttp", - "uri-template" - ], - "time": "2020-07-21T13:45:09+00:00" - }, - { - "name": "jakub-onderka/php-console-color", - "version": "v0.2", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Color.git", - "reference": "d5deaecff52a0d61ccb613bb3804088da0307191" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191", - "reference": "d5deaecff52a0d61ccb613bb3804088da0307191", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "jakub-onderka/php-code-style": "1.0", - "jakub-onderka/php-parallel-lint": "1.0", - "jakub-onderka/php-var-dump-check": "0.*", - "phpunit/phpunit": "~4.3", - "squizlabs/php_codesniffer": "1.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "JakubOnderka\\PhpConsoleColor\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "jakub.onderka@gmail.com" - } - ], - "abandoned": "php-parallel-lint/php-console-color", - "time": "2018-09-29T17:23:10+00:00" - }, - { - "name": "jakub-onderka/php-console-highlighter", - "version": "v0.4", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git", - "reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/9f7a229a69d52506914b4bc61bfdb199d90c5547", - "reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "jakub-onderka/php-console-color": "~0.2", - "php": ">=5.4.0" - }, - "require-dev": { - "jakub-onderka/php-code-style": "~1.0", - "jakub-onderka/php-parallel-lint": "~1.0", - "jakub-onderka/php-var-dump-check": "~0.1", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~1.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "JakubOnderka\\PhpConsoleHighlighter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "acci@acci.cz", - "homepage": "http://www.acci.cz/" - } - ], - "description": "Highlight PHP code in terminal", - "abandoned": "php-parallel-lint/php-console-highlighter", - "time": "2018-09-29T18:48:56+00:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "5.2.10", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", - "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2020-05-27T16:41:55+00:00" - }, - { - "name": "kylekatarnls/update-helper", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/kylekatarnls/update-helper.git", - "reference": "429be50660ed8a196e0798e5939760f168ec8ce9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/429be50660ed8a196e0798e5939760f168ec8ce9", - "reference": "429be50660ed8a196e0798e5939760f168ec8ce9", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0.0", - "php": ">=5.3.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "dev-master", - "composer/composer": "2.0.x-dev || ^2.0.0-dev", - "phpunit/phpunit": ">=4.8.35 <6.0" - }, - "type": "composer-plugin", - "extra": { - "class": "UpdateHelper\\ComposerPlugin" - }, - "autoload": { - "psr-0": { - "UpdateHelper\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kyle", - "email": "kylekatarnls@gmail.com" - } - ], - "description": "Update helper", - "time": "2020-04-07T20:44:10+00:00" - }, - { - "name": "laravel-doctrine/extensions", - "version": "1.0.14", - "source": { - "type": "git", - "url": "https://github.com/laravel-doctrine/extensions.git", - "reference": "a2e7896100559ecc64504252dbc74ec18ad59813" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel-doctrine/extensions/zipball/a2e7896100559ecc64504252dbc74ec18ad59813", - "reference": "a2e7896100559ecc64504252dbc74ec18ad59813", - "shasum": "" - }, - "require": { - "illuminate/auth": "~5.1", - "illuminate/config": "~5.1", - "illuminate/contracts": "~5.1", - "illuminate/http": "~5.1", - "illuminate/support": "~5.1", - "laravel-doctrine/orm": "~1.0", - "php": ">=5.5.9" - }, - "require-dev": { - "beberlei/doctrineextensions": "^1.0", - "gedmo/doctrine-extensions": "^2.4", - "mockery/mockery": "~0.9", - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "beberlei/DoctrineExtensions": "Query/Type Doctrine2 extensions (^1.0)", - "gedmo/doctrine-extensions": "Behavioral Doctrine2 extensions (^2.4)" - }, - "type": "library", - "autoload": { - "psr-4": { - "LaravelDoctrine\\Extensions\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Patrick Brouwers", - "email": "patrick@maatwebsite.nl" - } - ], - "description": "Doctrine extensions for Doctrine 2 and Laravel 5", - "keywords": [ - "beberlei", - "data mapper", - "database", - "doctrine", - "gedmo", - "laravel", - "orm" - ], - "time": "2018-03-01T17:07:28+00:00" - }, - { - "name": "laravel-doctrine/migrations", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/laravel-doctrine/migrations.git", - "reference": "78bb95cc4bd57c2a76f6003630e37a6f60904938" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel-doctrine/migrations/zipball/78bb95cc4bd57c2a76f6003630e37a6f60904938", - "reference": "78bb95cc4bd57c2a76f6003630e37a6f60904938", - "shasum": "" - }, - "require": { - "doctrine/migrations": "~1.8", - "illuminate/config": "~5.1", - "illuminate/console": "~5.1", - "illuminate/contracts": "~5.1", - "laravel-doctrine/orm": "~1.0", - "php": "^7.1" - }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "LaravelDoctrine\\Migrations\\MigrationsServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "LaravelDoctrine\\Migrations\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Patrick Brouwers", - "email": "patrick@maatwebsite.nl" - } - ], - "description": "Doctrine Migrations for Laravel", - "keywords": [ - "data mapper", - "database", - "doctrine", - "laravel", - "migrations", - "orm" - ], - "time": "2020-10-22T21:10:21+00:00" - }, - { - "name": "laravel-doctrine/orm", - "version": "1.4.18", - "source": { - "type": "git", - "url": "https://github.com/laravel-doctrine/orm.git", - "reference": "e3d8692c0c0f1fe1c180afc85e0fab5a185df879" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel-doctrine/orm/zipball/e3d8692c0c0f1fe1c180afc85e0fab5a185df879", - "reference": "e3d8692c0c0f1fe1c180afc85e0fab5a185df879", - "shasum": "" - }, - "require": { - "doctrine/orm": "2.5.*|2.6.*", - "illuminate/auth": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/console": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/container": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/contracts": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/pagination": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/routing": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/validation": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/view": "5.5.*|5.6.*|5.7.*|5.8.*", - "php": ">=7.0", - "symfony/serializer": "^2.7|^3.0|^4.0|^5.0" - }, - "require-dev": { - "barryvdh/laravel-debugbar": "~2.0|~3.0", - "illuminate/log": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/notifications": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/queue": "5.5.*|5.6.*|5.7.*|5.8.*", - "itsgoingd/clockwork": "~1.9", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "~5.0" - }, - "suggest": { - "fzaninotto/faker": "Required to use the entity factory builder (~1.4).", - "laravel-doctrine/acl": "to integrate Doctrine roles & permissions with Laravel's Authorization system (~1.0)", - "laravel-doctrine/extensions": "to add Behavioral and Query/Type Extensions for Laravel Doctrine (~1.0)", - "laravel-doctrine/fluent": "Fluent mapping driver (alternative to xml, yaml, ... (~1.1).", - "laravel-doctrine/migrations": "to add support for migrations in Laravel Doctrine (~1.0)", - "yajra/laravel-oci8": "Support for Laravel native queue and session database drivers in Oracle (~2.0)." - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "LaravelDoctrine\\ORM\\DoctrineServiceProvider" - ], - "aliases": { - "Registry": "LaravelDoctrine\\ORM\\Facades\\Registry", - "Doctrine": "LaravelDoctrine\\ORM\\Facades\\Doctrine", - "EntityManager": "LaravelDoctrine\\ORM\\Facades\\EntityManager" - } - } - }, - "autoload": { - "psr-4": { - "LaravelDoctrine\\ORM\\": "src/" - }, - "files": [ - "src/helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Patrick Brouwers", - "email": "patrick@maatwebsite.nl" - } - ], - "description": "A Doctrine ORM bridge for Laravel 5", - "keywords": [ - "data mapper", - "database", - "doctrine", - "laravel", - "orm" - ], - "time": "2020-05-17T10:22:40+00:00" - }, - { - "name": "laravel/framework", - "version": "v5.6.40", - "source": { - "type": "git", - "url": "https://github.com/laravel/framework.git", - "reference": "5ceadf91f13be89a3338c3d4166a4676272a23bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/5ceadf91f13be89a3338c3d4166a4676272a23bf", - "reference": "5ceadf91f13be89a3338c3d4166a4676272a23bf", - "shasum": "" - }, - "require": { - "doctrine/inflector": "~1.1", - "dragonmantank/cron-expression": "~2.0", - "erusev/parsedown": "~1.7", - "ext-mbstring": "*", - "ext-openssl": "*", - "league/flysystem": "^1.0.8", - "monolog/monolog": "~1.12", - "nesbot/carbon": "1.26.*", - "php": "^7.1.3", - "psr/container": "~1.0", - "psr/simple-cache": "^1.0", - "ramsey/uuid": "^3.7", - "swiftmailer/swiftmailer": "~6.0", - "symfony/console": "~4.0", - "symfony/debug": "~4.0", - "symfony/finder": "~4.0", - "symfony/http-foundation": "~4.0", - "symfony/http-kernel": "~4.0", - "symfony/process": "~4.0", - "symfony/routing": "~4.0", - "symfony/var-dumper": "~4.0", - "tijsverkoyen/css-to-inline-styles": "^2.2.1", - "vlucas/phpdotenv": "~2.2" - }, - "conflict": { - "tightenco/collect": "<5.5.33" - }, - "replace": { - "illuminate/auth": "self.version", - "illuminate/broadcasting": "self.version", - "illuminate/bus": "self.version", - "illuminate/cache": "self.version", - "illuminate/config": "self.version", - "illuminate/console": "self.version", - "illuminate/container": "self.version", - "illuminate/contracts": "self.version", - "illuminate/cookie": "self.version", - "illuminate/database": "self.version", - "illuminate/encryption": "self.version", - "illuminate/events": "self.version", - "illuminate/filesystem": "self.version", - "illuminate/hashing": "self.version", - "illuminate/http": "self.version", - "illuminate/log": "self.version", - "illuminate/mail": "self.version", - "illuminate/notifications": "self.version", - "illuminate/pagination": "self.version", - "illuminate/pipeline": "self.version", - "illuminate/queue": "self.version", - "illuminate/redis": "self.version", - "illuminate/routing": "self.version", - "illuminate/session": "self.version", - "illuminate/support": "self.version", - "illuminate/translation": "self.version", - "illuminate/validation": "self.version", - "illuminate/view": "self.version" - }, - "require-dev": { - "aws/aws-sdk-php": "~3.0", - "doctrine/dbal": "~2.6", - "filp/whoops": "^2.1.4", - "league/flysystem-cached-adapter": "~1.0", - "mockery/mockery": "~1.0", - "moontoast/math": "^1.1", - "orchestra/testbench-core": "3.6.*", - "pda/pheanstalk": "~3.0", - "phpunit/phpunit": "~7.0", - "predis/predis": "^1.1.1", - "symfony/css-selector": "~4.0", - "symfony/dom-crawler": "~4.0" - }, - "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.6).", - "ext-pcntl": "Required to use all features of the queue worker.", - "ext-posix": "Required to use all features of the queue worker.", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~6.0).", - "laravel/tinker": "Required to use the tinker console command (~1.0).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", - "league/flysystem-cached-adapter": "Required to use the Flysystem cache (~1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", - "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (~1.0).", - "nexmo/client": "Required to use the Nexmo transport (~1.0).", - "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).", - "predis/predis": "Required to use the redis cache and queue drivers (~1.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~3.0).", - "symfony/css-selector": "Required to use some of the crawler integration testing tools (~4.0).", - "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (~4.0).", - "symfony/psr-http-message-bridge": "Required to psr7 bridging features (~1.0)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "files": [ - "src/Illuminate/Foundation/helpers.php", - "src/Illuminate/Support/helpers.php" - ], - "psr-4": { - "Illuminate\\": "src/Illuminate/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Laravel Framework.", - "homepage": "https://laravel.com", - "keywords": [ - "framework", - "laravel" - ], - "time": "2020-04-14T14:16:50+00:00" - }, - { - "name": "laravel/tinker", - "version": "v1.0.10", - "source": { - "type": "git", - "url": "https://github.com/laravel/tinker.git", - "reference": "ad571aacbac1539c30d480908f9d0c9614eaf1a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/ad571aacbac1539c30d480908f9d0c9614eaf1a7", - "reference": "ad571aacbac1539c30d480908f9d0c9614eaf1a7", - "shasum": "" - }, - "require": { - "illuminate/console": "~5.1|^6.0", - "illuminate/contracts": "~5.1|^6.0", - "illuminate/support": "~5.1|^6.0", - "php": ">=5.5.9", - "psy/psysh": "0.7.*|0.8.*|0.9.*", - "symfony/var-dumper": "~3.0|~4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "suggest": { - "illuminate/database": "The Illuminate Database package (~5.1)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - }, - "laravel": { - "providers": [ - "Laravel\\Tinker\\TinkerServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Laravel\\Tinker\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "Powerful REPL for the Laravel framework.", - "keywords": [ - "REPL", - "Tinker", - "laravel", - "psysh" - ], - "time": "2019-08-07T15:10:45+00:00" - }, - { - "name": "league/csv", - "version": "9.6.2", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/csv.git", - "reference": "f28da6e483bf979bac10e2add384c90ae9983e4e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/f28da6e483bf979bac10e2add384c90ae9983e4e", - "reference": "f28da6e483bf979bac10e2add384c90ae9983e4e", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "php": ">=7.2.5" - }, - "require-dev": { - "ext-curl": "*", - "ext-dom": "*", - "friendsofphp/php-cs-fixer": "^2.16", - "phpstan/phpstan": "^0.12.0", - "phpstan/phpstan-phpunit": "^0.12.0", - "phpstan/phpstan-strict-rules": "^0.12.0", - "phpunit/phpunit": "^8.5" - }, - "suggest": { - "ext-dom": "Required to use the XMLConverter and or the HTMLConverter classes", - "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.x-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Csv\\": "src" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ignace Nyamagana Butera", - "email": "nyamsprod@gmail.com", - "homepage": "https://github.com/nyamsprod/", - "role": "Developer" - } - ], - "description": "CSV data manipulation made easy in PHP", - "homepage": "http://csv.thephpleague.com", - "keywords": [ - "convert", - "csv", - "export", - "filter", - "import", - "read", - "transform", - "write" - ], - "time": "2020-12-10T19:40:30+00:00" - }, - { - "name": "league/flysystem", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32", - "reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32", - "shasum": "" - }, - "require": { - "ext-fileinfo": "*", - "league/mime-type-detection": "^1.3", - "php": "^7.2.5 || ^8.0" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/prophecy": "^1.11.1", - "phpunit/phpunit": "^8.5.8" - }, - "suggest": { - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "time": "2021-06-23T21:56:05+00:00" - }, - { - "name": "league/flysystem-aws-s3-v3", - "version": "1.0.29", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", - "reference": "4e25cc0582a36a786c31115e419c6e40498f6972" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/4e25cc0582a36a786c31115e419c6e40498f6972", - "reference": "4e25cc0582a36a786c31115e419c6e40498f6972", - "shasum": "" - }, - "require": { - "aws/aws-sdk-php": "^3.20.0", - "league/flysystem": "^1.0.40", - "php": ">=5.5.0" - }, - "require-dev": { - "henrikbjorn/phpspec-code-coverage": "~1.0.1", - "phpspec/phpspec": "^2.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\AwsS3v3\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Flysystem adapter for the AWS S3 SDK v3.x", - "time": "2020-10-08T18:58:37+00:00" - }, - { - "name": "league/mime-type-detection", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", - "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3", - "shasum": "" - }, - "require": { - "ext-fileinfo": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.18", - "phpstan/phpstan": "^0.12.68", - "phpunit/phpunit": "^8.5.8 || ^9.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "League\\MimeTypeDetection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frankdejonge.nl" - } - ], - "description": "Mime-type detection for Flysystem", - "time": "2021-01-18T20:58:21+00:00" - }, - { - "name": "league/oauth2-client", - "version": "2.6.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/oauth2-client.git", - "reference": "badb01e62383430706433191b82506b6df24ad98" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/oauth2-client/zipball/badb01e62383430706433191b82506b6df24ad98", - "reference": "badb01e62383430706433191b82506b6df24ad98", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "^6.0 || ^7.0", - "paragonie/random_compat": "^1 || ^2 || ^9.99", - "php": "^5.6 || ^7.0 || ^8.0" - }, - "require-dev": { - "mockery/mockery": "^1.3", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpunit/phpunit": "^5.7 || ^6.0 || ^9.3", - "squizlabs/php_codesniffer": "^2.3 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "League\\OAuth2\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alex Bilbie", - "email": "hello@alexbilbie.com", - "homepage": "http://www.alexbilbie.com", - "role": "Developer" - }, - { - "name": "Woody Gilk", - "homepage": "https://github.com/shadowhand", - "role": "Contributor" - } - ], - "description": "OAuth 2.0 Client Library", - "keywords": [ - "Authentication", - "SSO", - "authorization", - "identity", - "idp", - "oauth", - "oauth2", - "single sign on" - ], - "time": "2020-10-28T02:03:40+00:00" - }, - { - "name": "monolog/monolog", - "version": "1.26.1", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/monolog.git", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" - }, - "provide": { - "psr/log-implementation": "1.0.0" - }, - "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", - "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "php-amqplib/php-amqplib": "~2.4", - "php-console/php-console": "^3.1.3", - "phpstan/phpstan": "^0.12.59", - "phpunit/phpunit": "~4.5", - "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "^5.3|^6.0" - }, - "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", - "doctrine/couchdb": "Allow sending log messages to a CouchDB server", - "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", - "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", - "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", - "php-console/php-console": "Allow sending log messages to Google Chrome", - "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" - }, - "type": "library", - "autoload": { - "psr-4": { - "Monolog\\": "src/Monolog" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Sends your logs to files, sockets, inboxes, databases and various web services", - "homepage": "http://github.com/Seldaek/monolog", - "keywords": [ - "log", - "logging", - "psr-3" - ], - "time": "2021-05-28T08:32:12+00:00" - }, - { - "name": "mtdowling/jmespath.php", - "version": "2.6.1", - "source": { - "type": "git", - "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/9b87907a81b87bc76d19a7fb2d61e61486ee9edb", - "reference": "9b87907a81b87bc76d19a7fb2d61e61486ee9edb", - "shasum": "" - }, - "require": { - "php": "^5.4 || ^7.0 || ^8.0", - "symfony/polyfill-mbstring": "^1.17" - }, - "require-dev": { - "composer/xdebug-handler": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^7.5.15" - }, - "bin": [ - "bin/jp.php" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "JmesPath\\": "src/" - }, - "files": [ - "src/JmesPath.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Declaratively specify how to extract elements from a JSON document", - "keywords": [ - "json", - "jsonpath" - ], - "time": "2021-06-14T00:11:39+00:00" - }, - { - "name": "muxinc/mux-php", - "version": "0.9.0", - "source": { - "type": "git", - "url": "https://github.com/muxinc/mux-php.git", - "reference": "7e7710bfc77335ca336527a3a3e26f4be6dff6f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/muxinc/mux-php/zipball/7e7710bfc77335ca336527a3a3e26f4be6dff6f5", - "reference": "7e7710bfc77335ca336527a3a3e26f4be6dff6f5", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/guzzle": "^7", - "php": ">=7.2.5" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.12", - "squizlabs/php_codesniffer": "~2.6" - }, - "type": "library", - "autoload": { - "psr-4": { - "MuxPhp\\": "MuxPhp/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mux SDK team", - "email": "sdks@mux.com", - "homepage": "https://mux.com" - } - ], - "description": "Official Mux API wrapper for PHP projects, supporting both Mux Data and Mux Video. Not familiar with Mux? Check out https://mux.com/ for more information.", - "homepage": "https://mux.com", - "keywords": [ - "api", - "php", - "rest", - "sdk", - "streaming", - "video" - ], - "time": "2021-03-17T18:06:14+00:00" - }, - { - "name": "nesbot/carbon", - "version": "1.26.6", - "source": { - "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "c6820f814496d71da7498d423427e6193d1f57c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/c6820f814496d71da7498d423427e6193d1f57c9", - "reference": "c6820f814496d71da7498d423427e6193d1f57c9", - "shasum": "" - }, - "require": { - "kylekatarnls/update-helper": "^1.1", - "php": ">=5.3.9", - "symfony/translation": "~2.6 || ~3.0 || ~4.0" - }, - "require-dev": { - "composer/composer": "^1.2", - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "^4.8.35 || ^5.7" - }, - "bin": [ - "bin/upgrade-carbon" - ], - "type": "library", - "extra": { - "update-helper": "Carbon\\Upgrade" - }, - "autoload": { - "psr-4": { - "": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" - } - ], - "description": "A simple API extension for DateTime.", - "homepage": "http://carbon.nesbot.com", - "keywords": [ - "date", - "datetime", - "time" - ], - "time": "2019-06-03T15:42:58+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.10.5", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f", - "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2021-05-03T19:11:20+00:00" - }, - { - "name": "ocramius/package-versions", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", - "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0.0", - "php": "^7.1.0" - }, - "require-dev": { - "composer/composer": "^1.6.3", - "doctrine/coding-standard": "^5.0.1", - "ext-zip": "*", - "infection/infection": "^0.7.1", - "phpunit/phpunit": "^7.5.17" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2019-11-15T16:17:10+00:00" - }, - { - "name": "ocramius/proxy-manager", - "version": "2.2.3", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/ProxyManager.git", - "reference": "4d154742e31c35137d5374c998e8f86b54db2e2f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/4d154742e31c35137d5374c998e8f86b54db2e2f", - "reference": "4d154742e31c35137d5374c998e8f86b54db2e2f", - "shasum": "" - }, - "require": { - "ocramius/package-versions": "^1.1.3", - "php": "^7.2.0", - "zendframework/zend-code": "^3.3.0" - }, - "require-dev": { - "couscous/couscous": "^1.6.1", - "ext-phar": "*", - "humbug/humbug": "1.0.0-RC.0@RC", - "nikic/php-parser": "^3.1.1", - "padraic/phpunit-accelerator": "dev-master@DEV", - "phpbench/phpbench": "^0.12.2", - "phpstan/phpstan": "dev-master#856eb10a81c1d27c701a83f167dc870fd8f4236a as 0.9.999", - "phpstan/phpstan-phpunit": "dev-master#5629c0a1f4a9c417cb1077cf6693ad9753895761", - "phpunit/phpunit": "^6.4.3", - "squizlabs/php_codesniffer": "^2.9.1" - }, - "suggest": { - "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects", - "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", - "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)", - "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "ProxyManager\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.io/" - } - ], - "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", - "homepage": "https://github.com/Ocramius/ProxyManager", - "keywords": [ - "aop", - "lazy loading", - "proxy", - "proxy pattern", - "service proxies" - ], - "time": "2019-08-10T08:37:15+00:00" - }, - { - "name": "paragonie/constant_time_encoding", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", - "reference": "f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c", - "shasum": "" - }, - "require": { - "php": "^7|^8" - }, - "require-dev": { - "phpunit/phpunit": "^6|^7|^8|^9", - "vimeo/psalm": "^1|^2|^3|^4" - }, - "type": "library", - "autoload": { - "psr-4": { - "ParagonIE\\ConstantTime\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com", - "role": "Maintainer" - }, - { - "name": "Steve 'Sc00bz' Thomas", - "email": "steve@tobtu.com", - "homepage": "https://www.tobtu.com", - "role": "Original Developer" - } - ], - "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", - "keywords": [ - "base16", - "base32", - "base32_decode", - "base32_encode", - "base64", - "base64_decode", - "base64_encode", - "bin2hex", - "encoding", - "hex", - "hex2bin", - "rfc4648" - ], - "time": "2020-12-06T15:14:20+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.100", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", - "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", - "shasum": "" - }, - "require": { - "php": ">= 7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "time": "2020-10-15T08:29:30+00:00" - }, - { - "name": "php-amqplib/php-amqplib", - "version": "v2.12.3", - "source": { - "type": "git", - "url": "https://github.com/php-amqplib/php-amqplib.git", - "reference": "f746eb44df6d8f838173729867dd1d20b0265faa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/f746eb44df6d8f838173729867dd1d20b0265faa", - "reference": "f746eb44df6d8f838173729867dd1d20b0265faa", - "shasum": "" - }, - "require": { - "ext-mbstring": "*", - "ext-sockets": "*", - "php": ">=5.6.3,<8.0", - "phpseclib/phpseclib": "^2.0|^3.0" - }, - "conflict": { - "php": "7.4.0 - 7.4.1" - }, - "replace": { - "videlalvaro/php-amqplib": "self.version" - }, - "require-dev": { - "ext-curl": "*", - "nategood/httpful": "^0.2.20", - "phpunit/phpunit": "^5.7|^6.5|^7.0", - "squizlabs/php_codesniffer": "^3.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.12-dev" - } - }, - "autoload": { - "psr-4": { - "PhpAmqpLib\\": "PhpAmqpLib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-or-later" - ], - "authors": [ - { - "name": "Alvaro Videla", - "role": "Original Maintainer" - }, - { - "name": "Raúl Araya", - "email": "nubeiro@gmail.com", - "role": "Maintainer" - }, - { - "name": "Luke Bakken", - "email": "luke@bakken.io", - "role": "Maintainer" - }, - { - "name": "Ramūnas Dronga", - "email": "github@ramuno.lt", - "role": "Maintainer" - } - ], - "description": "Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.", - "homepage": "https://github.com/php-amqplib/php-amqplib/", - "keywords": [ - "message", - "queue", - "rabbitmq" - ], - "time": "2021-03-01T12:21:31+00:00" - }, - { - "name": "php-opencloud/openstack", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/OpenStackweb/openstack.git", - "reference": "eafc3de006ad505355556c0d2f3c4af2c6b5a44e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/OpenStackweb/openstack/zipball/eafc3de006ad505355556c0d2f3c4af2c6b5a44e", - "reference": "eafc3de006ad505355556c0d2f3c4af2c6b5a44e", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "^7.0", - "guzzlehttp/uri-template": "0.2", - "justinrainbow/json-schema": "^5.2", - "php": "^7.2.5|^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.18", - "php-coveralls/php-coveralls": "^2.0", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpunit/phpunit": "^8.0", - "psr/log": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "OpenStack\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Jamie Hannaford", - "email": "jamie.hannaford@rackspace.com", - "homepage": "https://github.com/jamiehannaford" - }, - { - "name": "Ha Phan", - "email": "thanhha.work@gmail.com", - "homepage": "https://github.com/haphan" - } - ], - "description": "PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi", - "homepage": "https://github.com/php-opencloud/openstack", - "keywords": [ - "Openstack", - "api", - "php", - "sdk" - ], - "time": "2021-04-02T15:01:50+00:00" - }, - { - "name": "phpseclib/phpseclib", - "version": "3.0.9", - "source": { - "type": "git", - "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "a127a5133804ff2f47ae629dd529b129da616ad7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/a127a5133804ff2f47ae629dd529b129da616ad7", - "reference": "a127a5133804ff2f47ae629dd529b129da616ad7", - "shasum": "" - }, - "require": { - "paragonie/constant_time_encoding": "^1|^2", - "paragonie/random_compat": "^1.4|^2.0|^9.99.99", - "php": ">=5.6.1" - }, - "require-dev": { - "phing/phing": "~2.7", - "phpunit/phpunit": "^5.7|^6.0|^9.4", - "squizlabs/php_codesniffer": "~2.0" - }, - "suggest": { - "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", - "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", - "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", - "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." - }, - "type": "library", - "autoload": { - "files": [ - "phpseclib/bootstrap.php" - ], - "psr-4": { - "phpseclib3\\": "phpseclib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jim Wigginton", - "email": "terrafrost@php.net", - "role": "Lead Developer" - }, - { - "name": "Patrick Monnerat", - "email": "pm@datasphere.ch", - "role": "Developer" - }, - { - "name": "Andreas Fischer", - "email": "bantu@phpbb.com", - "role": "Developer" - }, - { - "name": "Hans-Jürgen Petrich", - "email": "petrich@tronic-media.com", - "role": "Developer" - }, - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "role": "Developer" - } - ], - "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", - "homepage": "http://phpseclib.sourceforge.net", - "keywords": [ - "BigInteger", - "aes", - "asn.1", - "asn1", - "blowfish", - "crypto", - "cryptography", - "encryption", - "rsa", - "security", - "sftp", - "signature", - "signing", - "ssh", - "twofish", - "x.509", - "x509" - ], - "time": "2021-06-14T06:54:45+00:00" - }, - { - "name": "pion/laravel-chunk-upload", - "version": "v1.4.1", - "source": { - "type": "git", - "url": "https://github.com/pionl/laravel-chunk-upload.git", - "reference": "149f911041f94efc6b030ee92691f075e29afb9d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pionl/laravel-chunk-upload/zipball/149f911041f94efc6b030ee92691f075e29afb9d", - "reference": "149f911041f94efc6b030ee92691f075e29afb9d", - "shasum": "" - }, - "require": { - "illuminate/console": "5.2 - 5.8 | ^6.0 | ^7.0 | ^8.0", - "illuminate/filesystem": "5.2 - 5.8 | ^6.0 | ^7.0 | ^8.0", - "illuminate/http": "5.2 - 5.8 | ^6.0 | ^7.0 | ^8.0", - "illuminate/support": "5.2 - 5.8 | ^6.0 | ^7.0 | ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16.0", - "laravel/laravel": "5.2 - 5.8 | ^6.0 | ^7.0 | ^8.0", - "mockery/mockery": "^1.1.0 | ^1.3.0", - "overtrue/phplint": "^1.1 | ^2.0", - "phpunit/phpunit": "5.7 | 6.0 | 7.0 | 7.5 | 8.4 | ^8.5 | ^9.3" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Pion\\Laravel\\ChunkUpload\\Providers\\ChunkUploadServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Pion\\Laravel\\ChunkUpload\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Martin Kluska", - "email": "martin@kluska.cz" - } - ], - "description": "Service for chunked upload with several js providers", - "time": "2020-12-07T18:02:05+00:00" - }, - { - "name": "predis/predis", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/predis/predis.git", - "reference": "9ead747663bb1b1ae017dfa0d152aca87792b42f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/predis/predis/zipball/9ead747663bb1b1ae017dfa0d152aca87792b42f", - "reference": "9ead747663bb1b1ae017dfa0d152aca87792b42f", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "suggest": { - "ext-curl": "Allows access to Webdis when paired with phpiredis", - "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol" - }, - "type": "library", - "autoload": { - "psr-4": { - "Predis\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniele Alessandri", - "email": "suppakilla@gmail.com", - "homepage": "http://clorophilla.net" - } - ], - "description": "Flexible and feature-complete Redis client for PHP and HHVM", - "homepage": "http://github.com/nrk/predis", - "keywords": [ - "nosql", - "predis", - "redis" - ], - "time": "2016-05-30T15:25:52+00:00" - }, - { - "name": "psr/cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Cache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for caching libraries", - "keywords": [ - "cache", - "psr", - "psr-6" - ], - "time": "2016-08-06T20:24:11+00:00" - }, - { - "name": "psr/container", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", - "shasum": "" - }, - "require": { - "php": ">=7.2.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2021-03-05T17:36:06+00:00" - }, - { - "name": "psr/http-client", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-client.git", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", - "shasum": "" - }, - "require": { - "php": "^7.0 || ^8.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Client\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP clients", - "homepage": "https://github.com/php-fig/http-client", - "keywords": [ - "http", - "http-client", - "psr", - "psr-18" - ], - "time": "2020-06-29T06:28:15+00:00" - }, - { - "name": "psr/http-message", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Http\\Message\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", - "keywords": [ - "http", - "http-message", - "psr", - "psr-7", - "request", - "response" - ], - "time": "2016-08-06T14:39:51+00:00" - }, - { - "name": "psr/log", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2021-05-03T11:20:27+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "time": "2017-10-23T01:57:42+00:00" - }, - { - "name": "psy/psysh", - "version": "v0.9.12", - "source": { - "type": "git", - "url": "https://github.com/bobthecow/psysh.git", - "reference": "90da7f37568aee36b116a030c5f99c915267edd4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/90da7f37568aee36b116a030c5f99c915267edd4", - "reference": "90da7f37568aee36b116a030c5f99c915267edd4", - "shasum": "" - }, - "require": { - "dnoegel/php-xdg-base-dir": "0.1.*", - "ext-json": "*", - "ext-tokenizer": "*", - "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*", - "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0", - "php": ">=5.4.0", - "symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0|~5.0", - "symfony/var-dumper": "~2.7|~3.0|~4.0|~5.0" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "hoa/console": "~2.15|~3.16", - "phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0" - }, - "suggest": { - "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", - "ext-pdo-sqlite": "The doc command requires SQLite to work.", - "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.", - "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.", - "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit." - }, - "bin": [ - "bin/psysh" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.9.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Psy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Justin Hileman", - "email": "justin@justinhileman.info", - "homepage": "http://justinhileman.com" - } - ], - "description": "An interactive shell for modern PHP.", - "homepage": "http://psysh.org", - "keywords": [ - "REPL", - "console", - "interactive", - "shell" - ], - "time": "2019-12-06T14:19:43+00:00" - }, - { - "name": "ralouphie/getallheaders", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/ralouphie/getallheaders.git", - "reference": "120b605dfeb996808c31b6477290a714d356e822" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", - "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.1", - "phpunit/phpunit": "^5 || ^6.5" - }, - "type": "library", - "autoload": { - "files": [ - "src/getallheaders.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ralph Khattar", - "email": "ralph.khattar@gmail.com" - } - ], - "description": "A polyfill for getallheaders.", - "time": "2019-03-08T08:55:37+00:00" - }, - { - "name": "ramsey/uuid", - "version": "3.x-dev", - "source": { - "type": "git", - "url": "https://github.com/ramsey/uuid.git", - "reference": "ec2f6b00414daacdd2c4fc97e87710fd1c3df409" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/ec2f6b00414daacdd2c4fc97e87710fd1c3df409", - "reference": "ec2f6b00414daacdd2c4fc97e87710fd1c3df409", - "shasum": "" - }, - "require": { - "ext-json": "*", - "paragonie/random_compat": "^1 | ^2 | ^9.99.99", - "php": "^5.4 | ^7 | ^8", - "symfony/polyfill-ctype": "^1.8" - }, - "replace": { - "rhumsaa/uuid": "self.version" - }, - "require-dev": { - "codeception/aspect-mock": "^1 | ^2", - "doctrine/annotations": "^1.2", - "goaop/framework": "1.0.0-alpha.2 | ^1 | ^2.1", - "jakub-onderka/php-parallel-lint": "^1", - "mockery/mockery": "^0.9.11 | ^1", - "moontoast/math": "^1.1", - "paragonie/random-lib": "^2", - "php-mock/php-mock-phpunit": "^0.3 | ^1.1", - "phpunit/phpunit": "^4.8 | ^5.4 | ^6.5", - "squizlabs/php_codesniffer": "^3.5" - }, - "suggest": { - "ext-ctype": "Provides support for PHP Ctype functions", - "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", - "ext-openssl": "Provides the OpenSSL extension for use with the OpenSslGenerator", - "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", - "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).", - "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Ramsey\\Uuid\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - }, - { - "name": "Marijn Huizendveld", - "email": "marijn.huizendveld@gmail.com" - }, - { - "name": "Thibaud Fabre", - "email": "thibaud@aztech.io" - } - ], - "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).", - "homepage": "https://github.com/ramsey/uuid", - "keywords": [ - "guid", - "identifier", - "uuid" - ], - "time": "2021-02-01T16:54:58+00:00" - }, - { - "name": "s-ichikawa/laravel-sendgrid-driver", - "version": "2.1.2", - "source": { - "type": "git", - "url": "https://github.com/s-ichikawa/laravel-sendgrid-driver.git", - "reference": "f5b763824768fab5602cba9066e9eb2d34252318" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/s-ichikawa/laravel-sendgrid-driver/zipball/f5b763824768fab5602cba9066e9eb2d34252318", - "reference": "f5b763824768fab5602cba9066e9eb2d34252318", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "~5.3|~6.2|~7.0", - "illuminate/mail": "~5.5|~6.0" - }, - "require-dev": { - "illuminate/container": "~5.5|~6.0", - "illuminate/filesystem": "~5.5|~6.0", - "phpunit/phpunit": "~5.7" - }, - "suggest": { - "s-ichikawa/sendgrid-api-builder": "support to build json for sendgrid api" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Sichikawa\\LaravelSendgridDriver\\SendgridTransportServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Sichikawa\\LaravelSendgridDriver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "shingo.ichikawa", - "email": "ichikawa.shingo.0829@gmail.com" - } - ], - "description": "This library adds a 'sendgrid' mail driver to Laravel.", - "keywords": [ - "laravel", - "sendgrid" - ], - "time": "2021-01-06T01:39:36+00:00" - }, - { - "name": "simplesoftwareio/simple-qrcode", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/SimpleSoftwareIO/simple-qrcode.git", - "reference": "90b2282dd29be1e52565e9832dc23af41610ea07" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/SimpleSoftwareIO/simple-qrcode/zipball/90b2282dd29be1e52565e9832dc23af41610ea07", - "reference": "90b2282dd29be1e52565e9832dc23af41610ea07", - "shasum": "" - }, - "require": { - "bacon/bacon-qr-code": "1.0.*", - "ext-gd": "*", - "illuminate/support": ">=5.0.0", - "php": ">=7.0" - }, - "require-dev": { - "mockery/mockery": "0.9.*", - "phpunit/phpunit": "~6" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider" - ], - "aliases": { - "QrCode": "SimpleSoftwareIO\\QrCode\\Facades\\QrCode" - } - } - }, - "autoload": { - "psr-0": { - "SimpleSoftwareIO\\QrCode\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Simple Software LLC", - "email": "support@simplesoftware.io" - } - ], - "description": "Simple QrCode is a QR code generator made for Laravel.", - "homepage": "http://www.simplesoftware.io", - "keywords": [ - "Simple", - "generator", - "laravel", - "qrcode", - "wrapper" - ], - "time": "2017-11-26T15:27:12+00:00" - }, - { - "name": "sokil/php-isocodes", - "version": "3.3.9", - "source": { - "type": "git", - "url": "https://github.com/sokil/php-isocodes.git", - "reference": "b635d41861693fd03892e6c890948b6b2d0c8a16" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sokil/php-isocodes/zipball/b635d41861693fd03892e6c890948b6b2d0c8a16", - "reference": "b635d41861693fd03892e6c890948b6b2d0c8a16", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": ">=7.1" - }, - "require-dev": { - "ext-gettext": "*", - "infection/infection": ">=0.11.5", - "php-coveralls/php-coveralls": "^2.1", - "phpmd/phpmd": "@stable", - "phpunit/phpunit": ">=7.5.20", - "squizlabs/php_codesniffer": "^3.4", - "symfony/translation": "^4.4.17|^5.2", - "vimeo/psalm": "^4.3" - }, - "suggest": { - "ext-gettext": "Required for gettext translation driver", - "phpbench/phpbench": "Required to run benchmarks", - "symfony/translation": "Translation driver by Symfont project" - }, - "type": "library", - "autoload": { - "psr-4": { - "Sokil\\IsoCodes\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dmytro Sokil", - "email": "dmytro.sokil@gmail.com" - } - ], - "description": "ISO country, subdivision, language, currency and script definitions and their translations. Based on pythons pycountry and Debian's iso-codes.", - "time": "2021-06-02T22:44:46+00:00" - }, - { - "name": "spatie/dropbox-api", - "version": "1.19.0", - "source": { - "type": "git", - "url": "https://github.com/spatie/dropbox-api.git", - "reference": "22ed7792e7ede170520f030e32ff0edde2337842" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/dropbox-api/zipball/22ed7792e7ede170520f030e32ff0edde2337842", - "reference": "22ed7792e7ede170520f030e32ff0edde2337842", - "shasum": "" - }, - "require": { - "graham-campbell/guzzle-factory": "^3.0||^4.0||^5.0", - "guzzlehttp/guzzle": "^6.2||^7.0", - "php": "^7.1||^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.5.15|^8.5|^9.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spatie\\Dropbox\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alex Vanderbist", - "email": "alex.vanderbist@gmail.com", - "homepage": "https://spatie.be", - "role": "Developer" - }, - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "A minimal implementation of Dropbox API v2", - "homepage": "https://github.com/spatie/dropbox-api", - "keywords": [ - "Dropbox-API", - "api", - "dropbox", - "spatie", - "v2" - ], - "time": "2021-06-18T06:34:17+00:00" - }, - { - "name": "spatie/flysystem-dropbox", - "version": "1.2.3", - "source": { - "type": "git", - "url": "https://github.com/spatie/flysystem-dropbox.git", - "reference": "8b6b072f217343b875316ca6a4203dd59f04207a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/flysystem-dropbox/zipball/8b6b072f217343b875316ca6a4203dd59f04207a", - "reference": "8b6b072f217343b875316ca6a4203dd59f04207a", - "shasum": "" - }, - "require": { - "league/flysystem": "^1.0.20", - "php": "^7.0 || ^8.0", - "spatie/dropbox-api": "^1.1.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5.14 || ^7.5.20 || ^8.5.11 || ^9.4.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Spatie\\FlysystemDropbox\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alex Vanderbist", - "email": "alex.vanderbist@gmail.com", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "Flysystem Adapter for the Dropbox v2 API", - "homepage": "https://github.com/spatie/flysystem-dropbox", - "keywords": [ - "Flysystem", - "api", - "dropbox", - "flysystem-dropbox", - "spatie", - "v2" - ], - "time": "2020-11-28T22:17:09+00:00" - }, - { - "name": "spatie/laravel-cors", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/spatie/laravel-cors.git", - "reference": "3ef534929531c609bc395610590b5bba204a4b44" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-cors/zipball/3ef534929531c609bc395610590b5bba204a4b44", - "reference": "3ef534929531c609bc395610590b5bba204a4b44", - "shasum": "" - }, - "require": { - "illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*|^6.0", - "php": "^7.2|^8.0" - }, - "require-dev": { - "orchestra/testbench": "3.5.*|3.6.*|3.7.*|3.8.*|^4.0", - "phpunit/phpunit": "^8.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Spatie\\Cors\\CorsServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Spatie\\Cors\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://spatie.be", - "role": "Developer" - } - ], - "description": "Send CORS headers in a Laravel or Lumen application", - "homepage": "https://github.com/spatie/laravel-cors", - "keywords": [ - "ajax", - "api", - "cors", - "laravel-cors", - "request", - "spatie" - ], - "abandoned": "laravel/framework", - "time": "2021-06-10T21:37:38+00:00" - }, - { - "name": "stripe/stripe-php", - "version": "v6.43.1", - "source": { - "type": "git", - "url": "https://github.com/stripe/stripe-php.git", - "reference": "42fcdaf99c44bb26937223f8eae1f263491d5ab8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/42fcdaf99c44bb26937223f8eae1f263491d5ab8", - "reference": "42fcdaf99c44bb26937223f8eae1f263491d5ab8", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "php-coveralls/php-coveralls": "1.*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0", - "symfony/process": "~2.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Stripe\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Stripe and contributors", - "homepage": "https://github.com/stripe/stripe-php/contributors" - } - ], - "description": "Stripe PHP Library", - "homepage": "https://stripe.com/", - "keywords": [ - "api", - "payment processing", - "stripe" - ], - "time": "2019-08-29T16:56:12+00:00" - }, - { - "name": "swiftmailer/swiftmailer", - "version": "v6.2.7", - "source": { - "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "15f7faf8508e04471f666633addacf54c0ab5933" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/15f7faf8508e04471f666633addacf54c0ab5933", - "reference": "15f7faf8508e04471f666633addacf54c0ab5933", - "shasum": "" - }, - "require": { - "egulias/email-validator": "^2.0|^3.1", - "php": ">=7.0.0", - "symfony/polyfill-iconv": "^1.0", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^1.0", - "symfony/phpunit-bridge": "^4.4|^5.0" - }, - "suggest": { - "ext-intl": "Needed to support internationalized email addresses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.2-dev" - } - }, - "autoload": { - "files": [ - "lib/swift_required.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Chris Corbyn" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "https://swiftmailer.symfony.com", - "keywords": [ - "email", - "mail", - "mailer" - ], - "time": "2021-03-09T12:30:35+00:00" - }, - { - "name": "symfony/console", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "a62acecdf5b50e314a4f305cd01b5282126f3095" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a62acecdf5b50e314a4f305cd01b5282126f3095", - "reference": "a62acecdf5b50e314a4f305cd01b5282126f3095", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3|>=5", - "symfony/lock": "<4.4", - "symfony/process": "<3.3" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/var-dumper": "^4.3|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "time": "2021-05-26T11:20:16+00:00" - }, - { - "name": "symfony/css-selector", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "c1e29de6dc893b130b45d20d8051efbb040560a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/c1e29de6dc893b130b45d20d8051efbb040560a9", - "reference": "c1e29de6dc893b130b45d20d8051efbb040560a9", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Converts CSS selectors to XPath expressions", - "homepage": "https://symfony.com", - "time": "2021-05-26T17:39:37+00:00" - }, - { - "name": "symfony/debug", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "a8d2d5c94438548bff9f998ca874e202bb29d07f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/a8d2d5c94438548bff9f998ca874e202bb29d07f", - "reference": "a8d2d5c94438548bff9f998ca874e202bb29d07f", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "~1.0", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to ease debugging PHP code", - "homepage": "https://symfony.com", - "time": "2021-05-26T17:39:37+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/error-handler", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/error-handler.git", - "reference": "310a756cec00d29d89a08518405aded046a54a8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/310a756cec00d29d89a08518405aded046a54a8b", - "reference": "310a756cec00d29d89a08518405aded046a54a8b", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "~1.0", - "symfony/debug": "^4.4.5", - "symfony/polyfill-php80": "^1.15", - "symfony/var-dumper": "^4.4|^5.0" - }, - "require-dev": { - "symfony/http-kernel": "^4.4|^5.0", - "symfony/serializer": "^4.4|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\ErrorHandler\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to manage errors and ease debugging PHP code", - "homepage": "https://symfony.com", - "time": "2021-05-26T17:39:37+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "047773e7016e4fd45102cedf4bd2558ae0d0c32f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/047773e7016e4fd45102cedf4bd2558ae0d0c32f", - "reference": "047773e7016e4fd45102cedf4bd2558ae0d0c32f", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", - "homepage": "https://symfony.com", - "time": "2021-05-26T17:39:37+00:00" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/84e23fdcd2517bf37aecbd16967e83f0caee25a7", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "suggest": { - "psr/event-dispatcher": "", - "symfony/event-dispatcher-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to dispatching event", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2020-07-06T13:19:58+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "ed33314396d968a8936c95f5bd1b88bd3b3e94a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ed33314396d968a8936c95f5bd1b88bd3b3e94a3", - "reference": "ed33314396d968a8936c95f5bd1b88bd3b3e94a3", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Finds files and directories via an intuitive fluent interface", - "homepage": "https://symfony.com", - "time": "2021-05-26T11:20:16+00:00" - }, - { - "name": "symfony/http-client-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "reference": "7e82f6084d7cae521a75ef2cb5c9457bbda785f4", - "shasum": "" - }, - "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/http-client-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\HttpClient\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to HTTP clients", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2021-04-11T23:07:08+00:00" - }, - { - "name": "symfony/http-foundation", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "0c79d5a65ace4fe66e49702658c024a419d2438b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/0c79d5a65ace4fe66e49702658c024a419d2438b", - "reference": "0c79d5a65ace4fe66e49702658c024a419d2438b", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/mime": "^4.3|^5.0", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.15" - }, - "require-dev": { - "predis/predis": "~1.0", - "symfony/expression-language": "^3.4|^4.0|^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Defines an object-oriented layer for the HTTP specification", - "homepage": "https://symfony.com", - "time": "2021-05-26T11:20:16+00:00" - }, - { - "name": "symfony/http-kernel", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "3795165596fe81a52296b78c9aae938d434069cc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3795165596fe81a52296b78c9aae938d434069cc", - "reference": "3795165596fe81a52296b78c9aae938d434069cc", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "psr/log": "~1.0", - "symfony/error-handler": "^4.4", - "symfony/event-dispatcher": "^4.4", - "symfony/http-client-contracts": "^1.1|^2", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "symfony/browser-kit": "<4.3", - "symfony/config": "<3.4", - "symfony/console": ">=5", - "symfony/dependency-injection": "<4.3", - "symfony/translation": "<4.2", - "twig/twig": "<1.43|<2.13,>=2" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^4.3|^5.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0", - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^4.3|^5.0", - "symfony/dom-crawler": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/finder": "^3.4|^4.0|^5.0", - "symfony/process": "^3.4|^4.0|^5.0", - "symfony/routing": "^3.4|^4.0|^5.0", - "symfony/stopwatch": "^3.4|^4.0|^5.0", - "symfony/templating": "^3.4|^4.0|^5.0", - "symfony/translation": "^4.2|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "twig/twig": "^1.43|^2.13|^3.0.4" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides a structured process for converting a Request into a Response", - "homepage": "https://symfony.com", - "time": "2021-06-01T07:12:08+00:00" - }, - { - "name": "symfony/mime", - "version": "v5.3.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/mime.git", - "reference": "47dd7912152b82d0d4c8d9040dbc93d6232d472a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/47dd7912152b82d0d4c8d9040dbc93d6232d472a", - "reference": "47dd7912152b82d0d4c8d9040dbc93d6232d472a", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", - "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "egulias/email-validator": "~3.0.0", - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/mailer": "<4.4" - }, - "require-dev": { - "egulias/email-validator": "^2.1.10|^3.1", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/property-access": "^4.4|^5.1", - "symfony/property-info": "^4.4|^5.1", - "symfony/serializer": "^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Mime\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Allows manipulating MIME messages", - "homepage": "https://symfony.com", - "keywords": [ - "mime", - "mime-type" - ], - "time": "2021-06-09T10:58:01+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-iconv", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/63b5bb7db83e5673936d6e3b8b3e022ff6474933", - "reference": "63b5bb7db83e5673936d6e3b8b3e022ff6474933", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-iconv": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Iconv\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Iconv extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "iconv", - "polyfill", - "portable", - "shim" - ], - "time": "2021-05-27T09:27:20+00:00" - }, - { - "name": "symfony/polyfill-intl-idn", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/65bd267525e82759e7d8c4e8ceea44f398838e65", - "reference": "65bd267525e82759e7d8c4e8ceea44f398838e65", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Idn\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Laurent Bassin", - "email": "laurent@bassin.info" - }, - { - "name": "Trevor Rowbotham", - "email": "trevor.rowbotham@pm.me" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "idn", - "intl", - "polyfill", - "portable", - "shim" - ], - "time": "2021-05-27T09:27:20+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1", - "reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2021-05-27T09:27:20+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2021-05-27T09:17:38+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "symfony/process", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "cd61e6dd273975c6625316de9d141ebd197f93c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cd61e6dd273975c6625316de9d141ebd197f93c9", - "reference": "cd61e6dd273975c6625316de9d141ebd197f93c9", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Executes commands in sub-processes", - "homepage": "https://symfony.com", - "time": "2021-05-26T11:20:16+00:00" - }, - { - "name": "symfony/routing", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/routing.git", - "reference": "3a3c2f197ad0846ac6413225fc78868ba1c61434" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/3a3c2f197ad0846ac6413225fc78868ba1c61434", - "reference": "3a3c2f197ad0846ac6413225fc78868ba1c61434", - "shasum": "" - }, - "require": { - "php": ">=7.1.3" - }, - "conflict": { - "symfony/config": "<4.2", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "doctrine/annotations": "^1.10.4", - "psr/log": "~1.0", - "symfony/config": "^4.2|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation loader", - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Routing\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Maps an HTTP request to a set of configuration variables", - "homepage": "https://symfony.com", - "keywords": [ - "router", - "routing", - "uri", - "url" - ], - "time": "2021-05-26T17:39:37+00:00" - }, - { - "name": "symfony/serializer", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/serializer.git", - "reference": "6db3eb4f1bb437cd3730f52353ba4b568acaddf5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/6db3eb4f1bb437cd3730f52353ba4b568acaddf5", - "reference": "6db3eb4f1bb437cd3730f52353ba4b568acaddf5", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "<3.0|>=3.2.0,<3.2.2", - "phpdocumentor/type-resolver": "<0.3.0|1.3.*", - "symfony/dependency-injection": "<3.4", - "symfony/property-access": "<3.4", - "symfony/property-info": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "doctrine/annotations": "^1.10.4", - "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", - "symfony/cache": "^3.4|^4.0|^5.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/mime": "^4.4|^5.0", - "symfony/property-access": "^3.4.41|^4.4.9|^5.0.9", - "symfony/property-info": "^3.4.13|~4.0|^5.0", - "symfony/validator": "^3.4|^4.0|^5.0", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping.", - "psr/cache-implementation": "For using the metadata cache.", - "symfony/config": "For using the XML mapping loader.", - "symfony/http-foundation": "For using a MIME type guesser within the DataUriNormalizer.", - "symfony/property-access": "For using the ObjectNormalizer.", - "symfony/property-info": "To deserialize relations.", - "symfony/yaml": "For using the default YAML mapping loader." - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Serializer\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", - "homepage": "https://symfony.com", - "time": "2021-05-26T11:20:16+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2021-04-01T10:43:52+00:00" - }, - { - "name": "symfony/translation", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "dfe132c5c6d89f90ce7f961742cc532e9ca16dd4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/dfe132c5c6d89f90ce7f961742cc532e9ca16dd4", - "reference": "dfe132c5c6d89f90ce7f961742cc532e9ca16dd4", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1.6|^2" - }, - "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/http-kernel": "<4.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "symfony/translation-implementation": "1.0|2.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/finder": "~2.8|~3.0|~4.0|^5.0", - "symfony/http-kernel": "^4.4", - "symfony/intl": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^3.4|^4.0|^5.0" - }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides tools to internationalize your application", - "homepage": "https://symfony.com", - "time": "2021-05-26T17:39:37+00:00" - }, - { - "name": "symfony/translation-contracts", - "version": "v2.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation-contracts.git", - "reference": "95c812666f3e91db75385749fe219c5e494c7f95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/95c812666f3e91db75385749fe219c5e494c7f95", - "reference": "95c812666f3e91db75385749fe219c5e494c7f95", - "shasum": "" - }, - "require": { - "php": ">=7.2.5" - }, - "suggest": { - "symfony/translation-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Translation\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Generic abstractions related to translation", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "time": "2021-03-23T23:28:01+00:00" - }, - { - "name": "symfony/var-dumper", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/var-dumper.git", - "reference": "31ea689a8e7d2410016b0d25fc15a1ba05a6e2e0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/31ea689a8e7d2410016b0d25fc15a1ba05a6e2e0", - "reference": "31ea689a8e7d2410016b0d25fc15a1ba05a6e2e0", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5", - "symfony/polyfill-php80": "^1.15" - }, - "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" - }, - "require-dev": { - "ext-iconv": "*", - "symfony/console": "^3.4|^4.0|^5.0", - "symfony/process": "^4.4|^5.0", - "twig/twig": "^1.43|^2.13|^3.0.4" - }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "bin": [ - "Resources/bin/var-dump-server" - ], - "type": "library", - "autoload": { - "files": [ - "Resources/functions/dump.php" - ], - "psr-4": { - "Symfony\\Component\\VarDumper\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides mechanisms for walking through any arbitrary PHP variable", - "homepage": "https://symfony.com", - "keywords": [ - "debug", - "dump" - ], - "time": "2021-05-27T09:48:32+00:00" - }, - { - "name": "symfony/yaml", - "version": "v4.2.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/d0aa6c0ea484087927b49fd513383a7d36190ca6", - "reference": "d0aa6c0ea484087927b49fd513383a7d36190ca6", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2019-01-03T09:07:35+00:00" - }, - { - "name": "tecnickcom/tcpdf", - "version": "6.4.1", - "source": { - "type": "git", - "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "5ba838befdb37ef06a16d9f716f35eb03cb1b329" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/5ba838befdb37ef06a16d9f716f35eb03cb1b329", - "reference": "5ba838befdb37ef06a16d9f716f35eb03cb1b329", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "config", - "include", - "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", - "tcpdf_barcodes_1d.php", - "tcpdf_barcodes_2d.php", - "include/tcpdf_colors.php", - "include/tcpdf_filters.php", - "include/tcpdf_font_data.php", - "include/tcpdf_fonts.php", - "include/tcpdf_images.php", - "include/tcpdf_static.php", - "include/barcodes/datamatrix.php", - "include/barcodes/pdf417.php", - "include/barcodes/qrcode.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0-only" - ], - "authors": [ - { - "name": "Nicola Asuni", - "email": "info@tecnick.com", - "role": "lead" - } - ], - "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", - "homepage": "http://www.tcpdf.org/", - "keywords": [ - "PDFD32000-2008", - "TCPDF", - "barcodes", - "datamatrix", - "pdf", - "pdf417", - "qrcode" - ], - "time": "2021-03-27T16:00:33+00:00" - }, - { - "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.3", - "source": { - "type": "git", - "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "b43b05cf43c1b6d849478965062b6ef73e223bb5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/b43b05cf43c1b6d849478965062b6ef73e223bb5", - "reference": "b43b05cf43c1b6d849478965062b6ef73e223bb5", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "php": "^5.5 || ^7.0 || ^8.0", - "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "TijsVerkoyen\\CssToInlineStyles\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Tijs Verkoyen", - "email": "css_to_inline_styles@verkoyen.eu", - "role": "Developer" - } - ], - "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", - "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", - "time": "2020-07-13T06:12:54+00:00" - }, - { - "name": "vlucas/phpdotenv", - "version": "v2.6.7", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "b786088918a884258c9e3e27405c6a4cf2ee246e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/b786088918a884258c9e3e27405c6a4cf2ee246e", - "reference": "b786088918a884258c9e3e27405c6a4cf2ee246e", - "shasum": "" - }, - "require": { - "php": "^5.3.9 || ^7.0 || ^8.0", - "symfony/polyfill-ctype": "^1.17" - }, - "require-dev": { - "ext-filter": "*", - "ext-pcre": "*", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20" - }, - "suggest": { - "ext-filter": "Required to use the boolean validator.", - "ext-pcre": "Required to use most of the library." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-4": { - "Dotenv\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Graham Campbell", - "email": "graham@alt-three.com", - "homepage": "https://gjcampbell.co.uk/" - }, - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "https://vancelucas.com/" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "time": "2021-01-20T14:39:13+00:00" - }, - { - "name": "zendframework/zend-code", - "version": "3.4.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-code.git", - "reference": "268040548f92c2bfcba164421c1add2ba43abaaa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-code/zipball/268040548f92c2bfcba164421c1add2ba43abaaa", - "reference": "268040548f92c2bfcba164421c1add2ba43abaaa", - "shasum": "" - }, - "require": { - "php": "^7.1", - "zendframework/zend-eventmanager": "^2.6 || ^3.0" - }, - "conflict": { - "phpspec/prophecy": "<1.9.0" - }, - "require-dev": { - "doctrine/annotations": "^1.7", - "ext-phar": "*", - "phpunit/phpunit": "^7.5.16 || ^8.4", - "zendframework/zend-coding-standard": "^1.0", - "zendframework/zend-stdlib": "^2.7 || ^3.0" - }, - "suggest": { - "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", - "zendframework/zend-stdlib": "Zend\\Stdlib component" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4.x-dev", - "dev-develop": "3.5.x-dev", - "dev-dev-4.0": "4.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Code\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Extensions to the PHP Reflection API, static code scanning, and code generation", - "keywords": [ - "ZendFramework", - "code", - "zf" - ], - "abandoned": "laminas/laminas-code", - "time": "2019-12-10T19:21:15+00:00" - }, - { - "name": "zendframework/zend-eventmanager", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "a5e2583a211f73604691586b8406ff7296a946dd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd", - "reference": "a5e2583a211f73604691586b8406ff7296a946dd", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "athletic/athletic": "^0.1", - "container-interop/container-interop": "^1.1.0", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", - "zendframework/zend-coding-standard": "~1.0.0", - "zendframework/zend-stdlib": "^2.7.3 || ^3.0" - }, - "suggest": { - "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", - "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev", - "dev-develop": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\EventManager\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Trigger and listen to events within a PHP application", - "homepage": "https://github.com/zendframework/zend-eventmanager", - "keywords": [ - "event", - "eventmanager", - "events", - "zf2" - ], - "abandoned": "laminas/laminas-eventmanager", - "time": "2018-04-25T15:33:34+00:00" - } - ], - "packages-dev": [ - { - "name": "filp/whoops", - "version": "2.13.0", - "source": { - "type": "git", - "url": "https://github.com/filp/whoops.git", - "reference": "2edbc73a4687d9085c8f20f398eebade844e8424" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/2edbc73a4687d9085c8f20f398eebade844e8424", - "reference": "2edbc73a4687d9085c8f20f398eebade844e8424", - "shasum": "" - }, - "require": { - "php": "^5.5.9 || ^7.0 || ^8.0", - "psr/log": "^1.0.1" - }, - "require-dev": { - "mockery/mockery": "^0.9 || ^1.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3", - "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0" - }, - "suggest": { - "symfony/var-dumper": "Pretty print complex values better with var-dumper available", - "whoops/soap": "Formats errors as SOAP responses" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Whoops\\": "src/Whoops/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Filipe Dobreira", - "homepage": "https://github.com/filp", - "role": "Developer" - } - ], - "description": "php error handling for cool kids", - "homepage": "https://filp.github.io/whoops/", - "keywords": [ - "error", - "exception", - "handling", - "library", - "throwable", - "whoops" - ], - "time": "2021-06-04T12:00:00+00:00" - }, - { - "name": "fzaninotto/faker", - "version": "v1.9.2", - "source": { - "type": "git", - "url": "https://github.com/fzaninotto/Faker.git", - "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/848d8125239d7dbf8ab25cb7f054f1a630e68c2e", - "reference": "848d8125239d7dbf8ab25cb7f054f1a630e68c2e", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "ext-intl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7", - "squizlabs/php_codesniffer": "^2.9.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "abandoned": true, - "time": "2020-12-11T09:56:16+00:00" - }, - { - "name": "hamcrest/hamcrest-php", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "shasum": "" - }, - "require": { - "php": "^5.3|^7.0|^8.0" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "hamcrest" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ], - "time": "2020-07-09T08:09:16+00:00" - }, - { - "name": "laravel/browser-kit-testing", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/laravel/browser-kit-testing.git", - "reference": "efe038f40fb8ad06655ddfcb64e8b603e9e1f999" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/browser-kit-testing/zipball/efe038f40fb8ad06655ddfcb64e8b603e9e1f999", - "reference": "efe038f40fb8ad06655ddfcb64e8b603e9e1f999", - "shasum": "" - }, - "require": { - "illuminate/support": "^5.6", - "php": ">=7.1.3", - "phpunit/phpunit": "~7.0", - "symfony/css-selector": "~4.0", - "symfony/dom-crawler": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Laravel\\BrowserKitTesting\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "Provides backwards compatibility for BrowserKit testing in Laravel 5.4.", - "keywords": [ - "laravel", - "testing" - ], - "time": "2018-09-26T13:42:46+00:00" - }, - { - "name": "mockery/mockery", - "version": "1.3.4", - "source": { - "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "31467aeb3ca3188158613322d66df81cedd86626" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/31467aeb3ca3188158613322d66df81cedd86626", - "reference": "31467aeb3ca3188158613322d66df81cedd86626", - "shasum": "" - }, - "require": { - "hamcrest/hamcrest-php": "^2.0.1", - "lib-pcre": ">=7.0", - "php": ">=5.6.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Mockery": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework", - "homepage": "https://github.com/mockery/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ], - "time": "2021-02-24T09:51:00+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.10.2", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2020-11-13T09:40:50+00:00" - }, - { - "name": "nunomaduro/collision", - "version": "v2.1.1", - "source": { - "type": "git", - "url": "https://github.com/nunomaduro/collision.git", - "reference": "b5feb0c0d92978ec7169232ce5d70d6da6b29f63" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/b5feb0c0d92978ec7169232ce5d70d6da6b29f63", - "reference": "b5feb0c0d92978ec7169232ce5d70d6da6b29f63", - "shasum": "" - }, - "require": { - "filp/whoops": "^2.1.4", - "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*", - "php": "^7.1", - "symfony/console": "~2.8|~3.3|~4.0" - }, - "require-dev": { - "laravel/framework": "5.7.*", - "nunomaduro/larastan": "^0.3.0", - "phpstan/phpstan": "^0.10", - "phpunit/phpunit": "~7.3" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "NunoMaduro\\Collision\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nuno Maduro", - "email": "enunomaduro@gmail.com" - } - ], - "description": "Cli error handling for console/command-line PHP applications.", - "keywords": [ - "artisan", - "cli", - "command-line", - "console", - "error", - "handling", - "laravel", - "laravel-zero", - "php", - "symfony" - ], - "time": "2018-11-21T21:40:54+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-09-03T19:13:55+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-09-17T18:55:26+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.13.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2021-03-17T13:42:18+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "6.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "ext-xdebug": "^2.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2018-10-31T16:06:48+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/4b49fb70f067272b659ef0174ff9ca40fdaa6357", - "reference": "4b49fb70f067272b659ef0174ff9ca40fdaa6357", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2020-11-30T08:25:21+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "2.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2020-11-30T08:20:02+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "472b687829041c24b25f475e14c2f38a09edf1c2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/472b687829041c24b25f475e14c2f38a09edf1c2", - "reference": "472b687829041c24b25f475e14c2f38a09edf1c2", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "abandoned": true, - "time": "2020-11-30T08:38:46+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "7.5.20", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2020-01-08T08:45:45+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2020-11-30T08:15:22+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", - "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", - "shasum": "" - }, - "require": { - "php": ">=7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2020-11-30T08:04:30+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2020-11-30T07:59:04+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2020-11-30T07:53:42+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/6b853149eab67d4da22291d36f5b0631c0fd856e", - "reference": "6b853149eab67d4da22291d36f5b0631c0fd856e", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2020-11-30T07:47:53+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "shasum": "" - }, - "require": { - "php": ">=7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2020-11-30T07:40:27+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2020-11-30T07:37:18+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2020-11-30T07:34:24+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2020-11-30T07:30:19+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/dom-crawler", - "version": "v4.4.25", - "source": { - "type": "git", - "url": "https://github.com/symfony/dom-crawler.git", - "reference": "41d15bb6d6b95d2be763c514bb2494215d9c5eef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/41d15bb6d6b95d2be763c514bb2494215d9c5eef", - "reference": "41d15bb6d6b95d2be763c514bb2494215d9c5eef", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "masterminds/html5": "<2.6" - }, - "require-dev": { - "masterminds/html5": "^2.6", - "symfony/css-selector": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/css-selector": "" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\DomCrawler\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases DOM navigation for HTML and XML documents", - "homepage": "https://symfony.com", - "time": "2021-05-26T11:20:16+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2020-07-12T23:59:07+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2021-03-09T10:59:23+00:00" - } - ], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": { - "php-opencloud/openstack": 20 - }, - "prefer-stable": true, - "prefer-lowest": false, - "platform": { - "php": "^7.1.3", - "ext-gd": "*", - "ext-imagick": "*", - "ext-json": "*", - "ext-pdo": "*" - }, - "platform-dev": [] -} diff --git a/config/app.php b/config/app.php deleted file mode 100644 index faa3d073..00000000 --- a/config/app.php +++ /dev/null @@ -1,225 +0,0 @@ - env('APP_OAUTH_2_0_CLIENT_ID'), - 'openstackid_client_secret' => env('APP_OAUTH_2_0_CLIENT_SECRET'), - 'openstackid_base_url' => env('APP_OAUTH_2_0_AUTH_SERVER_BASE_URL'), - /* - |-------------------------------------------------------------------------- - | Application Environment - |-------------------------------------------------------------------------- - | - | This value determines the "environment" your application is currently - | running in. This may determine how you prefer to configure various - | services your application utilizes. Set this in your ".env" file. - | - */ - - 'env' => env('APP_ENV', 'dev'), - - // emails will be send to this email on dev/testing mode - 'dev_email_to' => env('DEV_EMAIL_TO', null), - - /* - |-------------------------------------------------------------------------- - | Application Debug Mode - |-------------------------------------------------------------------------- - | - | When your application is in debug mode, detailed error messages with - | stack traces will be shown on every error that occurs within your - | application. If disabled, a simple generic error page is shown. - | - */ - - 'debug' => env('APP_DEBUG', true), - - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ - - 'url' => env('APP_URL', 'http://localhost'), - - /* - |--------------------------------------------------------------------------- - | Application Scope Base Realm - |--------------------------------------------------------------------------- - */ - - 'scope_base_realm' => env('APP_SCOPE_BASE_REALM', 'http://localhost'), - - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ - - 'timezone' => 'UTC', - - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ - - 'locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ - - 'fallback_locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ - - 'key' => env('APP_KEY'), - - 'cipher' => 'AES-256-CBC', - - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ - - 'providers' => [ - - /* - * Laravel Framework Service Providers... - */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, - /* - * Application Service Providers... - */ - App\Providers\AppServiceProvider::class, - App\Providers\AuthServiceProvider::class, - App\Providers\EventServiceProvider::class, - App\Providers\RouteServiceProvider::class, - App\Repositories\RepositoriesProvider::class, - App\Services\FileSystem\Swift\SwiftServiceProvider::class, - \App\Services\FileSystem\Dropbox\DropboxServiceProvider::class, - services\BaseServicesProvider::class, - services\ModelServicesProvider::class, - factories\FactoriesProvider::class, - App\Http\Utils\UtilsProvider::class, - libs\utils\CustomDoctrineServiceProvider::class, - LaravelDoctrine\Extensions\BeberleiExtensionsServiceProvider::class, - Sichikawa\LaravelSendgridDriver\SendgridTransportServiceProvider::class, - LaravelDoctrine\Migrations\MigrationsServiceProvider::class, - SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class, - \App\Queue\RabbitMQServiceProvider::class, - ], - - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ - - 'aliases' => [ - 'App' => Illuminate\Support\Facades\App::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, - 'EntityManager' => LaravelDoctrine\ORM\Facades\EntityManager::class, - 'Registry' => LaravelDoctrine\ORM\Facades\Registry::class, - 'Doctrine' => LaravelDoctrine\ORM\Facades\Doctrine::class, - 'Encryption' => services\utils\Facades\Encryption::class, - 'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class, - 'ResourceServerContext' => \App\Facades\ResourceServerContext::class, - ], - - 'app_name' => env('APP_NAME', 'Open Infrastructure Summit'), - 'tenant_name' => env('TENANT_NAME', 'OpenStack'), - -]; diff --git a/config/apple_api.php b/config/apple_api.php deleted file mode 100644 index 3c5c459c..00000000 --- a/config/apple_api.php +++ /dev/null @@ -1,17 +0,0 @@ - env('APPLE_CALDAV_BASE_SERVER', "p01-caldav.icloud.com"), -]; \ No newline at end of file diff --git a/config/auth.php b/config/auth.php deleted file mode 100644 index 78175010..00000000 --- a/config/auth.php +++ /dev/null @@ -1,102 +0,0 @@ - [ - 'guard' => 'web', - 'passwords' => 'users', - ], - - /* - |-------------------------------------------------------------------------- - | Authentication Guards - |-------------------------------------------------------------------------- - | - | Next, you may define every authentication guard for your application. - | Of course, a great default configuration has been defined for you - | here which uses session storage and the Eloquent user provider. - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | Supported: "session", "token" - | - */ - - 'guards' => [ - 'web' => [ - 'driver' => 'session', - 'provider' => 'users', - ], - - 'api' => [ - 'driver' => 'token', - 'provider' => 'users', - ], - ], - - /* - |-------------------------------------------------------------------------- - | User Providers - |-------------------------------------------------------------------------- - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | If you have multiple user tables or models you may configure multiple - | sources which represent each model / table. These sources may then - | be assigned to any extra authentication guards you have defined. - | - | Supported: "database", "eloquent" - | - */ - - 'providers' => [ - 'users' => [ - 'driver' => 'eloquent', - 'model' => App\User::class, - ], - - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], - ], - - /* - |-------------------------------------------------------------------------- - | Resetting Passwords - |-------------------------------------------------------------------------- - | - | You may specify multiple password reset configurations if you have more - | than one user table or model in the application and you want to have - | separate password reset settings based on the specific user types. - | - | The expire time is the number of minutes that the reset token should be - | considered valid. This security feature keeps tokens short-lived so - | they have less time to be guessed. You may change this as needed. - | - */ - - 'passwords' => [ - 'users' => [ - 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, - ], - ], - -]; diff --git a/config/bookable_rooms.php b/config/bookable_rooms.php deleted file mode 100644 index 7131d87b..00000000 --- a/config/bookable_rooms.php +++ /dev/null @@ -1,38 +0,0 @@ - env('BOOKABLE_ROOMS_RESERVATION_LIFETIME', 30), - 'admin_email' => env('BOOKABLE_ROOMS_ADMIN_EMAIL',null), - 'enable_bookable_rooms_reservation_revocation' => env('ENABLE_BOOKABLE_ROOMS_RESERVATION_REVOCATION', false), - 'reservation_canceled_email_subject' => env('BOOKABLE_ROOMS_RESERVATION_CANCELED_EMAIL_SUBJECT', null), - 'reservation_created_email_subject' => env('BOOKABLE_ROOMS_RESERVATION_CREATED_EMAIL_SUBJECT', null), - 'reservation_payment_confirmed_email_subject' => env('BOOKABLE_ROOMS_RESERVATION_PAYMENT_CONFIRMED_EMAIL_SUBJECT', null), - 'reservation_refund_accepted_email_subject' => env('BOOKABLE_ROOMS_RESERVATION_REFUND_ACCEPTED_EMAIL_SUBJECT', null), - 'reservation_refund_requested_admin_email_subject' => env('BOOKABLE_ROOMS_RESERVATION_REFUND_REQUESTED_ADMIN_EMAIL_SUBJECT', null), - 'reservation_refund_requested_owner_email_subject' => env('BOOKABLE_ROOMS_RESERVATION_REFUND_REQUESTED_OWNER_EMAIL_SUBJECT', null), - 'default_payment_provider' => env('BOOKABLE_ROOMS_DEFAULT_PAYMENT_PROVIDER',IPaymentConstants::ProviderStripe), - 'default_payment_provider_config' => [ - IPaymentConstants::ProviderStripe => [ - 'is_test_mode' => env('BOOKABLE_ROOMS_DEFAULT_STRIPE_TEST_MODE', true), - 'live_secret_key' => env('BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PRIVATE_KEY', null), - 'live_publishable_key' => env('BOOKABLE_ROOMS_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY', null), - 'live_web_hook_secret' => env('BOOKABLE_ROOMS_DEFAULT_LIVE_WEBHOOK_SECRET', null), - 'test_secret_key' => env('BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PRIVATE_KEY', null), - 'test_publishable_key' => env('BOOKABLE_ROOMS_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY', null), - 'test_web_hook_secret' => env('BOOKABLE_ROOMS_DEFAULT_TEST_WEBHOOK_SECRET', null), - ] - ] -]; \ No newline at end of file diff --git a/config/broadcasting.php b/config/broadcasting.php deleted file mode 100644 index abaaac32..00000000 --- a/config/broadcasting.php +++ /dev/null @@ -1,52 +0,0 @@ - env('BROADCAST_DRIVER', 'pusher'), - - /* - |-------------------------------------------------------------------------- - | Broadcast Connections - |-------------------------------------------------------------------------- - | - | Here you may define all of the broadcast connections that will be used - | to broadcast events to other systems or over websockets. Samples of - | each available type of connection are provided inside this array. - | - */ - - 'connections' => [ - - 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_KEY'), - 'secret' => env('PUSHER_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), - 'options' => [ - // - ], - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - ], - - 'log' => [ - 'driver' => 'log', - ], - - ], - -]; diff --git a/config/cache.php b/config/cache.php deleted file mode 100644 index 3ffa840b..00000000 --- a/config/cache.php +++ /dev/null @@ -1,81 +0,0 @@ - env('CACHE_DRIVER', 'file'), - - /* - |-------------------------------------------------------------------------- - | Cache Stores - |-------------------------------------------------------------------------- - | - | Here you may define all of the cache "stores" for your application as - | well as their drivers. You may even define multiple stores for the - | same cache driver to group types of items stored in your caches. - | - */ - - 'stores' => [ - - 'apc' => [ - 'driver' => 'apc', - ], - - 'array' => [ - 'driver' => 'array', - ], - - 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - ], - - 'file' => [ - 'driver' => 'file', - 'path' => storage_path('framework/cache'), - ], - - 'memcached' => [ - 'driver' => 'memcached', - 'servers' => [ - [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), - 'weight' => 100, - ], - ], - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Cache Key Prefix - |-------------------------------------------------------------------------- - | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. - | - */ - - 'prefix' => 'laravel', - -]; diff --git a/config/cache_api_response.php b/config/cache_api_response.php deleted file mode 100644 index 949e0a42..00000000 --- a/config/cache_api_response.php +++ /dev/null @@ -1,20 +0,0 @@ - env('CACHE_API_RESPONSE_GET_SUMMIT_LIFETIME', 600), - 'get_event_feedback_response_lifetime' => env('CACHE_API_RESPONSE_GET_EVENT_FEEDBACK_LIFETIME', 300), - 'get_published_event_response_lifetime' => env('CACHE_API_RESPONSE_GET_PUBLISHED_EVENT_LIFETIME', 300), - 'get_summits_response_lifetime' => env('CACHE_API_RESPONSE_GET_SUMMITS_LIFETIME', 600), -]; \ No newline at end of file diff --git a/config/cache_regions.php b/config/cache_regions.php deleted file mode 100644 index 8622df77..00000000 --- a/config/cache_regions.php +++ /dev/null @@ -1,17 +0,0 @@ - env('CACHE_REGION_API_SCOPES_LIFETIME', 1140), -]; \ No newline at end of file diff --git a/config/cal_sync.php b/config/cal_sync.php deleted file mode 100644 index 260c547f..00000000 --- a/config/cal_sync.php +++ /dev/null @@ -1,17 +0,0 @@ - env('ENABLE_CAL_SYNC', true), -]; \ No newline at end of file diff --git a/config/cfp.php b/config/cfp.php deleted file mode 100644 index 24ef205d..00000000 --- a/config/cfp.php +++ /dev/null @@ -1,19 +0,0 @@ - env('CFP_APP_BASE_URL', null), - 'support_email' => env('CFP_SUPPORT_EMAIL', null), - 'client_id' => env('CFP_OAUTH2_CLIENT_ID', null), -]; \ No newline at end of file diff --git a/config/chunk-upload.php b/config/chunk-upload.php deleted file mode 100644 index 8c7a241c..00000000 --- a/config/chunk-upload.php +++ /dev/null @@ -1,43 +0,0 @@ - [ - /* - * Returns the folder name of the chunks. The location is in storage/app/{folder_name} - */ - 'chunks' => 'chunks', - 'disk' => 'local', - ], - 'clear' => [ - /* - * How old chunks we should delete - */ - 'timestamp' => '-3 HOURS', - 'schedule' => [ - 'enabled' => true, - 'cron' => '25 * * * *', // run every hour on the 25th minute - ], - ], - 'chunk' => [ - // setup for the chunk naming setup to ensure same name upload at same time - 'name' => [ - 'use' => [ - 'session' => env('CHUNK_UPLOAD_USE_SESSION_ID', true), // should the chunk name use the session id? The uploader must send cookie!, - 'browser' => env('CHUNK_UPLOAD_USE_BROWSER_ID', false), // instead of session we can use the ip and browser? - ], - ], - ], - 'handlers' => [ - // A list of handlers/providers that will be appended to existing list of handlers - 'custom' => [ - - ], - // Overrides the list of handlers - use only what you really want - 'override' => [ - // \Pion\Laravel\ChunkUpload\Handler\DropZoneUploadHandler::class - ], - ], -]; diff --git a/config/compile.php b/config/compile.php deleted file mode 100644 index 04807eac..00000000 --- a/config/compile.php +++ /dev/null @@ -1,35 +0,0 @@ - [ - // - ], - - /* - |-------------------------------------------------------------------------- - | Compiled File Providers - |-------------------------------------------------------------------------- - | - | Here you may list service providers which define a "compiles" function - | that returns additional files that should be compiled, providing an - | easy way to get common files from any packages you are utilizing. - | - */ - - 'providers' => [ - // - ], - -]; diff --git a/config/cors.php b/config/cors.php deleted file mode 100644 index fe6da0ce..00000000 --- a/config/cors.php +++ /dev/null @@ -1,64 +0,0 @@ - Spatie\Cors\CorsProfile\DefaultProfile::class, - - /* - * This configuration is used by `DefaultProfile`. - */ - 'default_profile' => [ - - 'allow_credentials' => false, - - 'allow_origins' => [ - '*', - ], - - 'allow_methods' => [ - 'POST', - 'GET', - 'OPTIONS', - 'PUT', - 'PATCH', - 'DELETE', - ], - - 'allow_headers' => [ - 'Accept', - 'Content-Type', - 'X-Auth-Token', - 'Origin', - 'Authorization', - 'X-Requested-With', - 'Cache-Control', - ], - - 'expose_headers' => [ - 'Cache-Control', - 'Content-Language', - 'Content-Type', - 'Expires', - 'Last-Modified', - 'Pragma', - ], - - 'forbidden_response' => [ - 'message' => 'Forbidden (cors).', - 'status' => 403, - ], - - /* - * Preflight request will respond with value for the max age header. - */ - 'max_age' => 60 * 60 * 24, - ], -]; diff --git a/config/curl.php b/config/curl.php deleted file mode 100644 index 3e1be332..00000000 --- a/config/curl.php +++ /dev/null @@ -1,19 +0,0 @@ - env('CURL_TIMEOUT', 60), - 'allow_redirects' => env('CURL_ALLOWS_REDIRECT', false), - 'verify_ssl_cert' => env('CURL_VERIFY_SSL_CERT', true), -); \ No newline at end of file diff --git a/config/database.php b/config/database.php deleted file mode 100644 index 0e8ba5f5..00000000 --- a/config/database.php +++ /dev/null @@ -1,113 +0,0 @@ - PDO::FETCH_CLASS, - - /* - |-------------------------------------------------------------------------- - | Default Database Connection Name - |-------------------------------------------------------------------------- - | - | Here you may specify which of the database connections below you wish - | to use as your default connection for all database work. Of course - | you may use many connections at once using the Database library. - | - */ - - 'default' => env('DB_CONNECTION', 'config'), - - /* - |-------------------------------------------------------------------------- - | Database Connections - |-------------------------------------------------------------------------- - | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. - | - */ - - 'connections' => [ - - // config DB - 'config' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST'), - 'database' => env('DB_DATABASE'), - 'username' => env('DB_USERNAME'), - 'password' => env('DB_PASSWORD'), - 'port' => env('DB_PORT', 3306), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - ], - // Model DB - 'model' => [ - 'driver' => 'mysql', - 'host' => env('SS_DB_HOST'), - 'database' => env('SS_DATABASE'), - 'username' => env('SS_DB_USERNAME'), - 'password' => env('SS_DB_PASSWORD'), - 'port' => env('SS_DB_PORT', 3306), - 'charset' => 'utf8', - 'collation' => 'utf8_unicode_ci', - 'prefix' => '', - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ - - 'migrations' => 'migrations', - - /* - |-------------------------------------------------------------------------- - | Redis Databases - |-------------------------------------------------------------------------- - | - | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems - | such as APC or Memcached. Laravel makes it easy to dig right in. - | - */ - - 'redis' => [ - - 'cluster' => false, - - 'default' => [ - 'host' => env('REDIS_HOST'), - 'port' => env('REDIS_PORT'), - 'database' => env('REDIS_DB'), - 'password' => env('REDIS_PASSWORD','1qaz2wsx'), - ], - - ], - -]; diff --git a/config/doctrine.php b/config/doctrine.php deleted file mode 100644 index eacad589..00000000 --- a/config/doctrine.php +++ /dev/null @@ -1,268 +0,0 @@ - Warning: Proxy auto generation should only be enabled in dev! - | - */ - 'managers' => [ - 'config' => [ - 'dev' => env('APP_DEBUG', true), - 'meta' => env('DOCTRINE_METADATA', 'annotations'), - 'connection' => env('DB_CONNECTION', 'config'), - 'namespaces' => [ - 'App' - ], - 'paths' => [ - base_path('app/Models/ResourceServer') - ], - 'repository' => Doctrine\ORM\EntityRepository::class, - 'proxies' => [ - 'namespace' => false, - 'path' => storage_path('proxies'), - 'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false) - ], - /* - |-------------------------------------------------------------------------- - | Doctrine events - |-------------------------------------------------------------------------- - | - | The listener array expects the key to be a Doctrine event - | e.g. Doctrine\ORM\Events::onFlush - | - */ - 'events' => [ - 'listeners' => [], - 'subscribers' => [] - ], - 'filters' => [], - /* - |-------------------------------------------------------------------------- - | Doctrine mapping types - |-------------------------------------------------------------------------- - | - | Link a Database Type to a Local Doctrine Type - | - | Using 'enum' => 'string' is the same of: - | $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration, - | \Doctrine\DBAL\Connection $connection, - | \Doctrine\Common\EventManager $eventManager) { - | $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); - | }); - | - | References: - | http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html - | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types - | http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html - | http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types - | http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool - |-------------------------------------------------------------------------- - */ - 'mapping_types' => [ - 'enum' => 'string' - ] - ], - 'model' => [ - 'dev' => env('APP_DEBUG'), - 'meta' => env('DOCTRINE_METADATA', 'annotations'), - 'connection' => 'model', - 'namespaces' => [ - 'App' - ], - 'paths' => [ - base_path('app/Models/Foundation') - ], - 'repository' => Doctrine\ORM\EntityRepository::class, - 'proxies' => [ - 'namespace' => false, - 'path' => storage_path('proxies'), - 'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false) - ], - /* - |-------------------------------------------------------------------------- - | Doctrine events - |-------------------------------------------------------------------------- - | - | The listener array expects the key to be a Doctrine event - | e.g. Doctrine\ORM\Events::onFlush - | - */ - 'events' => [ - 'listeners' => [], - 'subscribers' => [] - ], - 'filters' => [], - /* - |-------------------------------------------------------------------------- - | Doctrine mapping types - |-------------------------------------------------------------------------- - | - | Link a Database Type to a Local Doctrine Type - | - | Using 'enum' => 'string' is the same of: - | $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration, - | \Doctrine\DBAL\Connection $connection, - | \Doctrine\Common\EventManager $eventManager) { - | $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); - | }); - | - | References: - | http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html - | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types - | http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html - | http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types - | http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool - |-------------------------------------------------------------------------- - */ - 'mapping_types' => [ - 'enum' => 'string' - ] - ] - ], - /* - |-------------------------------------------------------------------------- - | Doctrine Extensions - |-------------------------------------------------------------------------- - | - | Enable/disable Doctrine Extensions by adding or removing them from the list - | - | If you want to require custom extensions you will have to require - | laravel-doctrine/extensions in your composer.json - | - */ - 'extensions' => [ - //LaravelDoctrine\ORM\Extensions\TablePrefix\TablePrefixExtension::class, - //LaravelDoctrine\Extensions\Timestamps\TimestampableExtension::class, - //LaravelDoctrine\Extensions\SoftDeletes\SoftDeleteableExtension::class, - //LaravelDoctrine\Extensions\Sluggable\SluggableExtension::class, - //LaravelDoctrine\Extensions\Sortable\SortableExtension::class, - //LaravelDoctrine\Extensions\Tree\TreeExtension::class, - //LaravelDoctrine\Extensions\Loggable\LoggableExtension::class, - //LaravelDoctrine\Extensions\Blameable\BlameableExtension::class, - //LaravelDoctrine\Extensions\IpTraceable\IpTraceableExtension::class, - //LaravelDoctrine\Extensions\Translatable\TranslatableExtension::class - ], - /* - |-------------------------------------------------------------------------- - | Doctrine custom types - |-------------------------------------------------------------------------- - | - | Create a custom or override a Doctrine Type - |-------------------------------------------------------------------------- - */ - 'custom_types' => [ - 'json' => LaravelDoctrine\ORM\Types\Json::class - ], - /* - |-------------------------------------------------------------------------- - | DQL custom datetime functions - |-------------------------------------------------------------------------- - */ - 'custom_datetime_functions' => [], - /* - |-------------------------------------------------------------------------- - | DQL custom numeric functions - |-------------------------------------------------------------------------- - */ - 'custom_numeric_functions' => [], - /* - |-------------------------------------------------------------------------- - | DQL custom string functions - |-------------------------------------------------------------------------- - */ - 'custom_string_functions' => [], - /* - |-------------------------------------------------------------------------- - | Enable query logging with laravel file logging, - | debugbar, clockwork or an own implementation. - | Setting it to false, will disable logging - | - | Available: - | - LaravelDoctrine\ORM\Loggers\LaravelDebugbarLogger - | - LaravelDoctrine\ORM\Loggers\ClockworkLogger - | - LaravelDoctrine\ORM\Loggers\FileLogger - |-------------------------------------------------------------------------- - */ - 'logger' => env('DOCTRINE_LOGGER', 'LaravelDoctrine\ORM\Loggers\FileLogger'), - /* - |-------------------------------------------------------------------------- - | Cache - |-------------------------------------------------------------------------- - | - | Configure meta-data, query and result caching here. - | Optionally you can enable second level caching. - | - | Available: acp|array|file|memcached|redis|void - | - */ - 'cache' => [ - 'default' => env('DOCTRINE_CACHE', 'redis'), - 'namespace' => null, - 'second_level' => [ - 'enabled' => true, - 'region_lifetime' => 3600, - 'region_lock_lifetime' => 60, - 'regions' => [ - 'summit_event_feedback_region' => [ - 'lifetime' => 300, - 'lock_lifetime' => 60 - ], - 'current_summit_region' => [ - 'lifetime' => 600, - 'lock_lifetime' => 60 - ], - 'resource_server_region' => [ - 'lifetime' => 3600, - 'lock_lifetime' => 60 - ], - 'summit_type_region' => [ - 'lifetime' => 1800, - 'lock_lifetime' => 60 - ], - 'summit_ticket_type_region' => [ - 'lifetime' => 1800, - 'lock_lifetime' => 60 - ], - 'summit_event_type_region' => [ - 'lifetime' => 1800, - 'lock_lifetime' => 60 - ], - 'summit_presentation_category_region' => [ - 'lifetime' => 1800, - 'lock_lifetime' => 60 - ], - ], - 'log_enabled' => true, - 'file_lock_region_directory' => '/tmp' - ] - - ], - /* - |-------------------------------------------------------------------------- - | Gedmo extensions - |-------------------------------------------------------------------------- - | - | Settings for Gedmo extensions - | If you want to use this you will have to require - | laravel-doctrine/extensions in your composer.json - | - */ - 'gedmo' => [ - 'all_mappings' => false - ] -]; diff --git a/config/file_upload.php b/config/file_upload.php deleted file mode 100644 index 7f39d089..00000000 --- a/config/file_upload.php +++ /dev/null @@ -1,17 +0,0 @@ - env('FILE_UPLOAD_MAX_SIZE', 10485760), -]; \ No newline at end of file diff --git a/config/filesystems.php b/config/filesystems.php deleted file mode 100644 index 3f6f3bfa..00000000 --- a/config/filesystems.php +++ /dev/null @@ -1,100 +0,0 @@ - 'local', - - /* - |-------------------------------------------------------------------------- - | Default Cloud Filesystem Disk - |-------------------------------------------------------------------------- - | - | Many applications store files both locally and in the cloud. For this - | reason, you may specify a default "cloud" driver here. This driver - | will be bound as the Cloud disk implementation in the container. - | - */ - - 'cloud' => 's3', - - /* - |-------------------------------------------------------------------------- - | Filesystem Disks - |-------------------------------------------------------------------------- - | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. - | - */ - - 'disks' => [ - - 'local' => [ - 'driver' => 'local', - 'root' => storage_path('app'), - ], - - 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'visibility' => 'public', - ], - - 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), - ], - - 'assets' => [ - 'driver' => 'swift', - 'auth_url' => env('CLOUD_STORAGE_AUTH_URL'), - 'region' => env('CLOUD_STORAGE_REGION'), - 'app_credential_id' => env('CLOUD_STORAGE_APP_CREDENTIAL_ID'), - 'app_credential_secret' => env('CLOUD_STORAGE_APP_CREDENTIAL_SECRET'), - 'container' => env('CLOUD_STORAGE_ASSETS_CONTAINER'), - ], - - 'static_images' => [ - 'driver' => 'swift', - 'auth_url' => env('CLOUD_STORAGE_AUTH_URL'), - 'region' => env('CLOUD_STORAGE_REGION'), - 'app_credential_id' => env('CLOUD_STORAGE_APP_CREDENTIAL_ID'), - 'app_credential_secret' => env('CLOUD_STORAGE_APP_CREDENTIAL_SECRET'), - 'container' => env('CLOUD_STORAGE_IMAGES_CONTAINER'), - ], - - 'dropbox' => [ - 'driver' => 'dropbox', - 'authorization_token' => env('DROPBOX_ACCESS_TOKEN'), - ], - - 'swift' => [ - 'driver' => 'swift', - 'auth_url' => env('CLOUD_STORAGE_AUTH_URL'), - 'region' => env('CLOUD_STORAGE_REGION'), - 'app_credential_id' => env('CLOUD_STORAGE_APP_CREDENTIAL_ID'), - 'app_credential_secret' => env('CLOUD_STORAGE_APP_CREDENTIAL_SECRET'), - 'container' => env('CLOUD_STORAGE_MEDIA_UPLOADS_CONTAINER'), - ] - ], - -]; diff --git a/config/google_api.php b/config/google_api.php deleted file mode 100644 index a32d297f..00000000 --- a/config/google_api.php +++ /dev/null @@ -1,19 +0,0 @@ - env('GOOGLE_CLIENT_ID', null), - 'google_client_secret' => env('GOOGLE_CLIENT_SECRET', null), - 'google_scopes' => env('GOOGLE_SCOPES', null), -]; \ No newline at end of file diff --git a/config/hashing.php b/config/hashing.php deleted file mode 100644 index d3c8e2fb..00000000 --- a/config/hashing.php +++ /dev/null @@ -1,52 +0,0 @@ - 'bcrypt', - - /* - |-------------------------------------------------------------------------- - | Bcrypt Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Bcrypt algorithm. This will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'bcrypt' => [ - 'rounds' => env('BCRYPT_ROUNDS', 10), - ], - - /* - |-------------------------------------------------------------------------- - | Argon Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Argon algorithm. These will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'argon' => [ - 'memory' => 1024, - 'threads' => 2, - 'time' => 2, - ], - -]; diff --git a/config/idp.php b/config/idp.php deleted file mode 100644 index 4de7e73d..00000000 --- a/config/idp.php +++ /dev/null @@ -1,21 +0,0 @@ - env('IDP_BASE_URI', null), - 'authorization_endpoint' => env('IDP_AUTHORIZATION_ENDPOINT', null), - 'token_endpoint' => env('IDP_TOKEN_ENDPOINT', null), - 'introspection_endpoint' => env('IDP_INTROSPECTION_ENDPOINT', null), - 'userinfo_endpoint' => env('IDP_USERINFO_ENDPOINT', null), -]; \ No newline at end of file diff --git a/config/log.php b/config/log.php deleted file mode 100644 index 4090dc4a..00000000 --- a/config/log.php +++ /dev/null @@ -1,14 +0,0 @@ - env('LOG_EMAIL_TO'), - //The sender of the mail - 'from_email' => env('LOG_EMAIL_FROM'), - //Log Level (debug, info, notice, warning, error, critical, alert) - 'level' => env('LOG_LEVEL', 'error'), - 'email_level' => env('LOG_EMAIL_LEVEL', 'error'), - 'email_subject' => env('LOG_EMAIL_SUBJECT', ''), -]; \ No newline at end of file diff --git a/config/logging.php b/config/logging.php deleted file mode 100644 index e73d1049..00000000 --- a/config/logging.php +++ /dev/null @@ -1,81 +0,0 @@ - env('LOG_CHANNEL', 'stack'), - - /* - |-------------------------------------------------------------------------- - | Log Channels - |-------------------------------------------------------------------------- - | - | Here you may configure the log channels for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", - | "custom", "stack" - | - */ - - 'channels' => [ - 'stack' => [ - 'driver' => 'stack', - 'channels' => ['daily'], - ], - - 'single' => [ - 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'error'), - ], - - 'daily' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'error'), - 'days' => 7, - ], - - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => 'critical', - ], - - 'stderr' => [ - 'driver' => 'monolog', - 'handler' => StreamHandler::class, - 'with' => [ - 'stream' => 'php://stderr', - ], - ], - - 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'error'), - ], - - 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'error'), - ], - ], - -]; diff --git a/config/mail.php b/config/mail.php deleted file mode 100644 index efaa9687..00000000 --- a/config/mail.php +++ /dev/null @@ -1,115 +0,0 @@ - env('MAIL_DRIVER', 'smtp'), - - /* - |-------------------------------------------------------------------------- - | SMTP Host Address - |-------------------------------------------------------------------------- - | - | Here you may provide the host address of the SMTP server used by your - | applications. A default option is provided that is compatible with - | the Mailgun mail service which will provide reliable deliveries. - | - */ - - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), - - /* - |-------------------------------------------------------------------------- - | SMTP Host Port - |-------------------------------------------------------------------------- - | - | This is the SMTP port used by your application to deliver e-mails to - | users of the application. Like the host we have set this value to - | stay compatible with the Mailgun e-mail application by default. - | - */ - - 'port' => env('MAIL_PORT', 587), - - /* - |-------------------------------------------------------------------------- - | Global "From" Address - |-------------------------------------------------------------------------- - | - | You may wish for all e-mails sent by your application to be sent from - | the same address. Here, you may specify a name and address that is - | used globally for all e-mails that are sent by your application. - | - */ - - 'from' => ['address' => env('MAIL_FROM_EMAIL'), 'name' => env('MAIL_FROM_NAME')], - - /* - |-------------------------------------------------------------------------- - | E-Mail Encryption Protocol - |-------------------------------------------------------------------------- - | - | Here you may specify the encryption protocol that should be used when - | the application send e-mail messages. A sensible default using the - | transport layer security protocol should provide great security. - | - */ - - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - - /* - |-------------------------------------------------------------------------- - | SMTP Server Username - |-------------------------------------------------------------------------- - | - | If your SMTP server requires a username for authentication, you should - | set it here. This will get used to authenticate with your server on - | connection. You may also set the "password" value below this one. - | - */ - - 'username' => env('MAIL_USERNAME'), - - /* - |-------------------------------------------------------------------------- - | SMTP Server Password - |-------------------------------------------------------------------------- - | - | Here you may set the password required by your SMTP server to send out - | messages from your application. This will be given to the server on - | connection so that the application will be able to send messages. - | - */ - - 'password' => env('MAIL_PASSWORD'), - - /* - |-------------------------------------------------------------------------- - | Sendmail System Path - |-------------------------------------------------------------------------- - | - | When using the "sendmail" driver to send e-mails, we will need to know - | the path to where Sendmail lives on this server. A default path has - | been provided here, which will work well on most of your systems. - | - */ - - 'sendmail' => '/usr/sbin/sendmail -bs', - 'service_base_url' => env('MAIL_API_BASE_URL'), - 'service_client_id' => env('MAIL_API_OAUTH2_CLIENT_ID'), - 'service_client_secret' => env('MAIL_API_OAUTH2_CLIENT_SECRET'), - 'service_client_scopes' => env('MAIL_API_OAUTH2_CLIENT_SCOPES'), -]; diff --git a/config/mediaupload.php b/config/mediaupload.php deleted file mode 100644 index aeeabbc4..00000000 --- a/config/mediaupload.php +++ /dev/null @@ -1,19 +0,0 @@ - env('MEDIA_UPLOAD_SLIDES_MAX_FILE_SIZE', 524288000), - 'mounting_folder' => env('MEDIA_UPLOAD_MOUNTING_FOLDER','PresentationMediaUploads') -]; diff --git a/config/migrations.php b/config/migrations.php deleted file mode 100644 index f407c676..00000000 --- a/config/migrations.php +++ /dev/null @@ -1,108 +0,0 @@ - [ - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ - 'table' => 'DoctrineMigration', - /* - |-------------------------------------------------------------------------- - | Migration Directory - |-------------------------------------------------------------------------- - | - | This directory is where all migrations will be stored for this entity - | manager. Use different directories for each entity manager. - | - */ - 'directory' => sprintf("%s/%s", database_path('migrations') ,"config"), - /* - |-------------------------------------------------------------------------- - | Migration Namespace - |-------------------------------------------------------------------------- - | - | This namespace will be used on all migrations. To prevent collisions, add - | the entity manager name (connection name). - | - */ - 'namespace' => 'Database\\Migrations\\Config', - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | Tables which are filtered by Regular Expression. You optionally - | exclude or limit to certain tables. The default will - | filter all tables. - | - */ - 'schema' => [ - 'filter' => '/^(?!password_resets|failed_jobs).*$/' - ] - ], - 'model' => [ - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ - 'table' => 'DoctrineMigration', - /* - |-------------------------------------------------------------------------- - | Migration Directory - |-------------------------------------------------------------------------- - | - | This directory is where all migrations will be stored for this entity - | manager. Use different directories for each entity manager. - | - */ - 'directory' => sprintf("%s/%s", database_path('migrations') ,"model"), - /* - |-------------------------------------------------------------------------- - | Migration Namespace - |-------------------------------------------------------------------------- - | - | This namespace will be used on all migrations. To prevent collisions, add - | the entity manager name (connection name). - | - */ - 'namespace' => 'Database\\Migrations\\Model', - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | Tables which are filtered by Regular Expression. You optionally - | exclude or limit to certain tables. The default will - | filter all tables. - | - */ - 'schema' => [ - 'filter' => '/^(?!password_resets|failed_jobs).*$/' - ] - ], -]; diff --git a/config/mux.php b/config/mux.php deleted file mode 100644 index 7919632a..00000000 --- a/config/mux.php +++ /dev/null @@ -1,19 +0,0 @@ - env('MUX_TOKEN_ID', null), - 'password' => env('MUX_TOKEN_SECRET', null), -]; \ No newline at end of file diff --git a/config/queue.php b/config/queue.php deleted file mode 100644 index 735baa63..00000000 --- a/config/queue.php +++ /dev/null @@ -1,107 +0,0 @@ - env('QUEUE_DRIVER', 'database'), - - /* - |-------------------------------------------------------------------------- - | Queue Connections - |-------------------------------------------------------------------------- - | - | Here you may configure the connection information for each server that - | is used by your application. A default configuration has been added - | for each back-end shipped with Laravel. You are free to add more. - | - */ - - 'connections' => [ - - 'database' => [ - 'connection' => env('QUEUE_CONN', ''), - 'database' => env('QUEUE_DATABASE', ''), - 'driver' => 'database', - 'table' => 'queue_jobs', - 'queue' => 'default', - 'expire' => 60, - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => 'default', - 'expire' => 60, - 'block_for' => 5, - ], - - 'message_broker' => [ - 'driver' => 'rabbitmq', - 'queue' => env('RABBITMQ_QUEUE', ''), - 'connection' => $rabbit_connection, - 'hosts' => [ - [ - 'host' => env('RABBITMQ_HOST', '127.0.0.1'), - 'port' => $rabbit_port, - 'user' => env('RABBITMQ_LOGIN', 'guest'), - 'password' => env('RABBITMQ_PASSWORD', 'guest'), - 'vhost' => env('RABBITMQ_VHOST', '/'), - ], - ], - 'options' => [ - 'ssl_options' => [ - // @see https://www.php.net/manual/en/context.ssl.php - 'cafile' => env('RABBITMQ_SSL_CAFILE', null), - 'local_cert' => env('RABBITMQ_SSL_LOCALCERT', null), - 'local_pk' => env('RABBITMQ_SSL_LOCALKEY', null), - 'verify_peer' => env('RABBITMQ_SSL_VERIFY_PEER', true), - 'passphrase' => env('RABBITMQ_SSL_PASSPHRASE', null), - ], - 'queue' => [ - 'exchange' => env('RABBITMQ_EXCHANGE_NAME'), - 'exchange_type' => env('RABBITMQ_EXCHANGE_TYPE', 'fanout'), - 'passive' => env('RABBITMQ_QUEUE_PASSIVE', false), - 'durable' => env('RABBITMQ_QUEUE_DURABLE', true), - 'exclusive' => env('RABBITMQ_QUEUE_EXCLUSIVE', false), - 'auto_delete' => env('RABBITMQ_QUEUE_AUTODELETE', true), - ], - ], - ], - ], - - /* - |-------------------------------------------------------------------------- - | Failed Queue Jobs - |-------------------------------------------------------------------------- - | - | These options configure the behavior of failed queue job logging so you - | can control which database and table are used to store the jobs that - | have failed. You may change them to any database / table you wish. - | - */ - - 'failed' => [ - 'connection' => env('QUEUE_CONN', ''), - 'database' => env('QUEUE_CONN', ''), - 'table' => 'queue_failed_jobs', - ], - -]; diff --git a/config/registration.php b/config/registration.php deleted file mode 100644 index 6254a81b..00000000 --- a/config/registration.php +++ /dev/null @@ -1,48 +0,0 @@ - env('REGISTRATION_LIFETIME', 30), - 'admin_email' => env('REGISTRATION_ADMIN_EMAIL',null), - 'service_client_id' => env('REGISTRATION_SERVICE_OAUTH2_CLIENT_ID', null), - 'service_client_secret' => env('REGISTRATION_SERVICE_OAUTH2_CLIENT_SECRET', null), - 'service_client_scopes' => env('REGISTRATION_SERVICE_OAUTH2_SCOPES', null), - 'dashboard_client_id' => env('REGISTRATION_DASHBOARD_OAUTH2_CLIENT_ID', null), - 'dashboard_base_url' => env('REGISTRATION_DASHBOARD_BASE_URL', null), - 'dashboard_back_url' => env('REGISTRATION_DASHBOARD_BACK_URL', null), - 'dashboard_attendee_edit_form_url' => env('REGISTRATION_DASHBOARD_ATTENDEE_EDIT_FORM_URL', null), - 'dashboard_invitation_form_url' => env('REGISTRATION_DASHBOARD_INVITATION_FORM_URL', null), - 'from_email' => env('REGISTRATION_FROM_EMAIL', null), - 'invite_attendee_ticket_edition_email_subject' => env('REGISTRATION_INVITE_ATTENDEE_TICKET_EDITION_EMAIL_SUBJECT', null), - 'registered_member_order_paid_mail_subject' => env('REGISTRATION_REGISTERED_MEMBER_ORDER_PAID_MAIL_SUBJECT', null), - 'unregistered_member_order_paid_email_subject' => env('REGISTRATION_UNREGISTERED_MEMBER_ORDER_PAID_EMAIL_SUBJECT', null), - 'ticket_public_edit_ttl' => env('REGISTRATION_TICKET_PUBLIC_EDIT_TTL', 30),//in minutes - 'support_email' => env('REGISTRATION_SUPPORT_EMAIL', null), - 'reminder_email_days_interval' => env('REGISTRATION_REMINDER_EMAIL_DAYS_INTERVAL', 7),//in days - 'validate_ticket_type_removal' => env('REGISTRATION_VALIDATE_TICKET_TYPE_REMOVAL', true), - 'default_payment_provider' => env('REGISTRATION_DEFAULT_PAYMENT_PROVIDER',IPaymentConstants::ProviderStripe), - 'default_payment_provider_config' => [ - IPaymentConstants::ProviderStripe => [ - 'is_test_mode' => env('REGISTRATION_DEFAULT_STRIPE_TEST_MODE', true), - 'live_secret_key' => env('REGISTRATION_DEFAULT_LIVE_STRIPE_PRIVATE_KEY', null), - 'live_publishable_key' => env('REGISTRATION_DEFAULT_LIVE_STRIPE_PUBLISHABLE_KEY', null), - 'live_web_hook_secret' => env('REGISTRATION_DEFAULT_LIVE_WEBHOOK_SECRET', null), - 'test_secret_key' => env('REGISTRATION_DEFAULT_TEST_STRIPE_PRIVATE_KEY', null), - 'test_publishable_key' => env('REGISTRATION_DEFAULT_TEST_STRIPE_PUBLISHABLE_KEY', null), - 'test_web_hook_secret' => env('REGISTRATION_DEFAULT_TEST_WEBHOOK_SECRET', null), - ] - ], - 'send_ticket_attachments' => env('REGISTRATION_SEND_TICKET_ATTACHMENTS', false), -]; \ No newline at end of file diff --git a/config/schedule.php b/config/schedule.php deleted file mode 100644 index b94e7628..00000000 --- a/config/schedule.php +++ /dev/null @@ -1,31 +0,0 @@ - env('SCHEDULE_OG_SITE_NAME', 'OpenStack'), - 'og_image_url' => env('SCHEDULE_OG_IMAGE_URL', 'https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/6e4619c416ff4bd19e1c087f27a43eea/www-assets-prod/Uploads/newsummitlogo.png'), - 'og_image_secure_url' => env('SCHEDULE_OG_IMAGE_SECURE_URL', 'https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/6e4619c416ff4bd19e1c087f27a43eea/www-assets-prod/Uploads/newsummitlogo.png'), - 'og_image_width' => env('SCHEDULE_OG_IMAGE_WIDTH', '240'), - 'og_image_height' => env('SCHEDULE_OG_IMAGE_HEIGHT', '135'), - 'facebook_app_id' => env('SCHEDULE_FACEBOOK_APP_ID', '209869746011654'), - 'ios_app_name' => env('SCHEDULE_IOS_APP_NAME', 'OpenStack Summit'), - 'ios_app_store_id' => env('SCHEDULE_IOS_APP_STORE_ID', '1071261846'), - 'ios_app_custom_schema' => env('SCHEDULE_IOS_APP_CUSTOM_SCHEMA', 'org.openstack.ios.summit'), - 'android_app_name' => env('SCHEDULE_ANDROID_APP_NAME', 'OpenStackSummitApplication'), - 'android_app_package' => env('SCHEDULE_ANDROID_APP_PACKAGE', 'org.openstack.android.summit'), - 'android_custom_schema' => env('SCHEDULE_ANDROID_CUSTOM_SCHEMA', 'org.openstack.android.summit'), - 'twitter_app_name' => env('SCHEDULE_TWITTER_APP_NAME', '@openstack'), - 'twitter_text' => env('SCHEDULE_TWITTER_TEXT', 'Check out this %23OpenStack session I\'m attending at the %23OpenStackSummit!'), -]; \ No newline at end of file diff --git a/config/scp.php b/config/scp.php deleted file mode 100644 index c4bd28cc..00000000 --- a/config/scp.php +++ /dev/null @@ -1,22 +0,0 @@ - env('SSH_USER', ''), - 'ssh_public_key' => env('SSH_PUBLIC_KEY', ''), - 'ssh_private_key' => env('SSH_PRIVATE_KEY', ''), - 'scp_host' => env('SCP_HOST', ''), - 'scp_remote_base_path' => env('SCP_REMOTE_BASE_PATH', ''), -]; \ No newline at end of file diff --git a/config/server.php b/config/server.php deleted file mode 100644 index 02932e7f..00000000 --- a/config/server.php +++ /dev/null @@ -1,28 +0,0 @@ - env('SSL_ENABLED', false), - 'db_log_enabled' => env('DB_LOG_ENABLED', false), - 'db_log_trace_enabled' => env('DB_LOG_TRACE_ENABLED', false), - 'access_token_cache_lifetime' => env('ACCESS_TOKEN_CACHE_LIFETIME', 300), - 'assets_base_url' => env('ASSETS_BASE_URL', null), - 'response_cache_lifetime' => env('API_RESPONSE_CACHE_LIFETIME', 300), - 'eventbrite_oauth2_personal_token' => env('EVENTBRITE_OAUTH2_PERSONAL_TOKEN', ''), - 'firebase_gcm_server_key' => env('FIREBASE_GCM_SERVER_KEY', ''), - 'ss_encrypt_key' => env('SS_ENCRYPT_KEY', ''), - 'ss_encrypt_cypher' => env('SS_ENCRYPT_CYPHER', ''), - 'google_geocoding_api_key' => env('GOOGLE_GEO_CODING_API_KEY', ''), -); \ No newline at end of file diff --git a/config/services.php b/config/services.php deleted file mode 100644 index 85850f52..00000000 --- a/config/services.php +++ /dev/null @@ -1,37 +0,0 @@ - [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), - ], - 'ses' => [ - 'key' => env('SES_KEY'), - 'secret' => env('SES_SECRET'), - 'region' => 'us-east-1', - ], - 'sparkpost' => [ - 'secret' => env('SPARKPOST_SECRET'), - ], - - 'stripe' => [ - 'model' => App\User::class, - 'key' => env('STRIPE_KEY'), - 'secret' => env('STRIPE_SECRET'), - ], - 'sendgrid' => [ - 'api_key' => env('SENDGRID_API_KEY'), - ], -]; diff --git a/config/session.php b/config/session.php deleted file mode 100644 index b21ffee2..00000000 --- a/config/session.php +++ /dev/null @@ -1,166 +0,0 @@ - env('SESSION_DRIVER', 'redis'), - - /* - |-------------------------------------------------------------------------- - | Session Lifetime - |-------------------------------------------------------------------------- - | - | Here you may specify the number of minutes that you wish the session - | to be allowed to remain idle before it expires. If you want them - | to immediately expire on the browser closing, set that option. - | - */ - - 'lifetime' => 120, - - 'expire_on_close' => false, - - /* - |-------------------------------------------------------------------------- - | Session Encryption - |-------------------------------------------------------------------------- - | - | This option allows you to easily specify that all of your session data - | should be encrypted before it is stored. All encryption will be run - | automatically by Laravel and you can use the Session like normal. - | - */ - - 'encrypt' => false, - - /* - |-------------------------------------------------------------------------- - | Session File Location - |-------------------------------------------------------------------------- - | - | When using the native session driver, we need a location where session - | files may be stored. A default has been set for you but a different - | location may be specified. This is only needed for file sessions. - | - */ - - 'files' => storage_path('framework/sessions'), - - /* - |-------------------------------------------------------------------------- - | Session Database Connection - |-------------------------------------------------------------------------- - | - | When using the "database" or "redis" session drivers, you may specify a - | connection that should be used to manage these sessions. This should - | correspond to a connection in your database configuration options. - | - */ - - 'connection' => null, - - /* - |-------------------------------------------------------------------------- - | Session Database Table - |-------------------------------------------------------------------------- - | - | When using the "database" session driver, you may specify the table we - | should use to manage the sessions. Of course, a sensible default is - | provided for you; however, you are free to change this as needed. - | - */ - - 'table' => 'sessions', - - /* - |-------------------------------------------------------------------------- - | Session Sweeping Lottery - |-------------------------------------------------------------------------- - | - | Some session drivers must manually sweep their storage location to get - | rid of old sessions from storage. Here are the chances that it will - | happen on a given request. By default, the odds are 2 out of 100. - | - */ - - 'lottery' => [2, 100], - - /* - |-------------------------------------------------------------------------- - | Session Cookie Name - |-------------------------------------------------------------------------- - | - | Here you may change the name of the cookie used to identify a session - | instance by ID. The name specified here will get used every time a - | new session cookie is created by the framework for every driver. - | - */ - - 'cookie' => 'openstackid_resources', - - /* - |-------------------------------------------------------------------------- - | Session Cookie Path - |-------------------------------------------------------------------------- - | - | The session cookie path determines the path for which the cookie will - | be regarded as available. Typically, this will be the root path of - | your application but you are free to change this when necessary. - | - */ - - 'path' => '/', - - /* - |-------------------------------------------------------------------------- - | Session Cookie Domain - |-------------------------------------------------------------------------- - | - | Here you may change the domain of the cookie used to identify a session - | in your application. This will determine which domains the cookie is - | available to in your application. A sensible default has been set. - | - */ - - 'domain' => env('SESSION_COOKIE_DOMAIN'), - - /* - |-------------------------------------------------------------------------- - | HTTPS Only Cookies - |-------------------------------------------------------------------------- - | - | By setting this option to true, session cookies will only be sent back - | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you if it can not be done securely. - | - */ - - 'secure' => env('SESSION_COOKIE_SECURE', false), - - /* - |-------------------------------------------------------------------------- - | HTTP Access Only - |-------------------------------------------------------------------------- - | - | Setting this value to true will prevent JavaScript from accessing the - | value of the cookie and the cookie will only be accessible through - | the HTTP protocol. You are free to modify this option if needed. - | - */ - - 'http_only' => true, - -]; diff --git a/config/stripe.php b/config/stripe.php deleted file mode 100644 index 287f777c..00000000 --- a/config/stripe.php +++ /dev/null @@ -1,25 +0,0 @@ - env('STRIPE_BOOKING_PRIVATE_KEY', ''), - // You can find your endpoint's secret in your webhook settings - "booking_endpoint_secret" => env('STRIPE_BOOKING_ENDPOINT_SECRET', ''), - // Set your secret key: remember to change this to your live secret key in production - // See your keys here: https://dashboard.stripe.com/account/apikeys - "registration_private_key" => env('STRIPE_REGISTRATION_PRIVATE_KEY', ''), - // You can find your endpoint's secret in your webhook settings - "registration_endpoint_secret" => env('STRIPE_REGISTRATION_ENDPOINT_SECRET', ''), -]; \ No newline at end of file diff --git a/config/track_chairs.php b/config/track_chairs.php deleted file mode 100644 index 5b720f8e..00000000 --- a/config/track_chairs.php +++ /dev/null @@ -1,20 +0,0 @@ - env('TRACK_CHAIR_WEIGHT_PASS', 2), - 'weight_maybe' => env('TRACK_CHAIRS_WEIGHT_MAYBE', 1), - 'weight_pass' => env('TRACK_CHAIRS_WEIGHT_PASS', -1), - 'review_link' => env('TRACK_CHAIRS_REVIEW_LINK',''), -]; \ No newline at end of file diff --git a/config/view.php b/config/view.php deleted file mode 100644 index e193ab61..00000000 --- a/config/view.php +++ /dev/null @@ -1,33 +0,0 @@ - [ - realpath(base_path('resources/views')), - ], - - /* - |-------------------------------------------------------------------------- - | Compiled View Path - |-------------------------------------------------------------------------- - | - | This option determines where all the compiled Blade templates will be - | stored for your application. Typically, this is within the storage - | directory. However, as usual, you are free to change this value. - | - */ - - 'compiled' => realpath(storage_path('framework/views')), - -]; diff --git a/database/.gitignore b/database/.gitignore deleted file mode 100644 index 9b1dffd9..00000000 --- a/database/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.sqlite diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php deleted file mode 100644 index f596d0b5..00000000 --- a/database/factories/ModelFactory.php +++ /dev/null @@ -1,21 +0,0 @@ -define(App\User::class, function (Faker\Generator $faker) { - return [ - 'name' => $faker->name, - 'email' => $faker->safeEmail, - 'password' => bcrypt(str_random(10)), - 'remember_token' => str_random(10), - ]; -}); diff --git a/database/migrations/.gitkeep b/database/migrations/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/database/migrations/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/database/migrations/config/.gitkeep b/database/migrations/config/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/database/migrations/config/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/database/migrations/config/Version20190422160409.php b/database/migrations/config/Version20190422160409.php deleted file mode 100644 index 8ded1944..00000000 --- a/database/migrations/config/Version20190422160409.php +++ /dev/null @@ -1,135 +0,0 @@ -hasTable("apis")) { - $builder->create('apis', function (Table $table) { - $table->bigIncrements('id'); - $table->string('name',255); - $table->unique('name'); - $table->text('description')->setNotnull(false); - $table->boolean('active')->setDefault(true); - $table->timestamp('created_at')->setDefault('CURRENT_TIMESTAMP'); - $table->timestamp('updated_at')->setDefault('CURRENT_TIMESTAMP'); - }); - } - - if(!$builder->hasTable("api_scopes")) { - $builder->create('api_scopes', function (Table $table) { - $table->bigIncrements('id'); - $table->string('name', 512); - $table->string('short_description', 512); - $table->text('description'); - $table->boolean('active')->setNotnull(true); - $table->boolean('default')->setNotnull(false); - $table->boolean('system')->setNotnull(false); - $table->timestamp('created_at')->setDefault('CURRENT_TIMESTAMP'); - $table->timestamp('updated_at')->setDefault('CURRENT_TIMESTAMP'); - // FK - $table->bigInteger("api_id")->setUnsigned(true)->setNotnull(false); - $table->index('api_id'); - $table->foreign('apis', 'api_id', 'id'); - }); - } - - if(!$builder->hasTable("api_endpoints")) { - $builder->create('api_endpoints', function (Table $table) { - $table->bigIncrements('id'); - $table->boolean('active')->setDefault(true); - $table->boolean('allow_cors')->setDefault(true); - $table->boolean('allow_credentials')->setDefault(true); - $table->text('description')->setNotnull(false); - $table->string('name', 255); - $table->unique('name'); - $table->timestamp('created_at')->setDefault('CURRENT_TIMESTAMP'); - $table->timestamp('updated_at')->setDefault('CURRENT_TIMESTAMP'); - $table->text("route"); - $table->getTable()->addColumn('http_method', 'array'); - $table->bigInteger("rate_limit")->setUnsigned(true)->setDefault(0); - $table->bigInteger("rate_limit_decay")->setUnsigned(true)->setDefault(0); - //FK - $table->bigInteger("api_id")->setUnsigned(true); - $table->index('api_id'); - $table->foreign('apis','api_id', 'id'); - }); - } - - if(!$builder->hasTable("endpoint_api_scopes")) { - $builder->create('endpoint_api_scopes', function (Table $table) { - $table->bigIncrements('id'); - $table->timestamp('created_at')->setDefault('CURRENT_TIMESTAMP'); - $table->timestamp('updated_at')->setDefault('CURRENT_TIMESTAMP'); - $table->bigInteger("api_endpoint_id")->setUnsigned(true); - $table->index('api_endpoint_id'); - $table->foreign('api_endpoints','api_endpoint_id', 'id'); - // FK 2 - $table->bigInteger("scope_id")->setUnsigned(true); - $table->index('scope_id'); - $table->foreign('api_scopes','scope_id', 'id'); - - }); - } - - if(!$builder->hasTable("ip_rate_limit_routes")) { - $builder->create('ip_rate_limit_routes', function (Table $table) { - $table->bigIncrements('id'); - $table->string('ip',255); - $table->text("route"); - $table->boolean('active')->setDefault(true); - //$table->getTable()->addColumn('http_method', enum ('GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'TRACE', 'CONNECT', 'OPTIONS', 'PATCH')); - $table->getTable()->addColumn('http_method', 'array'); - $table->bigInteger("rate_limit")->setUnsigned(true)->setDefault(0); - $table->bigInteger("rate_limit_decay")->setUnsigned(true)->setDefault(0); - $table->timestamp('created_at')->setDefault('CURRENT_TIMESTAMP'); - $table->timestamp('updated_at')->setDefault('CURRENT_TIMESTAMP'); - - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists('endpoint_api_scopes'); - - $builder->dropIfExists('apis'); - - $builder->dropIfExists('api_scopes'); - - $builder->dropIfExists('api_endpoints'); - - $builder->dropIfExists('ip_rate_limit_routes'); - - } -} diff --git a/database/migrations/config/Version20190828142430.php b/database/migrations/config/Version20190828142430.php deleted file mode 100644 index aae3970b..00000000 --- a/database/migrations/config/Version20190828142430.php +++ /dev/null @@ -1,64 +0,0 @@ -hasTable("queue_jobs")) { - $builder->create('queue_jobs', function (Table $table) { - $table->bigInteger("id", true, false); - $table->primary("id"); - $table->string('queue'); - $table->index("queue","queue"); - $table->text("payload"); - $table->unsignedSmallInteger('attempts'); - $table->unsignedInteger('reserved_at')->setNotnull(false); - $table->unsignedInteger('available_at'); - $table->unsignedInteger('created_at'); - }); - } - if(!$schema->hasTable("queue_failed_jobs")) { - $builder->create('queue_failed_jobs', function (Table $table) { - $table->bigInteger("id", true, false); - $table->primary("id"); - $table->text('connection'); - $table->text('queue'); - $table->text('payload'); - $table->text('exception'); - $table->timestamp('failed_at')->setDefault('CURRENT_TIMESTAMP'); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $schema->dropTable("failed_jobs"); - $schema->dropTable("jobs"); - } -} diff --git a/database/migrations/config/Version20190828143005.php b/database/migrations/config/Version20190828143005.php deleted file mode 100644 index 3f9f6959..00000000 --- a/database/migrations/config/Version20190828143005.php +++ /dev/null @@ -1,42 +0,0 @@ -addSql("ALTER TABLE queue_jobs MODIFY payload longtext NOT NULL;"); - $this->addSql("ALTER TABLE queue_failed_jobs MODIFY payload longtext NOT NULL;"); - $this->addSql("ALTER TABLE queue_failed_jobs MODIFY `exception` longtext NOT NULL;"); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/config/Version20200123174717.php b/database/migrations/config/Version20200123174717.php deleted file mode 100644 index 271f45c4..00000000 --- a/database/migrations/config/Version20200123174717.php +++ /dev/null @@ -1,53 +0,0 @@ -hasTable("endpoint_api_authz_groups")) { - $builder->create('endpoint_api_authz_groups', function (Table $table) { - $table->bigIncrements('id'); - $table->timestamp('created_at')->setDefault('CURRENT_TIMESTAMP'); - $table->timestamp('updated_at')->setDefault('CURRENT_TIMESTAMP'); - $table->bigInteger("api_endpoint_id")->setUnsigned(true); - $table->index('api_endpoint_id'); - $table->foreign('api_endpoints','api_endpoint_id', 'id'); - $table->string('group_slug', 512); - $table->unique(['api_endpoint_id', 'group_slug']); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - $builder->dropIfExists('endpoint_api_authz_groups'); - } -} diff --git a/database/migrations/model/.gitkeep b/database/migrations/model/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/database/migrations/model/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/database/migrations/model/Version20190422151949.php b/database/migrations/model/Version20190422151949.php deleted file mode 100644 index 59cce889..00000000 --- a/database/migrations/model/Version20190422151949.php +++ /dev/null @@ -1,59 +0,0 @@ -hasTable("SpeakerEditPermissionRequest")) { - $builder->create('SpeakerEditPermissionRequest', function (Table $table) { - $table->increments('ID'); - $table->integer("RequestedByID"); - $table->boolean("Approved")->setDefault(false); - $table->dateTime("ApprovedDate")->setNotnull(false); - $table->dateTime("Created")->setNotnull(true); - $table->dateTime("LastEdited")->setNotnull(true); - $table->text("Hash"); - $table->integer("SpeakerID" ); - $table->index("SpeakerID", "SpeakerID"); - $table->foreign("PresentationSpeaker", "SpeakerID", "ID", ["onDelete" => "CASCADE"]); - $table->foreign("Member", "RequestedByID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - - if($builder->hasTable("SpeakerEditPermissionRequest")) - $builder->drop('SpeakerEditPermissionRequest'); - } -} diff --git a/database/migrations/model/Version20190506153014.php b/database/migrations/model/Version20190506153014.php deleted file mode 100644 index 6866c404..00000000 --- a/database/migrations/model/Version20190506153014.php +++ /dev/null @@ -1,47 +0,0 @@ -hasTable("PresentationCreatorNotificationEmailRequest")) { - $this->addSql("CREATE TABLE PresentationCreatorNotificationEmailRequest (PresentationID INT DEFAULT NULL, ID INT NOT NULL, INDEX IDX_B302D49879B1711B (PresentationID), PRIMARY KEY(ID)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;"); - $this->addSql("ALTER TABLE PresentationCreatorNotificationEmailRequest ADD CONSTRAINT FK_B302D49879B1711B FOREIGN KEY (PresentationID) REFERENCES Presentation (ID) ON DELETE CASCADE;"); - $this->addSql("ALTER TABLE PresentationCreatorNotificationEmailRequest ADD CONSTRAINT FK_B302D49811D3633A FOREIGN KEY (ID) REFERENCES EmailCreationRequest (ID) ON DELETE CASCADE"); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - $this->addSql("ALTER TABLE `PresentationCreatorNotificationEmailRequest` DROP FOREIGN KEY `FK_B302D49879B1711B`;"); - $this->addSql("ALTER TABLE `PresentationCreatorNotificationEmailRequest` DROP FOREIGN KEY `FK_B302D49811D3633A`;"); - $builder->dropIfExists('PresentationCreatorNotificationEmailRequest'); - } -} diff --git a/database/migrations/model/Version20190506153909.php b/database/migrations/model/Version20190506153909.php deleted file mode 100644 index 77a2a31f..00000000 --- a/database/migrations/model/Version20190506153909.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("PresentationSpeakerNotificationEmailRequest")){ - $this->addSql("CREATE TABLE PresentationSpeakerNotificationEmailRequest (SpeakerID INT DEFAULT NULL, PresentationID INT DEFAULT NULL, ID INT NOT NULL, INDEX IDX_2BFDC212FEC5CBA6 (SpeakerID), INDEX IDX_2BFDC21279B1711B (PresentationID), PRIMARY KEY(ID)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB; "); - $this->addSql("ALTER TABLE PresentationSpeakerNotificationEmailRequest ADD CONSTRAINT FK_2BFDC212FEC5CBA6 FOREIGN KEY (SpeakerID) REFERENCES PresentationSpeaker (ID) ON DELETE CASCADE; "); - $this->addSql("ALTER TABLE PresentationSpeakerNotificationEmailRequest ADD CONSTRAINT FK_2BFDC21279B1711B FOREIGN KEY (PresentationID) REFERENCES Presentation (ID) ON DELETE CASCADE;"); - $this->addSql("ALTER TABLE PresentationSpeakerNotificationEmailRequest ADD CONSTRAINT FK_2BFDC21211D3633A FOREIGN KEY (ID) REFERENCES EmailCreationRequest (ID) ON DELETE CASCADE;"); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - $this->addSql("ALTER TABLE `PresentationSpeakerNotificationEmailRequest` DROP FOREIGN KEY `FK_2BFDC212FEC5CBA6`;"); - $this->addSql("ALTER TABLE `PresentationSpeakerNotificationEmailRequest` DROP FOREIGN KEY `FK_2BFDC21279B1711B`;"); - $this->addSql("ALTER TABLE `PresentationSpeakerNotificationEmailRequest` DROP FOREIGN KEY `FK_2BFDC21211D3633A`;"); - $builder->dropIfExists('PresentationSpeakerNotificationEmailRequest'); - } -} diff --git a/database/migrations/model/Version20190529015655.php b/database/migrations/model/Version20190529015655.php deleted file mode 100644 index 861a6156..00000000 --- a/database/migrations/model/Version20190529015655.php +++ /dev/null @@ -1,54 +0,0 @@ -hasColumn("Summit","MeetingRoomBookingStartTime")) { - $builder->table('Summit', function (Table $table) { - $table->time("MeetingRoomBookingStartTime")->setNotnull(false); - $table->time("MeetingRoomBookingEndTime")->setNotnull(false); - $table->integer("MeetingRoomBookingSlotLength")->setNotnull(true)->setDefault(0); - $table->integer("MeetingRoomBookingMaxAllowed")->setNotnull(true)->setDefault(0); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->table('Summit', function (Table $table) { - $table->dropColumn("MeetingRoomBookingStartTime"); - $table->dropColumn("MeetingRoomBookingEndTime"); - $table->dropColumn("MeetingRoomBookingSlotLength"); - $table->dropColumn("MeetingRoomBookingMaxAllowed"); - }); - } -} diff --git a/database/migrations/model/Version20190529142913.php b/database/migrations/model/Version20190529142913.php deleted file mode 100644 index 6e62f574..00000000 --- a/database/migrations/model/Version20190529142913.php +++ /dev/null @@ -1,61 +0,0 @@ -hasTable("SummitBookableVenueRoom")) { - $sql = <<addSql($sql); - $builder->create('SummitBookableVenueRoom', function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->string("Currency",3); - $table->decimal("TimeSlotCost", 9, 2)->setDefault('0.00'); - $table->foreign("SummitAbstractLocation","ID", "ID", ["onDelete" => "CASCADE"]); - }); - - $this->addSql($sql); - - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $sql = <<addSql($sql); - - $builder->drop('SummitBookableVenueRoom'); - } -} diff --git a/database/migrations/model/Version20190529142927.php b/database/migrations/model/Version20190529142927.php deleted file mode 100644 index 24bae39c..00000000 --- a/database/migrations/model/Version20190529142927.php +++ /dev/null @@ -1,64 +0,0 @@ -hasTable("SummitRoomReservation")) { - $builder->create('SummitRoomReservation', function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->string('ClassName')->setDefault("SummitRoomReservation"); - $table->index("ClassName", "ClassName"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->timestamp('ApprovedPaymentDate')->setNotnull(false); - $table->timestamp('StartDateTime')->setNotnull(false); - $table->timestamp('EndDateTime')->setNotnull(false); - $table->string("Status"); - $table->string("LastError"); - $table->string("PaymentGatewayCartId", 512); - $table->decimal("Amount", 9, 2)->setDefault('0.00'); - $table->string("Currency", 3); - $table->index("PaymentGatewayCartId", "PaymentGatewayCartId"); - $table->integer("OwnerID", false, false)->setNotnull(false); - $table->index("OwnerID", "OwnerID"); - $table->foreign("Member", "OwnerID", "ID", ["onDelete" => "CASCADE"]); - $table->integer("RoomID", false, false)->setNotnull(false); - $table->index("RoomID", "RoomID"); - $table->foreign("SummitBookableVenueRoom", "RoomID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - (new Builder($schema))->drop('SummitRoomReservation'); - } -} diff --git a/database/migrations/model/Version20190530205326.php b/database/migrations/model/Version20190530205326.php deleted file mode 100644 index 6aeff2a3..00000000 --- a/database/migrations/model/Version20190530205326.php +++ /dev/null @@ -1,54 +0,0 @@ -hasTable("SummitBookableVenueRoomAttributeType")) { - $builder->create('SummitBookableVenueRoomAttributeType', function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->string('ClassName')->setDefault("SummitBookableVenueRoomAttributeType"); - $table->index("ClassName", "ClassName"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Type", 255); - $table->index("Type", "Type"); - $table->integer("SummitID", false, false)->setNotnull(false); - $table->index("SummitID", "SummitID"); - $table->unique(["SummitID", "Type"], "SummitID_Type"); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - (new Builder($schema))->drop('BookableSummitVenueRoomAttributeType'); - } -} diff --git a/database/migrations/model/Version20190530205344.php b/database/migrations/model/Version20190530205344.php deleted file mode 100644 index f9bd3357..00000000 --- a/database/migrations/model/Version20190530205344.php +++ /dev/null @@ -1,68 +0,0 @@ -hasTable("SummitBookableVenueRoomAttributeValue")) { - $builder->create('SummitBookableVenueRoomAttributeValue', function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->string('ClassName')->setDefault("SummitBookableVenueRoomAttributeValue"); - $table->index("ClassName", "ClassName"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Value", 255); - $table->index("Value", "Value"); - $table->integer("TypeID", false, false)->setNotnull(false); - $table->index("TypeID", "TypeID"); - $table->unique(["TypeID", "Value"], "TypeID_Value"); - }); - } - - if(!$schema->hasTable("SummitBookableVenueRoom_Attributes")) { - $builder->create('SummitBookableVenueRoom_Attributes', function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->integer("SummitBookableVenueRoomID", false, false)->setNotnull(false)->setDefault(0); - $table->index("SummitBookableVenueRoomID", "SummitBookableVenueRoomID"); - $table->integer("SummitBookableVenueRoomAttributeValueID", false, false)->setNotnull(false)->setDefault(0); - $table->index("SummitBookableVenueRoomAttributeValueID", "SummitBookableVenueRoomAttributeValueID"); - $table->unique(["SummitBookableVenueRoomID", "SummitBookableVenueRoomAttributeValueID"], "RoomID_ValueID"); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - (new Builder($schema))->drop('SummitBookableVenueRoomAttributeValue'); - (new Builder($schema))->drop('SummitBookableVenueRoom_Attributes'); - } -} diff --git a/database/migrations/model/Version20190625030955.php b/database/migrations/model/Version20190625030955.php deleted file mode 100644 index dfe8f8c4..00000000 --- a/database/migrations/model/Version20190625030955.php +++ /dev/null @@ -1,52 +0,0 @@ -hasColumn("Summit","ApiFeedType")) { - $builder->table('Summit', function (Table $table) { - $table->string("ApiFeedType")->setNotnull(false); - $table->string("ApiFeedUrl")->setNotnull(false); - $table->string("ApiFeedKey")->setNotnull(false); - }); - } - - if(!$builder->hasColumn("SummitEvent","ExternalId")) { - $builder->table('SummitEvent', function (Table $table) { - $table->string("ExternalId")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20190626125814.php b/database/migrations/model/Version20190626125814.php deleted file mode 100644 index ad1a5448..00000000 --- a/database/migrations/model/Version20190626125814.php +++ /dev/null @@ -1,52 +0,0 @@ -hasTable("SummitRoomReservation") && !$builder->hasColumns("SummitRoomReservation", ["PaymentGatewayClientToken","RefundedAmount"])) { - $builder->table('SummitRoomReservation', function (Table $table) { - $table->text("PaymentGatewayClientToken"); - $table->decimal("RefundedAmount", 9, 2)->setDefault('0.00'); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($builder->hasTable("SummitRoomReservation") && $builder->hasColumns("SummitRoomReservation", ["PaymentGatewayClientToken","RefundedAmount"])) { - $builder->table('SummitRoomReservation', function (Table $table) { - $table->dropColumn("PaymentGatewayClientToken"); - $table->dropColumn("RefundedAmount"); - }); - } - } -} diff --git a/database/migrations/model/Version20190629222739.php b/database/migrations/model/Version20190629222739.php deleted file mode 100644 index a4939534..00000000 --- a/database/migrations/model/Version20190629222739.php +++ /dev/null @@ -1,54 +0,0 @@ -hasTable("SummitRoomReservation")) { - $builder->table('SummitRoomReservation', function (Table $table) { - $table->dropColumn('RefundedAmount'); - $table->integer("RefundedAmount")->setDefault(0)->setNotnull(true); - $table->dropColumn('Amount'); - $table->integer("Amount")->setDefault(0)->setNotnull(true); - }); - } - if($schema->hasTable("SummitBookableVenueRoom")) { - $builder->table('SummitBookableVenueRoom', function (Table $table) { - $table->dropColumn('TimeSlotCost'); - $table->integer("TimeSlotCost")->setDefault(0)->setNotnull(true); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20190723210551.php b/database/migrations/model/Version20190723210551.php deleted file mode 100644 index 10b1ba02..00000000 --- a/database/migrations/model/Version20190723210551.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("SummitPresentationComment") && !$builder->hasColumn("SummitPresentationComment", "IsPublic")) { - $builder->table('SummitPresentationComment', function (Table $table) { - $table->boolean("IsPublic")->setDefault(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("SummitPresentationComment") && $builder->hasColumn("SummitPresentationComment", "IsPublic")) { - $builder->table('SummitPresentationComment', function (Table $table) { - $table->dropColumn("IsPublic"); - }); - } - } -} diff --git a/database/migrations/model/Version20190728200547.php b/database/migrations/model/Version20190728200547.php deleted file mode 100644 index bd24a4c6..00000000 --- a/database/migrations/model/Version20190728200547.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("Member") && !$builder->hasColumn("Member", "ExternalUserId")) { - $builder->table('Member', function (Table $table) { - $table->integer("ExternalUserId")->setNotnull(false); - $table->text("ExternalUserIdentifier")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("Member") && $builder->hasColumn("Member", "ExternalUserId")) { - $builder->table('Member', function (Table $table) { - $table->dropColumn("ExternalUserId")->setNotnull(false); - $table->dropColumn("ExternalUserIdentifier")->setNotnull(false); - }); - } - } -} diff --git a/database/migrations/model/Version20190730022151.php b/database/migrations/model/Version20190730022151.php deleted file mode 100644 index db09e55c..00000000 --- a/database/migrations/model/Version20190730022151.php +++ /dev/null @@ -1,55 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20190730031422.php b/database/migrations/model/Version20190730031422.php deleted file mode 100644 index 4b13e33c..00000000 --- a/database/migrations/model/Version20190730031422.php +++ /dev/null @@ -1,593 +0,0 @@ -hasTable("SummitAccessLevelType")) { - $builder->create("SummitAccessLevelType", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Name")->setNotnull(true); - $table->string("Description")->setNotnull(false); - $table->boolean("IsDefault")->setDefault(false); - $table->text("TemplateContent"); - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - // badge features - if (!$builder->hasTable("SummitBadgeFeatureType")) { - $builder->create("SummitBadgeFeatureType", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Name")->setNotnull(true); - $table->string("Description")->setNotnull(false); - $table->text("TemplateContent"); - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - // badge types per summit - if (!$builder->hasTable("SummitBadgeType")) { - $builder->create("SummitBadgeType", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Name")->setNotnull(true); - $table->string("Description")->setNotnull(false); - $table->text("TemplateContent"); - $table->boolean("IsDefault")->setDefault(false); - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - $table->integer("FileID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("FileID", "FileID"); - $table->foreign("File", "FileID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - if (!$builder->hasTable("SummitBadgeType_AccessLevels")) { - $builder->create("SummitBadgeType_AccessLevels", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitBadgeTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitBadgeTypeID", "SummitBadgeTypeID"); - //$table->foreign("SummitBadgeType", "SummitBadgeTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitAccessLevelTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitAccessLevelTypeID", "SummitAccessLevelTypeID"); - //$table->foreign("SummitAccessLevelType", "SummitAccessLevelTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SummitBadgeTypeID', 'SummitAccessLevelTypeID']); - }); - } - - // tax per summit - if (!$builder->hasTable("SummitTaxType")) { - $builder->create("SummitTaxType", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Name"); - $table->string("TaxID"); - $table->decimal("Rate", 9, 2)->setDefault('0.00'); - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - // refund policies - if (!$builder->hasTable("SummitRefundPolicyType")) { - $builder->create("SummitRefundPolicyType", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Name"); - $table->integer("UntilXDaysBeforeEventStarts")->setDefault(0); - $table->decimal("RefundRate", 9, 2)->setDefault('0.00'); - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - // update to ticket types - if ($builder->hasTable("SummitTicketType") && !$builder->hasColumn("SummitTicketType", "Cost")) { - $builder->table("SummitTicketType", function (Table $table) { - $table->decimal("Cost", 9, 2)->setDefault('0.00'); - $table->string("Currency", 3)->setDefault('USD'); - $table->integer("QuantityToSell")->setDefault(0); - $table->integer("QuantitySold")->setDefault(0); - $table->integer("MaxQuantityToSellPerOrder")->setDefault(0); - $table->timestamp('SaleStartDate')->setNotnull(false); - $table->timestamp('SaleEndDate')->setNotnull(false); - }); - } - - // taxes associated per tix type - if (!$builder->hasTable("SummitTicketType_Taxes")) { - $builder->create("SummitTicketType_Taxes", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitTicketTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitTicketTypeID", "SummitTicketTypeID"); - //$table->foreign("SummitTicketType", "TicketTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitTaxTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitTaxTypeID", "SummitTaxTypeID"); - //$table->foreign("SummitTaxType", "TaxTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SummitTicketTypeID', 'SummitTaxTypeID']); - }); - } - - // promo codes and discount codes - - - // update to promo codes with new fields - if ($builder->hasTable("SummitRegistrationPromoCode") && !$builder->hasColumn("SummitRegistrationPromoCode", "QuantityAvailable")) { - $builder->table("SummitRegistrationPromoCode", function (Table $table) { - $table->integer("QuantityAvailable")->setDefault(0)->setNotnull(false); - $table->integer("QuantityUsed")->setDefault(0)->setNotnull(false); - $table->timestamp('ValidSinceDate')->setNotnull(false); - $table->timestamp('ValidUntilDate')->setNotnull(false); - $table->integer("BadgeTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("BadgeTypeID", "BadgeTypeID"); - $table->foreign("SummitBadgeType", "BadgeTypeID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - // features per promo code - if (!$builder->hasTable("SummitRegistrationPromoCode_BadgeFeatures")) { - $builder->create("SummitRegistrationPromoCode_BadgeFeatures", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitRegistrationPromoCodeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitRegistrationPromoCodeID", "SummitRegistrationPromoCodeID"); - //$table->foreign("SummitRegistrationPromoCode", "SummitRegistrationPromoCodeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitBadgeFeatureTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitBadgeFeatureTypeID", "SummitBadgeFeatureTypeID"); - //$table->foreign("SummitBadgeFeatureType", "SummitBadgeFeatureTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SummitRegistrationPromoCodeID', 'SummitBadgeFeatureTypeID']); - }); - } - - // allowed tix types per promo code - if (!$builder->hasTable("SummitRegistrationPromoCode_AllowedTicketTypes")) { - - $builder->create("SummitRegistrationPromoCode_AllowedTicketTypes", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitRegistrationPromoCodeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitRegistrationPromoCodeID", "SummitRegistrationPromoCodeID"); - //$table->foreign("SummitRegistrationPromoCode", "SummitRegistrationPromoCodeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitTicketTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitTicketTypeID", "SummitTicketTypeID"); - //$table->foreign("SummitTicketType", "SummitTicketTypeID", "ID", ["onDelete" => "CASCADE"]); - $table->unique(['SummitRegistrationPromoCodeID', 'SummitTicketTypeID']); - }); - } - - // discount codes - if (!$builder->hasTable("SummitRegistrationDiscountCode")) { - - $builder->create("SummitRegistrationDiscountCode", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->decimal("DiscountRate", 9, 2)->setDefault('0.00')->setNotnull(true); - $table->decimal("DiscountAmount", 9, 2)->setDefault('0.00')->setNotnull(true); - - $table->foreign("SummitRegistrationPromoCode", "ID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - if (!$builder->hasTable("MemberSummitRegistrationDiscountCode")) { - $builder->create("MemberSummitRegistrationDiscountCode", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->integer("OwnerID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("OwnerID", "OwnerID"); - $table->foreign("Member", "OwnerID", "ID", ["onDelete" => "CASCADE"]); - $table->string("FirstName"); - $table->string("LastName"); - $table->string("Email"); - $table->string("Type"); - $table->foreign("SummitRegistrationPromoCode", "ID", "ID", ["onDelete" => "CASCADE"]); - }); - - } - - if (!$builder->hasTable("SpeakerSummitRegistrationDiscountCode")) { - $builder->create("SpeakerSummitRegistrationDiscountCode", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->integer("SpeakerID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SpeakerID", "SpeakerID"); - $table->foreign("PresentationSpeaker", "SpeakerID", "ID", ["onDelete" => "CASCADE"]); - $table->string("Type"); - $table->foreign("SummitRegistrationPromoCode", "ID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - if (!$builder->hasTable("SponsorSummitRegistrationDiscountCode")) { - $builder->create("SponsorSummitRegistrationDiscountCode", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->integer("SponsorID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SponsorID", "SponsorID"); - $table->foreign("Company", "SponsorID", "ID", ["onDelete" => "CASCADE"]); - $table->foreign("SummitRegistrationPromoCode", "ID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - // allowed tix types for discount codes - - if (!$builder->hasTable("SummitRegistrationDiscountCode_AllowedTicketTypes")) { - - $builder->create("SummitRegistrationDiscountCode_AllowedTicketTypes", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->decimal("DiscountRate", 9, 2)->setDefault('0.00'); - $table->decimal("DiscountAmount", 9, 2)->setDefault('0.00'); - - $table->integer("SummitRegistrationDiscountCodeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitRegistrationDiscountCodeID", "SummitRegistrationDiscountCodeID"); - //$table->foreign("SummitRegistrationDiscountCode", "SummitRegistrationDiscountCodeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitTicketTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitTicketTypeID", "SummitTicketTypeID"); - //$table->foreign("SummitTicketType", "SummitTicketTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SummitRegistrationDiscountCodeID', 'SummitTicketTypeID']); - }); - } - - if (!$builder->hasTable("SummitOrder")) { - $builder->create("SummitOrder", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->string("Status"); - $table->string("PaymentMethod"); - $table->string("Number"); - $table->index("Number", "Number"); - $table->unique(["SummitID", "Number"], "SummitID_Number"); - $table->string("QRCode")->setDefault("")->setNotnull(false); - $table->index("QRCode", "QRCode"); - - // owner - $table->string("OwnerFirstName"); - $table->string("OwnerSurname"); - $table->string("OwnerEmail", 100); - $table->string("OwnerCompany"); - - $table->integer("CompanyID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("CompanyID", "CompanyID"); - $table->foreign("Company", "CompanyID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("OwnerID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("OwnerID", "OwnerID"); - $table->foreign("Member", "OwnerID", "ID", ["onDelete" => "CASCADE"]); - $table->timestamp('DisclaimerAcceptedDate')->setNotnull(false); - // billing address - $table->string("BillingAddress1", 100)->setNotnull(false); - $table->string("BillingAddress2", 100)->setNotnull(false); - $table->string("BillingAddressZipCode", 50)->setNotnull(false); - $table->string("BillingAddressCity", 50)->setNotnull(false); - $table->string("BillingAddressState", 50)->setNotnull(false); - $table->string("BillingAddressCountryISOCode", 3)->setNotnull(false); - - //payment gateway - - $table->timestamp('ApprovedPaymentDate')->setNotnull(false); - $table->string("LastError")->setNotnull(false); - $table->text("PaymentGatewayClientToken")->setNotnull(false); - $table->string("PaymentGatewayCartId", 512)->setNotnull(false); - $table->index("PaymentGatewayCartId", "PaymentGatewayCartId"); - - $table->string("Hash", 255)->setNotnull(false); - $table->unique("Hash", "Hash"); - $table->timestamp('HashCreationDate')->setNotnull(false); - }); - } - - if ($builder->hasTable("SummitAttendeeTicket") && !$builder->hasColumn("SummitAttendeeTicket","OrderID")) { - $builder->table("SummitAttendeeTicket", function (Table $table) { - - $table->integer("OrderID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("OrderID", "OrderID"); - $table->foreign("SummitOrder", "OrderID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("PromoCodeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("PromoCodeID", "PromoCodeID"); - $table->foreign("SummitRegistrationPromoCode", "PromoCodeID", "ID", ["onDelete" => "CASCADE"]); - - $table->foreign("SummitAttendee", "OwnerID", "ID", ["onDelete" => "CASCADE"]); - - $table->decimal("RawCost", 9, 2)->setDefault('0.00'); - $table->decimal("Discount", 9, 2)->setDefault('0.00'); - $table->string("Status"); - $table->string("Number")->setNotnull(false); - $table->unique("Number", "Number"); - $table->decimal("RefundedAmount", 9, 2)->setDefault('0.00'); - $table->string("Currency", 3)->setDefault('USD'); - - $table->string("QRCode")->setDefault("")->setNotnull(false); - $table->index("QRCode", "QRCode"); - - $table->string("Hash", 255)->setNotnull(false); - $table->unique("Hash", "Hash"); - $table->timestamp('HashCreationDate')->setNotnull(false); - - }); - - } - - if (!$builder->hasTable("SummitAttendeeTicket_Taxes")) { - $builder->create("SummitAttendeeTicket_Taxes", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitAttendeeTicketID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitAttendeeTicketID", "SummitAttendeeTicketID"); - //$table->foreign("SummitAttendeeTicket", "TicketID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitTaxTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitTaxTypeID", "SummitTaxTypeID"); - //$table->foreign("SummitTaxType", "TaxTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->decimal("Amount", 9, 2)->setDefault('0.00'); - - $table->unique(['SummitAttendeeTicketID', 'SummitTaxTypeID']); - }); - } - - if ($builder->hasTable("SummitAttendee") && !$builder->hasColumn("SummitAttendee", "FirstName")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->string("FirstName", 255)->setNotnull(false); - $table->string("Surname", 255)->setNotnull(false); - $table->string("Email", 100)->setNotnull(false); - $table->index("Email", "Email"); - $table->timestamp('DisclaimerAcceptedDate')->setNotnull(false); - }); - } - - if (!$builder->hasTable("SummitAttendeeBadge")) { - $builder->create("SummitAttendeeBadge", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->timestamp('PrintDate')->setNotnull(false); - $table->boolean('IsVoid')->setDefault(false); - $table->string("QRCode")->setDefault("")->setNotnull(false); - $table->index("QRCode", "QRCode"); - - $table->integer("TicketID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("TicketID", "TicketID"); - $table->foreign("SummitAttendeeTicket", "TicketID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("BadgeTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("BadgeTypeID", "BadgeTypeID"); - $table->foreign("SummitBadgeType", "BadgeTypeID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - if (!$builder->hasTable("SummitAttendeeBadge_Features")) { - $builder->create("SummitAttendeeBadge_Features", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitAttendeeBadgeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitAttendeeBadgeID", "SummitAttendeeBadgeID"); - //$table->foreign("SummitAttendeeBadge", "BadgeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitBadgeFeatureTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitBadgeFeatureTypeID", "SummitBadgeFeatureTypeID"); - //$table->foreign("SummitBadgeFeatureType", "SummitBadgeFeatureTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SummitAttendeeBadgeID', 'SummitBadgeFeatureTypeID']); - }); - } - - - // order extra question types - - if (!$builder->hasTable("SummitOrderExtraQuestionType")) { - - $builder->create("SummitOrderExtraQuestionType", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->string("Name", 100); - $table->string("Type"); - $table->string("Label"); - $table->integer("Order")->setDefault(0); - - $table->boolean("Mandatory")->setDefault(false); - $table->string("Usage", 50); - $table->string("Placeholder", 50); - $table->boolean("Printable")->setDefault(false); - - }); - } - - if (!$builder->hasTable("SummitOrderExtraQuestionValue")) { - $builder->create("SummitOrderExtraQuestionValue", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->integer("QuestionID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("QuestionID", "QuestionID"); - $table->foreign("SummitOrderExtraQuestionType", "QuestionID", "ID", ["onDelete" => "CASCADE"]); - - $table->string("Value"); - $table->string("Label"); - $table->integer("Order")->setDefault(0); - }); - } - - - if (!$builder->hasTable("SummitOrderExtraQuestionAnswer")) { - - $builder->create("SummitOrderExtraQuestionAnswer", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->text("Value"); - - $table->integer("QuestionID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("QuestionID", "QuestionID"); - $table->foreign("SummitOrderExtraQuestionType", "QuestionID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("OrderID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("OrderID", "OrderID"); - $table->foreign("SummitOrder", "OrderID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitAttendeeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitAttendeeID", "SummitAttendeeID"); - $table->foreign("SummitAttendee", "SummitAttendeeID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - // sponsors users - - if (!$builder->hasTable("Sponsor_Users")) { - - $builder->create("Sponsor_Users", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->integer("SponsorID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SponsorID", "SponsorID"); - //$table->foreign("Sponsor", "SponsorID", "ID", ["onDelete" => "CASCADE"]); - - - $table->integer("MemberID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("MemberID", "MemberID"); - //$table->foreign("Member", "UserID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SponsorID', 'MemberID']); - - }); - } - - // sponsors badge scans - - - if (!$builder->hasTable("SponsorBadgeScan")) { - - $builder->create("SponsorBadgeScan", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->integer("SponsorID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SponsorID", "SponsorID"); - $table->foreign("Sponsor", "SponsorID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("UserID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("UserID", "UserID"); - $table->foreign("Member", "UserID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("BadgeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("BadgeID", "BadgeID"); - $table->foreign("SummitAttendeeBadge", "BadgeID", "ID", ["onDelete" => "CASCADE"]); - - $table->string("QRCode"); - - }); - } - - if ($builder->hasTable("Summit") && !$builder->hasColumn("Summit", "ReAssignTicketTillDate")) { - $builder->table("Summit", function (Table $table) { - $table->timestamp('ReAssignTicketTillDate')->setNotnull(false); - $table->text('RegistrationDisclaimerContent')->setNotnull(false); - $table->boolean('RegistrationDisclaimerMandatory')->setNotnull(false)->setDefault(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20190801211505.php b/database/migrations/model/Version20190801211505.php deleted file mode 100644 index 786a069b..00000000 --- a/database/migrations/model/Version20190801211505.php +++ /dev/null @@ -1,141 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - - $sql = <<addSql($sql); - - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - // promo codes - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20190824125218.php b/database/migrations/model/Version20190824125218.php deleted file mode 100644 index af771a91..00000000 --- a/database/migrations/model/Version20190824125218.php +++ /dev/null @@ -1,53 +0,0 @@ -addSql($sql); - - // make enum - $sql = <<addSql($sql); - $this->addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20190911132806.php b/database/migrations/model/Version20190911132806.php deleted file mode 100644 index 9a871d53..00000000 --- a/database/migrations/model/Version20190911132806.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("SummitOrder") && !$builder->hasColumn("SummitOrder", "RefundedAmount")) { - $builder->table("SummitOrder", function (Table $table) { - $table->decimal("RefundedAmount", 9, 2)->setDefault('0.00'); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("SummitOrder")) { - $builder->table("SummitOrder", function (Table $table) { - $table->dropColumn("RefundedAmount"); - }); - } - } -} diff --git a/database/migrations/model/Version20190918111958.php b/database/migrations/model/Version20190918111958.php deleted file mode 100644 index db563d64..00000000 --- a/database/migrations/model/Version20190918111958.php +++ /dev/null @@ -1,61 +0,0 @@ -hasTable("SummitAttendeeBadge") && !$builder->hasColumn("SummitAttendeeBadge", "PrintedTimes")) { - $builder->table("SummitAttendeeBadge", function (Table $table) { - $table->integer("PrintedTimes")->setNotnull(false)->setDefault(0); - }); - } - - if ($builder->hasTable("SummitTicketType") && !$builder->hasColumn("SummitTicketType", "BadgeTypeID")) { - $builder->table("SummitTicketType", function (Table $table) { - $table->integer("BadgeTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("BadgeTypeID", "BadgeTypeID"); - $table->foreign("SummitBadgeType", "BadgeTypeID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("SummitAttendeeBadge") && $builder->hasColumn("SummitAttendeeBadge", "PrintedTimes")) { - $builder->table("SummitAttendeeBadge", function (Table $table) { - $table->dropColumn("PrintedTimes"); - }); - } - - } -} diff --git a/database/migrations/model/Version20191016014630.php b/database/migrations/model/Version20191016014630.php deleted file mode 100644 index e7d0426f..00000000 --- a/database/migrations/model/Version20191016014630.php +++ /dev/null @@ -1,53 +0,0 @@ -hasTable("SponsorBadgeScan") && !$builder->hasColumn("SponsorBadgeScan", "ScanDate")) { - $builder->table("SponsorBadgeScan", function (Table $table) { - $table->timestamp('ScanDate'); - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("SponsorBadgeScan") && $builder->hasColumn("SponsorBadgeScan", "ScanDate")) { - $builder->table("SponsorBadgeScan", function (Table $table) { - $table->dropColumn('ScanDate'); - }); - } - } -} diff --git a/database/migrations/model/Version20191116183316.php b/database/migrations/model/Version20191116183316.php deleted file mode 100644 index 755bb298..00000000 --- a/database/migrations/model/Version20191116183316.php +++ /dev/null @@ -1,91 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit", "ExternalRegistrationFeedType")) { - $builder->table("Summit", function (Table $table) { - $table->string('ExternalRegistrationFeedType')->setNotnull(false); - $table->string('ExternalRegistrationFeedApiKey')->setNotnull(false); - }); - } - - if ($builder->hasTable("SummitOrder") && !$builder->hasColumn("SummitOrder", "ExternalId")) { - $builder->table("SummitOrder", function (Table $table) { - $table->string('ExternalId')->setNotnull(false); - }); - } - - if ($builder->hasTable("SummitAttendee") && !$builder->hasColumn("SummitAttendee", "ExternalId")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->string('ExternalId')->setNotnull(false); - }); - } - - if ($builder->hasTable("SummitRegistrationPromoCode") && !$builder->hasColumn("SummitRegistrationPromoCode", "ExternalId")) { - $builder->table("SummitRegistrationPromoCode", function (Table $table) { - $table->string('ExternalId')->setNotnull(false); - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("Summit") && $builder->hasColumn("Summit", "ExternalRegistrationFeedType")) { - $builder->table("Summit", function (Table $table) { - $table->dropColumn('ExternalRegistrationFeedType'); - $table->dropColumn('ExternalRegistrationFeedApiKey'); - }); - } - - if ($builder->hasTable("SummitOrder") && $builder->hasColumn("SummitOrder", "ExternalId")) { - $builder->table("SummitOrder", function (Table $table) { - $table->dropColumn('ExternalId'); - }); - } - - if ($builder->hasTable("SummitRegistrationPromoCode") && $builder->hasColumn("SummitRegistrationPromoCode", "ExternalId")) { - $builder->table("SummitRegistrationPromoCode", function (Table $table) { - $table->dropColumn('ExternalId'); - }); - } - - if ($builder->hasTable("SummitAttendee") && $builder->hasColumn("SummitAttendee", "ExternalId")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->dropColumn('ExternalId'); - }); - } - } -} diff --git a/database/migrations/model/Version20191125210134.php b/database/migrations/model/Version20191125210134.php deleted file mode 100644 index 0bcbf696..00000000 --- a/database/migrations/model/Version20191125210134.php +++ /dev/null @@ -1,70 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - - $sql = <<addSql($sql); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20191202223721.php b/database/migrations/model/Version20191202223721.php deleted file mode 100644 index b67ba09b..00000000 --- a/database/migrations/model/Version20191202223721.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("SummitAttendee") && !$builder->hasColumn("SummitAttendee", "Company")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->string("Company", 255)->setNotnull(false); - $table->index("Company", "Company"); - $table->integer("CompanyID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("CompanyID", "CompanyID"); - $table->foreign("Company", "CompanyID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20191206163423.php b/database/migrations/model/Version20191206163423.php deleted file mode 100644 index b2ba1bc2..00000000 --- a/database/migrations/model/Version20191206163423.php +++ /dev/null @@ -1,58 +0,0 @@ -hasTable("SummitBadgeType_BadgeFeatures")) { - $builder->create("SummitBadgeType_BadgeFeatures", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitBadgeTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitBadgeTypeID", "SummitBadgeTypeID"); - - $table->integer("SummitBadgeFeatureTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitBadgeFeatureTypeID", "SummitBadgeFeatureTypeID"); - - $table->unique(['SummitBadgeTypeID', 'SummitBadgeFeatureTypeID']); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if ($builder->hasTable("SummitBadgeType_BadgeFeatures")) { - $builder->drop("SummitBadgeType_BadgeFeatures"); - } - } -} diff --git a/database/migrations/model/Version20191212002736.php b/database/migrations/model/Version20191212002736.php deleted file mode 100644 index b39bdc4e..00000000 --- a/database/migrations/model/Version20191212002736.php +++ /dev/null @@ -1,52 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit", "BeginAllowBookingDate")) { - $builder->table('Summit', function (Table $table) { - $table->dateTime("BeginAllowBookingDate")->setNotnull(false); - $table->dateTime("EndAllowBookingDate")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("Summit") && $builder->hasColumn("Summit", "BeginAllowBookingDate")) { - $builder->table('Member', function (Table $table) { - $table->dropColumn("BeginAllowBookingDate"); - $table->dropColumn("EndAllowBookingDate"); - }); - } - } -} diff --git a/database/migrations/model/Version20191220223248.php b/database/migrations/model/Version20191220223248.php deleted file mode 100644 index bb9020f5..00000000 --- a/database/migrations/model/Version20191220223248.php +++ /dev/null @@ -1,52 +0,0 @@ -hasTable("SummitAttendee") && !$builder->hasColumn("SummitAttendee", "Status")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->string("Status", 255)->setNotnull(false)->setDefault(SummitAttendee::StatusIncomplete); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("SummitAttendee") && !$builder->hasColumn("SummitAttendee", "Status")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->dropColumn("Status"); - }); - } - } -} diff --git a/database/migrations/model/Version20191220223253.php b/database/migrations/model/Version20191220223253.php deleted file mode 100644 index abd81ad6..00000000 --- a/database/migrations/model/Version20191220223253.php +++ /dev/null @@ -1,48 +0,0 @@ -addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20191224021722.php b/database/migrations/model/Version20191224021722.php deleted file mode 100644 index 554713b2..00000000 --- a/database/migrations/model/Version20191224021722.php +++ /dev/null @@ -1,63 +0,0 @@ -hasTable("SummitAttendee") && !$builder->hasColumn("SummitAttendee", "LastReminderEmailSentDate")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->timestamp("LastReminderEmailSentDate")->setNotnull(false); - }); - } - - if ($builder->hasTable("SummitOrder") && !$builder->hasColumn("SummitOrder", "LastReminderEmailSentDate")) { - $builder->table("SummitOrder", function (Table $table) { - $table->timestamp("LastReminderEmailSentDate")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("SummitAttendee") && $builder->hasColumn("SummitAttendee", "LastReminderEmailSentDate")) { - $builder->table("SummitAttendee", function (Table $table) { - $table->dropColumn("LastReminderEmailSentDate"); - }); - } - - if ($builder->hasTable("SummitOrder") && $builder->hasColumn("SummitOrder", "LastReminderEmailSentDate")) { - $builder->table("SummitOrder", function (Table $table) { - $table->dropColumn("LastReminderEmailSentDate"); - }); - } - } -} diff --git a/database/migrations/model/Version20191224022307.php b/database/migrations/model/Version20191224022307.php deleted file mode 100644 index d3ebdf20..00000000 --- a/database/migrations/model/Version20191224022307.php +++ /dev/null @@ -1,53 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit", "RegistrationReminderEmailsDaysInterval")) { - $builder->table("Summit", function (Table $table) { - $table->integer("RegistrationReminderEmailsDaysInterval")->setNotnull(false); - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - $builder = new Builder($schema); - - if ($builder->hasTable("Summit") && $builder->hasColumn("Summit", "RegistrationReminderEmailsDaysInterval")) { - $builder->table("Summit", function (Table $table) { - $table->dropColumn("RegistrationReminderEmailsDaysInterval"); - }); - } - } -} diff --git a/database/migrations/model/Version20191229173636.php b/database/migrations/model/Version20191229173636.php deleted file mode 100644 index b82e85d9..00000000 --- a/database/migrations/model/Version20191229173636.php +++ /dev/null @@ -1,58 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $sql = <<addSql($sql); - $sql = <<addSql($sql); - } -} diff --git a/database/migrations/model/Version20200109171923.php b/database/migrations/model/Version20200109171923.php deleted file mode 100644 index c9195cb5..00000000 --- a/database/migrations/model/Version20200109171923.php +++ /dev/null @@ -1,52 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit", "RegistrationSlugPrefix")) { - $builder->table("Summit", function (Table $table) { - $table->string("RegistrationSlugPrefix")->setNotnull(false)->setDefault(null); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("Summit") && $builder->hasColumn("Summit", "RegistrationSlugPrefix")) { - $builder->table("Summit", function (Table $table) { - $table->dropColumn("RegistrationSlugPrefix"); - }); - } - } -} diff --git a/database/migrations/model/Version20200110184019.php b/database/migrations/model/Version20200110184019.php deleted file mode 100644 index 0888f7bb..00000000 --- a/database/migrations/model/Version20200110184019.php +++ /dev/null @@ -1,55 +0,0 @@ -hasTable("SummitAttendeeTicketFormerHash")) { - $builder->create("SummitAttendeeTicketFormerHash", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string("Hash", 255)->setNotnull(false); - $table->unique("Hash", "Hash"); - $table->integer("SummitAttendeeTicketID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitAttendeeTicketID", "SummitAttendeeTicketID"); - $table->foreign("SummitAttendeeTicket", "SummitAttendeeTicketID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists("SummitAttendeeTicketFormerHash"); - } -} diff --git a/database/migrations/model/Version20200123133515.php b/database/migrations/model/Version20200123133515.php deleted file mode 100644 index 7ea1bac5..00000000 --- a/database/migrations/model/Version20200123133515.php +++ /dev/null @@ -1,100 +0,0 @@ -hasTable("SummitAttendeeBadge") && $builder->hasColumn("SummitAttendeeBadge", "PrintedTimes")) { - $builder->table("SummitAttendeeBadge", function (Table $table) { - $table->dropColumn("PrintedTimes"); - $table->dropColumn("PrintDate"); - }); - } - - if (!$builder->hasTable("SummitAttendeeBadgePrint")) { - $builder->create("SummitAttendeeBadgePrint", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->timestamp('PrintDate')->setNotnull(false); - - $table->integer("BadgeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("BadgeID", "BadgeID"); - $table->foreign("SummitAttendeeBadge", "BadgeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("RequestorID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("RequestorID", "RequestorID"); - $table->foreign("Member", "RequestorID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - if (!$builder->hasTable("SummitAttendeeBadgePrintRule")) { - $builder->create("SummitAttendeeBadgePrintRule", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - - $table->integer('MaxPrintTimes',false, false)->setNotnull(true)->setDefault(0); - - $table->integer("GroupID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("GroupID", "GroupID"); - $table->foreign("Group", "GroupID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if ($builder->hasTable("SummitAttendeeBadge") && !$builder->hasColumn("SummitAttendeeBadge", "PrintedTimes")) { - $builder->table("SummitAttendeeBadge", function (Table $table) { - $table->timestamp('PrintDate')->setNotnull(false); - $table->integer("PrintedTimes")->setNotnull(false)->setDefault(0); - }); - } - - $builder->dropIfExists("SummitAttendeeBadgePrint"); - - $builder->dropIfExists("SummitAttendeeBadgePrintRule"); - } -} diff --git a/database/migrations/model/Version20200128184149.php b/database/migrations/model/Version20200128184149.php deleted file mode 100644 index ff34fbe4..00000000 --- a/database/migrations/model/Version20200128184149.php +++ /dev/null @@ -1,88 +0,0 @@ -hasTable("PaymentGatewayProfile")) { - $builder->create("PaymentGatewayProfile", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - $table->string('ApplicationType'); - $table->string('Provider'); - $table->boolean("IsActive"); - - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - if (!$builder->hasTable("StripePaymentProfile")) { - $builder->create("StripePaymentProfile", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->foreign("PaymentGatewayProfile", "ID", "ID", ["onDelete" => "CASCADE"]); - - $table->boolean("IsTestModeEnabled")->setDefault(false); - - /** - * Stripe isn’t exclusively in test or live mode at any given point in time. - * Instead, Stripe stores test and live transactions and other data completely separate from each other. - */ - - $table->text("LiveSecretKey")->setDefault('NULL')->setNotnull(false); - $table->text("LivePublishableKey")->setDefault('NULL')->setNotnull(false); - $table->text("LiveWebHookSecretKey")->setDefault('NULL')->setNotnull(false); - $table->text("LiveWebHookId")->setDefault('NULL')->setNotnull(false); - - $table->text("TestSecretKey")->setDefault('NULL')->setNotnull(false); - $table->text("TestPublishableKey")->setDefault('NULL')->setNotnull(false); - $table->text("TestWebHookSecretKey")->setDefault('NULL')->setNotnull(false); - $table->text("TestWebHookId")->setDefault('NULL')->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists("StripePaymentProfile"); - - $builder->dropIfExists("PaymentGatewayProfile"); - } -} diff --git a/database/migrations/model/Version20200128191140.php b/database/migrations/model/Version20200128191140.php deleted file mode 100644 index 77e6c59c..00000000 --- a/database/migrations/model/Version20200128191140.php +++ /dev/null @@ -1,73 +0,0 @@ -addSql($sql); - - // make enum - $sql = <<addSql($sql); - - // make enum - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200212023535.php b/database/migrations/model/Version20200212023535.php deleted file mode 100644 index 90bc137f..00000000 --- a/database/migrations/model/Version20200212023535.php +++ /dev/null @@ -1,49 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200212125943.php b/database/migrations/model/Version20200212125943.php deleted file mode 100644 index cd772102..00000000 --- a/database/migrations/model/Version20200212125943.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("RSVP") && !$builder->hasColumn("RSVP", "EventUri")) { - $builder->table('RSVP', function (Table $table) { - $table->string("EventUri")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("RSVP") && $builder->hasColumn("RSVP", "EventUri")) { - $builder->table('RSVP', function (Table $table) { - $table->dropColumn("EventUri"); - }); - } - } -} diff --git a/database/migrations/model/Version20200213131907.php b/database/migrations/model/Version20200213131907.php deleted file mode 100644 index 7103d7d5..00000000 --- a/database/migrations/model/Version20200213131907.php +++ /dev/null @@ -1,89 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit", "ScheduleEventDetailUrl")) { - $builder->table('Summit', function (Table $table) { - $table->text("ScheduleDefaultPageUrl")->setNotnull(false); - $table->text("ScheduleDefaultEventDetailUrl")->setNotnull(false); - // og tags - $table->text("ScheduleOGSiteName")->setNotnull(false); - $table->text("ScheduleOGImageUrl")->setNotnull(false); - $table->text("ScheduleOGImageSecureUrl")->setNotnull(false); - $table->integer("ScheduleOGImageWidth")->setNotnull(true)->setDefault(0); - $table->integer("ScheduleOGImageHeight")->setNotnull(true)->setDefault(0); - // face book app - $table->text("ScheduleFacebookAppId")->setNotnull(false); - // ios app - $table->text("ScheduleIOSAppName")->setNotnull(false); - $table->text("ScheduleIOSAppStoreId")->setNotnull(false); - $table->text("ScheduleIOSAppCustomSchema")->setNotnull(false); - // android app - $table->text("ScheduleAndroidAppName")->setNotnull(false); - $table->text("ScheduleAndroidAppPackage")->setNotnull(false); - $table->text("ScheduleAndroidAppCustomSchema")->setNotnull(false); - // twitter app - $table->text("ScheduleTwitterAppName")->setNotnull(false); - $table->text("ScheduleTwitterText")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("Summit") && $builder->hasColumn("Summit", "ScheduleEventDetailUrl")) { - $builder->table('Summit', function (Table $table) { - $table->dropColumn("ScheduleDefaultPageUrl"); - $table->dropColumn("ScheduleDefaultEventDetailUrl"); - // og tags - $table->dropColumn("ScheduleOGSiteName"); - $table->dropColumn("ScheduleOGImageUrl"); - $table->dropColumn("ScheduleOGImageSecureUrl"); - $table->dropColumn("ScheduleOGImageWidth"); - $table->dropColumn("ScheduleOGImageHeight"); - // face book app - $table->dropColumn("ScheduleFacebookAppId"); - // ios app - $table->dropColumn("ScheduleIOSAppName"); - $table->dropColumn("ScheduleIOSAppStoreId"); - $table->dropColumn("ScheduleIOSAppCustomSchema"); - // android app - $table->dropColumn("ScheduleAndroidAppName"); - $table->dropColumn("ScheduleAndroidAppPackage"); - $table->dropColumn("ScheduleAndroidAppCustomSchema"); - // twitter app - $table->dropColumn("ScheduleTwitterAppName"); - $table->dropColumn("ScheduleTwitterText"); - }); - } - } -} diff --git a/database/migrations/model/Version20200403191418.php b/database/migrations/model/Version20200403191418.php deleted file mode 100644 index 977e4d14..00000000 --- a/database/migrations/model/Version20200403191418.php +++ /dev/null @@ -1,42 +0,0 @@ -addSql($sentence); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200512132942.php b/database/migrations/model/Version20200512132942.php deleted file mode 100644 index 003e4ad1..00000000 --- a/database/migrations/model/Version20200512132942.php +++ /dev/null @@ -1,90 +0,0 @@ -hasTable("SummitEmailFlowType")) { - $builder->create("SummitEmailFlowType", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - $table->string('Name'); - - }); - - $builder->create("SummitEmailEventFlowType", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - $table->string('Slug'); - $table->string('Name'); - $table->string('DefaultEmailTemplateIdentifier'); - $table->integer("SummitEmailFlowTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitEmailFlowTypeID", "SummitEmailFlowTypeID"); - $table->foreign("SummitEmailFlowType", "SummitEmailFlowTypeID", "ID", ["onDelete" => "CASCADE"]); - }); - - $builder->create("SummitEmailEventFlow", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - $table->string('EmailTemplateIdentifier'); - $table->integer("SummitEmailEventFlowTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitEmailEventFlowTypeID", "SummitEmailEventFlowTypeID"); - $table->foreign("SummitEmailEventFlowType", "SummitEmailEventFlowTypeID", "ID", ["onDelete" => "CASCADE"]); - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists("SummitEmailEventFlow"); - - $builder->dropIfExists("SummitEmailEventFlowType"); - - $builder->dropIfExists("SummitEmailFlowType"); - } -} diff --git a/database/migrations/model/Version20200512174027.php b/database/migrations/model/Version20200512174027.php deleted file mode 100644 index e484168a..00000000 --- a/database/migrations/model/Version20200512174027.php +++ /dev/null @@ -1,54 +0,0 @@ -addSql($sentence); - - $sentence = <<addSql($sentence); - - $sentence = <<addSql($sentence); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200523235306.php b/database/migrations/model/Version20200523235306.php deleted file mode 100644 index 5991a785..00000000 --- a/database/migrations/model/Version20200523235306.php +++ /dev/null @@ -1,52 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit", "DefaultPageUrl")) { - $builder->table('Summit', function (Table $table) { - $table->text("DefaultPageUrl")->setNotnull(false); - $table->text("SpeakerConfirmationDefaultPageUrl")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - $builder = new Builder($schema); - if($schema->hasTable("Summit") && $builder->hasColumn("Summit", "DefaultPageUrl")) { - $builder->table('Summit', function (Table $table) { - $table->dropColumn("DefaultPageUrl"); - $table->dropColumn("SpeakerConfirmationDefaultPageUrl"); - }); - } - } -} diff --git a/database/migrations/model/Version20200526174904.php b/database/migrations/model/Version20200526174904.php deleted file mode 100644 index 0a6821bd..00000000 --- a/database/migrations/model/Version20200526174904.php +++ /dev/null @@ -1,78 +0,0 @@ -hasTable("SummitDocument")) { - $builder->create("SummitDocument", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - $table->string('Name'); - $table->string('Description'); - $table->string('Label'); - $table->integer("FileID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("FileID", "FileID"); - $table->foreign("File", "FileID", "ID", ["onDelete" => "CASCADE"]); - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - if (!$builder->hasTable("SummitDocument_EventTypes")) { - $builder->create("SummitDocument_EventTypes", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitDocumentID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitDocumentID", "SummitDocumentID"); - - $table->integer("SummitEventTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitEventTypeID", "SummitEventTypeID"); - - $table->unique(['SummitDocumentID', 'SummitEventTypeID']); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists("SummitDocument_EventTypes"); - - $builder->dropIfExists("SummitDocument"); - } -} diff --git a/database/migrations/model/Version20200601211446.php b/database/migrations/model/Version20200601211446.php deleted file mode 100644 index 2126dbea..00000000 --- a/database/migrations/model/Version20200601211446.php +++ /dev/null @@ -1,52 +0,0 @@ -hasTable("SummitEvent") && !$builder->hasColumn("SummitEvent", "StreamingUrl")) { - $builder->table('SummitEvent', function (Table $table) { - $table->text("StreamingUrl")->setNotnull(false); - $table->text("EtherpadLink")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("SummitEvent") && $builder->hasColumn("SummitEvent", "StreamingUrl")) { - $builder->table('SummitEvent', function (Table $table) { - $table->dropColumn("StreamingUrl"); - $table->dropColumn("EtherpadLink"); - }); - } - } -} diff --git a/database/migrations/model/Version20200602212951.php b/database/migrations/model/Version20200602212951.php deleted file mode 100644 index 6aef21cf..00000000 --- a/database/migrations/model/Version20200602212951.php +++ /dev/null @@ -1,80 +0,0 @@ -hasTable("SummitRegistrationInvitation")) { - - $builder->create("SummitRegistrationInvitation", function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - - $table->string("Hash", 255)->setNotnull(false); - $table->unique("Hash", "Hash"); - $table->timestamp("AcceptedDate")->setNotnull(false); - $table->string('Email')->setLength(255)->setNotnull(true); - $table->string('FirstName')->setLength(100)->setNotnull(true); - $table->string('LastName')->setLength(100)->setNotnull(true); - $table->string('SetPasswordLink')->setLength(255)->setNotnull(false); - // FK - - $table->integer("MemberID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("MemberID", "MemberID"); - $table->foreign("Member", "MemberID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitOrderID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitOrderID", "SummitOrderID"); - $table->foreign("SummitOrder", "SummitOrderID", "ID", ["onDelete" => "CASCADE"]); - - // Index - - $table->unique(["Email", "SummitID"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists("SummitRegistrationInvitation"); - - } -} diff --git a/database/migrations/model/Version20200609105105.php b/database/migrations/model/Version20200609105105.php deleted file mode 100644 index 705f7372..00000000 --- a/database/migrations/model/Version20200609105105.php +++ /dev/null @@ -1,50 +0,0 @@ -hasTable("SummitEvent") && !$builder->hasColumn("SummitEvent", "MeetingUrl")) { - $builder->table('SummitEvent', function (Table $table) { - $table->text("MeetingUrl")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("SummitEvent") && $builder->hasColumn("SummitEvent", "MeetingUrl")) { - $builder->table('SummitEvent', function (Table $table) { - $table->dropColumn("MeetingUrl"); - }); - } - } -} diff --git a/database/migrations/model/Version20200616144713.php b/database/migrations/model/Version20200616144713.php deleted file mode 100644 index cc31f76e..00000000 --- a/database/migrations/model/Version20200616144713.php +++ /dev/null @@ -1,45 +0,0 @@ -addSql($sql); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200618192655.php b/database/migrations/model/Version20200618192655.php deleted file mode 100644 index 462955cb..00000000 --- a/database/migrations/model/Version20200618192655.php +++ /dev/null @@ -1,96 +0,0 @@ -hasTable("SummitAdministratorPermissionGroup")) { - $builder->create('SummitAdministratorPermissionGroup', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - $table->string('Title')->setNotnull(true); - $table->unique(['Title']); - }); - } - - if(!$schema->hasTable("SummitAdministratorPermissionGroup_Members")) { - $builder->create('SummitAdministratorPermissionGroup_Members', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - // FK - $table->integer("MemberID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("MemberID", "MemberID"); - //$table->foreign("Member", "MemberID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitAdministratorPermissionGroupID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitAdministratorPermissionGroupID", "SummitAdministratorPermissionGroupID"); - //$table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SummitAdministratorPermissionGroupID', 'MemberID']); - }); - } - - if(!$schema->hasTable("SummitAdministratorPermissionGroup_Summits")) { - $builder->create('SummitAdministratorPermissionGroup_Summits', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - // FK - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - //$table->foreign("Member", "MemberID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitAdministratorPermissionGroupID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitAdministratorPermissionGroupID", "SummitAdministratorPermissionGroupID"); - //$table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['SummitAdministratorPermissionGroupID', 'SummitID']); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - $builder = new Builder($schema); - $builder->dropIfExists("SummitAdministratorPermissionGroup_Members"); - $builder->dropIfExists("SummitAdministratorPermissionGroup_Summits"); - $builder->dropIfExists("SummitAdministratorPermissionGroup"); - } -} diff --git a/database/migrations/model/Version20200623191130.php b/database/migrations/model/Version20200623191130.php deleted file mode 100644 index f383d384..00000000 --- a/database/migrations/model/Version20200623191130.php +++ /dev/null @@ -1,44 +0,0 @@ -addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200623191331.php b/database/migrations/model/Version20200623191331.php deleted file mode 100644 index e076fc7f..00000000 --- a/database/migrations/model/Version20200623191331.php +++ /dev/null @@ -1,67 +0,0 @@ -hasTable("SummitEventAttendanceMetric")) { - $builder->create('SummitEventAttendanceMetric', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - - $table->timestamp('IngressDate')->setNotnull(false); - $table->timestamp('OutgressDate')->setNotnull(false); - // FK - - $table->integer("MemberID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("MemberID", "MemberID"); - $table->foreign("Member", "MemberID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitEventID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitEventID", "SummitEventID"); - $table->foreign("SummitEvent", "SummitEventID", "ID", ["onDelete" => "CASCADE"]); - - $table->index(['MemberID', 'SummitEventID' ]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists('SummitEventAttendanceMetric'); - } -} diff --git a/database/migrations/model/Version20200623191754.php b/database/migrations/model/Version20200623191754.php deleted file mode 100644 index c696b96a..00000000 --- a/database/migrations/model/Version20200623191754.php +++ /dev/null @@ -1,44 +0,0 @@ -addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200624132001.php b/database/migrations/model/Version20200624132001.php deleted file mode 100644 index 7eab433f..00000000 --- a/database/migrations/model/Version20200624132001.php +++ /dev/null @@ -1,54 +0,0 @@ -hasTable("Group") && !$builder->hasColumn("Group", "IsExternal")) { - $builder->table('Group', function (Table $table) { - $table->boolean('IsExternal')->setDefault(false); - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - $builder = new Builder($schema); - - if($schema->hasTable("Group") && $builder->hasColumn("Group", "IsExternal")) { - $builder->table('Group', function (Table $table) { - $table->dropColumn("IsExternal"); - }); - } - } -} diff --git a/database/migrations/model/Version20200629142643.php b/database/migrations/model/Version20200629142643.php deleted file mode 100644 index 0205541d..00000000 --- a/database/migrations/model/Version20200629142643.php +++ /dev/null @@ -1,57 +0,0 @@ -hasTable("PresentationSpeaker") && !$builder->hasColumn("PresentationSpeaker", "BigPhotoID")) { - $builder->table('PresentationSpeaker', function (Table $table) { - - $table->integer("BigPhotoID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("BigPhotoID", "BigPhotoID"); - $table->foreign("File", "BigPhotoID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if($schema->hasTable("PresentationSpeaker") && $builder->hasColumn("PresentationSpeaker", "BigPhotoID")) { - $builder->table('PresentationSpeaker', function (Table $table) { - $table->dropColumn("BigPhotoID"); - }); - } - } -} diff --git a/database/migrations/model/Version20200629143447.php b/database/migrations/model/Version20200629143447.php deleted file mode 100644 index 23537b0d..00000000 --- a/database/migrations/model/Version20200629143447.php +++ /dev/null @@ -1,57 +0,0 @@ -hasTable("SummitEvent") && !$builder->hasColumn("SummitEvent", "ImageID")) { - $builder->table('SummitEvent', function (Table $table) { - - $table->integer("ImageID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("ImageID", "ImageID"); - $table->foreign("File", "ImageID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if($schema->hasTable("SummitEvent") && $builder->hasColumn("SummitEvent", "ImageID")) { - $builder->table('SummitEvent', function (Table $table) { - $table->dropColumn("ImageID"); - }); - } - } -} diff --git a/database/migrations/model/Version20200713164340.php b/database/migrations/model/Version20200713164340.php deleted file mode 100644 index f2f00bd6..00000000 --- a/database/migrations/model/Version20200713164340.php +++ /dev/null @@ -1,128 +0,0 @@ -hasTable("SummitMediaFileType")) { - $builder->create('SummitMediaFileType', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - - $table->string('Name'); - $table->string('Description')->setNotnull(false); - $table->boolean("IsSystemDefine"); - $table->string('AllowedExtensions'); - - $table->unique(['Name']); - }); - } - - if(!$schema->hasTable("SummitMediaUploadType")) { - $builder->create('SummitMediaUploadType', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - - $table->string('Name'); - $table->string('Description')->setNotnull(false); - $table->integer("MaxSize")->setDefault(1024); - $table->boolean("IsMandatory")->setDefault(false); - $table->string('PrivateStorageType'); - $table->string('PublicStorageType'); - - // FK - - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("TypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("TypeID", "TypeID"); - $table->foreign("SummitMediaFileType", "TypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->index(['SummitID']); - $table->index(['TypeID']); - $table->unique(['SummitID', 'Name']); - }); - } - - if(!$schema->hasTable("PresentationType_SummitMediaUploadType")) { - $builder->create('PresentationType_SummitMediaUploadType', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("PresentationTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("PresentationTypeID", "PresentationTypeID"); - //$table->foreign("PresentationType", "PresentationTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("SummitMediaUploadTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitMediaUploadTypeID", "SummitMediaUploadTypeID"); - //$table->foreign("SummitMediaUploadType", "SummitMediaUploadTypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(['PresentationTypeID', 'SummitMediaUploadTypeID']); - }); - } - - if(!$schema->hasTable("PresentationMediaUpload")) { - $builder->create('PresentationMediaUpload', function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - $table->string('FileName'); - - $table->integer("SummitMediaUploadTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitMediaUploadTypeID", "SummitMediaUploadTypeID"); - $table->foreign("SummitMediaUploadType", "SummitMediaUploadTypeID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - $builder->dropIfExists('PresentationMediaUpload'); - $builder->dropIfExists('PresentationType_SummitMediaUploadType'); - $builder->dropIfExists('SummitMediaUploadType'); - $builder->dropIfExists('SummitMediaFileType'); - } -} diff --git a/database/migrations/model/Version20200713164344.php b/database/migrations/model/Version20200713164344.php deleted file mode 100644 index 9215d356..00000000 --- a/database/migrations/model/Version20200713164344.php +++ /dev/null @@ -1,80 +0,0 @@ -addSql($sql); - - // make enum - $sql = <<addSql($sql); - - // make enum - $sql = <<addSql($sql); - - // make enum - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - } -} diff --git a/database/migrations/model/Version20200730135823.php b/database/migrations/model/Version20200730135823.php deleted file mode 100644 index 96e1fca2..00000000 --- a/database/migrations/model/Version20200730135823.php +++ /dev/null @@ -1,54 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit", "VirtualSiteUrl")) { - $builder->table('Summit', function (Table $table) { - $table->string("VirtualSiteUrl")->setNotnull(false); - $table->string("MarketingSiteUrl")->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if($schema->hasTable("Summit") && $builder->hasColumn("Summit", "VirtualSiteUrl")) { - $builder->table('Summit', function (Table $table) { - $table->dropColumn("VirtualSiteUrl"); - $table->dropColumn("MarketingSiteUrl"); - }); - } - } -} diff --git a/database/migrations/model/Version20200803171455.php b/database/migrations/model/Version20200803171455.php deleted file mode 100644 index 7e3a91da..00000000 --- a/database/migrations/model/Version20200803171455.php +++ /dev/null @@ -1,46 +0,0 @@ -hasTable("SummitEvent") && !$builder->hasColumn("SummitEvent",'Title')) { - $builder->table('SummitEvent', function (Table $table) { - $table->text("Title")->setNotnull(true)->setLength(255); - $table->index(['Title', 'SummitID']); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200817180752.php b/database/migrations/model/Version20200817180752.php deleted file mode 100644 index a082be91..00000000 --- a/database/migrations/model/Version20200817180752.php +++ /dev/null @@ -1,56 +0,0 @@ -sm->listTableIndexes("Member"); - if(array_key_exists("ExternalUserId", $indexes)) - $this->sm->dropIndex("ExternalUserId", "Member"); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200818120409.php b/database/migrations/model/Version20200818120409.php deleted file mode 100644 index 5ae7036d..00000000 --- a/database/migrations/model/Version20200818120409.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("PresentationSpeaker") && !$builder->hasColumn("PresentationSpeaker",'Company')) { - $builder->table('PresentationSpeaker', function (Table $table) { - $table->text("Company")->setNotnull(false)->setLength(255); - $table->text("PhoneNumber")->setNotnull(false)->setLength(255); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($builder->hasTable("PresentationSpeaker") && $builder->hasColumn("PresentationSpeaker",'Company')) { - $builder->table('PresentationSpeaker', function (Table $table) { - $table->dropColumn("Company"); - $table->dropColumn("PhoneNumber"); - }); - } - } -} diff --git a/database/migrations/model/Version20200824140528.php b/database/migrations/model/Version20200824140528.php deleted file mode 100644 index e2fd2248..00000000 --- a/database/migrations/model/Version20200824140528.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("Member") && !$builder->hasColumn("Member","ExternalPic") ) { - $builder->table('Member', function (Table $table) { - $table->string('ExternalPic')->setNotnull(false)->setLength(512); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("Member") && $builder->hasColumn("Member","ExternalPic") ) { - $builder->table('Member', function (Table $table) { - $table->dropColumn('ExternalPic'); - }); - } - } -} diff --git a/database/migrations/model/Version20200831193516.php b/database/migrations/model/Version20200831193516.php deleted file mode 100644 index 2e158290..00000000 --- a/database/migrations/model/Version20200831193516.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit","MarketingSiteOAuth2ClientId") ) { - $builder->table('Summit', function (Table $table) { - $table->string('MarketingSiteOAuth2ClientId')->setNotnull(false)->setLength(255); - $table->string('VirtualSiteOAuth2ClientId')->setNotnull(false)->setLength(255); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("Summit") && $builder->hasColumn("Summit","MarketingSiteOAuth2ClientId") ) { - $builder->table('Summit', function (Table $table) { - $table->dropColumn('MarketingSiteOAuth2ClientId'); - $table->dropColumn('VirtualSiteOAuth2ClientId'); - }); - } - } -} diff --git a/database/migrations/model/Version20200901160152.php b/database/migrations/model/Version20200901160152.php deleted file mode 100644 index f5e8db33..00000000 --- a/database/migrations/model/Version20200901160152.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("Summit") && !$builder->hasColumn("Summit","SupportEmail") ) { - $builder->table('Summit', function (Table $table) { - $table->string('SupportEmail')->setNotnull(false)->setLength(255); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("Summit") && $builder->hasColumn("Summit","SupportEmail") ) { - $builder->table('Summit', function (Table $table) { - $table->dropColumn('SupportEmail'); - }); - } - } -} diff --git a/database/migrations/model/Version20200904155247.php b/database/migrations/model/Version20200904155247.php deleted file mode 100644 index 7c4416be..00000000 --- a/database/migrations/model/Version20200904155247.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("PresentationCategory") && !$builder->hasColumn("PresentationCategory","Color") ) { - $builder->table('PresentationCategory', function (Table $table) { - $table->string('Color')->setNotnull(false)->setLength(50); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("PresentationCategory") && $builder->hasColumn("PresentationCategory","Color") ) { - $builder->table('PresentationCategory', function (Table $table) { - $table->dropColumn('Color'); - }); - } - } -} diff --git a/database/migrations/model/Version20200910184756.php b/database/migrations/model/Version20200910184756.php deleted file mode 100644 index 691c1a2a..00000000 --- a/database/migrations/model/Version20200910184756.php +++ /dev/null @@ -1,45 +0,0 @@ -addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $sql = <<addSql($sql); - - } -} diff --git a/database/migrations/model/Version20200924123949.php b/database/migrations/model/Version20200924123949.php deleted file mode 100644 index 6b079c7c..00000000 --- a/database/migrations/model/Version20200924123949.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("StripePaymentProfile") && !$builder->hasColumn("StripePaymentProfile","SendEmailReceipt") ) { - $builder->table('StripePaymentProfile', function (Table $table) { - $table->boolean('SendEmailReceipt')->setNotnull(true)->setDefault(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("StripePaymentProfile") && $builder->hasColumn("StripePaymentProfile","SendEmailReceipt") ) { - $builder->table('StripePaymentProfile', function (Table $table) { - $table->dropColumn('SendEmailReceipt'); - }); - } - } -} diff --git a/database/migrations/model/Version20200924203451.php b/database/migrations/model/Version20200924203451.php deleted file mode 100644 index be38da11..00000000 --- a/database/migrations/model/Version20200924203451.php +++ /dev/null @@ -1,66 +0,0 @@ -getRepository(SummitEmailFlowType::class); - $flow = $repository->findOneBy([ - "name" => "Presentation Submissions" - ]); - - SummitEmailFlowTypeSeeder::createEventsTypes( - [ - [ - 'name' => ImportEventSpeakerEmail::EVENT_NAME, - 'slug' => ImportEventSpeakerEmail::EVENT_SLUG, - 'default_email_template' => ImportEventSpeakerEmail::DEFAULT_TEMPLATE - ] - ], - $flow - ); - - $em->persist($flow); - $em->flush(); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200924210244.php b/database/migrations/model/Version20200924210244.php deleted file mode 100644 index c6976adf..00000000 --- a/database/migrations/model/Version20200924210244.php +++ /dev/null @@ -1,47 +0,0 @@ -getRepository(Summit::class); - $summits = $repository->findAll(); - foreach($summits as $summit){ - $summit->seedDefaultEmailFlowEvents(); - $em->persist($summit); - } - $em->flush(); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20200928132323.php b/database/migrations/model/Version20200928132323.php deleted file mode 100644 index 741926cb..00000000 --- a/database/migrations/model/Version20200928132323.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("PresentationMediaUpload") && !$builder->hasColumn("PresentationMediaUpload","LegacyPathFormat") ) { - $builder->table('PresentationMediaUpload', function (Table $table) { - $table->boolean('LegacyPathFormat')->setDefault(true)->setNotnull(true); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("PresentationMediaUpload") && $builder->hasColumn("PresentationMediaUpload","LegacyPathFormat") ) { - $builder->table('PresentationMediaUpload', function (Table $table) { - $table->dropColumn('LegacyPathFormat'); - }); - } - } -} diff --git a/database/migrations/model/Version20201001182314.php b/database/migrations/model/Version20201001182314.php deleted file mode 100644 index 03325be5..00000000 --- a/database/migrations/model/Version20201001182314.php +++ /dev/null @@ -1,58 +0,0 @@ -hasTable("Summit_FeaturedSpeakers")) { - - $builder->create("Summit_FeaturedSpeakers", function (Table $table) { - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - //$table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("PresentationSpeakerID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("PresentationSpeakerID", "PresentationSpeakerID"); - //$table->foreign("PresentationSpeaker", "PresentationSpeakerID", "ID", ["onDelete" => "CASCADE"]); - $table->unique(['SummitID', 'PresentationSpeakerID']); - }); - } - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - $builder->dropIfExists("Summit_FeaturedSpeakers"); - } -} diff --git a/database/migrations/model/Version20201008203936.php b/database/migrations/model/Version20201008203936.php deleted file mode 100644 index f2e922ed..00000000 --- a/database/migrations/model/Version20201008203936.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("SummitEvent") && !$builder->hasColumn("SummitEvent","MuxPlaybackID") ) { - $builder->table('SummitEvent', function (Table $table) { - $table->text('MuxPlaybackID')->setDefault(null)->setNotnull(false); - $table->text('MuxAssetID')->setDefault(null)->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("SummitEvent") && $builder->hasColumn("SummitEvent","MuxPlaybackID") ) { - $builder->table('SummitEvent', function (Table $table) { - $table->dropColumn('MuxPlaybackID'); - $table->dropColumn('MuxAssetID'); - }); - } - } -} diff --git a/database/migrations/model/Version20201014155708.php b/database/migrations/model/Version20201014155708.php deleted file mode 100644 index 03525c04..00000000 --- a/database/migrations/model/Version20201014155708.php +++ /dev/null @@ -1,81 +0,0 @@ -hasTable("SummitMetric")) { - $builder->create('SummitMetric', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - $table->string('Type')->setNotnull(true)->setDefault('GENERAL'); - $table->string('Ip')->setNotnull(false); - $table->string('Origin')->setNotnull(false); - $table->string('Browser')->setNotnull(false); - - $table->timestamp('IngressDate')->setNotnull(false); - $table->timestamp('OutgressDate')->setNotnull(false); - // FK - $table->integer("MemberID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("MemberID", "MemberID"); - $table->foreign("Member", "MemberID", "ID", ["onDelete" => "CASCADE"]); - - // FK - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - }); - } - - if(!$schema->hasTable("SummitSponsorMetric")) { - $builder->create('SummitSponsorMetric', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - $table->string('ClassName'); - - // FK - $table->integer("SponsorID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SponsorID", "SponsorID"); - $table->foreign("Sponsor", "SponsorID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201014155719.php b/database/migrations/model/Version20201014155719.php deleted file mode 100644 index daa766a8..00000000 --- a/database/migrations/model/Version20201014155719.php +++ /dev/null @@ -1,53 +0,0 @@ -addSql($sql); - - // make enum - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201014161727.php b/database/migrations/model/Version20201014161727.php deleted file mode 100644 index c2a15011..00000000 --- a/database/migrations/model/Version20201014161727.php +++ /dev/null @@ -1,89 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - - $sql = <<addSql($sql); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201015153512.php b/database/migrations/model/Version20201015153512.php deleted file mode 100644 index 302bc2d1..00000000 --- a/database/migrations/model/Version20201015153512.php +++ /dev/null @@ -1,61 +0,0 @@ -hasTable("SponsorUserInfoGrant")) { - $builder->create('SponsorUserInfoGrant', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - - // FK - $table->integer("AllowedUserID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("AllowedUserID", "AllowedUserID"); - $table->foreign("Member", "AllowedUserID", "ID", ["onDelete" => "CASCADE"]); - - // FK - $table->integer("SponsorID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SponsorID", "SponsorID"); - $table->foreign("Sponsor", "SponsorID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201015153514.php b/database/migrations/model/Version20201015153514.php deleted file mode 100644 index c80fbfb6..00000000 --- a/database/migrations/model/Version20201015153514.php +++ /dev/null @@ -1,44 +0,0 @@ -addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201015153516.php b/database/migrations/model/Version20201015153516.php deleted file mode 100644 index 6af0ba84..00000000 --- a/database/migrations/model/Version20201015153516.php +++ /dev/null @@ -1,72 +0,0 @@ -addSql($sql); - - // update PK - $sql = <<addSql($sql); - - // FK inheritance - $sql = <<addSql($sql); - - // DROP IDX - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201016145706.php b/database/migrations/model/Version20201016145706.php deleted file mode 100644 index 176fe3ad..00000000 --- a/database/migrations/model/Version20201016145706.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("SummitMetric") && !$builder->hasColumn("SummitMetric","Location") ) { - $builder->table('SummitMetric', function (Table $table) { - $table->text('Location')->setDefault(null)->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("SummitMetric") && $builder->hasColumn("SummitMetric","Location") ) { - $builder->table('SummitMetric', function (Table $table) { - $table->dropColumn('Location'); - }); - } - } -} diff --git a/database/migrations/model/Version20201018045210.php b/database/migrations/model/Version20201018045210.php deleted file mode 100644 index 25f67b2c..00000000 --- a/database/migrations/model/Version20201018045210.php +++ /dev/null @@ -1,51 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201021125624.php b/database/migrations/model/Version20201021125624.php deleted file mode 100644 index 46e2acda..00000000 --- a/database/migrations/model/Version20201021125624.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("SelectionPlan") && !$builder->hasColumn("SelectionPlan","AllowNewPresentations") ) { - $builder->table('SelectionPlan', function (Table $table) { - $table->boolean('AllowNewPresentations')->setNotnull(true)->setDefault(true); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - if($schema->hasTable("SelectionPlan") && $builder->hasColumn("SelectionPlan","AllowNewPresentations") ) { - $builder->table('SelectionPlan', function (Table $table) { - $table->dropColumn('AllowNewPresentations'); - }); - } - } -} diff --git a/database/migrations/model/Version20201021172434.php b/database/migrations/model/Version20201021172434.php deleted file mode 100644 index d57186a3..00000000 --- a/database/migrations/model/Version20201021172434.php +++ /dev/null @@ -1,50 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201022181641.php b/database/migrations/model/Version20201022181641.php deleted file mode 100644 index c4ce478b..00000000 --- a/database/migrations/model/Version20201022181641.php +++ /dev/null @@ -1,55 +0,0 @@ -hasTable("PresentationCategory") && !$builder->hasColumn("PresentationCategory", "IconID")) { - $builder->table('PresentationCategory', function (Table $table) { - - $table->integer("IconID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("IconID", "IconID"); - $table->foreign("File", "IconID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if($schema->hasTable("PresentationCategory") && $builder->hasColumn("PresentationCategory", "IconID")) { - $builder->table('PresentationCategory', function (Table $table) { - $table->dropColumn("IconID"); - }); - } - } -} diff --git a/database/migrations/model/Version20201027024056.php b/database/migrations/model/Version20201027024056.php deleted file mode 100644 index f9e13e7a..00000000 --- a/database/migrations/model/Version20201027024056.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("SummitAttendee") && !$builder->hasColumn("SummitAttendee", "AdminNotes")) { - $builder->table('SummitAttendee', function (Table $table) { - $table->string("AdminNotes", 1024)->setNotnull(false)->setDefault(null); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - if($schema->hasTable("SummitAttendee") && $builder->hasColumn("SummitAttendee", "AdminNotes")) { - $builder->table('SummitAttendee', function (Table $table) { - $table->dropColumn("AdminNotes"); - }); - } - } -} diff --git a/database/migrations/model/Version20201029175540.php b/database/migrations/model/Version20201029175540.php deleted file mode 100644 index 8bfbccdf..00000000 --- a/database/migrations/model/Version20201029175540.php +++ /dev/null @@ -1,60 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201116151153.php b/database/migrations/model/Version20201116151153.php deleted file mode 100644 index 32fe821b..00000000 --- a/database/migrations/model/Version20201116151153.php +++ /dev/null @@ -1,52 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201119155826.php b/database/migrations/model/Version20201119155826.php deleted file mode 100644 index 159ab8c5..00000000 --- a/database/migrations/model/Version20201119155826.php +++ /dev/null @@ -1,108 +0,0 @@ -hasTable("SponsoredProject")) { - $builder->create('SponsoredProject', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - - $table->string('Name')->setLength(255); - $table->string('Description')->setNotnull(false)->setLength(1024); - $table->string('Slug')->setLength(255); - $table->boolean('IsActive'); - $table->unique("Name"); - $table->unique("Slug"); - }); - } - - if(!$schema->hasTable("ProjectSponsorshipType")) { - $builder->create('ProjectSponsorshipType', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName'); - - $table->string('Name')->setLength(255); - $table->string('Description')->setNotnull(false)->setLength(1024); - $table->string('Slug')->setLength(255); - $table->integer('Order')->setDefault(1);; - $table->boolean('IsActive'); - // FK - $table->integer("SponsoredProjectID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SponsoredProjectID", "SponsoredProjectID"); - $table->foreign("SponsoredProject", "SponsoredProjectID", "ID", ["onDelete" => "CASCADE"]); - $table->unique(["Name", "SponsoredProjectID"]); - $table->unique(["Slug", "SponsoredProjectID"]); - }); - } - - if(!$schema->hasTable("SupportingCompany")) { - $builder->create('SupportingCompany', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->integer('Order')->setDefault(1); - - // FK - $table->integer("CompanyID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("CompanyID", "CompanyID"); - $table->foreign("Company", "CompanyID", "ID", ["onDelete" => "CASCADE"]); - - // FK - $table->integer("ProjectSponsorshipTypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("ProjectSponsorshipTypeID", "ProjectSponsorshipTypeID"); - $table->foreign("ProjectSponsorshipType", "ProjectSponsorshipTypeID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - $builder = new Builder($schema); - - $builder->dropIfExists("SupportingCompany"); - - $builder->dropIfExists("ProjectSponsorshipType"); - - $builder->dropIfExists("SponsoredProject"); - } -} diff --git a/database/migrations/model/Version20201120143925.php b/database/migrations/model/Version20201120143925.php deleted file mode 100644 index 3b64d029..00000000 --- a/database/migrations/model/Version20201120143925.php +++ /dev/null @@ -1,45 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20201208150500.php b/database/migrations/model/Version20201208150500.php deleted file mode 100644 index 80eac590..00000000 --- a/database/migrations/model/Version20201208150500.php +++ /dev/null @@ -1,65 +0,0 @@ -hasTable("SummitEvent") && !$builder->hasColumn("SummitEvent", "Level")) { - $builder->table('SummitEvent', function (Table $table) { - $table->string("Level", 255)->setNotnull(false)->setDefault('Beginner'); - }); - } - - if($schema->hasTable("SummitEventType") && !$builder->hasColumn("SummitEventType", "AllowsLevel")) { - $builder->table('SummitEventType', function (Table $table) { - $table->boolean("AllowsLevel")->setNotnull(true)->setDefault(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - $builder = new Builder($schema); - - if($schema->hasTable("SummitEvent") && $builder->hasColumn("SummitEvent", "Level")) { - $builder->table('SummitEvent', function (Table $table) { - $table->dropColumn("Level"); - }); - } - - if($schema->hasTable("SummitEventType") && $builder->hasColumn("SummitEventType", "AllowsLevel")) { - $builder->table('SummitEventType', function (Table $table) { - $table->dropColumn("AllowsLevel"); - }); - } - } -} diff --git a/database/migrations/model/Version20201208151735.php b/database/migrations/model/Version20201208151735.php deleted file mode 100644 index dae95ef3..00000000 --- a/database/migrations/model/Version20201208151735.php +++ /dev/null @@ -1,60 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20210203161916.php b/database/migrations/model/Version20210203161916.php deleted file mode 100644 index b0d84a93..00000000 --- a/database/migrations/model/Version20210203161916.php +++ /dev/null @@ -1,70 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); -*/ - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20210212151954.php b/database/migrations/model/Version20210212151954.php deleted file mode 100644 index 5fa0f1cc..00000000 --- a/database/migrations/model/Version20210212151954.php +++ /dev/null @@ -1,73 +0,0 @@ -setName("Presentation Selections"); - - SummitEmailFlowTypeSeeder::createEventsTypes([ - [ - 'name' => PresentationCategoryChangeRequestCreatedEmail::EVENT_NAME, - 'slug' => PresentationCategoryChangeRequestCreatedEmail::EVENT_SLUG, - 'default_email_template' => PresentationCategoryChangeRequestCreatedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationCategoryChangeRequestResolvedEmail::EVENT_NAME, - 'slug' => PresentationCategoryChangeRequestResolvedEmail::EVENT_SLUG, - 'default_email_template' => PresentationCategoryChangeRequestResolvedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => SpeakerEmail::EVENT_NAME, - 'slug' => SpeakerEmail::EVENT_SLUG, - 'default_email_template' => SpeakerEmail::DEFAULT_TEMPLATE - ], - ], $flow); - - $em->persist($flow); - $em->flush(); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20210212151956.php b/database/migrations/model/Version20210212151956.php deleted file mode 100644 index 5ceb8bf4..00000000 --- a/database/migrations/model/Version20210212151956.php +++ /dev/null @@ -1,47 +0,0 @@ -getRepository(Summit::class); - $summits = $repository->findAll(); - foreach($summits as $summit){ - $summit->seedDefaultEmailFlowEvents(); - $em->persist($summit); - } - $em->flush(); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20210322170708.php b/database/migrations/model/Version20210322170708.php deleted file mode 100644 index 447ab7fe..00000000 --- a/database/migrations/model/Version20210322170708.php +++ /dev/null @@ -1,42 +0,0 @@ -addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20210326171114.php b/database/migrations/model/Version20210326171114.php deleted file mode 100644 index 3eaf0432..00000000 --- a/database/migrations/model/Version20210326171114.php +++ /dev/null @@ -1,94 +0,0 @@ -hasTable("PresentationActionType")) { - $builder->create('PresentationActionType', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName')->setDefault("PresentationActionType"); - - $table->string('Label')->setNotnull(true)->setLength(255); - $table->integer('Order')->setDefault(1); - - // FK - $table->integer("SummitID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SummitID", "SummitID"); - $table->foreign("Summit", "SummitID", "ID", ["onDelete" => "CASCADE"]); - - $table->unique(["SummitID", "Label"]); - }); - } - - if(!$schema->hasTable("PresentationAction")) { - $builder->create('PresentationAction', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName')->setDefault("PresentationAction"); - - $table->boolean('IsCompleted')->setDefault(false); - - // FK - $table->integer("TypeID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("TypeID", "TypeID"); - $table->foreign("PresentationActionType", "TypeID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("PresentationID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("PresentationID", "PresentationID"); - $table->foreign("Presentation", "PresentationID", "ID", ["onDelete" => "CASCADE"]); - - $table->integer("CreatedByID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("CreatedByID", "CreatedByID"); - $table->foreign("Member", "CreatedByID", "ID", ["onDelete" => "SET NULL"]); - - $table->integer("UpdateByID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("UpdateByID", "UpdateByID"); - $table->foreign("Member", "UpdateByID", "ID", ["onDelete" => "SET NULL"]); - - $table->unique(["PresentationID", "TypeID"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20210326171117.php b/database/migrations/model/Version20210326171117.php deleted file mode 100644 index 97a90150..00000000 --- a/database/migrations/model/Version20210326171117.php +++ /dev/null @@ -1,52 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema) - { - - } -} diff --git a/database/migrations/model/Version20210405144636.php b/database/migrations/model/Version20210405144636.php deleted file mode 100644 index 8b2e5041..00000000 --- a/database/migrations/model/Version20210405144636.php +++ /dev/null @@ -1,60 +0,0 @@ -hasTable("SummitEvent")) { - $builder->table('SummitEvent', function (Table $table) { - - // FK - $table->integer("CreatedByID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("CreatedByID", "CreatedByID"); - $table->foreign("Member", "CreatedByID", "ID", ["onDelete" => "SET NULL"]); - - $table->integer("UpdatedByID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("UpdatedByID", "UpdatedByID"); - $table->foreign("Member", "UpdatedByID", "ID", ["onDelete" => "SET NULL"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - $builder = new Builder($schema); - if($schema->hasTable("SummitEvent")) { - $builder->table('SummitEvent', function (Table $table) { - // FK - $table->dropColumn("CreatedByID"); - $table->dropColumn("UpdatedByID"); - }); - } - } -} diff --git a/database/migrations/model/Version20210406124904.php b/database/migrations/model/Version20210406124904.php deleted file mode 100644 index 3e752aca..00000000 --- a/database/migrations/model/Version20210406124904.php +++ /dev/null @@ -1,50 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210406125358.php b/database/migrations/model/Version20210406125358.php deleted file mode 100644 index f925e172..00000000 --- a/database/migrations/model/Version20210406125358.php +++ /dev/null @@ -1,45 +0,0 @@ -hasTable("Presentation")) { - $builder->table('Presentation', function (Table $table) { - // FK - $table->dropColumn("CreatorID"); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210416191958.php b/database/migrations/model/Version20210416191958.php deleted file mode 100644 index a7813c1d..00000000 --- a/database/migrations/model/Version20210416191958.php +++ /dev/null @@ -1,47 +0,0 @@ -hasTable("SummitAbstractLocation")) { - $builder->table('SummitAbstractLocation', function (Table $table) { - $table->string("ShortName", 255)->setDefault(null)->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210419181056.php b/database/migrations/model/Version20210419181056.php deleted file mode 100644 index 0f589caa..00000000 --- a/database/migrations/model/Version20210419181056.php +++ /dev/null @@ -1,49 +0,0 @@ -hasTable("SummitDocument")) { - $builder->table('SummitDocument', function (Table $table) { - $table->boolean("ShowAlways")->setDefault(false)->setNotnull(true); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - $builder = new Builder($schema); - if($schema->hasTable("SummitDocument")) { - $builder->table('SummitDocument', function (Table $table) { - $table->dropColumn("ShowAlways"); - }); - } - } -} diff --git a/database/migrations/model/Version20210422150202.php b/database/migrations/model/Version20210422150202.php deleted file mode 100644 index 92fef9fe..00000000 --- a/database/migrations/model/Version20210422150202.php +++ /dev/null @@ -1,50 +0,0 @@ -hasTable("SummitAttendeeTicket")) { - $builder->table('SummitAttendeeTicket', function (Table $table) { - $table->boolean("IsActive")->setDefault(true)->setNotnull(true); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - $builder = new Builder($schema); - if($schema->hasTable("SummitAttendeeTicket")) { - $builder->table('SummitAttendeeTicket', function (Table $table) { - $table->dropColumn("IsActive"); - }); - } - } -} diff --git a/database/migrations/model/Version20210426223306.php b/database/migrations/model/Version20210426223306.php deleted file mode 100644 index ad257126..00000000 --- a/database/migrations/model/Version20210426223306.php +++ /dev/null @@ -1,48 +0,0 @@ -hasTable("PresentationTrackChairView")) { - $builder->table('PresentationTrackChairView', function (Table $table) { - // FK - $table->foreign("Member", "TrackChairID", "ID", ["onDelete" => "CASCADE"]); - $table->foreign("Presentation", "PresentationID", "ID", ["onDelete" => "CASCADE"]); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210429160901.php b/database/migrations/model/Version20210429160901.php deleted file mode 100644 index dcb1d5f4..00000000 --- a/database/migrations/model/Version20210429160901.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("Presentation")) { - $builder->table('Presentation', function (Table $table) { - $table->boolean("WillAllSpeakersAttend")->setDefault(false)->setNotnull(true); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - $builder = new Builder($schema); - - if($schema->hasTable("Presentation")) { - $builder->table('Presentation', function (Table $table) { - $table->dropColumn("WillAllSpeakersAttend"); - }); - } - } -} diff --git a/database/migrations/model/Version20210521135639.php b/database/migrations/model/Version20210521135639.php deleted file mode 100644 index ed919fcc..00000000 --- a/database/migrations/model/Version20210521135639.php +++ /dev/null @@ -1,134 +0,0 @@ -hasTable("ExtraQuestionType")) { - $builder->create('ExtraQuestionType', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName')->setNotnull(true); - - $table->string('Name')->setNotnull(true); - $table->string('Type')->setNotnull(true); - $table->string('Label')->setNotnull(true); - $table->integer('Order')->setNotnull(true)->setDefault(1); - $table->boolean('Mandatory')->setNotnull(true)->setDefault(false); - $table->string('Placeholder')->setNotnull(false)->setDefault(''); - }); - } - - if(!$schema->hasTable("SummitSelectionPlanExtraQuestionType")) { - $builder->create('SummitSelectionPlanExtraQuestionType', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - // FK - - $table->integer("SelectionPlanID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("SelectionPlanID", "SelectionPlanID"); - $table->foreign("SelectionPlan", "SelectionPlanID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - - if(!$schema->hasTable("ExtraQuestionTypeValue")) { - $builder->create('ExtraQuestionTypeValue', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName')->setNotnull(true); - - $table->string('Label')->setNotnull(true); - $table->string('Value')->setNotnull(true); - $table->integer('Order')->setNotnull(true)->setDefault(1); - - // FK - - $table->integer("QuestionID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("QuestionID", "QuestionID"); - $table->foreign("ExtraQuestionType", "QuestionID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - if(!$schema->hasTable("ExtraQuestionAnswer")) { - $builder->create('ExtraQuestionAnswer', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - $table->timestamp('Created'); - $table->timestamp('LastEdited'); - $table->string('ClassName')->setNotnull(true); - - $table->string('Value')->setNotnull(true); - - // FK - - $table->integer("QuestionID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("QuestionID", "QuestionID"); - $table->foreign("ExtraQuestionType", "QuestionID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - - if(!$schema->hasTable("PresentationExtraQuestionAnswer")) { - $builder->create('PresentationExtraQuestionAnswer', function (Table $table) { - - $table->integer("ID", true, false); - $table->primary("ID"); - - // FK - - $table->integer("PresentationID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("PresentationID", "PresentationID"); - $table->foreign("Presentation", "PresentationID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210521135642.php b/database/migrations/model/Version20210521135642.php deleted file mode 100644 index 5e781697..00000000 --- a/database/migrations/model/Version20210521135642.php +++ /dev/null @@ -1,56 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210521170713.php b/database/migrations/model/Version20210521170713.php deleted file mode 100644 index eb72e10c..00000000 --- a/database/migrations/model/Version20210521170713.php +++ /dev/null @@ -1,182 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - $sql = <<addSql($sql); - - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } - -} diff --git a/database/migrations/model/Version20210528150223.php b/database/migrations/model/Version20210528150223.php deleted file mode 100644 index 73233314..00000000 --- a/database/migrations/model/Version20210528150223.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("Presentation") && !$builder->hasColumn("Presentation", "DisclaimerAcceptedDate")) { - $builder->table("Presentation", function (Table $table) { - $table->timestamp('DisclaimerAcceptedDate')->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - $builder = new Builder($schema); - - if ($builder->hasTable("Presentation") && $builder->hasColumn("Presentation", "DisclaimerAcceptedDate")) { - $builder->table("Presentation", function (Table $table) { - $table->dropColumn('DisclaimerAcceptedDate'); - }); - } - } -} diff --git a/database/migrations/model/Version20210601152355.php b/database/migrations/model/Version20210601152355.php deleted file mode 100644 index 921c6845..00000000 --- a/database/migrations/model/Version20210601152355.php +++ /dev/null @@ -1,51 +0,0 @@ -hasTable("PresentationVideo") && !$builder->hasColumn("PresentationVideo", "ExternalUrl")) { - $builder->table("PresentationVideo", function (Table $table) { - $table->string('ExternalUrl')->setNotnull(false); - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - $builder = new Builder($schema); - - if ($builder->hasTable("PresentationVideo") && $builder->hasColumn("PresentationVideo", "ExternalUrl")) { - $builder->table("PresentationVideo", function (Table $table) { - $table->dropColumn('ExternalUrl'); - }); - } - } -} diff --git a/database/migrations/model/Version20210602181838.php b/database/migrations/model/Version20210602181838.php deleted file mode 100644 index d513bb4b..00000000 --- a/database/migrations/model/Version20210602181838.php +++ /dev/null @@ -1,45 +0,0 @@ -addSql($sql); - - $sql = <<addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210603182544.php b/database/migrations/model/Version20210603182544.php deleted file mode 100644 index eaf122c5..00000000 --- a/database/migrations/model/Version20210603182544.php +++ /dev/null @@ -1,41 +0,0 @@ -addSql($sql); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210628184207.php b/database/migrations/model/Version20210628184207.php deleted file mode 100644 index 905e2596..00000000 --- a/database/migrations/model/Version20210628184207.php +++ /dev/null @@ -1,55 +0,0 @@ -hasTable("SummitBadgeFeatureType") && !$builder->hasColumn("SummitBadgeFeatureType", "ImageID")) { - $builder->table('SummitBadgeFeatureType', function (Table $table) { - - $table->integer("ImageID", false, false)->setNotnull(false)->setDefault('NULL'); - $table->index("ImageID", "ImageID"); - $table->foreign("File", "ImageID", "ID", ["onDelete" => "CASCADE"]); - - }); - } - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):Void - { - $builder = new Builder($schema); - - if($schema->hasTable("SummitBadgeFeatureType") && $builder->hasColumn("SummitBadgeFeatureType", "ImageID")) { - $builder->table('SummitBadgeFeatureType', function (Table $table) { - $table->dropColumn("ImageID"); - }); - } - } -} diff --git a/database/migrations/model/Version20210707172103.php b/database/migrations/model/Version20210707172103.php deleted file mode 100644 index 709180e4..00000000 --- a/database/migrations/model/Version20210707172103.php +++ /dev/null @@ -1,63 +0,0 @@ -getRepository(SummitEmailFlowType::class); - $flow = $repository->findOneBy([ - "name" => "Presentation Submissions" - ]); - - SummitEmailFlowTypeSeeder::createEventsTypes( - [ - [ - 'name' => PresentationModeratorNotificationEmail::EVENT_NAME, - 'slug' => PresentationModeratorNotificationEmail::EVENT_SLUG, - 'default_email_template' => PresentationModeratorNotificationEmail::DEFAULT_TEMPLATE - ] - ], - $flow - ); - - $em->persist($flow); - $em->flush(); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210707172106.php b/database/migrations/model/Version20210707172106.php deleted file mode 100644 index 61e3c110..00000000 --- a/database/migrations/model/Version20210707172106.php +++ /dev/null @@ -1,47 +0,0 @@ -getRepository(Summit::class); - $summits = $repository->findAll(); - foreach($summits as $summit){ - $summit->seedDefaultEmailFlowEvents(); - $em->persist($summit); - } - $em->flush(); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/migrations/model/Version20210716165815.php b/database/migrations/model/Version20210716165815.php deleted file mode 100644 index 2c7fdbca..00000000 --- a/database/migrations/model/Version20210716165815.php +++ /dev/null @@ -1,47 +0,0 @@ -getRepository(Summit::class); - $summits = $repository->findAll(); - foreach($summits as $summit){ - $summit->seedDefaultAccessLevelTypes(); - $em->persist($summit); - } - $em->flush(); - } - - /** - * @param Schema $schema - */ - public function down(Schema $schema):void - { - - } -} diff --git a/database/seeds/.gitkeep b/database/seeds/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/database/seeds/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/database/seeds/ApiEndpointsSeeder.php b/database/seeds/ApiEndpointsSeeder.php deleted file mode 100644 index b4d3ee61..00000000 --- a/database/seeds/ApiEndpointsSeeder.php +++ /dev/null @@ -1,6957 +0,0 @@ -delete(); - DB::table('endpoint_api_authz_groups')->delete(); - DB::table('api_endpoints')->delete(); - - $this->seedSummitEndpoints(); - $this->seedMemberEndpoints(); - $this->seedTagsEndpoints(); - $this->seedCompaniesEndpoints(); - $this->seedSponsoredProjectsEndpoints(); - $this->seedGroupsEndpoints(); - $this->seedOrganizationsEndpoints(); - $this->seedTrackQuestionTemplateEndpoints(); - $this->seedRegistrationOrderEndpoints(); - $this->seedAttendeeTicketsEndpoints(); - $this->seedAttendeeBadgesEndpoints(); - $this->seedSummitAdministratorGroupsEndpoints(); - $this->seedSummitMediaFileTypeEndpoints(); - } - - private function seedAttendeeBadgesEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('summits', [ - // admin - [ - 'name' => 'get-all-badges-by-summit', - 'route' => '/api/v1/summits/{id}/badges', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-all-badges-by-summit-csv', - 'route' => '/api/v1/summits/{id}/badges/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - ]); - } - - private function seedAttendeeTicketsEndpoints() - { - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('summits', [ - // admin - [ - 'name' => 'get-all-tickets-by-summit', - 'route' => '/api/v1/summits/{id}/tickets', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - IGroup::BadgePrinters, - ] - ], - [ - 'name' => 'get-all-tickets-by-summit-csv', - 'route' => '/api/v1/summits/{id}/tickets/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'import-ticket-data', - 'route' => '/api/v1/summits/{id}/tickets/csv', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-import-ticket-data-template', - 'route' => '/api/v1/summits/{id}/tickets/csv/template', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'ingest-external-ticket-data', - 'route' => '/api/v1/summits/{id}/tickets/ingest', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-ticket-by-id-or-number', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - IGroup::BadgePrinters, - ] - ], - [ - 'name' => 'refund-ticket', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/refund', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-ticket-by-id-or-number-badge', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/badge', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'add-ticket-by-id-or-number-badge', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/badge', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrdersBadges, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'update-ticket-badge-type', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/type/{type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrdersBadges, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'add-ticket-badge-feature', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/features/{feature_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrdersBadges, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'remove-ticket-badge-feature', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/features/{feature_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrdersBadges, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'print-ticket-badge', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/print', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::PrintRegistrationOrdersBadges, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - IGroup::BadgePrinters, - ] - ], - [ - 'name' => 'delete-ticket-badge', - 'route' => '/api/v1/summits/{id}/tickets/{ticket_id}/badge/current', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - ]); - } - - private function seedRegistrationOrderEndpoints(){ - - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('summits', [ - // admin - [ - 'name' => 'get-all-orders-by-summit', - 'route' => '/api/v1/summits/{id}/orders', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-all-orders-by-summit-csv', - 'route' => '/api/v1/summits/{id}/orders/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'create-single-ticket-registration-order', - 'route' => '/api/v1/summits/{id}/orders', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::CreateOfflineRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-registration-order', - 'route' => '/api/v1/summits/{id}/orders/{order_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'delete-registration-order', - 'route' => '/api/v1/summits/{id}/orders/{order_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::DeleteRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'update-registration-order', - 'route' => '/api/v1/summits/{id}/orders/{order_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'refund-registration-order', - 'route' => '/api/v1/summits/{id}/orders/{order_id}/refund', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - // buy flow - [ - 'name' => 'reserve-registration-order', - 'route' => '/api/v1/summits/{id}/orders/reserve', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::CreateRegistrationOrders, $current_realm) - ], - ], - [ - 'name' => 'checkout-registration-order', - 'route' => '/api/v1/summits/{id}/orders/{hash}/checkout', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm) - ], - ], - [ - 'name' => 'get-ticket-by-order-hash', - 'route' => '/api/v1/summits/{id}/orders/{hash}/tickets/mine', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyRegistrationOrders, $current_realm) - ], - ], - [ - 'name' => 'delete-my-registration-order', - 'route' => '/api/v1/summits/{id}/orders/{hash}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::DeleteMyRegistrationOrders, $current_realm) - ], - ], - [ - 'name' => 'get-all-my-registration-order', - 'route' => '/api/v1/summits/all/orders/me', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'get-all-my-tickets', - 'route' => '/api/v1/summits/all/orders/all/tickets/me', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'update-my-ticket', - 'route' => '/api/v1/summits/all/orders/all/tickets/{ticket_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'get-my-ticket-pdf', - 'route' => '/api/v1/summits/all/orders/all/tickets/{ticket_id}/pdf', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'update-my-order', - 'route' => '/api/v1/summits/all/orders/{order_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'refund-my-order', - 'route' => '/api/v1/summits/all/orders/{order_id}/refund', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'cancel-order-refund', - 'route' => '/api/v1/summits/all/orders/{order_id}/refund/cancel', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'resend-order', - 'route' => '/api/v1/summits/all/orders/{order_id}/resend', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'revoke-attendee-from-my-order', - 'route' => '/api/v1/summits/all/orders/{order_id}/tickets/{ticket_id}/attendee', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'assign-attendee-from-my-order', - 'route' => '/api/v1/summits/all/orders/{order_id}/tickets/{ticket_id}/attendee', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'reinvite-attendee-from-order', - 'route' => '/api/v1/summits/all/orders/{order_id}/tickets/{ticket_id}/attendee/reinvite', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'refund-my-order-ticket', - 'route' => '/api/v1/summits/all/orders/{order_id}/tickets/{ticket_id}/refund', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'cancel-refund-ticket-request', - 'route' => '/api/v1/summits/all/orders/{order_id}/tickets/{ticket_id}/refund/cancel', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-ticket-pdf', - 'route' => '/api/v1/summits/all/orders/{order_id}/tickets/{ticket_id}/pdf', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyRegistrationOrders, $current_realm), - ], - ], - [ - 'name' => 'get-ticket-pdf-admin', - 'route' => '/api/v1/summits/{id}/orders/{order_id}/tickets/{ticket_id}/pdf', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'update-ticket', - 'route' => '/api/v1/summits/{id}/orders/{order_id}/tickets/{ticket_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'activate-ticket', - 'route' => '/api/v1/summits/{id}/orders/{order_id}/tickets/{ticket_id}/activate', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'deactivate-ticket', - 'route' => '/api/v1/summits/{id}/orders/{order_id}/tickets/{ticket_id}/activate', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'add-ticket-2-order', - 'route' => '/api/v1/summits/{id}/orders/{order_id}/tickets', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - // invitations - [ - 'name' => 'ingest-registration-invitations', - 'route' => '/api/v1/summits/{id}/registration-invitations/csv', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'add-registration-invitation', - 'route' => '/api/v1/summits/{id}/registration-invitations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'send-registration-invitations', - 'route' => '/api/v1/summits/{id}/registration-invitations/all/send', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-registration-invitations-csv', - 'route' => '/api/v1/summits/{id}/registration-invitations/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-registration-invitations', - 'route' => '/api/v1/summits/{id}/registration-invitations', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-registration-invitation-by-id', - 'route' => '/api/v1/summits/{id}/registration-invitations/{invitation_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'delete-registration-invitation-by-id', - 'route' => '/api/v1/summits/{id}/registration-invitations/{invitation_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'update-registration-invitation', - 'route' => '/api/v1/summits/{id}/registration-invitations/{invitation_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'delete-registration-all', - 'route' => '/api/v1/summits/{id}/registration-invitations/all', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - [ - 'name' => 'get-registration-invitation-by-token', - 'route' => '/api/v1/summits/all/registration-invitations/{token}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyRegistrationInvitations, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins - ] - ], - ]); - } - - private function seedSummitEndpoints() - { - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('summits', [ - // summits - [ - 'name' => 'get-summits', - 'route' => '/api/v1/summits', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - ], - ], - [ - 'name' => 'get-summits-all', - 'route' => '/api/v1/summits/all', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-summits-all-by-id-slug', - 'route' => '/api/v1/summits/all/{id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadBookableRoomsData, $current_realm), - ], - ], - [ - 'name' => 'get-summit-cached', - 'route' => '/api/v1/summits/{id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-summit-non-cached', - 'route' => '/api/v2/summits/{id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-summit', - 'route' => '/api/v1/summits', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'update-summit', - 'route' => '/api/v1/summits/{id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-summit-logo', - 'route' => '/api/v1/summits/{id}/logo', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-summit-logo', - 'route' => '/api/v1/summits/{id}/logo', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-summit', - 'route' => '/api/v1/summits/{id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'get-summit-entity-events', - 'route' => '/api/v1/summits/{id}/entity-events', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - // bookable rooms attributes types - [ - 'name' => 'get-summit-bookable-room-attribute-types', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-summit-bookable-room-attribute-types-by-id', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'update-summit-bookable-room-attribute-type', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-summit-bookable-room-attribute-type', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-summit-bookable-room-attribute-type', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-summit-bookable-room-attribute-type-values', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-summit-bookable-room-attribute-type-values', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-summit-bookable-room-attribute-type-value', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values/{value_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'update-summit-bookable-room-attribute-type-value', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values/{value_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-summit-bookable-room-attribute-type-value', - 'route' => '/api/v1/summits/{id}/bookable-room-attribute-types/{type_id}/values/{value_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // access level types - [ - 'name' => 'get-access-level-types', - 'route' => '/api/v1/summits/{id}/access-level-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-access-level-types', - 'route' => '/api/v1/summits/{id}/access-level-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-access-level-type', - 'route' => '/api/v1/summits/{id}/access-level-types/{level_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - - [ - 'name' => 'update-access-level-type', - 'route' => '/api/v1/summits/{id}/access-level-types/{level_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-access-level-type', - 'route' => '/api/v1/summits/{id}/access-level-types/{level_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // payment gateway profiles - [ - 'name' => 'get-payment-gateway-profiles', - 'route' => '/api/v1/summits/{id}/payment-gateway-profiles', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadPaymentProfiles, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-payment-gateway-profile', - 'route' => '/api/v1/summits/{id}/payment-gateway-profiles', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WritePaymentProfiles, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-payment-gateway-profile', - 'route' => '/api/v1/summits/{id}/payment-gateway-profiles/{payment_profile_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadPaymentProfiles, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-payment-gateway-profile', - 'route' => '/api/v1/summits/{id}/payment-gateway-profiles/{payment_profile_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WritePaymentProfiles, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-payment-gateway-profile', - 'route' => '/api/v1/summits/{id}/payment-gateway-profiles/{payment_profile_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WritePaymentProfiles, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // tax types - [ - 'name' => 'get-tax-types', - 'route' => '/api/v1/summits/{id}/tax-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-tax-types', - 'route' => '/api/v1/summits/{id}/tax-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-tax-type', - 'route' => '/api/v1/summits/{id}/tax-types/{tax_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-tax-type', - 'route' => '/api/v1/summits/{id}/tax-types/{tax_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-tax-type', - 'route' => '/api/v1/summits/{id}/tax-types/{tax_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-tax-type-2-ticket-type', - 'route' => '/api/v1/summits/{id}/tax-types/{tax_id}/ticket-types/{ticket_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-tax-type-from-ticket-type', - 'route' => '/api/v1/summits/{id}/tax-types/{tax_id}/ticket-types/{ticket_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // features types - [ - 'name' => 'get-feature-types', - 'route' => '/api/v1/summits/{id}/badge-feature-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-feature-type', - 'route' => '/api/v1/summits/{id}/badge-feature-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-feature-type', - 'route' => '/api/v1/summits/{id}/badge-feature-types/{feature_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-feature-type', - 'route' => '/api/v1/summits/{id}/badge-feature-types/{feature_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-feature-type', - 'route' => '/api/v1/summits/{id}/badge-feature-types/{feature_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-feature-type-image', - 'route' => '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-feature-type-image', - 'route' => '/api/v1/summits/{id}/badge-feature-types/{feature_id}/image', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // refund-policies - [ - 'name' => 'get-refund-policies', - 'route' => '/api/v1/summits/{id}/refund-policies', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-refund-policy', - 'route' => '/api/v1/summits/{id}/refund-policies', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-refund-policy', - 'route' => '/api/v1/summits/{id}/refund-policies/{policy_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-refund-policy', - 'route' => '/api/v1/summits/{id}/refund-policies/{policy_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-refund-policy', - 'route' => '/api/v1/summits/{id}/refund-policies/{policy_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // sponsors - [ - 'name' => 'get-sponsors', - 'route' => '/api/v1/summits/{id}/sponsors', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-sponsor', - 'route' => '/api/v1/summits/{id}/sponsors', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-sponsor', - 'route' => '/api/v1/summits/{id}/sponsors/{sponsor_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-sponsor', - 'route' => '/api/v1/summits/{id}/sponsors/{sponsor_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-sponsor', - 'route' => '/api/v1/summits/{id}/sponsors/{sponsor_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-sponsor-user', - 'route' => '/api/v1/summits/{id}/sponsors/{sponsor_id}/users/{member_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-sponsor-user', - 'route' => '/api/v1/summits/{id}/sponsors/{sponsor_id}/users/{member_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'share-my-user-info-with-sponsor', - 'route' => '/api/v1/summits/{id}/sponsors/{sponsor_id}/user-info-grants/me', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteMyBadgeScan, $current_realm), - ] - ], - // sponsorship-types - [ - 'name' => 'get-sponsorship-types', - 'route' => '/api/v1/sponsorship-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-sponsorship-type', - 'route' => '/api/v1/sponsorship-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-sponsorship-type', - 'route' => '/api/v1/sponsorship-types/{id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'update-sponsorship-type', - 'route' => '/api/v1/sponsorship-types/{id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-sponsorship-type', - 'route' => '/api/v1/sponsorship-types/{id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // order-extra-questions - [ - 'name' => 'get-order-extra-questions', - 'route' => '/api/v1/summits/{id}/order-extra-questions', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-order-extra-questions-metadata', - 'route' => '/api/v1/summits/{id}/order-extra-questions/metadata', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-order-extra-question', - 'route' => '/api/v1/summits/{id}/order-extra-questions', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-order-extra-question', - 'route' => '/api/v1/summits/{id}/order-extra-questions/{question_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-order-extra-question', - 'route' => '/api/v1/summits/{id}/order-extra-questions/{question_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-order-extra-question', - 'route' => '/api/v1/summits/{id}/order-extra-questions/{question_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-order-extra-question-value', - 'route' => '/api/v1/summits/{id}/order-extra-questions/{question_id}/values', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-order-extra-question-value', - 'route' => '/api/v1/summits/{id}/order-extra-questions/{question_id}/values/{value_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-order-extra-question-value', - 'route' => '/api/v1/summits/{id}/order-extra-questions/{question_id}/values/{value_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // badge types - [ - 'name' => 'get-badge-types', - 'route' => '/api/v1/summits/{id}/badge-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types/{badge_type_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types/{badge_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types/{badge_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-access-level-type-2-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types/{badge_type_id}/access-levels/{access_level_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-access-level-type-from-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types/{badge_type_id}/access-levels/{access_level_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-feature-2-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types/{badge_type_id}/features/{feature_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-feature-from-badge-type', - 'route' => '/api/v1/summits/{id}/badge-types/{badge_type_id}/features/{feature_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // attendees - [ - 'name' => 'get-attendees', - 'route' => '/api/v1/summits/{id}/attendees', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'get-attendees-csv', - 'route' => '/api/v1/summits/{id}/attendees/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'attendees-send-email', - 'route' => '/api/v1/summits/{id}/attendees/all/send', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'get-own-attendee', - 'route' => '/api/v1/summits/{id}/attendees/me', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-attendee', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'delete-attendee', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'update-attendee', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'get-attendee-schedule', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/schedule', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-event-attendee-schedule', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/schedule/{event_id}', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::WriteSummitData, $current_realm)], - ], - [ - 'name' => 'delete-event-attendee-schedule', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/schedule/{event_id}', - 'http_method' => 'DELETE', - 'scopes' => [sprintf(SummitScopes::WriteSummitData, $current_realm)], - ], - array( - 'name' => 'checking-event-attendee-schedule', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/schedule/{event_id}/check-in', - 'http_method' => 'PUT', - 'scopes' => [sprintf(SummitScopes::WriteSummitData, $current_realm)], - ), - [ - 'name' => 'add-attendee', - 'route' => '/api/v1/summits/{id}/attendees', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'add-attendee-ticket', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/tickets', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'delete-attendee-ticket', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/tickets/{ticket_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'reassign-attendee-ticket', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/tickets/{ticket_id}/reassign', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'reassign-attendee-ticket-by-member', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/tickets/{ticket_id}/reassign/{other_member_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteAttendeesData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - // speakers - [ - 'name' => 'get-speakers', - 'route' => '/api/v1/summits/{id}/speakers', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-speakers-on-schedule', - 'route' => '/api/v1/summits/{id}/speakers/on-schedule', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-speaker-by-summit', - 'route' => '/api/v1/summits/{id}/speakers', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'update-speaker-by-summit', - 'route' => '/api/v1/summits/{id}/speakers/{speaker_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'add-speaker-photo', - 'route' => '/api/v1/speakers/{speaker_id}/photo', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - ], - [ - 'name' => 'delete-speaker-photo', - 'route' => '/api/v1/speakers/{speaker_id}/photo', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - ], - [ - 'name' => 'add-speaker-big-photo', - 'route' => '/api/v1/speakers/{speaker_id}/big-photo', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - ], - [ - 'name' => 'delete-speaker-big-photo', - 'route' => '/api/v1/speakers/{speaker_id}/big-photo', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - ], - [ - 'name' => 'add-speaker', - 'route' => '/api/v1/speakers', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'update-speaker', - 'route' => '/api/v1/speakers/{speaker_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'delete-speaker', - 'route' => '/api/v1/speakers/{speaker_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'get-all-speakers', - 'route' => '/api/v1/speakers', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-speakers-active-involvements', - 'route' => '/api/v1/speakers/active-involvements', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-speakers-organizational-roles', - 'route' => '/api/v1/speakers/organizational-roles', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-speaker', - 'route' => '/api/v1/speakers/{speaker_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-my-speaker', - 'route' => '/api/v1/speakers/me', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'request-edit-speaker-permission', - 'route' => '/api/v1/speakers/{speaker_id}/edit-permission', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-edit-speaker-permission', - 'route' => '/api/v1/speakers/{speaker_id}/edit-permission', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-my-speaker-presentations-by-role-by-selection-plan', - 'route' => '/api/v1/speakers/me/presentations/{role}/selection-plans/{selection_plan_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - - ], - [ - 'name' => 'get-my-speaker-presentations-by-role-by-summit', - 'route' => '/api/v1/speakers/me/presentations/{role}/summits/{summit_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - - ], - [ - 'name' => 'add-speaker-2-my-presentation', - 'route' => '/api/v1/speakers/me/presentations/{presentation_id}/speakers/{speaker_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - sprintf(SummitScopes::WriteMySpeakersData, $current_realm) - ], - ], - [ - 'name' => 'remove-speaker-from-my-presentation', - 'route' => '/api/v1/speakers/me/presentations/{presentation_id}/speakers/{speaker_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - sprintf(SummitScopes::WriteMySpeakersData, $current_realm) - ], - ], - [ - 'name' => 'add-moderator-2-my-presentation', - 'route' => '/api/v1/speakers/me/presentations/{presentation_id}/moderators/{speaker_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - sprintf(SummitScopes::WriteMySpeakersData, $current_realm) - ], - ], - [ - 'name' => 'remove-moderators-from-my-presentation', - 'route' => '/api/v1/speakers/me/presentations/{presentation_id}/moderators/{speaker_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - sprintf(SummitScopes::WriteMySpeakersData, $current_realm) - ], - ], - [ - 'name' => 'create-my-speaker', - 'route' => '/api/v1/speakers/me', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteMySpeakersData, $current_realm), - ], - ], - [ - 'name' => 'update-my-speaker', - 'route' => '/api/v1/speakers/me', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteMySpeakersData, $current_realm), - ], - ], - [ - 'name' => 'add-my-speaker-photo', - 'route' => '/api/v1/speakers/me/photo', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteMySpeakersData, $current_realm), - ], - ], - [ - 'name' => 'merge-speakers', - 'route' => '/api/v1/speakers/merge/{speaker_from_id}/{speaker_to_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSpeakersData, $current_realm), - ], - ], - [ - 'name' => 'get-speaker-by-summit', - 'route' => '/api/v1/summits/{id}/speakers/{speaker_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSpeakersData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-my/speaker-by-summit', - 'route' => '/api/v1/summits/{id}/speakers/me', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMySpeakersData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - array( - 'name' => 'add-speaker-feedback', - 'route' => '/api/v1/summits/{id}/speakers/{speaker_id}/presentations/{presentation_id}/feedback', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::WriteSummitData, $current_realm)], - ), - // events - array( - 'name' => 'get-events', - 'route' => '/api/v1/summits/{id}/events', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ), - [ - 'name' => 'get-events-csv', - 'route' => '/api/v1/summits/{id}/events/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'import-events-csv', - 'route' => '/api/v1/summits/{id}/events/csv', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteEventData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-published-events', - 'route' => '/api/v1/summits/{id}/events/published', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-published-events-tags', - 'route' => '/api/v1/summits/{id}/events/all/published/tags', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-schedule-empty-spots', - 'route' => '/api/v1/summits/{id}/events/published/empty-spots', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-unpublished-events', - 'route' => '/api/v1/summits/{id}/events/unpublished', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-all-events', - 'route' => '/api/v1/summits/events', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-all-published-events', - 'route' => '/api/v1/summits/events/published', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-published-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}/published', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'share-email-published-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}/published/mail', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::SendMyScheduleMail, $current_realm) - ], - // 5 request per day - 'rate_limit' => 5, - 'rate_limit_decay' => 1440 - ], - [ - 'name' => 'add-event', - 'route' => '/api/v1/summits/{id}/events', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::WriteEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'update-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}', - 'http_method' => 'PUT', - 'scopes' => [sprintf(SummitScopes::WriteEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'add-event-image', - 'route' => '/api/v1/summits/{id}/events/{event_id}/image', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::WriteEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'delete-event-image', - 'route' => '/api/v1/summits/{id}/events/{event_id}/image', - 'http_method' => 'DELETE', - 'scopes' => [sprintf(SummitScopes::WriteEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'clone-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}/clone', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::WriteEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'update-events', - 'route' => '/api/v1/summits/{id}/events', - 'http_method' => 'PUT', - 'scopes' => [sprintf(SummitScopes::WriteEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'publish-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}/publish', - 'http_method' => 'PUT', - 'scopes' => [sprintf(SummitScopes::PublishEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'publish-events', - 'route' => '/api/v1/summits/{id}/events/publish', - 'http_method' => 'PUT', - 'scopes' => [sprintf(SummitScopes::PublishEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'unpublish-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}/publish', - 'http_method' => 'DELETE', - 'scopes' => [sprintf(SummitScopes::PublishEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'unpublish-events', - 'route' => '/api/v1/summits/{id}/events/publish', - 'http_method' => 'DELETE', - 'scopes' => [sprintf(SummitScopes::PublishEventData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'delete-event', - 'route' => '/api/v1/summits/{id}/events/{event_id}', - 'http_method' => 'DELETE', - 'scopes' => [sprintf('%s/summits/delete-event', $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'add-event-attachment', - 'route' => '/api/v1/summits/{id}/events/{event_id}/attachment', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::WriteSummitData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRegistrationAdmins, - ] - ], - [ - 'name' => 'add-event-feedback', - 'route' => ' api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/feedback', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::AddMyEventFeedback, $current_realm), - ], - ], - [ - 'name' => 'update-event-feedback', - 'route' => ' api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/feedback', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::AddMyEventFeedback, $current_realm), - ], - ], - [ - 'name' => 'delete-event-feedback', - 'route' => ' api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/feedback', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::DeleteMyEventFeedback, $current_realm), - ], - ], - [ - 'name' => 'get-event-feedback-by-member', - 'route' => ' api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/feedback', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::MeRead, $current_realm), - ], - ], - [ - 'name' => 'add-event-feedback-v2', - 'route' => '/api/v2/summits/{id}/events/{event_id}/feedback', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::AddMyEventFeedback, $current_realm), - ], - ], - [ - 'name' => 'update-event-feedback-v2', - 'route' => '/api/v2/summits/{id}/events/{event_id}/feedback', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::AddMyEventFeedback, $current_realm), - ], - ], - [ - 'name' => 'get-event-feedback', - 'route' => '/api/v1/summits/{id}/events/{event_id}/feedback', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - ], - ], - [ - 'name' => 'delete-rsvp', - 'route' => '/api/v1/summits/{id}/attendees/{attendee_id}/schedule/{event_id}/rsvp', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::DeleteMyRSVP, $current_realm), - ], - - ], - // locations - [ - 'name' => 'get-locations', - 'route' => '/api/v1/summits/{id}/locations', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-location', - 'route' => '/api/v1/summits/{id}/locations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-location', - 'route' => '/api/v1/summits/{id}/locations/{location_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-location', - 'route' => '/api/v1/summits/{id}/locations/{location_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-locations-metadata', - 'route' => '/api/v1/summits/{id}/locations/metadata', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // maps - [ - 'name' => 'add-location-map', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/maps', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-location-map', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/maps/{map_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-location-map', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/maps/{map_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'delete-location-map', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/maps/{map_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // 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) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - '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) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - '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) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // banners - [ - 'name' => 'get-location-banners', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/banners', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-location-banner', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/banners', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm), - sprintf(SummitScopes::WriteLocationBannersData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-location-banner', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/banners/{banner_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm), - sprintf(SummitScopes::WriteLocationBannersData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-location-banner', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/banners/{banner_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm), - sprintf(SummitScopes::WriteLocationBannersData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // venues - [ - 'name' => 'get-venues', - 'route' => '/api/v1/summits/{id}/locations/venues', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-venue', - 'route' => '/api/v1/summits/{id}/locations/venues', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-venue', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // floors - [ - 'name' => 'get-venue-floor', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-venue-floor', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-venue-floor', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-venue-floor', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // rsvp templates - [ - 'name' => 'get-rsvp-templates', - 'route' => '/api/v1/summits/{id}/rsvp-templates', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-rsvp-template', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-rsvp-template', - 'route' => '/api/v1/summits/{id}/rsvp-templates', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-rsvp-template-question-metadata', - 'route' => '/api/v1/summits/{id}/rsvp-templates/questions/metadata', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-rsvp-template', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-rsvp-template', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // rsvp template questions - [ - 'name' => 'get-rsvp-template-question', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions/{question_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-rsvp-template-question', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-rsvp-template-question', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions/{question_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-rsvp-template-question', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions/{question_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // multi value questions - [ - 'name' => 'add-rsvp-template-question-value', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions/{question_id}/values', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-rsvp-template-question-value', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions/{question_id}/values/{value_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-rsvp-template-question-value', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions/{question_id}/values/{value_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-rsvp-template-question-value', - 'route' => '/api/v1/summits/{id}/rsvp-templates/{template_id}/questions/{question_id}/values/{value_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteRSVPTemplateData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // rooms - [ - 'name' => 'get-venue-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/rooms/{room_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-venue-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/rooms', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-venue-room-image', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/rooms/{room_id}/image', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-venue-room-image', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/rooms/{room_id}/image', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-venue-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/rooms/{room_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-venue-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/rooms/{room_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // bookable rooms - [ - 'name' => 'get-bookable-venue-rooms', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadBookableRoomsData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-bookable-venue-room', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/{room_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadBookableRoomsData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-bookable-venue-room-availability', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/{room_id}/availability/{day}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadBookableRoomsData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-my-bookable-venue-room-reservations', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/all/reservations/me', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyBookableRoomsReservationData, $current_realm), - ], - ], - [ - 'name' => 'get-bookable-venue-room-reservations-by-id', - 'route' => '/api/v1/summits/all/locations/bookable-rooms/all/reservations/{id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadBookableRoomsData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::SummitRoomAdministrators, - ] - ], - [ - 'name' => 'cancel-my-bookable-venue-room-reservation', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/all/reservations/{reservation_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteMyBookableRoomsReservationData, $current_realm), - ], - ], - [ - 'name' => 'refund-bookable-venue-room-reservation', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/{room_id}/reservations/{reservation_id}/refund', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-bookable-venue-room-reservations-by-summit', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/all/reservations', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-bookable-venue-room-reservations-by-summit-csv', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/all/reservations/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-bookable-venue-room-reservation', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/{room_id}/reservations/{reservation_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'create-bookable-venue-room-reservation', - 'route' => '/api/v1/summits/{id}/locations/bookable-rooms/{room_id}/reservations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteMyBookableRoomsReservationData, $current_realm), - ], - ], - [ - 'name' => 'add-bookable-venue-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-bookable-venue-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-bookable-venue-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // bookable room attributes - [ - 'name' => 'add-bookable-venue-room-attribute', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}/attributes/{attribute_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-bookable-venue-room-attribute', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/bookable-rooms/{room_id}/attributes/{attribute_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // floor rooms - [ - 'name' => 'get-venue-floor-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/rooms/{room_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-venue-floor-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/rooms', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-venue-floor-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/rooms/{room_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-venue-floor-image', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/image', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-venue-floor-image', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/image', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-venue-floor-bookable-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/bookable-rooms/{room_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadBookableRoomsData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-venue-floor-bookable-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/bookable-rooms', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-venue-floor-bookable-room', - 'route' => '/api/v1/summits/{id}/locations/venues/{venue_id}/floors/{floor_id}/bookable-rooms/{room_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteBookableRoomsData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // external locations - [ - 'name' => 'get-external-locations', - 'route' => '/api/v1/summits/{id}/locations/external-locations', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-external-location', - 'route' => '/api/v1/summits/{id}/locations/external-locations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-external-location', - 'route' => '/api/v1/summits/{id}/locations/external-locations/{external_location_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-hotels', - 'route' => '/api/v1/summits/{id}/locations/hotels', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-hotel', - 'route' => '/api/v1/summits/{id}/locations/hotels', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-hotel', - 'route' => '/api/v1/summits/{id}/locations/hotels/{hotel_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-airports', - 'route' => '/api/v1/summits/{id}/locations/airports', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-airport', - 'route' => '/api/v1/summits/{id}/locations/airports', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-airport', - 'route' => '/api/v1/summits/{id}/locations/airports/{airport_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteLocationsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-location', - 'route' => '/api/v1/summits/{id}/locations/{location_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-location-events', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/events', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-location-published-events', - 'route' => '/api/v1/summits/{id}/locations/{location_id}/events/published', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - // event types - [ - 'name' => 'get-event-types', - 'route' => '/api/v1/summits/{id}/event-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-event-types-csv', - 'route' => '/api/v1/summits/{id}/event-types/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-event-type-by-id', - 'route' => '/api/v1/summits/{id}/event-types/{event_type_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-event-type', - 'route' => '/api/v1/summits/{id}/event-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteEventTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'seed-default-event-types', - 'route' => '/api/v1/summits/{id}/event-types/seed-defaults', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteEventTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-event-type', - 'route' => '/api/v1/summits/{id}/event-types/{event_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteEventTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-event-type', - 'route' => '/api/v1/summits/{id}/event-types/{event_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteEventTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - - [ - 'name' => 'add-document-2-event-type', - 'route' => '/api/v1/summits/{id}/event-types/{event_type_id}/summit-documents/{document_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteEventTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-document-from-event-type', - 'route' => '/api/v1/summits/{id}/event-types/{event_type_id}/summit-documents/{document_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteEventTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // tracks-chairs - [ - 'name' => 'get-tracks-chairs', - 'route' => '/api/v1/summits/{id}/track-chairs', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - IGroup::TrackChairs - ] - ], - [ - 'name' => 'get-tracks-chairs-csv', - 'route' => '/api/v1/summits/{id}/track-chairs/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'add-tracks-chairs', - 'route' => '/api/v1/summits/{id}/track-chairs', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'get-tracks-chair', - 'route' => '/api/v1/summits/{id}/track-chairs/{track_chair_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'delete-tracks-chair', - 'route' => '/api/v1/summits/{id}/track-chairs/{track_chair_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'update-tracks-chair', - 'route' => '/api/v1/summits/{id}/track-chairs/{track_chair_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'add-track-2-track-chair', - 'route' => '/api/v1/summits/{id}/track-chairs/{track_chair_id}/categories/{track_id}', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'remove-track-from-track-chair', - 'route' => '/api/v1/summits/{id}/track-chairs/{track_chair_id}/categories/{track_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - //tracks - [ - 'name' => 'get-tracks', - 'route' => '/api/v1/summits/{id}/tracks', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-tracks-csv', - 'route' => '/api/v1/summits/{id}/tracks/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-track-by-id', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-track-extra-questions', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/extra-questions', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-track-icon', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/icon', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-track-icon', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/icon', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-track-extra-questions', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/extra-questions/{question_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-track-extra-questions', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/extra-questions/{question_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-track-allowed-tags', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/allowed-tags', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'copy-tracks-to-summit', - 'route' => '/api/v1/summits/{id}/tracks/copy/{to_summit_id}', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-track', - 'route' => '/api/v1/summits/{id}/tracks', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-track', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-track', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteTracksData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // ticket types - [ - 'name' => 'get-ticket-types', - 'route' => '/api/v1/summits/{id}/ticket-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-ticket-types-csv', - 'route' => '/api/v1/summits/{id}/ticket-types/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-ticket-type', - 'route' => '/api/v1/summits/{id}/ticket-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteTicketTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'seed-default-ticket-types', - 'route' => '/api/v1/summits/{id}/ticket-types/seed-defaults', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteTicketTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-ticket-type', - 'route' => '/api/v1/summits/{id}/ticket-types/{ticket_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteTicketTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-ticket-type', - 'route' => '/api/v1/summits/{id}/ticket-types/{ticket_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteTicketTypeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-ticket-type', - 'route' => '/api/v1/summits/{id}/ticket-types/{ticket_type_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - // track groups - [ - 'name' => 'get-track-groups', - 'route' => '/api/v1/summits/{id}/track-groups', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-track-groups-csv', - 'route' => '/api/v1/summits/{id}/track-groups/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-track-groups-metadata', - 'route' => '/api/v1/summits/{id}/track-groups/metadata', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-track-group', - 'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-track-group', - 'route' => '/api/v1/summits/{id}/track-groups', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteTrackGroupsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-track-group', - 'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteTrackGroupsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-track-group', - 'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteTrackGroupsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'associate-track-2-track-group', - 'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}/tracks/{track_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteTrackGroupsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'disassociate-track-2-track-group', - 'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}/tracks/{track_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteTrackGroupsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'associate-group-2-track-group', - 'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}/allowed-groups/{group_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteTrackGroupsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'disassociate-group-2-track-group', - 'route' => '/api/v1/summits/{id}/track-groups/{track_group_id}/allowed-groups/{group_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteTrackGroupsData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - //external orders - array( - 'name' => 'get-external-order', - 'route' => '/api/v1/summits/{id}/external-orders/{external_order_id}', - 'http_method' => 'GET', - 'scopes' => [sprintf('%s/summits/read-external-orders', $current_realm)], - ), - array( - 'name' => 'confirm-external-order', - 'route' => '/api/v1/summits/{id}/external-orders/{external_order_id}/external-attendees/{external_attendee_id}/confirm', - 'http_method' => 'POST', - 'scopes' => [sprintf('%s/summits/confirm-external-orders', $current_realm)], - ), - [ - 'name' => 'import-assets-from-mux', - 'route' => '/api/v1/summits/{id}/presentations/all/import/mux', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteEventData, $current_realm), - sprintf(SummitScopes::WritePresentationData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // presentation submissions - [ - 'name' => 'submit-presentation', - 'route' => '/api/v1/summits/{id}/presentations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteEventData, $current_realm), - sprintf(SummitScopes::WritePresentationData, $current_realm) - ], - ], - [ - 'name' => 'update-submit-presentation', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteEventData, $current_realm), - sprintf(SummitScopes::WritePresentationData, $current_realm) - ], - ], - [ - 'name' => 'complete-submit-presentation', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/completed', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteEventData, $current_realm), - sprintf(SummitScopes::WritePresentationData, $current_realm) - ], - ], - [ - 'name' => 'delete-submit-presentation', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteEventData, $current_realm), - sprintf(SummitScopes::WritePresentationData, $current_realm) - ], - ], - //videos - [ - 'name' => 'get-presentation-videos', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/videos', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-presentation-video', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/video/{video_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'create-presentation-video', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/videos', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteVideoData, $current_realm), - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationVideosData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-presentation-video', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/videos/{video_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteVideoData, $current_realm), - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationVideosData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-presentation-video', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/videos/{video_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteVideoData, $current_realm), - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationVideosData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // links - [ - 'name' => 'get-presentation-links', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/links', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-presentation-link', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/links/{link_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'create-presentation-link', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/links', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationLinksData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-presentation-link', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/links/{link_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationLinksData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-presentation-link', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/links/{link_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationLinksData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // slides - [ - 'name' => 'get-presentation-slides', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/slides', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-presentation-slide', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/slides/{slide_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'create-presentation-slide', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/slides', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationSlidesData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-presentation-slide', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/slides/{slide_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationSlidesData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-presentation-slide', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/slides/{slide_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationSlidesData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // media uplods - [ - 'name' => 'get-presentation-media-uploads', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/media-uploads', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-presentation-media-upload', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/media-uploads/{media_upload_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'create-presentation-media-uploads', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/media-uploads', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationSlidesData, $current_realm) - ] - ], - [ - 'name' => 'update-presentation-media-uploads', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/media-uploads/{media_upload_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationSlidesData, $current_realm) - ], - ], - [ - 'name' => 'delete-presentation-media-uploads', - 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/media-uploads/{media_upload_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - sprintf(SummitScopes::WritePresentationSlidesData, $current_realm) - ], - ], - //members - [ - 'name' => 'create-schedule-shareable-link', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/shareable-link', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::AddMyScheduleShareable, $current_realm) - ], - ], - [ - 'name' => 'delete-schedule-shareable-link', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/shareable-link', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::DeleteMyScheduleShareable, $current_realm) - ], - ], - [ - 'name' => 'get-own-member', - 'route' => '/api/v1/summits/{id}/members/{member_id}', - 'http_method' => 'GET', - 'scopes' => [sprintf(SummitScopes::MeRead, $current_realm)], - ], - [ - 'name' => 'get-own-member-favorites', - 'route' => '/api/v1/summits/{id}/members/{member_id}/favorites', - 'http_method' => 'GET', - 'scopes' => [sprintf(SummitScopes::MeRead, $current_realm)], - ], - [ - 'name' => 'add-2-own-member-favorites', - 'route' => '/api/v1/summits/{id}/members/{member_id}/favorites/{event_id}', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::AddMyFavorites, $current_realm)], - ], - [ - 'name' => 'add-rsvp-member', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/rsvp', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::AddMyRSVP, $current_realm) - ], - ], - [ - 'name' => 'update-rsvp-member', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/rsvp', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::AddMyRSVP, $current_realm) - ], - ], - [ - 'name' => 'delete-rsvp-member', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/rsvp', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::DeleteMyRSVP, $current_realm) - ], - ], - [ - 'name' => 'remove-from-own-member-favorites', - 'route' => '/api/v1/summits/{id}/members/{member_id}/favorites/{event_id}', - 'http_method' => 'DELETE', - 'scopes' => [sprintf(SummitScopes::DeleteMyFavorites, $current_realm)], - ], - [ - 'name' => 'get-own-member-schedule', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule', - 'http_method' => 'GET', - 'scopes' => [sprintf(SummitScopes::MeRead, $current_realm)] - ], - [ - 'name' => 'add-2-own-member-schedule', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::AddMySchedule, $current_realm), - ], - ], - [ - 'name' => 'remove-from-own-member-schedule', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::DeleteMySchedule, $current_realm), - ], - ], - // enter/leave - [ - 'name' => 'enter-member-to-event', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/enter', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::EnterEvent, $current_realm) - ], - ], - [ - 'name' => 'leave-member-from-event', - 'route' => '/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/leave', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::LeaveEvent, $current_realm) - ], - ], - // - [ - 'name' => 'get-member-from-summit', - 'route' => '/api/v1/summits/{id}/members', - 'http_method' => 'GET', - 'scopes' => [sprintf(SummitScopes::ReadAllSummitData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-member-from-summit-csv', - 'route' => '/api/v1/summits/{id}/members/csv', - 'http_method' => 'GET', - 'scopes' => [sprintf(SummitScopes::ReadAllSummitData, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // notifications - [ - 'name' => 'get-notifications', - 'route' => '/api/v1/summits/{id}/notifications', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadNotifications, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-sent-notifications', - 'route' => '/api/v1/summits/{id}/notifications/sent', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadNotifications, $current_realm) - ], - ], - [ - 'name' => 'get-notifications-csv', - 'route' => '/api/v1/summits/{id}/notifications/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadNotifications, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-notification-by-id', - 'route' => '/api/v1/summits/{id}/notifications/{notification_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadNotifications, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-notifications', - 'route' => '/api/v1/summits/{id}/notifications', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteNotifications, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'approve-notification', - 'route' => '/api/v1/summits/{id}/notifications/{notification_id}/approve', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteNotifications, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'unapprove-notification', - 'route' => '/api/v1/summits/{id}/notifications/{notification_id}/approve', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteNotifications, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-notification', - 'route' => '/api/v1/summits/{id}/notifications/{notification_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteNotifications, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // promo codes - [ - 'name' => 'get-promo-codes', - 'route' => '/api/v1/summits/{id}/promo-codes', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-promo-codes-csv', - 'route' => '/api/v1/summits/{id}/promo-codes/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-promo-code', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-promo-code', - 'route' => '/api/v1/summits/{id}/promo-codes', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-promo-code', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-promo-code', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'send-promo-code-mail', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}/mail', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-promo-codes-metadata', - 'route' => '/api/v1/summits/{id}/promo-codes/metadata', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-promo-code-badge-feature', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}/badge-features/{badge_feature_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-promo-code-badge-feature', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}/badge-features/{badge_feature_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-promo-code-ticket-type', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}/ticket-types/{ticket_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-promo-code-ticket-type', - 'route' => '/api/v1/summits/{id}/promo-codes/{promo_code_id}/ticket-types/{ticket_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WritePromoCodeData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // summit speakers assistances - [ - 'name' => 'get-speaker-assistances-by-summit', - 'route' => '/api/v1/summits/{id}/speakers-assistances', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-speaker-assistances-by-summit-csv', - 'route' => '/api/v1/summits/{id}/speakers-assistances/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-speaker-assistance', - 'route' => '/api/v1/summits/{id}/speakers-assistances', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitSpeakerAssistanceData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-speaker-assistance', - 'route' => '/api/v1/summits/{id}/speakers-assistances/{assistance_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitSpeakerAssistanceData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-speaker-assistance', - 'route' => '/api/v1/summits/{id}/speakers-assistances/{assistance_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-speaker-assistance', - 'route' => '/api/v1/summits/{id}/speakers-assistances/{assistance_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitSpeakerAssistanceData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'send-speaker-assistance-mail', - 'route' => '/api/v1/summits/{id}/speakers-assistances/{assistance_id}/mail', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitSpeakerAssistanceData, $current_realm), - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // selection plans - [ - 'name' => 'get-current-selection-plan-by-status', - 'route' => '/api/v1/summits/{id}/selection-plans/current/{status}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-selection-plan-by-id', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - ], - [ - 'name' => 'update-selection-plan', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-selection-plan', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-selection-plan', - 'route' => '/api/v1/summits/{id}/selection-plans', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-track-group-2-selection-plan', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/track-groups/{track_group_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-track-group-2-selection-plan', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/track-groups/{track_group_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // selection plans extra questions - [ - 'name' => 'get-selection-plan-extra-questions', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-selection-plan-extra-questions-metadata', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions/metadata', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - ], - [ - 'name' => 'add-selection-plan-extra-question', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-selection-plan-extra-question', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions/{question_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - ], - [ - 'name' => 'update-selection-plan-extra-question', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions/{question_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-selection-plan-extra-question', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions/{question_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-selection-plan-extra-question_value', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions/{question_id}/values', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-selection-plan-extra-question_value', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions/{question_id}/values/{value_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-selection-plan-extra-question_value', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/extra-questions/{question_id}/values/{value_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // selection plan presentations - [ - 'name' => 'get-selection-plan-presentations', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'get-selection-plan-presentations-csv', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'get-selection-plan-presentation', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'presentation-action-complete', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/actions/{action_id}/complete', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'presentation-action-uncomplete', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/actions/{action_id}/incomplete', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'add-comment-2-presentation', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/comments', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'mark-presentation-viewed', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/view', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'get-presentation-category-change-requests', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/all/category-change-requests', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'create-presentation-category-change-request', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/category-change-requests', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'resolve-presentation-category-change-request', - 'route' => '/api/v1/summits/{id}/selection-plans/{selection_plan_id}/presentations/{presentation_id}/category-change-requests/{category_change_request_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - // track tag groups - [ - 'name' => 'get-track-tag-groups', - 'route' => '/api/v1/summits/{id}/track-tag-groups', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-track-tag-groups-allowed-tags', - 'route' => '/api/v1/summits/{id}/track-tag-groups/all/allowed-tags', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'seed-track-tag-groups-allowed-tags', - 'route' => '/api/v1/summits/{id}/track-tag-groups/all/allowed-tags/{tag_id}/seed-on-tracks', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTracksData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-track-tag-group', - 'route' => '/api/v1/summits/{id}/track-tag-groups/{track_tag_group_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'seed-default-track-tag-groups', - 'route' => '/api/v1/summits/{id}/track-tag-groups/seed-defaults', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackTagGroupsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-track-tag-group', - 'route' => '/api/v1/summits/{id}/track-tag-groups', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackTagGroupsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-track-tag-group', - 'route' => '/api/v1/summits/{id}/track-tag-groups/{track_tag_group_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackTagGroupsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-track-tag-group', - 'route' => '/api/v1/summits/{id}/track-tag-groups/{track_tag_group_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackTagGroupsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'copy-track-tag-group-allowed-tags-to-track', - 'route' => '/api/v1/summits/{id}/track-tag-groups/{track_tag_group_id}/allowed-tags/all/copy/tracks/{track_id}', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTracksData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - - // email-flows-events - [ - 'name' => 'get-all-email-flows-events', - 'route' => '/api/v1/summits/{id}/email-flows-events', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-email-flows-event-by-id', - 'route' => '/api/v1/summits/{id}/email-flows-events/{event_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-email-flows-event', - 'route' => '/api/v1/summits/{id}/email-flows-events/{event_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // summit documents - [ - 'name' => 'add-summit-document', - 'route' => '/api/v1/summits/{id}/summit-documents', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-summit-documents', - 'route' => '/api/v1/summits/{id}/summit-documents', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'get-summit-document', - 'route' => '/api/v1/summits/{id}/summit-documents/{document_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - ], - [ - 'name' => 'update-summit-document', - 'route' => '/api/v1/summits/{id}/summit-documents/{document_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-summit-document', - 'route' => '/api/v1/summits/{id}/summit-documents/{document_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-event-type-2-summit-document', - 'route' => '/api/v1/summits/{id}/summit-documents/{document_id}/event-types/{event_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-event-type-from-summit-document', - 'route' => '/api/v1/summits/{id}/summit-documents/{document_id}/event-types/{event_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // media-upload-types - [ - 'name' => 'get-all-media-upload-types', - 'route' => '/api/v1/summits/{id}/media-upload-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-media-upload-types', - 'route' => '/api/v1/summits/{id}/media-upload-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-media-upload-type', - 'route' => '/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-media-upload-types', - 'route' => '/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-media-upload-types', - 'route' => '/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-event-type-2-media-upload-type', - 'route' => '/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'remove-event-type-media-upload-type', - 'route' => '/api/v1/summits/{id}/media-upload-types/{media_upload_type_id}/presentation-types/{event_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'clone-media-upload-types', - 'route' => '/api/v1/summits/{id}/media-upload-types/all/clone/{to_summit_id}', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-individual-selection-list', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/selection-lists/individual/owner/me', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'get-individual-selection-list', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/selection-lists/individual/owner/{owner_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'add-presentation-to-individual-selection-list', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/selection-lists/individual/presentation-selections/{collection}/presentations/{presentation_id}', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'remove-presentation-from-individual-selection-list', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/selection-lists/individual/presentation-selections/{collection}/presentations/{presentation_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'get-team-selection-list', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/selection-lists/team', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'add-team-selection-list', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/selection-lists/team', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'reorder-selection-list', - 'route' => '/api/v1/summits/{id}/tracks/{track_id}/selection-lists/{list_id}/reorder', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::TrackChairs, - IGroup::TrackChairsAdmins, - ] - ], - ]); - - } - - /** - * @param string $api_name - * @param array $endpoints_info - */ - private function seedApiEndpoints($api_name, array $endpoints_info){ - - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => $api_name]); - if(is_null($api)) return; - - foreach($endpoints_info as $endpoint_info){ - - $endpoint = new ApiEndpoint(); - $endpoint->setName($endpoint_info['name']); - $endpoint->setRoute($endpoint_info['route']); - $endpoint->setHttpMethod($endpoint_info['http_method']); - $endpoint->setActive(true); - $endpoint->setAllowCors(true); - $endpoint->setAllowCredentials(true); - $endpoint->setApi($api); - - if(isset($endpoint_info['rate_limit'])) - $endpoint->setRateLimit(intval($endpoint_info['rate_limit'])); - - if(isset($endpoint_info['rate_limit_decay'])) - $endpoint->setRateLimitDecay(intval($endpoint_info['rate_limit_decay'])); - - foreach($endpoint_info['scopes'] as $scope_name){ - $scope = EntityManager::getRepository(\App\Models\ResourceServer\ApiScope::class)->findOneBy(['name' => $scope_name]); - if(is_null($scope)) continue; - $endpoint->addScope($scope); - } - - if(isset($endpoint_info['authz_groups'])) { - foreach ($endpoint_info['authz_groups'] as $authz_group_slug) { - $endpoint->addAuthGroup($authz_group_slug); - } - } - - EntityManager::persist($endpoint); - } - - EntityManager::flush(); - } - - private function seedMemberEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('members', [ - // members - [ - 'name' => 'get-members', - 'route' => '/api/v1/members', - 'http_method' => 'GET', - 'scopes' => [sprintf('%s/members/read', $current_realm)], - ], - [ - 'name' => 'get-my-member', - 'route' => '/api/v1/members/me', - 'http_method' => 'GET', - 'scopes' => [sprintf('%s/members/read/me', $current_realm)], - ], - // my membership - [ - 'name' => 'sign-foundation-membership', - 'route' => '/api/v1/members/me/membership/foundation', - 'http_method' => 'PUT', - 'scopes' => [sprintf(MemberScopes::WriteMyMemberData, $current_realm)], - ], - [ - 'name' => 'sign-community-membership', - 'route' => '/api/v1/members/me/membership/community', - 'http_method' => 'PUT', - 'scopes' => [sprintf(MemberScopes::WriteMyMemberData, $current_realm)], - ], - [ - 'name' => 'resign-membership', - 'route' => '/api/v1/members/me/membership/resign', - 'http_method' => 'DELETE', - 'scopes' => [sprintf(MemberScopes::WriteMyMemberData, $current_realm)], - ], - // my member affiliations - [ - 'name' => 'get-my-member-affiliations', - 'route' => '/api/v1/members/me/affiliations', - 'http_method' => 'GET', - 'scopes' => [sprintf(MemberScopes::ReadMyMemberData, $current_realm)], - ], - [ - 'name' => 'add-my-member-affiliation', - 'route' => '/api/v1/members/me/affiliations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(MemberScopes::WriteMyMemberData, $current_realm) - ], - ], - [ - 'name' => 'update-my-member-affiliation', - 'route' => '/api/v1/members/me/affiliations/{affiliation_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(MemberScopes::WriteMyMemberData, $current_realm) - ], - ], - [ - 'name' => 'delete-my-member-affiliation', - 'route' => '/api/v1/members/me/affiliations/{affiliation_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(MemberScopes::WriteMyMemberData, $current_realm) - ], - ], - // member affiliations - [ - 'name' => 'get-member-affiliations', - 'route' => '/api/v1/members/{member_id}/affiliations', - 'http_method' => 'GET', - 'scopes' => [sprintf('%s/members/read', $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-member-affiliation', - 'route' => '/api/v1/members/{member_id}/affiliations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(MemberScopes::WriteMemberData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-member-affiliation', - 'route' => '/api/v1/members/{member_id}/affiliations/{affiliation_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(MemberScopes::WriteMemberData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-member-affiliation', - 'route' => '/api/v1/members/{member_id}/affiliations/{affiliation_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(MemberScopes::WriteMemberData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-member-rsvp', - 'route' => '/api/v1/members/{member_id}/rsvp/{rsvp_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(MemberScopes::WriteMemberData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - ] - ); - } - - private function seedTagsEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('tags', [ - // tags - [ - 'name' => 'get-tags', - 'route' => '/api/v1/tags', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(SummitScopes::ReadTagsData, $current_realm) - ], - ], - [ - 'name' => 'add-tag', - 'route' => '/api/v1/tags', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTagsData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ] - ] - ); - } - - private function seedCompaniesEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - $this->seedApiEndpoints('companies', [ - [ - 'name' => 'get-companies', - 'route' => '/api/v1/companies', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf(CompanyScopes::Read, $current_realm) - ], - ], - [ - 'name' => 'add-company', - 'route' => '/api/v1/companies', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(CompanyScopes::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'update-company', - 'route' => '/api/v1/companies/{id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(CompanyScopes::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'delete-company', - 'route' => '/api/v1/companies/{id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(CompanyScopes::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'get-company', - 'route' => '/api/v1/companies/{id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(CompanyScopes::Read, $current_realm) - ] - ], - [ - 'name' => 'add-company-logo', - 'route' => '/api/v1/companies/{id}/logo', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(CompanyScopes::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'delete-company-logo', - 'route' => '/api/v1/companies/{id}/logo', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(CompanyScopes::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'add-company-big-logo', - 'route' => '/api/v1/companies/{id}/logo/big', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(CompanyScopes::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'delete-company-big-logo', - 'route' => '/api/v1/companies/{id}/logo/big', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(CompanyScopes::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - - ] - ); - } - - private function seedSponsoredProjectsEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - $this->seedApiEndpoints('sponsored-projects', [ - [ - 'name' => 'get-sponsored-projects', - 'route' => '/api/v1/sponsored-projects', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SponsoredProjectScope::Read, $current_realm) - ], - ], - [ - 'name' => 'add-sponsored-projects', - 'route' => '/api/v1/sponsored-projects', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'update-sponsored-projects', - 'route' => '/api/v1/sponsored-projects/{id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'delete-sponsored-projects', - 'route' => '/api/v1/sponsored-projects/{id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'get-sponsored-project', - 'route' => '/api/v1/sponsored-projects/{id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SponsoredProjectScope::Read, $current_realm) - ] - ], - // sponsorship types - [ - 'name' => 'get-sponsored-project-sponsorship-types', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SponsoredProjectScope::Read, $current_realm) - ], - ], - [ - 'name' => 'add-sponsored-project-sponsorship-types', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'update-sponsored-project-sponsorship-types', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - - [ - 'name' => 'delete-sponsored-project-sponsorship-types', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - - [ - 'name' => 'get-sponsored-project-sponsorship-type', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SponsoredProjectScope::Read, $current_realm) - ], - ], - [ - 'name' => 'get-sponsored-project-supporting-companies', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}/supporting-companies', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SponsoredProjectScope::Read, $current_realm) - ], - ], - [ - 'name' => 'add-sponsored-project-supporting-companies', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}/supporting-companies', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'update-sponsored-project-supporting-companies', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}/supporting-companies/{company_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'delete-sponsored-project-supporting-companies', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}/supporting-companies/{company_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SponsoredProjectScope::Write, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'get-sponsored-project-supporting-company', - 'route' => '/api/v1/sponsored-projects/{id}/sponsorship-types/{sponsorship_type_id}/supporting-companies/{company_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SponsoredProjectScope::Read, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - ] - ); - } - - private function seedGroupsEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('groups', [ - // members - [ - 'name' => 'get-groups', - 'route' => '/api/v1/groups', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - sprintf('%s/groups/read', $current_realm) - ], - ] - ] - ); - } - - private function seedOrganizationsEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('organizations', [ - // organizations - [ - 'name' => 'get-organizations', - 'route' => '/api/v1/organizations', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(OrganizationScopes::ReadOrganizationData, $current_realm) - ], - ] - ] - ); - - $this->seedApiEndpoints('organizations', [ - // organizations - [ - 'name' => 'add-organizations', - 'route' => '/api/v1/organizations', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(OrganizationScopes::WriteOrganizationData, $current_realm) - ], - ] - ] - ); - } - - public function seedTrackQuestionTemplateEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('track-question-templates', [ - // track question templates - [ - 'name' => 'get-track-question-templates', - 'route' => '/api/v1/track-question-templates', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-track-question-templates', - 'route' => '/api/v1/track-question-templates', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackQuestionTemplateData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-track-question-templates', - 'route' => '/api/v1/track-question-templates/{track_question_template_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackQuestionTemplateData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-track-question-templates', - 'route' => '/api/v1/track-question-templates/{track_question_template_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackQuestionTemplateData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-track-question-template', - 'route' => '/api/v1/track-question-templates/{track_question_template_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-track-question-templates-metadata', - 'route' => '/api/v1/track-question-templates/metadata', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-track-question-template-value', - 'route' => '/api/v1/track-question-templates/{track_question_template_id}/values', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackQuestionTemplateData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'update-track-question-template-value', - 'route' => '/api/v1/track-question-templates/{track_question_template_id}/values/{track_question_template_value_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackQuestionTemplateData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-track-question-template-value', - 'route' => '/api/v1/track-question-templates/{track_question_template_id}/values/{track_question_template_value_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - sprintf(SummitScopes::WriteTrackQuestionTemplateData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-track-question-template-value', - 'route' => '/api/v1/track-question-templates/{track_question_template_id}/values/{track_question_template_value_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - // badge scans - [ - 'name' => 'add-badge-scan', - 'route' => '/api/v1/summits/{id}/badge-scans', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteBadgeScan, $current_realm) - ], - ], - [ - 'name' => 'get-my-badge-scans', - 'route' => '/api/v1/summits/{id}/badge-scans/me', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadMyBadgeScan, $current_realm) - ], - ], - [ - 'name' => 'get-badge-scans', - 'route' => '/api/v1/summits/{id}/badge-scans', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadBadgeScan, $current_realm) - ], - ], - [ - 'name' => 'get-badge-scans-csv', - 'route' => '/api/v1/summits/{id}/badge-scans/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadBadgeScan, $current_realm) - ], - ], - // featured speakers - - [ - 'name' => 'get-featured-speakers', - 'route' => '/api/v1/summits/{id}/featured-speakers', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'add-featured-speaker', - 'route' => '/api/v1/summits/{id}/featured-speakers/{speaker_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'delete-featured-speaker', - 'route' => '/api/v1/summits/{id}/featured-speakers/{speaker_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - ] - ], - [ - 'name' => 'get-presentation-action-types', - 'route' => '/api/v1/summits/{id}/presentation-action-types', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - IGroup::TrackChairs, - ] - ], - [ - 'name' => 'get-presentation-action-types-csv', - 'route' => '/api/v1/summits/{id}/presentation-action-types/csv', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'add-presentation-action-types', - 'route' => '/api/v1/summits/{id}/presentation-action-types', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'get-presentation-action-type-by-id', - 'route' => '/api/v1/summits/{id}/presentation-action-types/{action_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadAllSummitData, $current_realm), - sprintf(SummitScopes::ReadSummitData, $current_realm) - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'delete-presentation-action-type', - 'route' => '/api/v1/summits/{id}/presentation-action-types/{action_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ], - [ - 'name' => 'update-presentation-action-type', - 'route' => '/api/v1/summits/{id}/presentation-action-types/{action_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitData, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - IGroup::SummitAdministrators, - IGroup::TrackChairsAdmins, - ] - ] - ] - ); - } - - public function seedSummitAdministratorGroupsEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('summit-administrator-groups', [ - [ - 'name' => 'get-summit-administrator-groups', - 'route' => '/api/v1/summit-administrator-groups', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'get-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups/{group_id}', - 'http_method' => 'GET', - 'scopes' => [ - sprintf(SummitScopes::ReadSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'add-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'update-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups/{group_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'delete-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups/{group_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'add-member-to-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups/{group_id}/members/{member_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'remove-member-from-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups/{group_id}/members/{member_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'add-summit-to-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups/{group_id}/summits/{summit_id}', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'remove-summit-from-summit-administrator-group', - 'route' => '/api/v1/summit-administrator-groups/{group_id}/summits/{summit_id}', - 'http_method' => 'DELETE', - 'scopes' => [ - sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - ], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - - ] - ); - } - - public function seedSummitMediaFileTypeEndpoints(){ - $current_realm = Config::get('app.scope_base_realm'); - - $this->seedApiEndpoints('summit-media-file-types', [ - [ - 'name' => 'get-summit-media-file-types', - 'route' => '/api/v1/summit-media-file-types', - 'http_method' => 'GET', - 'scopes' => [sprintf(SummitScopes::ReadSummitMediaFileTypes, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'get-summit-media-file-type-by-id', - 'route' => '/api/v1/summit-media-file-types/{id}', - 'http_method' => 'GET', - 'scopes' => [sprintf(SummitScopes::ReadSummitMediaFileTypes, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'add-summit-media-file-type', - 'route' => '/api/v1/summit-media-file-types', - 'http_method' => 'POST', - 'scopes' => [sprintf(SummitScopes::WriteSummitMediaFileTypes, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'update-summit-media-file-type', - 'route' => '/api/v1/summit-media-file-types/{id}', - 'http_method' => 'PUT', - 'scopes' => [sprintf(SummitScopes::WriteSummitMediaFileTypes, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'delete-summit-media-file-type', - 'route' => '/api/v1/summit-media-file-types/{id}', - 'http_method' => 'DELETE', - 'scopes' => [sprintf(SummitScopes::WriteSummitMediaFileTypes, $current_realm)], - 'authz_groups' => [ - IGroup::SuperAdmins, - IGroup::Administrators, - ] - ], - [ - 'name' => 'metric-enter', - 'route' => '/api/v1/summits/{id}/metrics/enter', - 'http_method' => 'PUT', - 'scopes' => [ - sprintf(SummitScopes::EnterEvent, $current_realm), - sprintf(SummitScopes::WriteMetrics, $current_realm) - ], - ], - [ - 'name' => 'metric-leave', - 'route' => '/api/v1/summits/{id}/metrics/leave', - 'http_method' => 'POST', - 'scopes' => [ - sprintf(SummitScopes::LeaveEvent, $current_realm), - sprintf(SummitScopes::WriteMetrics, $current_realm) - ], - ], - ] - ); - } -} \ No newline at end of file diff --git a/database/seeds/ApiScopesSeeder.php b/database/seeds/ApiScopesSeeder.php deleted file mode 100644 index 891f6ee6..00000000 --- a/database/seeds/ApiScopesSeeder.php +++ /dev/null @@ -1,673 +0,0 @@ -delete(); - DB::table('api_scopes')->delete(); - - $this->seedSummitScopes(); - $this->seedMembersScopes(); - $this->seedTeamsScopes(); - $this->seedTagsScopes(); - $this->seedCompaniesScopes(); - $this->seedSponsoredProjectsScopes(); - $this->seedGroupsScopes(); - $this->seedOrganizationScopes(); - $this->seedSummitAdminGroupScopes(); - $this->seedSummitMediaFileTypes(); - } - - private function seedSummitScopes() - { - - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'summits']); - - $scopes = [ - [ - 'name' => sprintf(SummitScopes::ReadSummitData, $current_realm), - 'short_description' => 'Get Summit Data', - 'description' => 'Grants read only access for Summits Data', - ], - [ - 'name' => sprintf(SummitScopes::ReadAllSummitData, $current_realm), - 'short_description' => 'Get All Summits Data', - 'description' => 'Grants read only access for All Summits Data', - ], - [ - 'name' => sprintf(SummitScopes::MeRead, $current_realm), - 'short_description' => 'Get own summit member data', - 'description' => 'Grants read only access for our own summit member data', - ], - [ - 'name' => sprintf(SummitScopes::AddMyFavorites, $current_realm), - 'short_description' => 'Allows to add Summit events as favorite', - 'description' => 'Allows to add Summit events as favorite', - ], - [ - 'name' => sprintf(SummitScopes::DeleteMyFavorites, $current_realm), - 'short_description' => 'Allows to remove Summit events as favorite', - 'description' => 'Allows to remove Summit events as favorite', - ], - // enter/leave event - [ - 'name' => sprintf(SummitScopes::EnterEvent, $current_realm), - 'short_description' => '', - 'description' => '', - ], - [ - 'name' => sprintf(SummitScopes::LeaveEvent, $current_realm), - 'short_description' => '', - 'description' => '', - ], - [ - 'name' => sprintf(SummitScopes::WriteMetrics, $current_realm), - 'short_description' => '', - 'description' => '', - ], - [ - 'name' => sprintf(SummitScopes::ReadMetrics, $current_realm), - 'short_description' => '', - 'description' => '', - ], - [ - 'name' => sprintf(SummitScopes::AddMyRSVP, $current_realm), - 'short_description' => 'Allows to add Summit events as RSVP', - 'description' => 'Allows to add Summit events as RSVP', - ], - [ - 'name' => sprintf(SummitScopes::DeleteMyRSVP, $current_realm), - 'short_description' => 'Allows to remove Summit events from RSVP', - 'description' => 'Allows to remove Summit events from RSVP', - ], - [ - 'name' => sprintf(SummitScopes::AddMySchedule, $current_realm), - 'short_description' => 'Allows to add Summit events to my schedule', - 'description' => 'Allows to add Summit events to my schedule', - ], - [ - 'name' => sprintf(SummitScopes::DeleteMySchedule, $current_realm), - 'short_description' => 'Allows to remove Summit events from my schedule', - 'description' => 'Allows to remove Summit events from my schedule', - ], - [ - 'name' => sprintf(SummitScopes::AddMyScheduleShareable, $current_realm), - 'short_description' => 'Allows create a shareable link from my schedule', - 'description' => 'Allows create a shareable link from my schedule', - ], - [ - 'name' => sprintf(SummitScopes::DeleteMyScheduleShareable, $current_realm), - 'short_description' => 'Allows to delete shareable links from my schedule', - 'description' => 'Allows to delete shareable links from my schedule', - ], - [ - 'name' => sprintf(SummitScopes::AddMyEventFeedback, $current_realm), - 'short_description' => 'Allows to create event feedback', - 'description' => 'Allows to create event feedback', - ], - [ - 'name' => sprintf(SummitScopes::DeleteMyEventFeedback, $current_realm), - 'short_description' => 'Allows to delete event feedback', - 'description' => 'Allows to delete event feedback', - ], - [ - 'name' => sprintf(SummitScopes::SendMyScheduleMail, $current_realm), - 'short_description' => 'Allows to send my schedule share email', - 'description' => 'Allows to send my schedule share email', - ], - [ - 'name' => sprintf(SummitScopes::WriteSummitData, $current_realm), - 'short_description' => 'Write Summit Data', - 'description' => 'Grants write access for Summits Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteRegistrationData, $current_realm), - 'short_description' => 'Write Registration Data', - 'description' => 'Grants write access for Registration Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteEventData, $current_realm), - 'short_description' => 'Write Summit Events', - 'description' => 'Grants write access for Summits Events', - ], - [ - 'name' => sprintf(SummitScopes::WritePresentationData, $current_realm), - 'short_description' => 'Write Summit Presentations', - 'description' => 'Grants write access for Summits Presentations', - ], - array( - 'name' => sprintf('%s/summits/delete-event', $current_realm), - 'short_description' => 'Delete Summit Events', - 'description' => 'Grants delete access for Summits Events', - ), - array( - 'name' => sprintf('%s/summits/publish-event', $current_realm), - 'short_description' => 'Publish/UnPublish Summit Events', - 'description' => 'Grants Publish/UnPublish access for Summits Events', - ), - [ - 'name' => sprintf('%s/summits/read-external-orders', $current_realm), - 'short_description' => 'Allow to read External Orders', - 'description' => 'Allow to read External Orders', - ], - [ - 'name' => sprintf('%s/summits/confirm-external-orders', $current_realm), - 'short_description' => 'Allow to confirm External Orders', - 'description' => 'Allow to confirm External Orders', - ], - [ - 'name' => sprintf('%s/summits/write-videos', $current_realm), - 'short_description' => 'Allow to write presentation videos', - 'description' => 'Allow to write presentation videos', - ], - [ - 'name' => sprintf('%s/summits/read-notifications', $current_realm), - 'short_description' => 'Allow to read summit notifications', - 'description' => 'Allow to read summit notifications', - ], - [ - 'name' => sprintf(SummitScopes::WriteSpeakersData, $current_realm), - 'short_description' => 'Write Speakers Data', - 'description' => 'Grants write access for Speakers Data', - ], - [ - 'name' => sprintf(SummitScopes::ReadSpeakersData, $current_realm), - 'short_description' => 'Read Speakers Data', - 'description' => 'Grants read access for Speakers Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteMySpeakersData, $current_realm), - 'short_description' => 'Write My Speakers Profile Data', - 'description' => 'Grants write access for My Speaker Profile Data', - ], - [ - 'name' => sprintf(SummitScopes::ReadMySpeakersData, $current_realm), - 'short_description' => 'Read My Speakers Profile Data', - 'description' => 'Grants read access for My Speaker Profile Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteAttendeesData, $current_realm), - 'short_description' => 'Write Attendees Data', - 'description' => 'Grants write access for Attendees Data', - ], - [ - 'name' => sprintf(SummitScopes::WritePromoCodeData, $current_realm), - 'short_description' => 'Write Promo Codes Data', - 'description' => 'Grants write access for Promo Codes Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteLocationsData, $current_realm), - 'short_description' => 'Write Summit Locations Data', - 'description' => 'Grants write access for Summit Locations Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteLocationBannersData, $current_realm), - 'short_description' => 'Write Summit Location Banners Data', - 'description' => 'Grants write access for Summit Location Banners Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteTrackTagGroupsData, $current_realm), - 'short_description' => 'Write Summit Track Tag Groups Data', - 'description' => 'Grants write access for Summit Track Tag Groups Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteTrackQuestionTemplateData, $current_realm), - 'short_description' => 'Write Summit Track Question Template Data', - 'description' => 'Grants write access for Summit Track Question Template Data', - ], - [ - 'name' => sprintf(SummitScopes::WritePresentationVideosData, $current_realm), - 'short_description' => 'Write Summit Presentation Videos Data', - 'description' => 'Grants write access for Summit Presentation Videos Data', - ], - [ - 'name' => sprintf(SummitScopes::WritePresentationSlidesData, $current_realm), - 'short_description' => 'Write Summit Presentation Slides Data', - 'description' => 'Grants write access for Summit Presentation Slides Data', - ], - [ - 'name' => sprintf(SummitScopes::WritePresentationLinksData, $current_realm), - 'short_description' => 'Write Summit Presentation Links Data', - 'description' => 'Grants write access for Summit Presentation Links Data', - ], - [ - 'name' => sprintf(SummitScopes::WritePresentationMaterialsData, $current_realm), - 'short_description' => 'Write Summit Presentation Materials Data', - 'description' => 'Grants write access for Summit Materials Links Data', - ], - [ - 'name' => sprintf(SummitScopes::ReadMyBookableRoomsReservationData, $current_realm), - 'short_description' => 'Read my bookable rooms reservations', - 'description' => 'Read my bookable rooms reservations', - ], - [ - 'name' => sprintf(SummitScopes::WriteMyBookableRoomsReservationData, $current_realm), - 'short_description' => 'Write my bookable rooms reservations', - 'description' => 'Write my bookable rooms reservations', - ], - [ - 'name' => sprintf(SummitScopes::CreateOfflineRegistrationOrders, $current_realm), - 'short_description' => 'Create summit offline registration orders', - 'description' => 'Create summit offline registration orders', - ], - [ - 'name' => sprintf(SummitScopes::CreateRegistrationOrders, $current_realm), - 'short_description' => 'Create summit registration orders', - 'description' => 'Create summit registration orders', - ], - [ - 'name' => sprintf(SummitScopes::DeleteRegistrationOrders, $current_realm), - 'short_description' => 'Delete summit registration orders', - 'description' => 'Delete summit registration orders', - ], - [ - 'name' => sprintf(SummitScopes::DeleteMyRegistrationOrders, $current_realm), - 'short_description' => 'Delete my summit registration orders', - 'description' => 'Delete my summit registration orders', - ], - [ - 'name' => sprintf(SummitScopes::ReadMyRegistrationOrders, $current_realm), - 'short_description' => 'Read my summit registration orders', - 'description' => 'Read my summit registration orders', - ], - [ - 'name' => sprintf(SummitScopes::ReadRegistrationOrders, $current_realm), - 'short_description' => 'Read summit registration orders', - 'description' => 'Read summit registration orders', - ], - [ - 'name' => sprintf(SummitScopes::UpdateRegistrationOrders, $current_realm), - 'short_description' => 'Update summit registration orders', - 'description' => 'Update summit registration orders', - ], - [ - 'name' => sprintf(SummitScopes::UpdateMyRegistrationOrders, $current_realm), - 'short_description' => 'Update my summit registration orders', - 'description' => 'Update my summit registration orders', - ], - [ - 'name' => sprintf(SummitScopes::UpdateRegistrationOrdersBadges, $current_realm), - 'short_description' => 'Update summit registration orders badges', - 'description' => 'Update summit registration orders badges', - ], - [ - 'name' => sprintf(SummitScopes::PrintRegistrationOrdersBadges, $current_realm), - 'short_description' => 'print summit registration orders badges', - 'description' => 'print summit registration orders badges', - ], - [ - 'name' => sprintf(SummitScopes::ReadMyBadgeScan, $current_realm), - 'short_description' => 'read my badge scans', - 'description' => 'read my badge scans', - ], - [ - 'name' => sprintf(SummitScopes::WriteMyBadgeScan, $current_realm), - 'short_description' => 'allow to share my badge with sponsors', - 'description' => 'allow to share my badge with sponsors', - ], - [ - 'name' => sprintf(SummitScopes::ReadBadgeScan, $current_realm), - 'short_description' => 'read badge scans', - 'description' => 'read badge scans', - ], - [ - 'name' => sprintf(SummitScopes::WriteBadgeScan, $current_realm), - 'short_description' => 'write badge scans', - 'description' => 'write badge scans', - ], - [ - 'name' => sprintf(SummitScopes::ReadPaymentProfiles, $current_realm), - 'short_description' => 'read summit payment profiles', - 'description' => 'read summit payment profiles', - ], - [ - 'name' => sprintf(SummitScopes::WritePaymentProfiles, $current_realm), - 'short_description' => 'write summit payment profiles', - 'description' => 'write summit payment profiles', - ], - [ - 'name' => sprintf(SummitScopes::WriteRegistrationInvitations, $current_realm), - 'short_description' => 'write summit registration invitation', - 'description' => 'write summit registration invitation', - ], - [ - 'name' => sprintf(SummitScopes::ReadRegistrationInvitations, $current_realm), - 'short_description' => 'read summit registration invitation', - 'description' => 'read summit registration invitation', - ], - [ - 'name' => sprintf(SummitScopes::ReadMyRegistrationInvitations, $current_realm), - 'short_description' => 'read my summit registration invitation', - 'description' => 'read my summit registration invitation', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - - } - - private function seedMembersScopes(){ - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'members']); - - $scopes = [ - [ - 'name' => sprintf(MemberScopes::ReadMemberData, $current_realm), - 'short_description' => 'Get Members Data', - 'description' => 'Grants read only access for Members Data', - ], - [ - 'name' => sprintf(MemberScopes::ReadMyMemberData, $current_realm), - 'short_description' => 'Get My Member Data', - 'description' => 'Grants read only access for My Member', - ], - [ - 'name' => sprintf(MemberScopes::WriteMemberData, $current_realm), - 'short_description' => 'Allows write only access to members', - 'description' => 'Allows write only access to memberss', - ], - [ - 'name' => sprintf(MemberScopes::WriteMyMemberData, $current_realm), - 'short_description' => 'Allows write only access to my Member Data', - 'description' => 'Allows write only access to my Member Data', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedTagsScopes(){ - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'organizations']); - - $scopes = [ - [ - 'name' => sprintf(SummitScopes::ReadTagsData, $current_realm), - 'short_description' => 'Get Tags Data', - 'description' => 'Grants read only access for Tags Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteTagsData, $current_realm), - 'short_description' => 'Write Tags Data', - 'description' => 'Grants write access to Tags Data', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedOrganizationScopes(){ - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'companies']); - - $scopes = [ - [ - 'name' => sprintf(OrganizationScopes::ReadOrganizationData, $current_realm), - 'short_description' => 'Get Organizations Data', - 'description' => 'Grants read only access for Organization Data', - ], - [ - 'name' => sprintf(OrganizationScopes::WriteOrganizationData, $current_realm), - 'short_description' => 'Write Companies Data', - 'description' => 'Grants write access for Organization Data', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedCompaniesScopes(){ - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'companies']); - - $scopes = [ - [ - 'name' => sprintf(CompanyScopes::Read, $current_realm), - 'short_description' => 'Get Companies Data', - 'description' => 'Grants read only access for Companies Data', - ], - [ - 'name' => sprintf(CompanyScopes::Write, $current_realm), - 'short_description' => 'Write Companies Data', - 'description' => 'Grants write only access for Companies Data', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedSponsoredProjectsScopes(){ - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'sponsored-projects']); - - $scopes = [ - [ - 'name' => sprintf(SponsoredProjectScope::Read, $current_realm), - 'short_description' => 'Get Sponsored Projects Data', - 'description' => 'Grants read only access for Sponsored Projects Data', - ], - [ - 'name' => sprintf(SponsoredProjectScope::Write, $current_realm), - 'short_description' => 'Write Sponsored Projects Data', - 'description' => 'Grants write only access for Sponsored Projects Data', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedGroupsScopes(){ - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'groups']); - - $scopes = [ - array( - 'name' => sprintf('%s/groups/read', $current_realm), - 'short_description' => 'Get Groups Data', - 'description' => 'Grants read only access for Groups Data', - ), - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedTeamsScopes(){ - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'teams']); - - $scopes = [ - array( - 'name' => sprintf('%s/teams/read', $current_realm), - 'short_description' => 'Get Teams Data', - 'description' => 'Grants read only access for Teams Data', - ), - array( - 'name' => sprintf('%s/teams/write', $current_realm), - 'short_description' => 'Write Teams Data', - 'description' => 'Grants write access for Teams Data', - ), - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedSummitAdminGroupScopes(){ - - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'summit-administrator-groups']); - - $scopes = [ - [ - 'name' => sprintf(SummitScopes::ReadSummitAdminGroups, $current_realm), - 'short_description' => 'Get Summit Admin Groups Data', - 'description' => 'Grants read only access for Summit Admin Groups Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteSummitAdminGroups, $current_realm), - 'short_description' => 'Write Summit Admin Groups Data', - 'description' => 'Grants write access to Summit Admin Groups Data', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - - private function seedSummitMediaFileTypes(){ - - $current_realm = Config::get('app.scope_base_realm'); - $api = EntityManager::getRepository(\App\Models\ResourceServer\Api::class)->findOneBy(['name' => 'summit-media-file-types']); - - $scopes = [ - [ - 'name' => sprintf(SummitScopes::ReadSummitMediaFileTypes, $current_realm), - 'short_description' => 'Get Summit Media File Types Data', - 'description' => 'Grants read only access for Summit Media File Types Data', - ], - [ - 'name' => sprintf(SummitScopes::WriteSummitMediaFileTypes, $current_realm), - 'short_description' => 'Write Summit Media File Types Data', - 'description' => 'Grants write access to Summit Media File Types Data', - ], - ]; - - foreach ($scopes as $scope_info) { - $scope = new ApiScope(); - $scope->setName($scope_info['name']); - $scope->setShortDescription($scope_info['short_description']); - $scope->setDescription($scope_info['description']); - $scope->setActive(true); - $scope->setDefault(false); - $scope->setApi($api); - EntityManager::persist($scope); - } - - EntityManager::flush(); - } - -} \ No newline at end of file diff --git a/database/seeds/ApiSeeder.php b/database/seeds/ApiSeeder.php deleted file mode 100644 index 1ca0d09c..00000000 --- a/database/seeds/ApiSeeder.php +++ /dev/null @@ -1,155 +0,0 @@ -delete(); - DB::table('endpoint_api_authz_groups')->delete(); - DB::table('api_scopes')->delete(); - DB::table('api_endpoints')->delete(); - DB::table('apis')->delete(); - - // summit - - $api = new Api(); - $api->setName('summits'); - $api->setActive(true); - $api->setDescription('Summit API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - // members - - $api = new Api(); - $api->setName('members'); - $api->setActive(true); - $api->setDescription('Members API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - //tags - - $api = new Api(); - $api->setName('tags'); - $api->setActive(true); - $api->setDescription('tags API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - //companies - - $api = new Api(); - $api->setName('companies'); - $api->setActive(true); - $api->setDescription('companies API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - // sponsored projects - $api = new Api(); - $api->setName('sponsored-projects'); - $api->setActive(true); - $api->setDescription('Sponsored Projects API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - //groups - - $api = new Api(); - $api->setName('groups'); - $api->setActive(true); - $api->setDescription('groups API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - - // teams - - $api = new Api(); - $api->setName('teams'); - $api->setActive(true); - $api->setDescription('Teams API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - // organizations - - $api = new Api(); - $api->setName('organizations'); - $api->setActive(true); - $api->setDescription('Organizations API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - // track question templates - - $api = new Api(); - $api->setName('track-question-templates'); - $api->setActive(true); - $api->setDescription('Track Question Templates API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - // summit administrator groups - - $api = new Api(); - $api->setName('summit-administrator-groups'); - $api->setActive(true); - $api->setDescription('Summit Administrator Groups API'); - - EntityManager::persist($api); - - // summit-media-file-types - - $api = new Api(); - $api->setName('summit-media-file-types'); - $api->setActive(true); - $api->setDescription('Summit Media File Types API'); - - EntityManager::persist($api); - - EntityManager::flush(); - - } -} \ No newline at end of file diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php deleted file mode 100644 index 2e9d3b38..00000000 --- a/database/seeds/DatabaseSeeder.php +++ /dev/null @@ -1,28 +0,0 @@ -call(UsersTableSeeder::class); - Model::unguard(); - $this->call('ApiSeeder'); - $this->call('ApiScopesSeeder'); - $this->call('ApiEndpointsSeeder'); - // summit - $this->call('DefaultEventTypesSeeder'); - $this->call('DefaultPrintRulesSeeder'); - $this->call('SummitMediaFileTypeSeeder'); - } -} diff --git a/database/seeds/SummitEmailFlowEventSeeder.php b/database/seeds/SummitEmailFlowEventSeeder.php deleted file mode 100644 index 84e9b3b3..00000000 --- a/database/seeds/SummitEmailFlowEventSeeder.php +++ /dev/null @@ -1,39 +0,0 @@ -getRepository(Summit::class); - foreach ($summit_repository->findAll() as $summit) { - $summit->seedDefaultEmailFlowEvents(); - $em->persist($summit); - } - - $em->flush(); - } - -} \ No newline at end of file diff --git a/database/seeds/SummitEmailFlowTypeSeeder.php b/database/seeds/SummitEmailFlowTypeSeeder.php deleted file mode 100644 index e8f45ca5..00000000 --- a/database/seeds/SummitEmailFlowTypeSeeder.php +++ /dev/null @@ -1,350 +0,0 @@ -delete(); - DB::table("SummitEmailEventFlowType")->delete(); - DB::table("SummitEmailEventFlow")->delete(); - - self::seed(); - } - - - public static function seed(){ - $em = Registry::getManager(SilverstripeBaseModel::EntityManager); - // Registration Flow - $flow = new SummitEmailFlowType(); - $flow->setName("Registration"); - - self::createEventsTypes([ - [ - 'name' => InviteAttendeeTicketEditionMail::EVENT_NAME, - 'slug' => InviteAttendeeTicketEditionMail::EVENT_SLUG, - 'default_email_template' => InviteAttendeeTicketEditionMail::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitAttendeeTicketRegenerateHashEmail::EVENT_NAME, - 'slug' => SummitAttendeeTicketRegenerateHashEmail::EVENT_SLUG, - 'default_email_template' => SummitAttendeeTicketRegenerateHashEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => RegisteredMemberOrderPaidMail::EVENT_NAME, - 'slug' => RegisteredMemberOrderPaidMail::EVENT_SLUG, - 'default_email_template' => RegisteredMemberOrderPaidMail::DEFAULT_TEMPLATE - ], - [ - 'name' => RevocationTicketEmail::EVENT_NAME, - 'slug' => RevocationTicketEmail::EVENT_SLUG, - 'default_email_template' => RevocationTicketEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitAttendeeTicketEmail::EVENT_NAME, - 'slug' => SummitAttendeeTicketEmail::EVENT_SLUG, - 'default_email_template' => SummitAttendeeTicketEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => UnregisteredMemberOrderPaidMail::EVENT_NAME, - 'slug' => UnregisteredMemberOrderPaidMail::EVENT_SLUG, - 'default_email_template' => UnregisteredMemberOrderPaidMail::DEFAULT_TEMPLATE - ], - // reminders - [ - 'name' => SummitOrderReminderEmail::EVENT_NAME, - 'slug' => SummitOrderReminderEmail::EVENT_SLUG, - 'default_email_template' => SummitOrderReminderEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitTicketReminderEmail::EVENT_NAME, - 'slug' => SummitTicketReminderEmail::EVENT_SLUG, - 'default_email_template' => SummitTicketReminderEmail::DEFAULT_TEMPLATE - ], - // refunds - [ - 'name' => SummitOrderRefundAccepted::EVENT_NAME, - 'slug' => SummitOrderRefundAccepted::EVENT_SLUG, - 'default_email_template' => SummitOrderRefundAccepted::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitOrderRefundRequestAdmin::EVENT_NAME, - 'slug' => SummitOrderRefundRequestAdmin::EVENT_SLUG, - 'default_email_template' => SummitOrderRefundRequestAdmin::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitOrderRefundRequestOwner::EVENT_NAME, - 'slug' => SummitOrderRefundRequestOwner::EVENT_SLUG, - 'default_email_template' => SummitOrderRefundRequestOwner::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitTicketRefundAccepted::EVENT_NAME, - 'slug' => SummitTicketRefundAccepted::EVENT_SLUG, - 'default_email_template' => SummitTicketRefundAccepted::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitTicketRefundRequestAdmin::EVENT_NAME, - 'slug' => SummitTicketRefundRequestAdmin::EVENT_SLUG, - 'default_email_template' => SummitTicketRefundRequestAdmin::DEFAULT_TEMPLATE - ], - [ - 'name' => SummitTicketRefundRequestOwner::EVENT_NAME, - 'slug' => SummitTicketRefundRequestOwner::EVENT_SLUG, - 'default_email_template' => SummitTicketRefundRequestOwner::DEFAULT_TEMPLATE - ], - [ - 'name' => MemberPromoCodeEmail::EVENT_NAME, - 'slug' => MemberPromoCodeEmail::EVENT_SLUG, - 'default_email_template' => MemberPromoCodeEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => SpeakerPromoCodeEMail::EVENT_NAME, - 'slug' => SpeakerPromoCodeEMail::EVENT_SLUG, - 'default_email_template' => SpeakerPromoCodeEMail::DEFAULT_TEMPLATE - ], - [ - 'name' => InviteSummitRegistrationEmail::EVENT_NAME, - 'slug' => InviteSummitRegistrationEmail::EVENT_SLUG, - 'default_email_template' => InviteSummitRegistrationEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => ReInviteSummitRegistrationEmail::EVENT_NAME, - 'slug' => ReInviteSummitRegistrationEmail::EVENT_SLUG, - 'default_email_template' => ReInviteSummitRegistrationEmail::DEFAULT_TEMPLATE - ], - ], $flow); - - $em->persist($flow); - - // Bookable Rooms Flow - $flow = new SummitEmailFlowType(); - $flow->setName("Bookable Rooms"); - - self::createEventsTypes([ - [ - 'name' => BookableRoomReservationCanceledEmail::EVENT_NAME, - 'slug' => BookableRoomReservationCanceledEmail::EVENT_SLUG, - 'default_email_template' => BookableRoomReservationCanceledEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => BookableRoomReservationCreatedEmail::EVENT_NAME, - 'slug' => BookableRoomReservationCreatedEmail::EVENT_SLUG, - 'default_email_template' => BookableRoomReservationCreatedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => BookableRoomReservationPaymentConfirmedEmail::EVENT_NAME, - 'slug' => BookableRoomReservationPaymentConfirmedEmail::EVENT_SLUG, - 'default_email_template' => BookableRoomReservationPaymentConfirmedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => BookableRoomReservationRefundAcceptedEmail::EVENT_NAME, - 'slug' => BookableRoomReservationRefundAcceptedEmail::EVENT_SLUG, - 'default_email_template' => BookableRoomReservationRefundAcceptedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => BookableRoomReservationRefundRequestedAdminEmail::EVENT_NAME, - 'slug' => BookableRoomReservationRefundRequestedAdminEmail::EVENT_SLUG, - 'default_email_template' => BookableRoomReservationRefundRequestedAdminEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => BookableRoomReservationRefundRequestedOwnerEmail::EVENT_NAME, - 'slug' => BookableRoomReservationRefundRequestedOwnerEmail::EVENT_SLUG, - 'default_email_template' => BookableRoomReservationRefundRequestedOwnerEmail::DEFAULT_TEMPLATE - ], - ], $flow); - - - $em->persist($flow); - - // Schedule Flow - $flow = new SummitEmailFlowType(); - $flow->setName("Schedule"); - - self::createEventsTypes([ - [ - 'name' => RSVPRegularSeatMail::EVENT_NAME, - 'slug' => RSVPRegularSeatMail::EVENT_SLUG, - 'default_email_template' => RSVPRegularSeatMail::DEFAULT_TEMPLATE - ], - [ - 'name' => RSVPWaitListSeatMail::EVENT_NAME, - 'slug' => RSVPWaitListSeatMail::EVENT_SLUG, - 'default_email_template' => RSVPWaitListSeatMail::DEFAULT_TEMPLATE - ], - [ - 'name' => ShareEventEmail::EVENT_NAME, - 'slug' => ShareEventEmail::EVENT_SLUG, - 'default_email_template' => ShareEventEmail::DEFAULT_TEMPLATE - ], - ], $flow); - - $em->persist($flow); - - // Presentation Submissions Flow - $flow = new SummitEmailFlowType(); - $flow->setName("Presentation Submissions"); - - self::createEventsTypes([ - [ - 'name' => PresentationCreatorNotificationEmail::EVENT_NAME, - 'slug' => PresentationCreatorNotificationEmail::EVENT_SLUG, - 'default_email_template' => PresentationCreatorNotificationEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationSpeakerNotificationEmail::EVENT_NAME, - 'slug' => PresentationSpeakerNotificationEmail::EVENT_SLUG, - 'default_email_template' => PresentationSpeakerNotificationEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationModeratorNotificationEmail::EVENT_NAME, - 'slug' => PresentationModeratorNotificationEmail::EVENT_SLUG, - 'default_email_template' => PresentationModeratorNotificationEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationSpeakerSelectionProcessAcceptedAlternateEmail::EVENT_NAME, - 'slug' => PresentationSpeakerSelectionProcessAcceptedAlternateEmail::EVENT_SLUG, - 'default_email_template' => PresentationSpeakerSelectionProcessAcceptedAlternateEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationSpeakerSelectionProcessAcceptedOnlyEmail::EVENT_NAME, - 'slug' => PresentationSpeakerSelectionProcessAcceptedOnlyEmail::EVENT_SLUG, - 'default_email_template' => PresentationSpeakerSelectionProcessAcceptedOnlyEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationSpeakerSelectionProcessAcceptedRejectedEmail::EVENT_NAME, - 'slug' => PresentationSpeakerSelectionProcessAcceptedRejectedEmail::EVENT_SLUG, - 'default_email_template' => PresentationSpeakerSelectionProcessAcceptedRejectedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationSpeakerSelectionProcessAlternateOnlyEmail::EVENT_NAME, - 'slug' => PresentationSpeakerSelectionProcessAlternateOnlyEmail::EVENT_SLUG, - 'default_email_template' => PresentationSpeakerSelectionProcessAlternateOnlyEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationSpeakerSelectionProcessAlternateRejectedEmail::EVENT_NAME, - 'slug' => PresentationSpeakerSelectionProcessAlternateRejectedEmail::EVENT_SLUG, - 'default_email_template' => PresentationSpeakerSelectionProcessAlternateRejectedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationSpeakerSelectionProcessRejectedEmail::EVENT_NAME, - 'slug' => PresentationSpeakerSelectionProcessRejectedEmail::EVENT_SLUG, - 'default_email_template' => PresentationSpeakerSelectionProcessRejectedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => ImportEventSpeakerEmail::EVENT_NAME, - 'slug' => ImportEventSpeakerEmail::EVENT_SLUG, - 'default_email_template' => ImportEventSpeakerEmail::DEFAULT_TEMPLATE - ], - - ], $flow); - - $em->persist($flow); - $em->flush(); - - // Presentation Selection Flow - - $flow = new SummitEmailFlowType(); - $flow->setName("Presentation Selections"); - - self::createEventsTypes([ - [ - 'name' => PresentationCategoryChangeRequestCreatedEmail::EVENT_NAME, - 'slug' => PresentationCategoryChangeRequestCreatedEmail::EVENT_SLUG, - 'default_email_template' => PresentationCategoryChangeRequestCreatedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => PresentationCategoryChangeRequestResolvedEmail::EVENT_NAME, - 'slug' => PresentationCategoryChangeRequestResolvedEmail::EVENT_SLUG, - 'default_email_template' => PresentationCategoryChangeRequestResolvedEmail::DEFAULT_TEMPLATE - ], - [ - 'name' => SpeakerEmail::EVENT_NAME, - 'slug' => SpeakerEmail::EVENT_SLUG, - 'default_email_template' => SpeakerEmail::DEFAULT_TEMPLATE - ], - ], $flow); - - $em->persist($flow); - $em->flush(); - } - /** - * @param array $payload - * @param SummitEmailFlowType $flow - */ - static public function createEventsTypes(array $payload , SummitEmailFlowType $flow){ - foreach($payload as $definition){ - $event_type = new SummitEmailEventFlowType(); - $event_type->setName($definition['name']); - $event_type->setSlug($definition['slug']); - $event_type->setDefaultEmailTemplate($definition['default_email_template']); - $flow->addFlowEventType($event_type); - } - } -} \ No newline at end of file diff --git a/database/seeds/SummitMediaFileTypeSeeder.php b/database/seeds/SummitMediaFileTypeSeeder.php deleted file mode 100644 index 5df0c913..00000000 --- a/database/seeds/SummitMediaFileTypeSeeder.php +++ /dev/null @@ -1,99 +0,0 @@ -findOneBy(['name' => "Online presence file upload"])) { - $type = new SummitMediaFileType(); - $type->setName("Online presence file upload"); - $type->setDescription("Online presence file upload: JPEG or PNG"); - $type->setAllowedExtensions("JPG|JPEG|PNG"); - $type->markAsSystemDefined(); - $em->persist($type); - } - - if(!$repository->findOneBy(['name' => "Print file upload: PDF, EPS or AI"])) { - $type = new SummitMediaFileType(); - $type->setName("Print file upload: PDF, EPS or AI"); - $type->setDescription("Print file upload: PDF, EPS or AI"); - $type->setAllowedExtensions("EPS|PDF|AI"); - $type->markAsSystemDefined(); - $em->persist($type); - } - - if(!$repository->findOneBy(['name' => "Backdrop file upload: PDF only"])) { - $type = new SummitMediaFileType(); - $type->setName("Backdrop file upload: PDF only"); - $type->setDescription("Backdrop file upload: PDF only"); - $type->setAllowedExtensions("PDF"); - $type->markAsSystemDefined(); - $em->persist($type); - } - - if(!$repository->findOneBy(['name' => "Presentation slides: (Keynote, powerpoint or JPEG)"])) { - $type = new SummitMediaFileType(); - $type->setName("Presentation slides: (Keynote, powerpoint or JPEG)"); - $type->setDescription("Presentation slides: (Keynote, powerpoint or JPEG)"); - $type->setAllowedExtensions("KEYNOTE|JPG|JPEG|PPT|PPTX"); - $type->markAsSystemDefined(); - $em->persist($type); - } - - if(!$repository->findOneBy(['name' => "Video (MOV or MP4)"])) { - $type = new SummitMediaFileType(); - $type->setName("Video (MOV or MP4)"); - $type->setDescription("Video (MOV or MP4)"); - $type->setAllowedExtensions("MOV|MP4"); - $type->markAsSystemDefined(); - $em->persist($type); - } - - if(!$repository->findOneBy(['name' => "Photoshop PSD file or PDF file"])) { - $type = new SummitMediaFileType(); - $type->setName("Photoshop PSD file or PDF file"); - $type->setDescription("Photoshop PSD file or PDF file"); - $type->setAllowedExtensions("PSD|PDF"); - $type->markAsSystemDefined(); - $em->persist($type); - } - - if(!$repository->findOneBy(['name' => "Scalable Vector Graphics file: SVG"])) { - $type = new SummitMediaFileType(); - $type->setName("Scalable Vector Graphics file: SVG"); - $type->setDescription("Scalable Vector Graphics file: SVG"); - $type->setAllowedExtensions("SVG"); - $type->markAsSystemDefined(); - $em->persist($type); - } - - $em->flush(); - } -} \ No newline at end of file diff --git a/database/seeds/TestSeeder.php b/database/seeds/TestSeeder.php deleted file mode 100644 index d4344b1c..00000000 --- a/database/seeds/TestSeeder.php +++ /dev/null @@ -1,36 +0,0 @@ -call('ApiSeeder'); - $this->call('ApiScopesSeeder'); - $this->call('ApiEndpointsSeeder'); - // summit - $this->call('DefaultEventTypesSeeder'); - $this->call('DefaultPrintRulesSeeder'); - $this->call('SummitEmailFlowTypeSeeder'); - $this->call('SummitEmailFlowEventSeeder'); - $this->call('SummitMediaFileTypeSeeder'); - } -} \ No newline at end of file diff --git a/database/seeds/summit/DefaultEventTypesSeeder.php b/database/seeds/summit/DefaultEventTypesSeeder.php deleted file mode 100644 index 15c20575..00000000 --- a/database/seeds/summit/DefaultEventTypesSeeder.php +++ /dev/null @@ -1,189 +0,0 @@ -getRepository(DefaultSummitEventType::class); - - // presentation default types - - $presentation_type = $repo->getByType(IPresentationType::Presentation); - - if(is_null($presentation_type)){ - $presentation_type = new DefaultPresentationType(); - $presentation_type->setType(IPresentationType::Presentation); - $presentation_type->setMinSpeakers(1); - $presentation_type->setMaxSpeakers(3); - $presentation_type->setMinModerators(0); - $presentation_type->setMaxModerators(0); - $presentation_type->setUseSpeakers(true); - $presentation_type->setShouldBeAvailableOnCfp(true); - $presentation_type->setAreSpeakersMandatory(false); - $presentation_type->setUseModerator(false); - $presentation_type->setIsModeratorMandatory(false); - $em->persist($presentation_type); - } - - $key_note = $repo->getByType(IPresentationType::Keynotes); - - if(is_null($key_note)){ - $key_note = new DefaultPresentationType(); - $key_note->setType(IPresentationType::Keynotes); - $key_note->setMinSpeakers(1); - $key_note->setMaxSpeakers(3); - $key_note->setMinModerators(0); - $key_note->setMaxModerators(1); - $key_note->setUseSpeakers(true); - $key_note->setShouldBeAvailableOnCfp(true); - $key_note->setAreSpeakersMandatory(false); - $key_note->setUseModerator(true); - $key_note->setIsModeratorMandatory(false); - $em->persist($key_note); - } - - $panel = $repo->getByType(IPresentationType::Panel); - - if(is_null($panel)){ - $panel = new DefaultPresentationType(); - $panel->setType(IPresentationType::Panel); - $panel->setMinSpeakers(1); - $panel->setMaxSpeakers(3); - $panel->setMinModerators(0); - $panel->setMaxModerators(1); - $panel->setUseSpeakers(true); - $panel->setShouldBeAvailableOnCfp(true); - $panel->setAreSpeakersMandatory(false); - $panel->setUseModerator(true); - $panel->setIsModeratorMandatory(false); - $em->persist($panel); - } - - $lighting_talks = $repo->getByType(IPresentationType::LightingTalks); - - if(is_null($lighting_talks)){ - $lighting_talks = new DefaultPresentationType(); - $lighting_talks->setType(IPresentationType::LightingTalks); - $lighting_talks->setMinSpeakers(1); - $lighting_talks->setMaxSpeakers(3); - $lighting_talks->setMinModerators(0); - $lighting_talks->setMaxModerators(0); - $lighting_talks->setUseSpeakers(true); - $lighting_talks->setShouldBeAvailableOnCfp(true); - $lighting_talks->setAreSpeakersMandatory(false); - $lighting_talks->setUseModerator(false); - $lighting_talks->setIsModeratorMandatory(false); - $em->persist($lighting_talks); - } - - $fishbowl = $repo->getByType(IPresentationType::Fishbowl); - - if(is_null($fishbowl)){ - $fishbowl = new DefaultPresentationType(); - $fishbowl->setType(IPresentationType::Fishbowl); - $fishbowl->setMinSpeakers(0); - $fishbowl->setMaxSpeakers(2); - $fishbowl->setMinModerators(0); - $fishbowl->setMaxModerators(2); - $fishbowl->setUseSpeakers(true); - $fishbowl->setShouldBeAvailableOnCfp(false); - $fishbowl->setAreSpeakersMandatory(false); - $fishbowl->setUseModerator(true); - $fishbowl->setIsModeratorMandatory(false); - $em->persist($fishbowl); - } - - $workshop = $repo->getByType(IPresentationType::Workshop); - - if(is_null($fishbowl)){ - $workshop = new DefaultPresentationType(); - $workshop->setType(IPresentationType::Workshop); - $workshop->setMinSpeakers(1); - $workshop->setMaxSpeakers(4); - $workshop->setMinModerators(0); - $workshop->setMaxModerators(0); - $workshop->setUseSpeakers(true); - $workshop->setShouldBeAvailableOnCfp(true); - $workshop->setAreSpeakersMandatory(false); - $workshop->setUseModerator(false); - $workshop->setIsModeratorMandatory(false); - $em->persist($workshop); - } - - // events default types - - $lunch = $repo->getByType(ISummitEventType::Lunch); - if (is_null($lunch)) { - $lunch = new DefaultSummitEventType(); - $lunch->setType(ISummitEventType::Lunch); - $lunch->setAllowsAttachment(true); - $em->persist($lunch); - } - - $hand_on_labs = $repo->getByType(ISummitEventType::HandonLabs); - if (is_null($hand_on_labs)) { - $hand_on_labs = new DefaultSummitEventType(); - $hand_on_labs->setType(ISummitEventType::HandonLabs); - $em->persist($hand_on_labs); - } - - $evening_events = $repo->getByType(ISummitEventType::EveningEvents); - if (is_null($evening_events)) { - $evening_events = new DefaultSummitEventType(); - $evening_events->setType(ISummitEventType::EveningEvents); - $em->persist($evening_events); - } - - $breaks = $repo->getByType(ISummitEventType::Breaks); - if (is_null($breaks)) { - $breaks = new DefaultSummitEventType(); - $breaks->setType(ISummitEventType::Breaks); - $em->persist($breaks); - } - - $breakfast = $repo->getByType(ISummitEventType::Breakfast); - if (is_null($breakfast)) { - $breakfast = new DefaultSummitEventType(); - $breakfast->setType(ISummitEventType::Breakfast); - $em->persist($breakfast); - } - - $marketplace_hours = $repo->getByType(ISummitEventType::MarketplaceHours); - if (is_null($marketplace_hours)) { - $marketplace_hours = new DefaultSummitEventType(); - $marketplace_hours->setType(ISummitEventType::MarketplaceHours); - $em->persist($marketplace_hours); - } - - $em->flush(); - - } -} \ No newline at end of file diff --git a/database/seeds/summit/DefaultPrintRulesSeeder.php b/database/seeds/summit/DefaultPrintRulesSeeder.php deleted file mode 100644 index 97310f29..00000000 --- a/database/seeds/summit/DefaultPrintRulesSeeder.php +++ /dev/null @@ -1,55 +0,0 @@ -getRepository(SummitAttendeeBadgePrintRule::class); - $repo_group = $em->getRepository(Group::class); - $group = $repo_group->getBySlug(IGroup::BadgePrinters); - if(is_null($group)){ - $group = new Group(); - $group->setTitle(IGroup::BadgePrinters); - $group->setCode(IGroup::BadgePrinters); - $group->setDescription(IGroup::BadgePrinters); - $em->persist($group); - $em->flush(); - } - $repo->deleteAll(); - - $em->flush(); - - $rule1 = new SummitAttendeeBadgePrintRule(); - $rule1->setMaxPrintTimes(1); - $rule1->setGroup($group); - - $em->persist($rule1); - $em->flush(); - } -} \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py deleted file mode 100644 index b369b7cf..00000000 --- a/doc/source/conf.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- -# 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. - -import datetime -import os -import sys - -sys.path.insert(0, os.path.abspath('../..')) -# -- General configuration ---------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sphinx.ext.autodoc', - 'sphinxcontrib.httpdomain', - #'sphinx.ext.intersphinx', - 'oslosphinx', - 'yasfb', -] - -# Feed configuration for yasfb -feed_base_url = 'http://ci.openstack.org/openstackid-resources' -feed_author = 'OpenStack Infrastructure Team' - -exclude_patterns = [ - 'template.rst', -] - -# Optionally allow the use of sphinxcontrib.spelling to verify the -# spelling of the documents. -try: - import sphinxcontrib.spelling - extensions.append('sphinxcontrib.spelling') -except ImportError: - pass - -# autodoc generation is a bit aggressive and a nuisance when doing heavy -# text edit cycles. -# execute "export SPHINX_DEBUG=1" in your terminal to disable - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'openstackid-resources' -copyright = u'%s, OpenStack Foundation' % datetime.date.today().year - -# If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -add_module_names = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# -- Options for HTML output -------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -# html_theme_path = ["."] -# html_theme = '_theme' -# html_static_path = ['static'] - -# Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). -latex_documents = [ - ('index', - '%s.tex' % project, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), -] - -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst deleted file mode 100644 index 0253d7c7..00000000 --- a/doc/source/index.rst +++ /dev/null @@ -1,17 +0,0 @@ -======================================================= -Welcome to OpenStackId's Resource Server documentation! -======================================================= - -Introduction -============ - -Table of contents -================= - -Client API Reference --------------------- - -.. toctree:: - :maxdepth: 1 - - restapi/v1 \ No newline at end of file diff --git a/doc/source/restapi/v1.rst b/doc/source/restapi/v1.rst deleted file mode 100644 index 0ca4ed0c..00000000 --- a/doc/source/restapi/v1.rst +++ /dev/null @@ -1,560 +0,0 @@ -================== -OAuth 2.0 Rest API -================== - -Schema -^^^^^^ - -All API access is over HTTPS, and accessed from the **https://openstackid-resources.org/** -domain. All data is sent and received as JSON. - -Parameters -^^^^^^^^^^ - -Many API methods take optional parameters. For GET requests, any parameters not -specified as a segment in the path can be passed as an HTTP query string - -Pagination -^^^^^^^^^^ - -Requests that return multiple items will be paginated to 10 items by default. -You can specify further pages with the **?page** parameter. For some -resources, you can also set a custom page size up to 100 with the **?per_page** -parameter. - -Rate Limiting -^^^^^^^^^^^^^ - -This is configured per API endpoint. -You can check the returned HTTP headers of any API request to see your current -rate limit status:: - - X-RateLimit-Limit: 60 - X-RateLimit-Remaining: 56 - X-RateLimit-Reset: 1372700873 - - -The headers tell you everything you need to know about your current rate limit -status : - -======================= ============================================================================== -Header Name Description -======================= ============================================================================== -X-RateLimit-Limit The maximum number of requests that the consumer is permitted to make per hour. -X-RateLimit-Remaining The number of requests remaining in the current rate limit window. -X-RateLimit-Reset The number of seconds remaining until the current rate limit window resets. -======================= ============================================================================== - -If your application triggers this rate limit, you'll receive an informative -response: - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 403 Forbidden - Content-Type: application/json; charset=utf-8 - Connection: close - - { - - "message": "You have triggered an abuse detection mechanism and have been - temporarily blocked. Please retry your request again later." - - } - -Conditional requests -^^^^^^^^^^^^^^^^^^^^ - -Most responses return an **ETag** header. You can use the values -of this headers to make subsequent requests to those resources using the -**If-None-Match** header, respectively. If the resource -has not changed, the server will return a **304 Not Modified**. - - -Cross Origin Resource Sharing -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -The API supports Cross Origin Resource Sharing (CORS) for AJAX requests from -any origin. -You can read the [CORS W3C Recommendation](http://www.w3.org/TR/cors), or -[this intro] -(http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity) from -the HTML 5 Security Guide. - -JSON-P Callbacks -^^^^^^^^^^^^^^^^ - -You can send a **?callback** parameter to any GET call to have the results -wrapped in a JSON function. This is typically used when browsers want to -embed OpenStack content in web pages by getting around cross domain issues. -The response includes the same data output as the regular API, plus the -relevant HTTP Header information. - - -MarketPlace API -^^^^^^^^^^^^^^^ - -Public Clouds Endpoints ------------------------ - -Allows to get read only access to public clouds related data ( clouds and data -centers locations) - -.. http:get:: /api/v1/marketplace/public-clouds - - Get a list of public clouds - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/public-clouds HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Content-Type: text/javascript - - { - - "total":20, - "per_page":10, - "current_page":1, - "last_page":2, - "from":1, - "to":10, - "data":[ - { - "ID":"YYYY", - "Created":"2014-04-23 05:36:10", - "LastEdited":"2015-02-04 11:13:58", - "Name":"Next-Generation AgileCLOUD", - "Slug":"next-generation-agilecloud", - "Overview":"....", - "Call2ActionUri":"http:\/\/....", - "Active":"1", - "CompanyID":"XXX" - } - ,{...} - ] - - } - - :query page: used in conjunction with "per_page" query string parameter. - indicates the desired page number, when we want paginate - over results - :query per_page: used in conjunction with "page" query string parameter. - indicates the desired page size - :query status: (optional filter) allow us to get active, non active or all - public clouds - :query order_by: (optional) used in conjunction with query string parameter - "order_dir", point out the desired order of the result (date or name) - :query order_dir: (optional) used in conjunction with query string parameter - "order", point out the desired order direction of the result (asc or desc) - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 412: invalid parameters - :statuscode 500: server error - -.. http:get:: api/v1/marketplace/public-clouds/(int:id) - - Get desired public cloud point out by `id` param - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/public-clouds/123456 HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Vary: Accept - Content-Type: text/javascript - - { - "ID":"123456", - "Created":"2014-04-23 05:36:10", - "LastEdited":"2015-02-04 11:13:58", - "Name":"test public cloud", - "Slug":"test-public-cloud", - "Overview":"lorep ip sum", - "Call2ActionUri":"http:\/\/.../", - "Active":"1", - "CompanyID":"123456" - } - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 404: entity not found - :statuscode 500: server error - - -.. http:get:: /api/v1/marketplace/public-clouds/(int:id)/data-centers - - Get data center locations for public cloud pointed out by `id` param - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/public-clouds/123456/data-centers HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Vary: Accept - Content-Type: text/javascript - - {"datacenters":[ - { - "ID":"72", - "Created":"2014-05-07 15:19:39", - "LastEdited":"2014-05-07 15:19:39", - "Name":"West", - "Endpoint":"https:\/\/identity.uswest1.cloud.io.com\/v2.0", - "Color":"000000", - "locations":[ - { - "ID":"109", - "Created":"2014-05-07 15:19:39", - "LastEdited":"2014-05-07 15:19:39", - "City":"Phoenix", - "State":"AZ", - "Country":"US", - "Lat":"33.45", - "Lng":"-112.07" - } - ] - },... - ] - } - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 404: entity not found (cloud) - :statuscode 500: server error - -Private Clouds Endpoints ------------------------- - -Allows to get read only access to private clouds related data ( clouds and data -centers locations) - -.. http:get:: /api/v1/marketplace/private-clouds - - Get a list of private clouds - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/private-clouds HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Content-Type: text/javascript - - { - - "total":20, - "per_page":10, - "current_page":1, - "last_page":2, - "from":1, - "to":10, - "data":[ - { - "ID":"YYYY", - "Created":"2014-04-23 05:36:10", - "LastEdited":"2015-02-04 11:13:58", - "Name":"test private cloud", - "Slug":"test-private-cloud", - "Overview":"....", - "Call2ActionUri":"http:\/\/....", - "Active":"1", - "CompanyID":"XXX" - } - ,{...} - ] - - } - - :query page: used in conjunction with "per_page" query string parameter. - indicates the desired page number, when we want paginate - over results - :query per_page: used in conjunction with "page" query string parameter. - indicates the desired page size - :query status: (optional filter) allow us to get active, non active or all - public clouds - :query order_by: (optional) used in conjunction with query string parameter - "order_dir", point out the desired order of the result (date or name) - :query order_dir: (optional) used in conjunction with query string parameter - "order", point out the desired order direction of the result (asc or desc) - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 412: invalid parameters - :statuscode 500: server error - -.. http:get:: /api/v1/marketplace/private-clouds/(int:id) - - Get desired private cloud point out by `id` param - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/private-clouds/123456 HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Vary: Accept - Content-Type: text/javascript - - { - "ID":"123456", - "Created":"2014-04-23 05:36:10", - "LastEdited":"2015-02-04 11:13:58", - "Name":"test private cloud", - "Slug":"test-private-cloud", - "Overview":"lorep ip sum", - "Call2ActionUri":"http:\/\/..", - "Active":"1", - "CompanyID":"123456" - } - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 404: entity not found - :statuscode 500: server error - - -.. http:get:: /api/v1/marketplace/private-clouds/(int:id)/data-centers - - Get data center locations for private cloud pointed out by `id` param - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/private-clouds/123456/data-centers HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Vary: Accept - Content-Type: text/javascript - - {"datacenters":[ - { - "ID":"72", - "Created":"2014-05-07 15:19:39", - "LastEdited":"2014-05-07 15:19:39", - "Name":"West", - "Endpoint":"https:\/\/identity.uswest1.cloud.io.com\/v2.0", - "Color":"000000", - "locations":[ - { - "ID":"109", - "Created":"2014-05-07 15:19:39", - "LastEdited":"2014-05-07 15:19:39", - "City":"Phoenix", - "State":"AZ", - "Country":"US", - "Lat":"33.45", - "Lng":"-112.07" - } - ] - },... - ] - } - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 404: entity not found (cloud) - :statuscode 500: server error - - -Consultants Endpoints ---------------------- - -Allows to get read only access to consultants related data ( consultants and -offices locations) - -.. http:get:: /api/v1/marketplace/consultants - - Get a list of consultants - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/consultants HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Content-Type: text/javascript - - { - - "total":20, - "per_page":10, - "current_page":1, - "last_page":2, - "from":1, - "to":10, - "data":[ - { - "ID":"YYYY", - "Created":"2014-04-23 05:36:10", - "LastEdited":"2015-02-04 11:13:58", - "Name":"Consultant Name", - "Slug":"consultant-name", - "Overview":"....", - "Call2ActionUri":"http:\/\/....", - "Active":"1", - "CompanyID":"XXX" - } - ,{...} - ] - - } - - :query page: used in conjunction with "per_page" query string parameter. - indicates the desired page number, when we want paginate - over results - :query per_page: used in conjunction with "page" query string parameter. - indicates the desired page size - :query status: (optional filter) allow us to get active, non active or all - public clouds - :query order_by: (optional) used in conjunction with query string parameter - "order_dir", point out the desired order of the result (date or name) - :query order_dir: (optional) used in conjunction with query string parameter - "order", point out the desired order direction of the result (asc or desc) - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 412: invalid parameters - :statuscode 500: server error - -.. http:get:: /api/v1/marketplace/consultants/(int:id) - - Get desired consultant point out by `id` param - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/consultants/123456 HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Vary: Accept - Content-Type: text/javascript - - { - "ID":"123456", - "Created":"2014-04-23 05:36:10", - "LastEdited":"2015-02-04 11:13:58", - "Name":"Consultant Name", - "Slug":"consultant_name", - "Overview":"lorep ip sum", - "Call2ActionUri":"http:\/\/...", - "Active":"1", - "CompanyID":"123456" - } - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 404: entity not found - :statuscode 500: server error - -.. http:get:: /api/v1/marketplace/consultants/(int:id)/offices - - Get offices locations for consultant pointed out by `id` param - - **Example request**: - - .. sourcecode:: http - - GET /api/v1/marketplace/consultants/123456/offices HTTP/1.1 - Host: openstackid.org - Accept: application/json, text/javascript - - **Example response**: - - .. sourcecode:: http - - HTTP/1.1 200 OK - Vary: Accept - Content-Type: text/javascript - - { - "offices":[ - { - "ID":"45", - "Created":"2014-04-29 16:02:50", - "LastEdited":"2014-04-29 16:02:50", - "Address":null, - "Address2":null, - "State":"CA", - "ZipCode":null, - "City":"Mountain View", - "Country":"US", - "Lat":"37.39", - "Lng":"-122.08" - },... - ] - } - - :reqheader Authorization: OAuth 2.0 Bearer Access Token - - :statuscode 200: no error - :statuscode 404: entity not found (consultant) - :statuscode 500: server error \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index dc6f1ebb..00000000 --- a/gulpfile.js +++ /dev/null @@ -1,16 +0,0 @@ -var elixir = require('laravel-elixir'); - -/* - |-------------------------------------------------------------------------- - | Elixir Asset Management - |-------------------------------------------------------------------------- - | - | Elixir provides a clean, fluent API for defining some basic Gulp tasks - | for your Laravel application. By default, we are compiling the Sass - | file for our application, as well as publishing vendor resources. - | - */ - -elixir(function(mix) { - mix.sass('app.scss'); -}); diff --git a/migrate.sh b/migrate.sh deleted file mode 100755 index df3d9d2c..00000000 --- a/migrate.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -php artisan doctrine:migrations:migrate --connection=config -php artisan doctrine:migrations:migrate --connection=model \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index 87481c73..00000000 --- a/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "private": true, - "scripts": { - "prod": "gulp --production", - "dev": "gulp watch" - }, - "devDependencies": { - "gulp": "^3.9.1", - "laravel-elixir": "^5.0.0", - "bootstrap-sass": "^3.3.0" - } -} diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 08f617a6..00000000 --- a/phpunit.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - ./tests/ - - - - - - diff --git a/public/.htaccess b/public/.htaccess deleted file mode 100644 index 903f6392..00000000 --- a/public/.htaccess +++ /dev/null @@ -1,20 +0,0 @@ - - - Options -MultiViews - - - RewriteEngine On - - # Redirect Trailing Slashes If Not A Folder... - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.*)/$ /$1 [L,R=301] - - # Handle Front Controller... - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^ index.php [L] - - # Handle Authorization Header - RewriteCond %{HTTP:Authorization} . - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index e69de29b..00000000 diff --git a/public/index.php b/public/index.php deleted file mode 100644 index c5820533..00000000 --- a/public/index.php +++ /dev/null @@ -1,58 +0,0 @@ - - */ - -/* -|-------------------------------------------------------------------------- -| Register The Auto Loader -|-------------------------------------------------------------------------- -| -| Composer provides a convenient, automatically generated class loader for -| our application. We just need to utilize it! We'll simply require it -| into the script here so that we don't have to worry about manual -| loading any of our classes later on. It feels nice to relax. -| -*/ - -require __DIR__.'/../bootstrap/autoload.php'; - -/* -|-------------------------------------------------------------------------- -| Turn On The Lights -|-------------------------------------------------------------------------- -| -| We need to illuminate PHP development, so let us turn on the lights. -| This bootstraps the framework and gets it ready for use, then it -| will load up this application so that we can run it and send -| the responses back to the browser and delight our users. -| -*/ - -$app = require_once __DIR__.'/../bootstrap/app.php'; - -/* -|-------------------------------------------------------------------------- -| Run The Application -|-------------------------------------------------------------------------- -| -| Once we have the application, we can handle the incoming request -| through the kernel, and send the associated response back to -| the client's browser allowing them to enjoy the creative -| and wonderful application we have prepared for them. -| -*/ - -$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); - -$response = $kernel->handle( - $request = Illuminate\Http\Request::capture() -); - -$response->send(); - -$kernel->terminate($request, $response); diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index eb053628..00000000 --- a/public/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: diff --git a/public/web.config b/public/web.config deleted file mode 100644 index 624c1760..00000000 --- a/public/web.config +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/readme.md b/readme.md index c78a4c1d..add16a5c 100644 --- a/readme.md +++ b/readme.md @@ -1,70 +1,11 @@ -# OpenStackId Resource Server +This project is no longer maintained at this location. It has moved to +https://github.com/OpenStackweb/summit-api. -## Prerequisites +The historical contents of this repository are still available in the +Git source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". - * LAMP/LEMP environment - * PHP >= 7.1 - * Redis - * composer (https://getcomposer.org/) - -## Install - -run following commands on root folder - * curl -s https://getcomposer.org/installer | php - * php composer.phar install --prefer-dist - * php composer.phar dump-autoload --optimize - * php artisan migrate --env=YOUR_ENVIRONMENT - * php artisan db:seed --env=YOUR_ENVIRONMENT - * phpunit --bootstrap vendor/autoload.php - * php artisan doctrine:generate:proxies - * php artisan doctrine:clear:metadata:cache - * php artisan doctrine:clear:query:cache - * php artisan doctrine:clear:result:cache - * php artisan doctrine:ensure:production - * php artisan route:clear - * php artisan route:cache - * give proper rights to storage folder (775 and proper users) - * chmod 777 vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer - -## Permissions - -Laravel may require some permissions to be configured: folders within storage and vendor require write access by the web server. - -## create SS schema - -php artisan doctrine:schema:create --sql --em=model > ss.sql - -## validate SS schema - -php artisan doctrine:schema:validate - -## Doctrine Migrations - -# For Config Storage - -## create new migration -php artisan doctrine:migrations:generate --connection=config --create= - -## check status -php artisan doctrine:migrations:status --connection=config - -## run -php artisan doctrine:migrations:migrate --connection=config - -# For Model Storage - -## create new migrations -php artisan doctrine:migrations:generate --connection=model --create= - -## check status -php artisan doctrine:migrations:status --connection=model - -## run -php artisan doctrine:migrations:migrate --connection=model - -## Queues - -php artisan queue:work - -# message broker -php artisan queue:work message_broker \ No newline at end of file +For any further questions, please email +service-discuss@lists.opendev.org or join #opendev on +OFTC. diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 585de733..00000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -oslosphinx -sphinx>=1.1.2,<1.2 -sphinxcontrib-httpdomain -yasfb>=0.5.1 \ No newline at end of file diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss deleted file mode 100644 index bb76e29c..00000000 --- a/resources/assets/sass/app.scss +++ /dev/null @@ -1,2 +0,0 @@ -// @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; - diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php deleted file mode 100644 index e5506df2..00000000 --- a/resources/lang/en/auth.php +++ /dev/null @@ -1,19 +0,0 @@ - 'These credentials do not match our records.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - -]; diff --git a/resources/lang/en/not_found_errors.php b/resources/lang/en/not_found_errors.php deleted file mode 100644 index 786a6246..00000000 --- a/resources/lang/en/not_found_errors.php +++ /dev/null @@ -1,113 +0,0 @@ - 'promo code id :promo_code_id does not belongs to summit id :summit_id.', - 'promo_code_email_code_not_found' => 'promo code id :promo_code_id does not belongs to summit id :summit_id.', - 'add_speaker_assistance_speaker_not_found' => 'speaker id :speaker_id not found', - 'send_speaker_summit_assistance_announcement_mail_not_found_assistance' => 'summit speaker assistance :assistance_id not found for summit id :summit_id', - // LocationService - 'LocationService.addVenueFloor.VenueNotFound' => 'venue :venue_id not found on summit :summit_id', - 'LocationService.updateVenueFloor.FloorNotFound' => 'floor :floor_id does not belongs to venue :venue_id', - 'LocationService.updateVenueFloor.VenueNotFound' => 'venue :venue_id not found on summit :summit_id', - 'LocationService.deleteVenueFloor.FloorNotFound' => 'floor :floor_id does not belongs to venue :venue_id', - 'LocationService.deleteVenueFloor.VenueNotFound' => 'venue :venue_id not found on summit :summit_id', - 'LocationService.addVenueRoom.FloorNotFound' => 'floor :floor_id does not belongs to venue :venue_id', - 'LocationService.addVenueRoom.VenueNotFound' => 'venue :venue_id not found on summit :summit_id', - 'LocationService.updateVenueRoom.FloorNotFound' => 'floor :floor_id does not belongs to venue :venue_id', - 'LocationService.updateVenueRoom.VenueNotFound' => 'venue :venue_id not found on summit :summit_id', - 'LocationService.addLocationBanner.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.deleteLocationBanner.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.deleteLocationBanner.BannerNotFound'=> 'banner :banner_id not found on location :location_id', - 'LocationService.updateLocationBanner.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.updateLocationBanner.BannerNotFound'=> 'banner :banner_id not found on location :location_id', - 'LocationService.addLocationMap.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.updateLocationMap.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.updateLocationMap.MapNotFound' => 'map :map_id does not belongs to location :location_id', - 'LocationService.deleteLocationMap.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.deleteLocationMap.MapNotFound' => 'map :map_id not found on location :location_id', - 'LocationService.addLocationImage.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.updateLocationImage.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.updateLocationImage.ImageNotFound' => 'image :image_id does not belongs to location :location_id', - 'LocationService.deleteLocationImage.LocationNotFound' => 'location :location_id not found on summit :summit_id', - 'LocationService.deleteLocationImage.ImageNotFound' => 'image :image_id not found on location :location_id', - // RSVPTemplateService - 'RSVPTemplateService.updateTemplate.TemplateNotFound' => 'template :template_id not found on summit :summit_id', - 'RSVPTemplateService.deleteTemplate.TemplateNotFound' => 'template :template_id not found on summit :summit_id', - 'RSVPTemplateService.addQuestion.TemplateNotFound' => 'template :template_id not found on summit :summit_id', - 'RSVPTemplateService.updateQuestion.TemplateNotFound' => 'template :template_id not found on summit :summit_id', - 'RSVPTemplateService.updateQuestion.QuestionNotFound' => 'question :question_id not found on template :template_id', - 'RSVPTemplateService.deleteQuestion.TemplateNotFound' => 'template :template_id not found on summit :summit_id', - 'RSVPTemplateService.deleteQuestion.QuestionNotFound' => 'question :question_id not found on template :template_id', - 'RSVPTemplateService.addQuestionValue.TemplateNotFound' => 'template :template_id not found on summit :summit_id', - 'RSVPTemplateService.addQuestionValue.QuestionNotFound' => 'question :question_id not found on template :template_id', - 'RSVPTemplateService.deleteQuestionValue.TemplateNotFound' => 'template :template_id not found on summit :summit_id', - 'RSVPTemplateService.deleteQuestionValue.QuestionNotFound' => 'question :question_id not found on template :template_id', - 'RSVPTemplateService.deleteQuestionValue.ValueNotFound' => 'value :value_id not found on question :question_id', - // SummitTicketTypeService - 'SummitTicketTypeService.updateTicketType.TicketTypeNotFound' => 'ticket type :ticket_type_id does not exists on summit :summit_id', - 'SummitTicketTypeService.deleteTicketType.TicketTypeNotFound' => 'ticket type :ticket_type_id does not exists on summit :summit_id', - // PresentationCategoryGroupService - 'PresentationCategoryGroupService.updateTrackGroup.TrackGroupNotFound' => 'track group :track_group_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.deleteTrackGroup.TrackGroupNotFound' => 'track group :track_group_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.associateTrack2TrackGroup.TrackGroupNotFound' => 'track group :track_group_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.associateTrack2TrackGroup.TrackNotFound' => 'track :track_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.disassociateTrack2TrackGroup.TrackGroupNotFound' => 'track group :track_group_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.disassociateTrack2TrackGroup.TrackNotFound' => 'track :track_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.associateAllowedGroup2TrackGroup.TrackGroupNotFound' => 'track group :track_group_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.associateAllowedGroup2TrackGroup.GroupNotFound' => 'group :group_id does not exists.', - 'PresentationCategoryGroupService.disassociateAllowedGroup2TrackGroup.TrackGroupNotFound' => 'track group :track_group_id does not exists on summit :summit_id', - 'PresentationCategoryGroupService.disassociateAllowedGroup2TrackGroup.GroupNotFound' => 'group :group_id does not exists.', - 'SummitService.updateSummit.SummitNotFound' => 'summit :summit_id not found', - 'SummitService.deleteSummit.SummitNotFound' => 'summit :summit_id not found', - // SummitPushNotificationService - 'SummitPushNotificationService.addPushNotification.EventNotFound' => 'event :event_id does not belongs to summit :summit_id schedule', - 'SummitPushNotificationService.addPushNotification.GroupNotFound' => 'group :group_id not found', - 'SummitPushNotificationService.addPushNotification.MemberNotFound' => 'member :member_id not found', - 'SummitPushNotificationService.approveNotification.NotificationNotFound' => 'notification :notification_id not found on summit :summit_id', - 'SummitPushNotificationService.unApproveNotification.NotificationNotFound'=> 'notification :notification_id not found on summit :summit_id', - 'SummitPushNotificationService.deleteNotification.NotificationNotFound'=> 'notification :notification_id not found on summit :summit_id', - 'SummitSelectionPlanService.updateSelectionPlan.SelectionPlanNotFound' => 'selection plan :selection_plan_id not found on summit :summit_id', - 'SummitSelectionPlanService.deleteSelectionPlan.SelectionPlanNotFound' => 'selection plan :selection_plan_id not found on summit :summit_id', - 'SummitSelectionPlanService.addTrackGroupToSelectionPlan.SelectionPlanNotFound' => 'selection plan :selection_plan_id not found on summit :summit_id', - 'SummitSelectionPlanService.addTrackGroupToSelectionPlan.TrackGroupNotFound' => 'track group :track_group_id not found on summit :summit_id', - 'SummitSelectionPlanService.deleteTrackGroupToSelectionPlan.SelectionPlanNotFound' => 'selection plan :selection_plan_id not found on summit :summit_id', - 'SummitSelectionPlanService.deleteTrackGroupToSelectionPlan.TrackGroupNotFound' => 'track group :track_group_id not found on summit :summit_id', - // Presentations - 'PresentationService.saveOrUpdatePresentation.trackNotFound' => 'track :track_id not found.', - 'PresentationService.submitPresentation.eventTypeNotFound' => 'event type :type_id not found.', - 'PresentationService.saveOrUpdatePresentation.trackQuestionNotFound' => 'extra question :question_id not found.', - 'PresentationService.updatePresentationSubmission.PresentationNotFound' => 'presentation :presentation_id not found', - // track tag groups - 'SummitTrackTagGroupService.updateTrackTagGroup.TrackTagGroupNotFound' => 'track tag group :track_tag_group_id not found on summit :summit_id', - 'SummitTrackTagGroupService.deleteTrackTagGroup.TrackTagGroupNotFound' => 'track tag group :track_tag_group_id not found on summit :summit_id', - 'SummitTrackTagGroupService.seedTagOnAllTrack.TagNotFound' => 'tag :tag_id not found', - 'SummitTrackTagGroupService.seedTagTrackGroupTagsOnTrack.TrackTagGroupNotFound' => 'track tag group :track_tag_group_id not found on summit :summit_id', - 'SummitTrackTagGroupService.seedTagTrackGroupTagsOnTrack.TrackNotFound' => 'track :track_id not found on summit :summit_id', - // track question templates - 'TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackQuestionTemplateNotFound' => 'track question template :track_question_template_id not found', - 'TrackQuestionTemplateService.deleteTrackQuestionTemplate.TrackQuestionTemplateNotFound' => 'track question template :track_question_template_id not found', - 'TrackQuestionTemplateService.addTrackQuestionValueTemplate.TrackQuestionTemplateNotFound' => 'track question template :track_question_template_id not found', - 'TrackQuestionTemplateService.updateTrackQuestionValueTemplate.TrackQuestionTemplateNotFound' => 'track question template :track_question_template_id not found', - 'TrackQuestionTemplateService.updateTrackQuestionValueTemplate.TrackQuestionTemplateValueNotFound' => 'track question template value :track_question_value_template_id not found', - 'TrackQuestionTemplateService.deleteTrackQuestionValueTemplate.TrackQuestionTemplateNotFound' => 'track question template :track_question_template_id not found', - 'TrackQuestionTemplateService.deleteTrackQuestionValueTemplate.TrackQuestionTemplateValueNotFound' => 'track question template value :track_question_value_template_id not found', - 'TrackQuestionTemplateService.addTrackQuestionTemplate.TrackNotFound' => 'track :track_id not found', - 'TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackNotFound' => 'track :track_id not found', - 'TrackQuestionTemplateService.updateTrackQuestionTemplate.DefaultValueNotFound' => 'default value :default_value not found', - // tracks - 'SummitTrackService.addTrackExtraQuestion.TrackNotFound' => 'track :track_id not found', - 'SummitTrackService.addTrackExtraQuestion.QuestionNotFound' => 'question :question_id not found', - 'SummitTrackService.removeTrackExtraQuestion.TrackNotFound' => 'track :track_id not found', - 'SummitTrackService.removeTrackExtraQuestion.QuestionNotFound' => 'question :question_id not found', -]; \ No newline at end of file diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php deleted file mode 100644 index fcab34b2..00000000 --- a/resources/lang/en/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« Previous', - 'next' => 'Next »', - -]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php deleted file mode 100644 index e5544d20..00000000 --- a/resources/lang/en/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Passwords must be at least six characters and match the confirmation.', - 'reset' => 'Your password has been reset!', - 'sent' => 'We have e-mailed your password reset link!', - 'token' => 'This password reset token is invalid.', - 'user' => "We can't find a user with that e-mail address.", - -]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php deleted file mode 100644 index b720584b..00000000 --- a/resources/lang/en/validation.php +++ /dev/null @@ -1,114 +0,0 @@ - 'The :attribute must be accepted.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'between' => [ - 'numeric' => 'The :attribute must be between :min and :max.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'string' => 'The :attribute must be between :min and :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'exists' => 'The selected :attribute is invalid.', - 'filled' => 'The :attribute field is required.', - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'max' => [ - 'numeric' => 'The :attribute may not be greater than :max.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'string' => 'The :attribute may not be greater than :max characters.', - 'array' => 'The :attribute may not have more than :max items.', - ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'numeric' => 'The :attribute must be at least :min.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'string' => 'The :attribute must be at least :min characters.', - 'array' => 'The :attribute must have at least :min items.', - ], - 'not_in' => 'The selected :attribute is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'present' => 'The :attribute field must be present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values is present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'numeric' => 'The :attribute must be :size.', - 'file' => 'The :attribute must be :size kilobytes.', - 'string' => 'The :attribute must be :size characters.', - 'array' => 'The :attribute must contain :size items.', - ], - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'url' => 'The :attribute format is invalid.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap attribute place-holders - | with something more reader friendly such as E-Mail Address instead - | of "email". This simply helps us make messages a little cleaner. - | - */ - - 'attributes' => [], - -]; diff --git a/resources/lang/en/validation_errors.php b/resources/lang/en/validation_errors.php deleted file mode 100644 index cc580ed4..00000000 --- a/resources/lang/en/validation_errors.php +++ /dev/null @@ -1,118 +0,0 @@ - 'Cannot delete a code that has been already sent.', - 'promo_code_delete_already_redeemed' => 'Cannot delete a code that has been already redeemed.', - 'promo_code_email_send_already_sent' => 'Cannot resend a code that has been already sent.', - 'promo_code_email_send_empty_email' => 'Cannot find an email address for the promocode owner.', - 'promo_code_email_send_empty_name' => 'Cannot find a name for the promocode owner.', - 'speaker_assistance_delete_already_confirmed' => 'Cannot delete summit assistance :assistance_id because is already confirmed by speaker :speaker_id', - 'add_speaker_assistance_speaker_already_has_assistance' => 'speaker id :speaker_id already has an assistance for summit id :summit_id', - 'add_speaker_assistance_speaker_is_not_on_summit' => 'speaker id :speaker_id is not related to summit id :summit_id ( is not assigned as speaker of any published presentations nor its assigned as moderator)', - 'speaker_assistance_does_not_belongs_to_summit' => 'summit assistance :assistance_id does not belongs to summit :summit_id', - 'send_speaker_summit_assistance_announcement_mail_email_already_sent' => 'speaker announcement email was already sent for speaker :speaker_id on summit :summit_id', - 'send_speaker_summit_assistance_announcement_mail_run_out_promo_code' => 'can not get any promo code for speaker :speaker_id , run out of :type promo codes for summit :summit_id', - 'send_speaker_summit_assistance_announcement_mail_code_already_redeemed' => 'promo code :promo_code already redeemed.', - 'send_speaker_summit_assistance_announcement_mail_invalid_mail_type' => 'mail type :mail_type is not valid.', - 'send_speaker_summit_assistance_promo_code_not_set' => 'speaker :speaker_id has not set a promo code for summit :summit_id, please set one manually.', - // LocationService - 'LocationService.addLocation.LocationNameAlreadyExists' => 'there is already another location with same name for summit :summit_id', - 'LocationService.addLocation.InvalidClassName' => 'invalid class name', - 'LocationService.addLocation.InvalidAddressOrCoordinates' => 'was passed a non-existent address', - 'LocationService.addLocation.OverQuotaLimit' => 'geocode api over rate limit, try again later', - 'LocationService.addLocation.geoCodingGenericError' => 'geocode api generic error', - 'LocationService.updateLocation.LocationNameAlreadyExists' => 'there is already another location with same name for summit :summit_id', - 'LocationService.updateLocation.LocationNotFoundOnSummit' => 'location :location_id not found on summit :summit_id', - 'LocationService.updateLocation.ClassNameMissMatch' => 'location :location_id on summit :summit_id does not belongs to class name :class_name', - 'LocationService.addVenueFloor.FloorNameAlreadyExists' => 'floor name :floor_name already belongs to another floor on venue :venue_id', - 'LocationService.addVenueFloor.FloorNumberAlreadyExists' => 'floor number :floor_number already belongs to another floor on venue :venue_id', - 'LocationService.updateVenueFloor.FloorNameAlreadyExists' => 'floor name :floor_name already belongs to another floor on venue :venue_id', - 'LocationService.updateVenueFloor.FloorNumberAlreadyExists' => 'floor number :floor_number already belongs to another floor on venue :venue_id', - 'LocationService.addVenueRoom.InvalidClassName' => 'invalid class name', - 'LocationService.addVenueRoom.LocationNameAlreadyExists' => 'there is already another location with same name for summit :summit_id', - 'LocationService.updateVenueRoom.LocationNameAlreadyExists' => 'there is already another location with same name for summit :summit_id', - 'LocationService.addLocationBanner.InvalidClassName' => 'invalid class name', - 'LocationService.addLocationMap.FileNotAllowedExtension' => 'file extension is not allowed (:allowed_extensions)', - 'LocationService.addLocationMap.FileMaxSize' => 'file exceeds max_file_size (:max_file_size MB)', - 'LocationService.updateLocationMap.FileNotAllowedExtension' => 'file extension is not allowed (:allowed_extensions)', - 'LocationService.updateLocationMap.FileMaxSize' => 'file exceeds max_file_size (:max_file_size MB)', - 'LocationService.addLocationImage.FileNotAllowedExtension' => 'file extension is not allowed (:allowed_extensions)', - 'LocationService.addLocationImage.FileMaxSize' => 'file exceeds max_file_size (:max_file_size MB)', - 'LocationService.updateLocationImage.FileNotAllowedExtension' => 'file extension is not allowed (:allowed_extensions)', - 'LocationService.updateLocationImage.FileMaxSize' => 'file exceeds max_file_size (:max_file_size MB)', - // RSVPTemplateService - 'RSVPTemplateService.addQuestion.QuestionNameAlreadyExists' => 'question name :name already exists for template :template_id', - 'RSVPTemplateService.updateQuestion.QuestionNameAlreadyExists' => 'question name :name already exists for template :template_id', - 'RSVPTemplateService.addQuestionValue.ValueAlreadyExist' => 'value :value already exists on question :question_id', - 'RSVPTemplateService.addTemplate.TitleAlreadyExists' => 'title :title already exists on summit :summit_id', - 'RSVPTemplateService.updateTemplate.TitleAlreadyExists' => 'title :title already exists on summit :summit_id', - // SummitTicketTypeService - 'SummitTicketTypeService.addTicketType.NameAlreadyExists' => 'ticket name :name already exists on summit :summit_id', - 'SummitTicketTypeService.addTicketType.ExternalIdAlreadyExists' => 'ticket external id :external_id already exists on summit :summit_id', - 'SummitTicketTypeService.updateTicketType.NameAlreadyExists' => 'ticket name :name already exists on summit :summit_id', - 'SummitTicketTypeService.updateTicketType.ExternalIdAlreadyExists' => 'ticket external id :external_id already exists on summit :summit_id', - 'SummitTicketTypeService.seedSummitTicketTypesFromEventBrite.MissingExternalId' => 'summit :summit_is has not set external id (eventbrite)', - // PresentationCategoryGroupService - 'PresentationCategoryGroupService.addTrackGroup.NameAlreadyExists' => 'name :name already exists for summit :summit_id', - // SummitService - 'SummitService.AddSummit.NameAlreadyExists' => 'name :name its already being assigned to another summit', - 'SummitService.updateSummit.NameAlreadyExists'=> 'name :name its already being assigned to another summit', - 'SummitService.updateSummit.SummitAlreadyActive' => 'summit :active_summit_id is already activated please deactivate it to set current summit as active', - 'SummitTrackService.copyTracks.SameSummit' => 'from summit is equal a to summit.', - // SummitPushNotificationService - 'SummitPushNotificationService.addPushNotification.MemberNotActive' => 'member :member_id is not active', - 'SummitPushNotificationService.deleteNotification.NotificationAlreadySent' => 'notification :notification_id is already sent.', - 'Summit.checkSelectionPlanConflicts.conflictOnSelectionWorkflow' => 'there is a conflict on selection dates with selection plan :selection_plan_id on summit :summit_id', - 'Summit.checkSelectionPlanConflicts.conflictOnSubmissionWorkflow' => 'there is a conflict on submission dates with selection plan :selection_plan_id on summit :summit_id', - 'Summit.checkSelectionPlanConflicts.conflictOnVotingWorkflow' => 'there is a conflict on voting dates with selection plan :selection_plan_id on summit :summit_id', - 'SummitSelectionPlanService.addSelectionPlan.alreadyExistName' => 'there is already another selection plan with same name on summit :summit_id', - 'SummitSelectionPlanService.updateSelectionPlan.alreadyExistName' => 'there is already another selection plan with same name on summit :summit_id', - // Presentations - 'PresentationService.saveOrUpdatePresentation.invalidPresentationType' => 'type id :type_id is not a valid presentation type', - 'PresentationService.saveOrUpdatePresentation.notAvailableCFP' => 'type id :type_id is not a available for CFP', - 'PresentationService.saveOrUpdatePresentation.trackDontBelongToSelectionPlan' => 'track :track_id does not belongs to selection plan :selection_plan_id', - 'PresentationService.submitPresentation.limitReached' => 'You reached the limit :limit of presentations.', - 'PresentationService.saveOrUpdatePresentation.MaxAllowedLinks' => 'max. links quantity allowed is :max_allowed_links.', - 'PresentationService.submitPresentation.NotValidSpeaker' => 'Current Member not has a valid speaker profile', - 'PresentationService.submitPresentation.NotValidSelectionPlan' => 'Current Summit not has a valid selection plan', - 'PresentationService.updatePresentationSubmission.NotValidSpeaker' => 'Current Member not has a valid speaker profile', - 'PresentationService.updatePresentationSubmission.NotValidSelectionPlan' => 'Current Summit not has a valid selection plan', - 'PresentationService.updatePresentationSubmission.CurrentSpeakerCanNotEditPresentation' => 'Current Speaker can not edit :presentation_id presentation', - 'PresentationService.saveOrUpdatePresentation.TagNotAllowed' => 'tag :tag is not allowed on track :track_id', - // organizations - 'OrganizationService.addOrganization.alreadyExistName' => 'Organization name :name already exists!', - // track tag groups - 'SummitTrackTagGroupService.addTrackTagGroup.TrackTagGroupLabelAlreadyExists' => 'track tag group label already exist on summit :summit_id', - 'SummitTrackTagGroupService.addTrackTagGroup.TrackTagGroupNameAlreadyExists' => 'track tag group name already exist on summit :summit_id', - 'SummitTrackTagGroupService.updateTrackTagGroup.TrackTagGroupLabelAlreadyExists' => 'track tag group label already exist on summit :summit_id', - 'SummitTrackTagGroupService.updateTrackTagGroup.TrackTagGroupNameAlreadyExists' => 'track tag group name already exist on summit :summit_id', - 'SummitTrackTagGroupService.seedTagOnAllTrack.TagDoesNotBelongToTrackTagGroup' => 'tag :tag_id does not belongs to any track tag group on summit :summit_id', - // track question templates - 'TrackQuestionTemplateService.addTrackQuestionTemplate.TrackQuestionTemplateLabelAlreadyExist' => 'track question template label already exists', - 'TrackQuestionTemplateService.addTrackQuestionTemplate.TrackQuestionTemplateNameAlreadyExist' => 'track question template name already exists', - 'TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackQuestionTemplateLabelAlreadyExist' => 'track question template label already exists', - 'TrackQuestionTemplateService.updateTrackQuestionTemplate.TrackQuestionTemplateNameAlreadyExist' => 'track question template name already exists', - 'TrackQuestionTemplateService.addTrackQuestionValueTemplate.ValueAlreadyExist' => 'value :value already exists on track question template :track_question_template_id', - 'TrackQuestionTemplateService.addTrackQuestionValueTemplate.LabelAlreadyExist' => 'label :label already exists on track question template :track_question_template_id', - 'TrackQuestionTemplateService.updateTrackQuestionValueTemplate.ValueAlreadyExist' => 'value :value already exists on track question template :track_question_template_id', - 'TrackQuestionTemplateService.updateTrackQuestionValueTemplate.LabelAlreadyExist' => 'label :label already exists on track question template :track_question_template_id', - // SpeakerService - 'SpeakerService.addSpeaker.MissingMemberOrEmail' => "you must provide an email or a member_id in order to create a speaker!", - 'SpeakerService.addSpeaker.MemberAlreadyAssigned2Speaker' => "member id :member_id already has assigned speaker :speaker_id!", - 'SpeakerService.updateSpeaker.MemberAlreadyAssigned2Speaker' => "member id :member_id already has assigned speaker :speaker_id!", - "SpeakerService.updateSpeakerRelations.InvalidLanguage" => "language :lang_id does not exists!", - "SpeakerService.updateSpeakerRelations.InvalidCountryCode" => "country :country does not exists!", - "SpeakerService.updateSpeakerRelations.InvalidOrganizationRole" => "organization role :role does not exists!", - "SpeakerService.updateSpeakerRelations.InvalidActiveInvolvement" => "involvement :involvement_id does not exists!" -]; \ No newline at end of file diff --git a/resources/views/emails/mux_export_excerpt.blade.php b/resources/views/emails/mux_export_excerpt.blade.php deleted file mode 100644 index bb678f2f..00000000 --- a/resources/views/emails/mux_export_excerpt.blade.php +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - -

MUX EXPORT RESULTS - {!! $step !!}

-

{!! $excerpt !!}

-
-
-

Cheers,
Your {!! Config::get('app.tenant_name') !!} Support Team

- - \ No newline at end of file diff --git a/resources/views/errors/404.blade.php b/resources/views/errors/404.blade.php deleted file mode 100644 index f1bd62f0..00000000 --- a/resources/views/errors/404.blade.php +++ /dev/null @@ -1,12 +0,0 @@ -@extends('layouts.master') -@section('title', '404') -@section('content') -
-

- 404. That's an error. -

-

- The page you requested is invalid. That's all we know. -

-
-@stop \ No newline at end of file diff --git a/resources/views/errors/503.blade.php b/resources/views/errors/503.blade.php deleted file mode 100644 index 669dcb80..00000000 --- a/resources/views/errors/503.blade.php +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - -
-
-
Be right back.
-
-
- - diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php deleted file mode 100644 index 61dea881..00000000 --- a/resources/views/layouts/master.blade.php +++ /dev/null @@ -1,39 +0,0 @@ - - - OpenStackId - Resource Server - @yield('title') - - - - -
- @yield('content') -
- - \ No newline at end of file diff --git a/resources/views/speakers/edit_permissions/approved.blade.php b/resources/views/speakers/edit_permissions/approved.blade.php deleted file mode 100644 index 07552086..00000000 --- a/resources/views/speakers/edit_permissions/approved.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('layouts.master') -@section('title', 'Speaker Edit Permission - Approved') -@section('content') -
-

- Your Speaker Edit Profile Permission Request was Approved!. -

-
-@stop \ No newline at end of file diff --git a/resources/views/speakers/edit_permissions/approved_error.blade.php b/resources/views/speakers/edit_permissions/approved_error.blade.php deleted file mode 100644 index fcd61d74..00000000 --- a/resources/views/speakers/edit_permissions/approved_error.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('layouts.master') -@section('title', 'Speaker Edit Permission - Approved Error') -@section('content') -
-

- There was a problem with your request. -

-
-@stop \ No newline at end of file diff --git a/resources/views/speakers/edit_permissions/approved_validation_error.blade.php b/resources/views/speakers/edit_permissions/approved_validation_error.blade.php deleted file mode 100644 index c013e573..00000000 --- a/resources/views/speakers/edit_permissions/approved_validation_error.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('layouts.master') -@section('title', 'Speaker Edit Permission - Approved Validation Error') -@section('content') -
-

- There was a problem with your request. the permission request its already approved!. -

-
-@stop \ No newline at end of file diff --git a/resources/views/speakers/edit_permissions/rejected.blade.php b/resources/views/speakers/edit_permissions/rejected.blade.php deleted file mode 100644 index 7a9cca96..00000000 --- a/resources/views/speakers/edit_permissions/rejected.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('layouts.master') -@section('title', 'Speaker Edit Permission - Rejected') -@section('content') -
-

- Your Speaker Edit Profile Permission Request was Rejected!. -

-
-@stop \ No newline at end of file diff --git a/resources/views/speakers/edit_permissions/rejected_error.blade.php b/resources/views/speakers/edit_permissions/rejected_error.blade.php deleted file mode 100644 index cd4ec893..00000000 --- a/resources/views/speakers/edit_permissions/rejected_error.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('layouts.master') -@section('title', 'Speaker Edit Permission - Rejected Error') -@section('content') -
-

- There was a problem with your request. -

-
-@stop \ No newline at end of file diff --git a/resources/views/speakers/edit_permissions/rejected_validation_error.blade.php b/resources/views/speakers/edit_permissions/rejected_validation_error.blade.php deleted file mode 100644 index a153ae60..00000000 --- a/resources/views/speakers/edit_permissions/rejected_validation_error.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('layouts.master') -@section('title', 'Speaker Edit Permission - Rejected Validation Error') -@section('content') -
-

- There was a problem with your request. the permission request its already redeem !. -

-
-@stop \ No newline at end of file diff --git a/resources/views/tickets/raw.blade.php b/resources/views/tickets/raw.blade.php deleted file mode 100644 index 21c74a75..00000000 --- a/resources/views/tickets/raw.blade.php +++ /dev/null @@ -1,11 +0,0 @@ -

{!! $summit_name !!}

-

{!! $ticket_type !!} ( {!! $price !!} )

-

{!!$location_name !!}

-

{!! $dates !!}

-

Order information

-

Order # {!! $order_number !!}

-

Ordered by {!! $owner_full_name !!} on {!! $order_creation_date !!}

-@if(!empty($attendee_name)) -

Attendee

-

{!! $attendee_name!!}

-@endif \ No newline at end of file diff --git a/resources/views/vendor/.gitkeep b/resources/views/vendor/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/server.php b/server.php deleted file mode 100644 index f65c7c44..00000000 --- a/server.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ - -$uri = urldecode( - parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) -); - -// This file allows us to emulate Apache's "mod_rewrite" functionality from the -// built-in PHP web server. This provides a convenient way to test a Laravel -// application without having installed a "real" web server software here. -if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { - return false; -} - -require_once __DIR__.'/public/index.php'; diff --git a/setup.py b/setup.py deleted file mode 100644 index 5229c561..00000000 --- a/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# 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. - -import setuptools - -setuptools.setup( - setup_requires=['pbr'], - pbr=True) \ No newline at end of file diff --git a/storage/app/.gitignore b/storage/app/.gitignore deleted file mode 100755 index 8f4803c0..00000000 --- a/storage/app/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!public/ -!.gitignore diff --git a/storage/app/public/.gitignore b/storage/app/public/.gitignore deleted file mode 100755 index d6b7ef32..00000000 --- a/storage/app/public/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/storage/framework/.gitignore b/storage/framework/.gitignore deleted file mode 100755 index b02b700f..00000000 --- a/storage/framework/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -config.php -routes.php -schedule-* -compiled.php -services.json -events.scanned.php -routes.scanned.php -down diff --git a/storage/framework/cache/.gitignore b/storage/framework/cache/.gitignore deleted file mode 100755 index d6b7ef32..00000000 --- a/storage/framework/cache/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/storage/framework/sessions/.gitignore b/storage/framework/sessions/.gitignore deleted file mode 100755 index d6b7ef32..00000000 --- a/storage/framework/sessions/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/storage/framework/views/.gitignore b/storage/framework/views/.gitignore deleted file mode 100755 index d6b7ef32..00000000 --- a/storage/framework/views/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/storage/logs/.gitignore b/storage/logs/.gitignore deleted file mode 100755 index d6b7ef32..00000000 --- a/storage/logs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/tests/AdminActionsCalendarSyncPreProcessorTest.php b/tests/AdminActionsCalendarSyncPreProcessorTest.php deleted file mode 100644 index 008571b8..00000000 --- a/tests/AdminActionsCalendarSyncPreProcessorTest.php +++ /dev/null @@ -1,170 +0,0 @@ -shouldIgnoreMissing(); - $app->instance(IAbstractCalendarSyncWorkRequestRepository::class, $repo_mock); - - $repo_mock = Mockery::mock(ICalendarSyncInfoRepository::class)->shouldIgnoreMissing(); - $app->instance(ICalendarSyncInfoRepository::class, $repo_mock); - return $app; - } - - public function testUpdateFourthSameEvent(){ - $preprocessor = App::make('App\Services\Model\AdminActionsCalendarSyncPreProcessor'); - - $summit_event = Mockery::mock(SummitEvent::class); - $summit_event->shouldReceive('getId')->andReturn(1); - - $mock_update_request = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $mock_update_request1 = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request1->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request1->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $mock_update_request2 = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request2->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request2->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $mock_update_request3 = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request3->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request3->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $purged_requests = $preprocessor->preProcessActions([ - $mock_update_request, - $mock_update_request1, - $mock_update_request2, - $mock_update_request3 - ]); - - $this->assertTrue(count($purged_requests) == 1); - } - - public function testUpdateFourthTimesDeleteSameEvent(){ - $preprocessor = App::make('App\Services\Model\AdminActionsCalendarSyncPreProcessor'); - - $summit_event = Mockery::mock(SummitEvent::class); - $summit_event->shouldReceive('getId')->andReturn(1); - - $mock_update_request = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $mock_update_request1 = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request1->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request1->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $mock_update_request2 = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request2->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request2->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $mock_update_request3 = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request3->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request3->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $mock_delete_request = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_delete_request->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_delete_request->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeRemove); - - $purged_requests = $preprocessor->preProcessActions([ - $mock_update_request, - $mock_update_request1, - $mock_delete_request, - $mock_update_request2, - $mock_update_request3 - ]); - - $this->assertTrue(count($purged_requests) == 1); - $this->assertTrue($purged_requests[0]->getType() == AbstractCalendarSyncWorkRequest::TypeUpdate); - } - - public function testDeleteUpdateSameEvent(){ - $preprocessor = App::make('App\Services\Model\AdminActionsCalendarSyncPreProcessor'); - - $summit_event = Mockery::mock(SummitEvent::class); - $summit_event->shouldReceive('getId')->andReturn(1); - - $mock_delete_request = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_delete_request->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_delete_request->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeRemove); - - $mock_update_request = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $purged_requests = $preprocessor->preProcessActions([ - $mock_delete_request, - $mock_update_request - ]); - - $this->assertTrue(count($purged_requests) == 1); - $this->assertTrue($purged_requests[0]->getType() == AbstractCalendarSyncWorkRequest::TypeUpdate); - } - - - public function testUpdateDeleteSameEvent(){ - - $preprocessor = App::make('App\Services\Model\AdminActionsCalendarSyncPreProcessor'); - - $summit_event = Mockery::mock(SummitEvent::class); - $summit_event->shouldReceive('getId')->andReturn(1); - - $mock_delete_request = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_delete_request->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_delete_request->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeRemove); - - $mock_update_request = Mockery::mock(AdminSummitEventActionSyncWorkRequest::class); - $mock_update_request->shouldReceive('getSummitEvent')->andReturn($summit_event); - $mock_update_request->shouldReceive('getType')->andReturn(AbstractCalendarSyncWorkRequest::TypeUpdate); - - $purged_requests = $preprocessor->preProcessActions([ - $mock_update_request, - $mock_delete_request, - ]); - - $this->assertTrue(count($purged_requests) == 1); - $this->assertTrue($purged_requests[0]->getType() == AbstractCalendarSyncWorkRequest::TypeRemove); - } - -} \ No newline at end of file diff --git a/tests/AttendeeServiceTest.php b/tests/AttendeeServiceTest.php deleted file mode 100644 index 358fafd3..00000000 --- a/tests/AttendeeServiceTest.php +++ /dev/null @@ -1,30 +0,0 @@ -getById(24); - - $service->updateRedeemedPromoCodes($summit); - } -} \ No newline at end of file diff --git a/tests/BrowserKitTestCase.php b/tests/BrowserKitTestCase.php deleted file mode 100644 index dba2e842..00000000 --- a/tests/BrowserKitTestCase.php +++ /dev/null @@ -1,58 +0,0 @@ -redis = Redis::connection(); - $this->redis->flushall(); - $this->prepareForTests(); - } - - /** - * Migrates the database and set the mailer to 'pretend'. - * This will cause the tests to run quickly. - * - */ - protected function prepareForTests() - { - Model::unguard(); - DB::setDefaultConnection("model"); - Artisan::call('doctrine:migrations:migrate', ["--connection" => 'config']); - Artisan::call('doctrine:migrations:migrate', ["--connection" => 'model']); - //Mail::pretend(true); - $this->seed('TestSeeder'); - } -} diff --git a/tests/CountriesApiTest.php b/tests/CountriesApiTest.php deleted file mode 100644 index 28024a75..00000000 --- a/tests/CountriesApiTest.php +++ /dev/null @@ -1,43 +0,0 @@ -action( - "GET", - "CountriesApiController@getAll", - $params, - [], - [], - [], - [] - ); - - $content = $response->getContent(); - $countries = json_decode($content); - $this->assertTrue(!is_null($countries)); - $this->assertResponseStatus(200); - } - -} \ No newline at end of file diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php deleted file mode 100644 index 6ae91832..00000000 --- a/tests/CreatesApplication.php +++ /dev/null @@ -1,22 +0,0 @@ -make(Kernel::class)->bootstrap(); - - return $app; - } -} \ No newline at end of file diff --git a/tests/DoctrineTest.php b/tests/DoctrineTest.php deleted file mode 100644 index e9f1ee08..00000000 --- a/tests/DoctrineTest.php +++ /dev/null @@ -1,240 +0,0 @@ -getById(6); - $locations = $summit->getLocations(); - $locations = $locations->toArray(); - $this->assertTrue($summit->getIdentifier() === 6); - $this->assertTrue(count($locations) > 0); - $data = SerializerRegistry::getInstance()->getSerializer($summit)->serialize(); - $this->assertTrue(is_array($data)); - } - - public function testGetSummitVenues(){ - - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $venues = $summit->getVenues(); - foreach($venues->toArray() as $venue) - { - foreach($venue->getRooms() as $r) - { - - } - foreach($venue->getFloors() as $f) - { - - } - } - } - - public function testGetAttendeeById(){ - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $this->assertTrue(!is_null($summit)); - $attendee = $summit->getAttendeeById(493); - $this->assertTrue(!is_null($attendee)); - - $member = $attendee->getMember(); - $this->assertTrue(!is_null($member)); - $feedback = $attendee->getEmittedFeedback(); - $schedule = $attendee->getSchedule(); - } - - public function testGetMember(){ - $em = Registry::getManager(\models\utils\SilverstripeBaseModel::EntityManager); - $repo = $em->getRepository(\models\main\Member::class); - $me = $repo->find(11624); - $this->assertTrue(!is_null($me)); - $photo = $me->getPhoto(); - $group = $me->getGroupByCode(\App\Models\Foundation\Main\IGroup::Administrators); - $res = $me->isOnGroup(\App\Models\Foundation\Main\IGroup::Administrators); - $filename = $photo->getFilename(); - $this->assertTrue(!is_null($photo)); - } - - public function testGetEventFeedback(){ - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $this->assertTrue(!is_null($summit)); - $event = $summit->getEvent(9454); - $this->assertTrue(!is_null($event)); - } - - public function testGetFile(){ - $em = Registry::getManager(SilverstripeBaseModel::EntityManager); - $repo = $em->getRepository(\models\main\File::class); - $file = $repo->find(1); - $this->assertTrue(!is_null($file)); - } - - public function testAddLocation() - { - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $newExternalLocation = new SummitExternalLocation(); - $newExternalLocation->setType(SummitExternalLocation::Lounge); - $newExternalLocation->setSummit($summit); - $summit->getLocations()->add($newExternalLocation); - $em = Registry::getManager(SilverstripeBaseModel::EntityManager); - $em->flush(); - } - - public function testGetEvents(){ - - $filter = FilterParser::parse('tags=@nova', array - ( - 'title' => array('=@', '=='), - 'tags' => array('=@', '=='), - 'start_date' => array('>', '<', '<=', '>=', '=='), - 'end_date' => array('>', '<', '<=', '>=', '=='), - 'summit_type_id' => array('=='), - 'event_type_id' => array('=='), - )); - - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $response = $repo->getEvents($summit->getIdentifier(), new PagingInfo(1, 10), $published = true, $filter); - $schedule = $response->getItems(); - $this->assertTrue(count($schedule) > 0); - $event = $schedule[0]; - $tags = $event->getTags()->toArray(); - $this->assertTrue(count($tags) > 0); - } - - public function testGetPresentation() - { - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $presentation = $summit->getEvent(6859); - $videos = $presentation->getVideos(); - $slides = $presentation->getSlides(); - $links = $presentation->getLinks(); - $this->assertTrue(!is_null($presentation)); - } - - public function testGetPresentations() - { - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $presentations = $summit->getPresentations(); - } - - - public function testGetSpeakers(){ - $repo = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo->getById(6); - $speakers = $summit->getSpeakers(); - $sponsors = $summit->getSponsors(); - $repo = EntityManager::getRepository(\models\summit\PresentationSpeaker::class); - $speakers = $repo->getSpeakersBySummit($summit, new PagingInfo(1,10))->getItems(); - $this->assertTrue(count($speakers) > 0); - $speaker = $speakers[0]; - $member = $speaker->getMember(); - $id = $member->getId(); - } - - public function testGetSpeakerPublishedRegularPresentations($speaker_id = 1759){ - $repo1 = EntityManager::getRepository(\models\summit\PresentationSpeaker::class); - $repo2 = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo2->getById(23); - $speaker = $repo1->getById($speaker_id); - - $this->assertTrue($speaker->hasPublishedRegularPresentations($summit)); - - $presentations = $speaker->getPublishedRegularPresentations($summit); - - $this->assertTrue(count($presentations) > 0); - } - - public function testGetSpeakerAlternatePresentations($speaker_id = 70){ - $repo1 = EntityManager::getRepository(\models\summit\PresentationSpeaker::class); - $repo2 = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo2->getById(23); - $speaker = $repo1->getById($speaker_id); - - $this->assertTrue($speaker->hasAlternatePresentations($summit)); - - $presentations = $speaker->getAlternatePresentations($summit); - - $this->assertTrue(count($presentations) > 0); - } - - public function testGetSpeakerRejectedPresentations($speaker_id = 70){ - $repo1 = EntityManager::getRepository(\models\summit\PresentationSpeaker::class); - $repo2 = EntityManager::getRepository(\models\summit\Summit::class); - $summit = $repo2->getById(23); - $speaker = $repo1->getById($speaker_id); - - $this->assertTrue($speaker->hasRejectedPresentations($summit)); - - $presentations = $speaker->getRejectedPresentations($summit); - - $this->assertTrue(count($presentations) > 0); - } - - public function testGetTicketTypeLock(){ - - $em1 = Registry::getManager(SilverstripeBaseModel::EntityManager); - $em2 = Registry::getManager(SilverstripeBaseModel::EntityManager); - $con1 = $em1->getConnection(); - $con2 = $em2->getConnection(); - $con1->beginTransaction(); // suspend auto-commit - $repo = EntityManager::getRepository(\models\summit\SummitTicketType::class); - - $type = $repo->getByIdExclusiveLock(103); - - $con2->beginTransaction(); // suspend aut - - $type2 = $repo->getByIdExclusiveLock(103); - - $con2->rollBack(); - } - - public function testRegistrationSpeaker(){ - $speaker_repo = EntityManager::getRepository(\models\summit\PresentationSpeaker::class); - $speaker = new \models\summit\PresentationSpeaker(); - $registration_request = new \models\summit\SpeakerRegistrationRequest(); - $speaker->setTitle("test title"); - $speaker->setBio("this is the bio"); - $speaker->setFirstName("this is the name"); - $speaker->setLastName("this is the last name"); - $registration_request->setEmail("test2@test.com"); - - $speaker->setRegistrationRequest($registration_request); - - $em = Registry::getManager(SilverstripeBaseModel::EntityManager); - $em->persist($speaker); - $em->flush(); - - $speaker_repo->delete($speaker); - - $em->flush(); - } -} \ No newline at end of file diff --git a/tests/ExternalFeedIngestionTest.php b/tests/ExternalFeedIngestionTest.php deleted file mode 100644 index c58003f1..00000000 --- a/tests/ExternalFeedIngestionTest.php +++ /dev/null @@ -1,167 +0,0 @@ -A laptop is required for hackathon. We will have 1 hour training on how to install the Virtual Switch with SONiC image on your laptop and how to use it.
Participants may team with up others. Attendees will vote for the winning team at the end of the hackathon.
Agenda<\/strong>
Tuesday, March 12<\/strong><\/em>
9:30 \u2013 10:00 - BREAKFAST SOCIAL
10-10:10 \u2013 OPENING AND WELCOME - Sadaf Fardeen, LinkedIn
10:10 \u2013 10:30 \u2013 KEYNOTE - Zaid Kahn, LinkedIn
10:30 \u2013 11:00 - \"SONiC OS Virtualization and Data Plane Emulation Work\" - Yongfeng Liu, Alibaba
11:05 - 11:35 - \"SONiC in Microsoft Azure: Enabling Mission Critical Applications\" - Alberto Gonzalez Prieto and Weixi Chen, Microsoft
11:40 - 12:10 - \"SONIC Extension Infrastructure\" - Matty Kadosh, Mellanox
12:15 - 12:45 - \"Using programmable dataplanes to transform network system high availability\" - Kumaresh Perumal, Barefoot
12:45 \u2013 1:30 \u2013 LUNCH
1:30 - 2:00 - \"Developer`s Overview of Sonic\", - Praveen Chaudhary, Linkdedin
2:00 - 2:30 - \"Opportunities and Obstacles for Open Source Networking\" - Alley Hasan and Sandeep Madhavan, Dell
2:30 - 3:00 - \"Cloud-grade Routing as a Micro-service for Open Networking Platforms\" - Vinay Nallamothu, Juniper
3:00 \u2013 3:15 \u2013 BREAK
3:15 \u2013 3:45 \u2013 \"Using NBI images for SONiC system on Cisco Platforms\" - Ashoka Kallappa and Jiahua Wang, Cisco
3:45 \u2013 4:15 \u2013 \"SONiC unit test and function test enhancement\" - Larry Ho, Edgecore
4:15 \u2013 4:25 \u2013 HACKATHON INTRO - Sadaf Fardeen, LinkedIn
4:25 \u2013 4:30 \u2013 BREAK
4:30 \u2013 5:30 \u2013 System Setup Instructions and Team up
5:30 PM - DISPERSE
Wednesday, March 13<\/em><\/strong>
8:00am \u2013 4:00pm \u2013 HACKATHON (Breakfast included)
12:00 - 1:00 - LUNCH
4:00 - 5:00 - HACKATHON PRESENTATION AND AWARD
Instructions for Hackathon:<\/strong>
Put on your thinking caps, team up with friends, and get ready to be the geek coder!! As a part of SONiC Workshop we are organizing a Hackathon for SONiC. Here are more details of the event. Feel free to reach out with questions if any.
Rules<\/strong>
1. Participate alone or in teams up to a size of 4.
2. Team up with anyone in the community.
3. Free to choose any idea as long as it is useful for SONiC. Some suggested areas: test framework, debugging, performance improvement, standard interfaces, Monitoring.
4. Execute on a virtual switch or a physical switch.
5. Hackathon begins at 4PM on 12th March and ends at 4 PM on 13th March. You are free to work at home or hotel during this period and come back at 4 PM for final presentation.
6. Participants from remote\/video conferencing can also join.
7. Final presentation at 4PM on 13th March includes a working demo of 7-10 min.
8. Bring your own laptop for development.
9. Development in any programming language is fine as long as it can integrate with SONiC ecosystem.
10. Use of any off the shelf tools and package is allowed as long as it has appropriate license for use with SONiC.
Instructions<\/strong>
1. Prepare your laptop for virtual switch based development by following instructions given here:
https:\/\/github.com\/Azure\/sonic-mgmt\/blob\/master\/ansible\/doc\/README.testbed.VsSetup.md<\/a>
2.Reach out to community and form a team before the event.
Awards<\/strong>
1. Three winning teams to be chosen. $1000 per team.
- Zeus Hacker: Award for most difficult project
- Athena hacker: Award for best idea
- Prometheus hacker: Award for best presentation
2. Judging committee consists of Senior Engineering leaders from SONiC community and OCP
- Haiyong Wang, Senior Director, Alibaba Group
- Lihua Yuan, Partner Developer Manager, Microsoft
- Omar Baldonado, Director of Software Engineering, Facebook
- Shawn Zandi, Director of Engineering, LinkedIn
3. Criteria for evaluation : Relevance for SONiC, complexity in execution, overall presentation and uniqueness of idea.
4. All participants will get a swag

Click here <\/a>to pre-register.<\/strong> 

","seats":"0","goers":"7","invite_only":"N","venue":"LinkedIn Building R","id":"15f8ba1324afae0578df4d8b4fc7b2e6","venue_id":"895579"},{"event_key":"350","active":"Y","name":"Gen-Z Technology: Enabling Memory Centric Architecture","event_start":"2019-03-15 15:00:00","event_end":"2019-03-15 15:30:00","event_type":"EW: Server","seats":"0","goers":"66","invite_only":"N","venue":"210 CG","id":"162820feea574d1e0c5d004c5b871390","venue_id":"851681","speakers":"Greg Casey"},{"event_key":"160","active":"Y","name":"InBand Network Telemetry an Open and Multi-platform Network Analytics for Disaggregated Data-Centers","event_start":"2019-03-15 09:30:00","event_end":"2019-03-15 09:42:00","event_type":"EW: SONiC","description":"Modern data-centers use high-density L2 and L3 topologies to accommodate heterogeneous mission critical applications. In such an environment visibility is essential to reliably operate and manage the networking elements. We present an open framework called \u201cInband Network Telemetry\u201d (INT). In INT each network element (e.g. a SmartNIC or a Barefoot Network switch) can be programmed to insert metadata about the network state in the packet as it traverses the network. This enables visibility on all traffic (e.g. Compute, Storage\/RDMA) carried over ethernet for transient issues due to bottlenecks, failures or configuration errors. In such a solution machine learning techniques can be used to Baseline Network Performance (Path and Latency), match patterns of behavior and correlate phenomena. Such techniques can be used to promptly react to network issues or predict and anticipate problems.","seats":"0","goers":"38","invite_only":"N","venue":"Marriott Salon IV","id":"1674455a54366a59c2698696f3933b25","venue_id":"859652","speakers":"Roberto Mari"},{"event_key":"154","active":"Y","name":"Live Demo of Zero Touch Deployment","event_start":"2019-03-15 14:30:00","event_end":"2019-03-15 14:55:00","event_type":"EW: Networking: Software","description":"Live demo of installing NOS and orchestration agent on an OCP switch and live rollout of configuration of fully functional network with E-BGP, NAT, Load Balancer, ACLs.

","seats":"0","goers":"26","invite_only":"N","venue":"210 DH","id":"176dc6826b6a2a3296708479b26e0937","venue_id":"859649","speakers":"Alex Saroyan"},{"event_key":"238","active":"Y","name":"Xhaul Switch Specification","event_start":"2019-03-15 09:00:00","event_end":"2019-03-15 09:18:00","event_type":"EW: Telco & openEDGE","description":"New OCP specification of a xhaul Switch used in mobility network using merchant silicon.","seats":"0","goers":"25","invite_only":"N","venue":"212 CD","id":"1957dbe805a25a2f45f474e77ed6c535","venue_id":"851696","speakers":"Mike Meche"},{"event_key":"132","active":"Y","name":"Tools and Process for Creating a Redfish Profile","event_start":"2019-03-15 09:00:00","event_end":"2019-03-15 09:25:00","event_type":"EW: HW Management","description":"This session will describe the machine-readable document format for describing a Redfish Interoperability Profile, and will discuss the open source tools available to generate documentation and test systems for conformance.","seats":"0","goers":"31","invite_only":"N","venue":"Marriott Salon I&II","id":"19bfffbd2a9a6419b22406ce726850e7","venue_id":"859646","speakers":"Jeff Autor"},{"event_key":"360","active":"Y","name":"OCP Experience Lab","event_start":"2019-03-14 07:30:00","event_end":"2019-03-14 19:30:00","event_type":"Expo Hall","seats":"0","goers":"38","invite_only":"N","venue":"Lobby","id":"19e0f3595b6d4b0c9515d7afcd93f523","venue_id":"851654"},{"event_key":"232","active":"Y","name":"HW\/SW Co-design for Predictable IO Latency","event_start":"2019-03-15 15:00:00","event_end":"2019-03-15 15:18:00","event_type":"EW: Storage","description":"While the industry has been focusing on improving the IOPS & density of storage, the growth rate hasn\u2019t been the same for both across HDD\u2019s, Flash & SCM (storage class memory). In order to keep up with the required IOPS\/TB, applications pay the cost with the latency credits. Using a RocksDB use-case, we discuss about the various considerations & trade-offs in the HW\/SW co-design that influences an optimal solution that solves for predictable IO latency.","seats":"0","goers":"51","invite_only":"N","venue":"212 AB","id":"1b73bc0306b1e3ea34007f7c73660345","venue_id":"851693","speakers":"Navneeth Kankani, Vijayan Rajan"},{"event_key":"203","active":"Y","name":"Convergence in Open Hardware Platforms","event_start":"2019-03-15 13:00:00","event_end":"2019-03-15 13:25:00","event_type":"EW: Server","description":"OCP Community is expanding its reach to consolidate different open hardware platforms (including Project Olympus, Open19 and OpenPower solutions) into the community to provide more selections and alternatives to datacenters of all sizes to scale globally. Inspur will share actual use cases from our customers, benchmarks for different application workloads and provide insights for optimization using different platforms. Inspur will also share new compute, storage, GPU server designs and OpenBMC hardware management contributions into the OCP community to drive adoption.","seats":"0","goers":"45","invite_only":"N","venue":"210 CG","id":"1cd18d1dc402db65533c094ea881676a","venue_id":"851681","speakers":"Dolly Wu"},{"event_key":"178","active":"Y","name":"Storage Security from A to Z","event_start":"2019-03-15 13:30:00","event_end":"2019-03-15 13:55:00","event_type":"EW: OSF\/Security","description":"Data security is becoming an increasingly lucrative target for cyber criminals. Worldwide revenue for data theft is estimated to be approaching $1 trillion per year. Storage vendors including Seagate have invested heavily in data security from secure supply chain, to securing data at rest to end of life solutions like instant secure erase. These are all based on industry and government standards and best practices.

Collaboration with OCP Security efforts by device makers is essential to a full defense-in-depth data security strategy that defends against the possibility of malware or defects from privileged device related firmware and software.

","seats":"0","goers":"38","invite_only":"N","venue":"Marriott Salon III","id":"1e1f02ef28ef68ff216e57cf73608d7e","venue_id":"859612","speakers":"Arie van der Hoeven"},{"event_key":"214","active":"Y","name":"SONiC - Latest Update and Roadmap Forward","event_start":"2019-03-15 13:00:00","event_end":"2019-03-15 13:25:00","event_type":"EW: SONiC","description":"Since 2017 summit, a lot of new developments were added to SONiC, e.g. feature wise, operation maturity, new scenarios, etc. We are going to update the industry the last status of SONiC and share what is new coming on the SONiC roadmap.","seats":"0","goers":"69","invite_only":"N","venue":"Marriott Salon IV","id":"1f3e280b3d9a9798a83a6c0d9614abc6","venue_id":"859652","speakers":"Xin Liu, Lihua Yuan"},{"event_key":"173","active":"Y","name":"Open Systems Firmware Overview","event_start":"2019-03-15 08:00:00","event_end":"2019-03-15 08:25:00","event_type":"EW: OSF\/Security","description":"Open Systems Firmware is growing fast. From zero systems in 2017 we expect to see 100,000 or more deployed in 2019 in switches, servers, and other types of systems. OSF is also a key part of partner efforts to support a circular economy model in which systems are reused, not sent to landfills. In this session, we'll go over the state of the effort and where we're headed.","seats":"0","goers":"43","invite_only":"N","venue":"Marriott Salon III","id":"1f55bfb30454b78f01a302affe6bb428","venue_id":"859612","speakers":"Ron Minnich, Gundrala Goud, David Hendricks"},{"event_key":"209","active":"Y","name":"LinkedIn Adoption of OCP SONiC","event_start":"2019-03-15 14:00:00","event_end":"2019-03-15 14:25:00","event_type":"EW: SONiC","description":"Linkedin contribution and experience with OCP SONiC. Lessons learnt, development\/maintenance case study, future looking features.","seats":"0","goers":"60","invite_only":"N","venue":"Marriott Salon IV","id":"2023a128438e2ab0f76000f010ba077a","venue_id":"859652","speakers":"Zhenggen Xu"},{"event_key":"310","active":"Y","name":"SmartNIC Makes Composable Cloud Storage a SNAP - Presented by Mellanox","event_start":"2019-03-14 15:15:00","event_end":"2019-03-14 15:40:00","event_type":"Executive Track","description":"The next generation of cloud native applications are based on a container based microservice architecture with dynamic scaling. These applications support a wide variety of workloads, each have differing needs for compute, storage, and networking. Thus, the ideal architecture is highly composable and able to transcend the specific configuration of physical server and storage infrastructures and instead deliver fully software defined, virtualized resources that provides as much compute, storage and networking as needed. Moreover, this flexibility must be provided in a way that is transparent to applications and provides agility, scalability, and secure isolation. This presentation will introduce a new SmartNIC technology that blurs the lines between local and remote NVMe Storage and makes all cloud resources be appear local. The presentation will provide a deep-dive into those new requirements and demonstrate a solution that brings virtualized storage to bare-metal clouds and delivers disaggregation of compute and storage to achieve fully optimized resource utilization.","seats":"0","goers":"119","invite_only":"N","venue":"210 CG","id":"212ddf38992c7bd7cc651f281a4c0d17","venue_id":"851681","speakers":"Kevin Deierling"},{"event_key":"134","active":"Y","name":"RunBMC: A Hardware Interface for BMC Cards for OCP","event_start":"2019-03-15 13:00:00","event_end":"2019-03-15 13:25:00","event_type":"EW: HW Management","description":"We propose an openBMC development platform that would be the actual baseboard management controller platform and hardware you could leverage in any OCP design. At a high level it would consist of a BMC Mezzanine daughter card routing all major signals through a small pitch connector allowing a reusable, standardized footprint for OCP hardware designs. An additional development board would allow developers access to the BMC mezzanine early in the HW lifecycle, increasing openBMC contributions and adoption. The daughter card itself, which we call openBMC, would provide flexibility, reusability, and added velocity for server and switch designs in the Open Compute project.","seats":"0","goers":"61","invite_only":"N","venue":"Marriott Salon I&II","id":"221ffaaafb63eb26b978772b79728ec4","venue_id":"859646","speakers":"Eric Shobe, Jared Mednick"},{"event_key":"235","active":"Y","name":"Panel Discussion on Computational Storage","event_start":"2019-03-15 16:00:00","event_end":"2019-03-15 16:55:00","event_type":"EW: Storage","seats":"0","goers":"60","invite_only":"N","venue":"212 AB","id":"242c6e7e264144ae720664410d42c3aa","venue_id":"851693","speakers":"Yahya H. Mirza, Jorge Campello, Thad Omura, Jason Adrian, Scott Shadley, Shahar Noy, Stephen Bates"},{"event_key":"114","active":"Y","name":"ISO Containers are NOT a Good Data Center Solution","event_start":"2019-03-15 14:00:00","event_end":"2019-03-15 14:25:00","event_type":"EW: Data Center Facility","description":"When exploring modular data center solutions, the ISO shipping container is frequently part of the discussion. Modular, purpose built enclosures are a great solution for data centers. Modular hybrid constructed buildings like CyrusOne and Microsoft, enterprise data systems, and telecom systems are all a perfect fit for modular, but not shipping containers.When building a modular data center, the walls are not the bulk of the cost, and should not be a limiting factor. It is true that containers are cheap and readily available, 80% of them are made in China to ship goods all over the world, and the Americas get a steady surplus of these metal boxes. To make them suitable for a data center (even a limited one with few racks) requires significant modification. Cleaning, repair, painting, insulating, door installation and more must be done to provide acceptable white space. These modifications are time consuming and costly, this quickly eats up the initial savings from that \"cheap\" shipping container. Purpose built modular data centers are the safest, most efficient, and most functional way to add capacity for any network. In this session, participants will learn the details of modular enclosures and limiting factors of ISO containers by looking at efficiencies, code requirements, and transportation costs.","seats":"0","goers":"16","invite_only":"N","venue":"211 AB","id":"2509bf612cd94390084454b1d9be4b2a","venue_id":"851669","speakers":"Rob Coyle"},{"event_key":"124","active":"Y","name":"Next Generation Intel Xeon Scalable Processors for Machine Learning","event_start":"2019-03-15 15:00:00","event_end":"2019-03-15 15:25:00","event_type":"EW: HPC & GPU\/FPGA Technology","description":"Intel is accelerating AI performance on Intel Xeon Scalable Processors with hardware features and software optimizations boosting performance across a wide range of AI\/DL\/ML workloads. Starting with the codename Cascade Lake Intel Xeon processors, Intel added the Vector Neural Network Instruction (VNNI) to the AVX-512 instruction set to further boost AI inference performance. In this session, we will provide a detailed overview of VNNI and the optimizations Intel is doing across popular frameworks. And, we\u2019ll live demo these benefits using publicly available frameworks.","seats":"0","goers":"53","invite_only":"N","venue":"210 A ","id":"27450b9b3a4b600c6458c22820b13cf3","venue_id":"859643","speakers":"Shivani Sud, Andres Rodriguez, Niveditha Sundaram, Jianhui Li"},{"event_key":"168","active":"Y","name":"Multi-mode OCP NIC 3.0 card HW management","event_start":"2019-03-15 09:15:00","event_end":"2019-03-15 09:27:00","event_type":"EW: NIC 3.0 Development","description":"The introduction of OCP NIC 3.0 brings new HW management challenges. OCP NIC 3.0 standard allows for multiple operating modes for NIC cards. Multi-Host capable OCP NIC 3.0 cards based on ConnectX, supporting both Mellanox Multi-Host\u00ae and Mellanox Socket Direct\u00ae technologies, leverage this new standard by offering a single hardware, capable to operate as Single-Host, Multi-Host and Mellanox Socket Direct\u00ae device. Being an OCP NIC 3.0 card, the operating-mode is automatically set, allowing data-centers and OEMs to use the same hardware in different server platforms. This talk covers the special features which were introduced into this new technology, to address the new HW management challenges.","seats":"0","goers":"40","invite_only":"N","venue":"210 A ","id":"28c99398ee784ca1d4a27fe560771065","venue_id":"859643","speakers":"Yuval Itkin"},{"event_key":"225","active":"Y","name":"OCP Use Case: Using a Software Defined Storage on OCP Lightning (NVMe JBOF)","event_start":"2019-03-15 09:25:00","event_end":"2019-03-15 09:45:00","event_type":"EW: Storage","description":"Software Defined Storages is more flexible and scalable compared with Storage Appliances, because it can run on commodity hardware. OCP Lightning (NVMe JBOF) is suitable for these applications. Yahoo Japan is starting to use Quobyte that is software storage as backend of OpenStack Cinder, Manila, Kubernetes Persistent Volumes. In this talk, we will describe about our experiences of using a Software Defined Storage on OCP Lightning.","seats":"0","goers":"60","invite_only":"N","venue":"212 AB","id":"29ed243b1cff9655e316e90c36880cf6","venue_id":"851693","speakers":"Yusuke Sato, Akira Kamio"},{"event_key":"30","active":"Y","name":"Summit Highlights","event_start":"2019-03-14 10:48:00","event_end":"2019-03-14 11:00:00","event_type":"Keynote","seats":"0","goers":"210","invite_only":"N","venue":"Grand Ballroom","id":"2a52aedde875217ecb66e79394669f35","venue_id":"851660","speakers":"William Carter"},{"event_key":"223","active":"Y","name":"Unleash Stranded Flash Capacity - Deep Dive on Disaggregated Storage Architecture, Trends and OCP Solutions","event_start":"2019-03-15 09:00:00","event_end":"2019-03-15 09:20:00","event_type":"EW: Storage","description":"Flash memory is becoming an increasingly popular choice for latency sensitive workloads such as databases, real time analytics, in-memory key-value stores. Current generation of NVMe SSDs provide significant performance at a lower latency. It is not uncommon to expect these devices providing million IOPS. In traditional deployments with NVMe SSDs directly attached to the processor, it is difficult to achieve balanced system configuration resulting in stranded flash performance and capacity. In disaggregated storage, flash is shared among pool of compute nodes using dynamic binding of storage resources based on performance, capacity requirements. However, carving out storage from the flash pool and exposing over network introduces latency. In this session we outline different network protocols, latency implications and industry trends to deliver low latency disaggregated flash storage over the network using OCP platforms.","seats":"0","goers":"77","invite_only":"N","venue":"212 AB","id":"2b00b95b628c0b6e760a3db8079c3c37","venue_id":"851693","speakers":"Anjaneya "Reddy" Chagam, Manoj Wadekar"},{"event_key":"136","active":"Y","name":"Manageability Security","event_start":"2019-03-15 14:00:00","event_end":"2019-03-15 14:25:00","event_type":"EW: HW Management","description":"A presentation on how to approach security for Management Hardware and Firmware. Understanding the threats to a system and how to approach defending against attacks from adversaries. This presentation will cover some of the challenges the industry is faced with today regarding manageability. Where hardware vendors are being asked to provide the maximum level of manageability while providing the highest level of security. This is especially important with the increasing threat landscape of computers being deployed in every aspect of our lives. This presentation will highlight some of the things to consider when designing hardware and firmware with manageability in mind.","seats":"0","goers":"33","invite_only":"N","venue":"Marriott Salon I&II","id":"2b51d6cc7c0443471fb00c1663f4bb4c","venue_id":"859646","speakers":"James Mihm"},{"event_key":"157","active":"Y","name":"The Linux Kernel, Ecosystem and Community for Open Switch Hardware","event_start":"2019-03-15 13:00:00","event_end":"2019-03-15 13:25:00","event_type":"EW: Networking: Software","description":"The Linux kernel has been doing network hardware offloads and acceleration for decades (Nics, smart-nics, wireless AP\u2019s and many other places). Because of this, the kernel has had the infrastructure and the right abstractions to recognize and register a networking hardware device since the early days. And this infrastructure has matured over time. Today Linux enablement is the best way to get faster adoption of your hardware. And also possibly the fastest way to go-to-market. In this talk we look at Open switch hardware's journey into the Linux kernel, ecosystem and community. We will show how embracing Linux for your open switch hardware can simplify and unify your networking infrastructure. Linux kernel has abstractions for supporting switch hardware. We will talk about the support for switch hardware in the Linux kernel and walk through many cases of collaborative development in the Linux community that made this possible. In the recent years the Linux kernel has also received many networking updates to make it a first class network operating system for a data center switch hardware. These include VRF, MPLS, VxLAN, E-VPN and many others. We will cover details on these updates. Today one can build a open E-VPN data center fabric with open switch hardware, Linux kernel and other open software from the Linux ecosystem. How cool is that ?. Running native Linux allows you to now also extend the same E-VPN fabric to servers or hypervisors. We will show how benefits of unifying your networking infrastructure with open hardware and Linux are endless: your provisioning and operational tools are developed and maintained for the same operating system and come from the same Linux ecosystem. We will conclude with a few details on the next big things coming in the Linux kernel and community to support the next generation switch hardware!","seats":"0","goers":"44","invite_only":"N","venue":"210 DH","id":"2d092f8dee505b0074fa5b1c5a13ce98","venue_id":"859649","speakers":"Roopa Prabhu"},{"event_key":"116","active":"Y","name":"From PUE to ERE to Synergy","event_start":"2019-03-15 15:00:00","event_end":"2019-03-15 15:25:00","event_type":"EW: Data Center Facility","description":"This session is aimed at positioning datacenter concepts which are fully focused on synergy by maximizing exergy and embracing the advantages for this.
This session reviews and considers future datacenters as part of a wider industrial business environment, within the four utility domains
  1. power<\/li>
  2. IT\/data<\/li>
  3. heat<\/li>
  4. CO2<\/li> <\/ol>and distribution of all four above, within the datacenter context.","seats":"0","goers":"22","invite_only":"N","venue":"211 AB","id":"2e0980532d20218ab58e5ef149848c0c","venue_id":"851669","speakers":"Wim Buters"},{"event_key":"222","active":"Y","name":"SSD with Compression for the Compute and Storage Infrastructure: Implementation, Interface and Use Cases","event_start":"2019-03-15 08:40:00","event_end":"2019-03-15 08:58:00","event_type":"EW: Storage","description":"Data compression within the SSD significantly reduces write amplification leading to increased performance and endurance. Alternatively, compression inside the SSD can be utilized to significantly increase user capacity. These benefits can in particular make high capacity QLC SSDs more attractive for the data center, cloud or edge infrastructure. However, compression inside SSDs is not widely available yet, and there is a lack of understanding of the implementation trade-offs and benefits. This talk will describe the implementation, interface and use cases for compression inside SSDs. The goal of this presentation is to add compression-enabled SSD devices to the Open Compute Project by defining hardware and software interfaces, workloads, and use cases. This will provide the industry an additional attribute to consider when optimizing SSD requirements for specific workloads.","seats":"0","goers":"67","invite_only":"N","venue":"212 AB","id":"3164c01f61ee26254874c3dbc6bd610b","venue_id":"851693","speakers":"Erich Haratsch"},{"event_key":"340","active":"Y","name":"The 8 Best-Fit Workloads for Enterprise QLC SSDs - Presented by Micron","event_start":"2019-03-15 13:30:00","event_end":"2019-03-15 13:45:00","event_type":"Expo Hall Talk","description":"With breakthrough storage technologies like Quad-Level Cell (QLC) SSDs now readily available, storage developers need to become more sophisticated in their endurance needs. Based on real results and countless customer uses for the world\u2019s first QLC SSD, Micron will show you the 8 best ways to deploy QLC SSDs and how to save and adopt them in your systems.","seats":"0","goers":"22","invite_only":"N","venue":"Expo Hall 1","id":"31b7500f1cbb3b2f7386961f6edabdd0","venue_id":"894058","speakers":"Steve Hanna"},{"event_key":"332","active":"Y","name":"The State of Hardware Security: Cerberus Present and Future - Presented by Microsoft","event_start":"2019-03-14 16:10:00","event_end":"2019-03-14 16:25:00","event_type":"Expo Hall Talk","description":"Microsoft announced Project Cerberus in October 2017 at the Open Compute Project Summit and contributed the specifications to OCP community.  In this presentation, we will discuss Cerberus V1 development and products and go over Cerberus Next, a proposal for second generation Cerberus for hardware security.  Cerberus Next will provide in-silicon hardware security which will be an enhancement over V1.","seats":"0","goers":"128","invite_only":"N","venue":"Expo Hall 1","id":"369aceb7f5f2da10a572c3e33f79cdf5","venue_id":"894058","speakers":"Bryan Kelly, Badriddine Khessib"},{"event_key":"219","active":"Y","name":"cRPD \u2013 Cloud-Grade Routing as a Micro-Service for Open Networking Platforms","event_start":"2019-03-15 15:15:00","event_end":"2019-03-15 15:27:00","event_type":"EW: SONiC","description":"Building web scale data centers require simple, open, scale-out, secure, automated software architectures. This requires disaggregation of the technology stack so that applications can run in any cloud, cloud workloads can run on any device, and software is not locked to hardware. Here we will present a solution using JUNOS control plane (cRPD) running as a software micro-service which provides management, routing, programmability and rich telemetry in a container package. Will demonstrate following use cases using cRPD, 1. Scale out Route Reflector and Route Server with Kubernetes 2. Routing on the host (BGP, ISIS, OSPF, BFD, Netconf, OpenConfig, gRPC based APIs & telemetry) 3. Egress peer engineering in Data Centers 4. Building Overlays in Data Centers (L3VPN, EVPN) with MPLSoUDP, VxLAN, SR-MPLS 5. Securing host in data centers - filtering and DDoS protection using BGP Flow spec 6. Routing on SONiC for white box switches 7. Routing on edge cloud gateway","seats":"0","goers":"15","invite_only":"N","venue":"Marriott Salon IV","id":"37d5916382c5f341461ca3e73350a6eb","venue_id":"859652","speakers":"Vinay Nallamothu, Manish Gupta"},{"event_key":"181","active":"Y","name":"LinuxBoot: Boot anything from Linux","event_start":"2019-03-15 15:00:00","event_end":"2019-03-15 15:25:00","event_type":"EW: OSF\/Security","description":"With LinuxBoot making its way into data centers, people are starting to wonder: can I boot something other than Linux? Of course you can! We'll talk about getting multiboot kernels such as Xen or VMware ESXi or Akaros to boot from Linux, as well as goals such as getting Windows to boot.","seats":"0","goers":"52","invite_only":"N","venue":"Marriott Salon III","id":"37d931d85f9dfaf04076dfade4a8392f","venue_id":"859612","speakers":"Chris Koch"},{"event_key":"163","active":"Y","name":"SONiC Event Driven Dataplane Telemetry","event_start":"2019-03-15 09:45:00","event_end":"2019-03-15 09:57:00","event_type":"EW: SONiC","description":"We present a method for performing accurate and efficient telemetry based on dataplane events. Instead of capturing large volumes of statistical data (sflow or INT), we target specific network events such as packet drops, physical layer drop, buffer congestion and latency thresholds. An event record is generated with the truncated packet along with a cause or reason. An optional local aggregation mechanism is proposed that will reduce the network load by filtering any redundant data. For example, in a buffer tail drop, only a single representative packet per flow need be sent with relevant counters. A mechanism for integration in SONiC will be presented.","seats":"0","goers":"34","invite_only":"N","venue":"Marriott Salon IV","id":"394252392bf4e03fbf64f90720ca1603","venue_id":"859652","speakers":"Matty Kadosh, Aviad Raveh"},{"event_key":"20","active":"Y","name":"Lunch","event_start":"2019-03-15 12:00:00","event_end":"2019-03-15 13:00:00","event_type":"Meals","seats":"0","goers":"119","invite_only":"N","venue":"Lobby","id":"3a1994c0c31df3359e10da46b45139ff","venue_id":"851654"},{"event_key":"195","active":"Y","name":"Power Shelf Input Power Connector Design Workshop","event_start":"2019-03-15 16:00:00","event_end":"2019-03-15 16:30:00","event_type":"EW: Rack & Power","description":"The Open Rack Standard is driven off of open, non-proprietary designs that can be developed cheaply and easily. This philosophy has been used to drive down costs in many areas except for one: the electrical connector. This session will highlight the progress made in developing a Universal Connector for input power to the power shelf, and to solicit feedback from the community before a standard is finalized","seats":"0","goers":"31","invite_only":"N","venue":"210 BF","id":"3ad4b067380a1795c18aba8b95ae983b","venue_id":"851687","speakers":"Will Stewart"},{"event_key":"338","active":"Y","name":"Open Cloud, Open Access Solutions - Presented by Cambridge Industries","event_start":"2019-03-15 12:50:00","event_end":"2019-03-15 13:05:00","event_type":"Expo Hall Talk","description":"Introduction of Cloud and Access networking evolution, large scale JDM\/ODM business model and open platforms\/solutions, CIG\u2019s contribution in Data Center Switch and Open OLT","seats":"0","goers":"16","invite_only":"N","venue":"Expo Hall 1","id":"3b204a4f7fc0b83ee528e94dfeeaca66","venue_id":"894058","speakers":"Michael Xin"},{"event_key":"352","active":"Y","name":"Future Memory and Storage Technologies Fueling Innovation in the Cloud - Presented by Samsung","event_start":"2019-03-14 11:50:00","event_end":"2019-03-14 12:05:00","event_type":"Expo Hall Talk","description":"Samsung, a key driver of new flash and memory technologies, is the industry leader in NVMe SSDs and high capacity memory. Learn how Samsung\u2019s next generation products will facilitate continuous innovation in the cloud. Topics will include future high density memory solutions, new SSD products that enable the all NVMe data center, as well as intelligent flash storage concepts that will help overcome CPU limitations and maximize data center efficiencies.","seats":"0","goers":"161","invite_only":"N","venue":"Expo Hall 1","id":"3d4f1215853e3379aa45ad95492c0ab1","venue_id":"894058","speakers":"Anders Graham, Anson Tsui"},{"event_key":"204","active":"Y","name":"How Effective was OCP Adoption in Yahoo! Japan Infrastructure as Non-Board Member of OCP","event_start":"2019-03-15 13:30:00","event_end":"2019-03-15 13:55:00","event_type":"EW: Server","description":"Yahoo! JAPAN is the Top-Level Japan's Contents Service Provider. And we have adopted OCP solutions at our infrastructure in Japan's DC since 2016. This session provide \"Actually, How effective by adopting OCP as Non-Board Member of OCP\". Especially, I'd like you to refer to session for People who are considering OCP which includes like Non-Board Member of OCP, as same infrastructure scale as Yahoo! Japan. This session will include below topics - CAPEX\/OPEX figures from Yahoo! Japan Case - In Japan, Datacenter standard for OCP \/ Power standard for OCP - In our datacenter, how to delivery and install of OCP - operation cost comparison between EIA19 and OCP from actual data I'd like to emphasize that OCP is one of the effective solution for Non-Board Member and U.S. Datacenter.","seats":"0","goers":"43","invite_only":"N","venue":"210 CG","id":"3df33640edc52077e9e128022edaaf85","venue_id":"851681","speakers":"Kazuhide Fujimi"},{"event_key":"361","active":"Y","name":"OCP Experience Lab","event_start":"2019-03-15 07:30:00","event_end":"2019-03-15 17:00:00","event_type":"Expo Hall","seats":"0","goers":"22","invite_only":"N","venue":"Lobby","id":"3f4367f25de33a369f4211cea2daa57c","venue_id":"851654"},{"event_key":"159","active":"Y","name":"Large-scale Operations for our Next-gen Fabric and Fabric Hardware","event_start":"2019-03-15 09:30:00","event_end":"2019-03-15 09:55:00","event_type":"EW: Networking: Software","description":"There is a lot of testing to get ready for a new fabric and new hardware, including large-scale device and network testing, as well as operational migration, configuration, and image automation testing.","seats":"0","goers":"59","invite_only":"N","venue":"210 DH","id":"3fdf2210519e97d44469e8d94bc6485f","venue_id":"859649","speakers":"Lalita Damaraju, Ashik Ratnani"},{"event_key":"345","active":"Y","name":"MiTAC\u2019s Offering for OCP and the Next Gen Infrastructure - Presented by MiTAC","event_start":"2019-03-15 15:10:00","event_end":"2019-03-15 15:25:00","event_type":"Expo Hall Talk","description":"