Refactor project structure
This commit is contained in:
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
|
||||
}
|
||||
Reference in New Issue
Block a user