Refactor project structure
This commit is contained in:
40
core/src/Metadata/Admin/Api/MetadataAdminManager.php
Normal file
40
core/src/Metadata/Admin/Api/MetadataAdminManager.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:10 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Admin\Api;
|
||||
|
||||
use Classes\AbstractModuleManager;
|
||||
|
||||
class MetadataAdminManager extends AbstractModuleManager
|
||||
{
|
||||
|
||||
public function initializeUserClasses()
|
||||
{
|
||||
}
|
||||
|
||||
public function initializeFieldMappings()
|
||||
{
|
||||
}
|
||||
|
||||
public function initializeDatabaseErrorMappings()
|
||||
{
|
||||
}
|
||||
|
||||
public function setupModuleClassDefinitions()
|
||||
{
|
||||
$this->addModelClass('Country');
|
||||
$this->addModelClass('Province');
|
||||
$this->addModelClass('CurrencyType');
|
||||
$this->addModelClass('Nationality');
|
||||
$this->addModelClass('ImmigrationStatus');
|
||||
$this->addModelClass('Ethnicity');
|
||||
$this->addModelClass('CalculationHook');
|
||||
$this->addModelClass('SupportedLanguage');
|
||||
$this->addModelClass('CustomFieldValue');
|
||||
}
|
||||
}
|
||||
43
core/src/Metadata/Common/Model/CalculationHook.php
Normal file
43
core/src/Metadata/Common/Model/CalculationHook.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:08 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Classes\BaseService;
|
||||
use Model\BaseModel;
|
||||
|
||||
class CalculationHook extends BaseModel
|
||||
{
|
||||
public $table = 'CalculationHooks';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
return BaseService::getInstance()->getCalculationHooks();
|
||||
}
|
||||
|
||||
function Load($where = null, $bindarr = false)
|
||||
{
|
||||
return BaseService::getInstance()->getCalculationHook($bindarr[0]);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
54
core/src/Metadata/Common/Model/Country.php
Normal file
54
core/src/Metadata/Common/Model/Country.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:00 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Classes\SettingsManager;
|
||||
use Model\BaseModel;
|
||||
|
||||
class Country extends BaseModel
|
||||
{
|
||||
public $table = 'Country';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Countries');
|
||||
$allowedCountries = array();
|
||||
if (!empty($allowedCountriesStr)) {
|
||||
$allowedCountries = json_decode($allowedCountriesStr, true);
|
||||
}
|
||||
|
||||
if (!empty($allowedCountries)) {
|
||||
$res = parent::Find("id in (".implode(",", $allowedCountries).")", array());
|
||||
if (empty($res)) {
|
||||
SettingsManager::getInstance()->setSetting('System: Allowed Countries', '');
|
||||
} else {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
54
core/src/Metadata/Common/Model/CurrencyType.php
Normal file
54
core/src/Metadata/Common/Model/CurrencyType.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:03 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Classes\SettingsManager;
|
||||
use Model\BaseModel;
|
||||
|
||||
class CurrencyType extends BaseModel
|
||||
{
|
||||
public $table = 'CurrencyTypes';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Currencies');
|
||||
$allowedCountries = array();
|
||||
if (!empty($allowedCountriesStr)) {
|
||||
$allowedCountries = json_decode($allowedCountriesStr, true);
|
||||
}
|
||||
|
||||
if (!empty($allowedCountries)) {
|
||||
$res = parent::Find("id in (".implode(",", $allowedCountries).")", array());
|
||||
if (empty($res)) {
|
||||
SettingsManager::getInstance()->setSetting('System: Allowed Currencies', '');
|
||||
} else {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
31
core/src/Metadata/Common/Model/CustomFieldValue.php
Normal file
31
core/src/Metadata/Common/Model/CustomFieldValue.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:08 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Model\BaseModel;
|
||||
|
||||
class CustomFieldValue extends BaseModel
|
||||
{
|
||||
public $table = 'CustomFieldValues';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
31
core/src/Metadata/Common/Model/Ethnicity.php
Normal file
31
core/src/Metadata/Common/Model/Ethnicity.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:07 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Model\BaseModel;
|
||||
|
||||
class Ethnicity extends BaseModel
|
||||
{
|
||||
public $table = 'Ethnicity';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
31
core/src/Metadata/Common/Model/ImmigrationStatus.php
Normal file
31
core/src/Metadata/Common/Model/ImmigrationStatus.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:06 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Model\BaseModel;
|
||||
|
||||
class ImmigrationStatus extends BaseModel
|
||||
{
|
||||
public $table = 'ImmigrationStatus';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
53
core/src/Metadata/Common/Model/Nationality.php
Normal file
53
core/src/Metadata/Common/Model/Nationality.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:03 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Classes\SettingsManager;
|
||||
use Model\BaseModel;
|
||||
|
||||
class Nationality extends BaseModel
|
||||
{
|
||||
public $table = 'Nationality';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
// @codingStandardsIgnoreStart
|
||||
function Find($whereOrderBy, $bindarr = false, $pkeysArr = false, $extra = array())
|
||||
{
|
||||
$allowedCountriesStr = SettingsManager::getInstance()->getSetting('System: Allowed Nationality');
|
||||
$allowedCountries = array();
|
||||
if (!empty($allowedCountriesStr)) {
|
||||
$allowedCountries = json_decode($allowedCountriesStr, true);
|
||||
}
|
||||
|
||||
if (!empty($allowedCountries)) {
|
||||
$res = parent::Find("id in (".implode(",", $allowedCountries).")", array());
|
||||
if (empty($res)) {
|
||||
SettingsManager::getInstance()->setSetting('System: Allowed Countries', '');
|
||||
} else {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::Find($whereOrderBy, $bindarr, $pkeysArr, $extra);
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
31
core/src/Metadata/Common/Model/Province.php
Normal file
31
core/src/Metadata/Common/Model/Province.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:02 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Model\BaseModel;
|
||||
|
||||
class Province extends BaseModel
|
||||
{
|
||||
public $table = 'Province';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get", "element", "save", "delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get", "element");
|
||||
}
|
||||
}
|
||||
31
core/src/Metadata/Common/Model/SupportedLanguage.php
Normal file
31
core/src/Metadata/Common/Model/SupportedLanguage.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Thilina
|
||||
* Date: 8/19/17
|
||||
* Time: 3:09 PM
|
||||
*/
|
||||
|
||||
namespace Metadata\Common\Model;
|
||||
|
||||
use Model\BaseModel;
|
||||
|
||||
class SupportedLanguage extends BaseModel
|
||||
{
|
||||
public $table = 'SupportedLanguages';
|
||||
|
||||
public function getAdminAccess()
|
||||
{
|
||||
return array("get","element","save","delete");
|
||||
}
|
||||
|
||||
public function getUserAccess()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getAnonymousAccess()
|
||||
{
|
||||
return array("get","element");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user