|
@@ -2,10 +2,11 @@
|
|
|
|
|
|
|
|
namespace Opentalent\OtAdmin\Controller;
|
|
namespace Opentalent\OtAdmin\Controller;
|
|
|
|
|
|
|
|
-use Opentalent\OtTemplating\Domain\Model\Organization;
|
|
|
|
|
-use Opentalent\OtTemplating\Domain\Repository\OrganizationRepository;
|
|
|
|
|
-use Opentalent\OtTemplating\Exception\ApiRequestException;
|
|
|
|
|
-use Opentalent\OtTemplating\Page\OtPageRepository;
|
|
|
|
|
|
|
+use http\Exception\RuntimeException;
|
|
|
|
|
+use Opentalent\OtCore\Domain\Model\Organization;
|
|
|
|
|
+use Opentalent\OtCore\Domain\Repository\OrganizationRepository;
|
|
|
|
|
+use Opentalent\OtCore\Exception\ApiRequestException;
|
|
|
|
|
+use Opentalent\OtCore\Page\OtPageRepository;
|
|
|
use PDO;
|
|
use PDO;
|
|
|
use Psr\Log\LoggerAwareInterface;
|
|
use Psr\Log\LoggerAwareInterface;
|
|
|
use Symfony\Component\Yaml\Yaml;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
@@ -56,7 +57,7 @@ class SiteController extends ActionController
|
|
|
const DEFAULT_COLOR = 'light-blue';
|
|
const DEFAULT_COLOR = 'light-blue';
|
|
|
|
|
|
|
|
// BE rights
|
|
// BE rights
|
|
|
- CONST PRODUCT_MAPPING = [
|
|
|
|
|
|
|
+ const PRODUCT_MAPPING = [
|
|
|
"school-standard" => 1, // Association writer basic
|
|
"school-standard" => 1, // Association writer basic
|
|
|
"artist-standard" => 1, // Association writer basic
|
|
"artist-standard" => 1, // Association writer basic
|
|
|
"school-premium" => 3, // Association writer full
|
|
"school-premium" => 3, // Association writer full
|
|
@@ -64,6 +65,9 @@ class SiteController extends ActionController
|
|
|
"manager" => 3, // Association writer full
|
|
"manager" => 3, // Association writer full
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+ const MODE_PROD = 1;
|
|
|
|
|
+ const MODE_DEV = 1;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Doctrine connection pool
|
|
* Doctrine connection pool
|
|
|
* @var object|LoggerAwareInterface|\TYPO3\CMS\Core\SingletonInterface
|
|
* @var object|LoggerAwareInterface|\TYPO3\CMS\Core\SingletonInterface
|
|
@@ -103,10 +107,13 @@ class SiteController extends ActionController
|
|
|
* returns the root page uid of the newly created site
|
|
* returns the root page uid of the newly created site
|
|
|
*
|
|
*
|
|
|
* @param int $organizationId
|
|
* @param int $organizationId
|
|
|
|
|
+ * @param int $mode Can be either MODE_PROD or MODE_DEV, MODE_PROD being the normal behaviour.
|
|
|
|
|
+ * If MODE_DEV is used, sites urls will be of the form 'http://host/subdomain'
|
|
|
|
|
+ * instead of 'http://subdomain/host'
|
|
|
* @return int Uid of the root page of the newly created website
|
|
* @return int Uid of the root page of the newly created website
|
|
|
* @throws \RuntimeException|\Exception
|
|
* @throws \RuntimeException|\Exception
|
|
|
*/
|
|
*/
|
|
|
- public function createSiteAction(int $organizationId) {
|
|
|
|
|
|
|
+ public function createSiteAction(int $organizationId, int $mode=self::MODE_PROD) {
|
|
|
|
|
|
|
|
$organization = $this->fetchOrganization($organizationId);
|
|
$organization = $this->fetchOrganization($organizationId);
|
|
|
|
|
|
|
@@ -385,7 +392,14 @@ class SiteController extends ActionController
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
// Build and update the domain
|
|
// Build and update the domain
|
|
|
- $domain = $organization->getSubDomain() . '.opentalent.fr';
|
|
|
|
|
|
|
+ if ($mode == self::MODE_PROD) {
|
|
|
|
|
+ $domain = $organization->getSubDomain() . '.opentalent.fr';
|
|
|
|
|
+ } elseif ($mode == self::MODE_DEV) {
|
|
|
|
|
+ $domain = $organization->getSubDomain() . '/';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new RuntimeException('Unknown value for $mode: ' . $mode);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$queryBuilder = $this->cnnPool->getQueryBuilderForTable('sys_domain');
|
|
$queryBuilder = $this->cnnPool->getQueryBuilderForTable('sys_domain');
|
|
|
$queryBuilder->insert('sys_domain')
|
|
$queryBuilder->insert('sys_domain')
|
|
|
->values([
|
|
->values([
|