Files
FHC-Core/application/models/codex/Nation_model.php
T
Paminger 6836c3608d Models
2016-05-04 07:05:23 +02:00

74 lines
1.3 KiB
PHP

<?php
class Nation_model extends DB_Model
{
protected $_bundeslandQuery = "SELECT * FROM bis.tbl_bundesland";
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'bis.tbl_nation';
$this->pk = 'nation_code';
}
/**
*
*/
public function getAll($notLocked = FALSE, $orderEnglish = FALSE)
{
$result = NULL;
// Checks if the operation is permitted by the API caller
// All the code should be put inside this if statement
if(isAllowed($this->getAddonID(), 'nation'))
{
$result = $this->db->query($this->_getNationQuery($notLocked, $orderEnglish));
}
return $result;
}
/**
*
*/
protected function _getNationQuery($notLocked = FALSE, $orderEnglish = FALSE)
{
$qry = "SELECT * FROM bis.tbl_nation";
if($notLocked)
{
$qry .= " WHERE sperre IS NULL";
}
if(!$orderEnglish)
{
$qry .= " ORDER BY kurztext";
}
else
{
$qry .= " ORDER BY engltext";
}
return $qry;
}
/**
*
*/
public function getBundesland()
{
$result = NULL;
// Checks if the operation is permitted by the API caller
// All the code should be put inside this if statement
if(isAllowed($this->getAddonID(), 'nation'))
{
$result = $this->db->query($this->_bundeslandQuery);
}
return $result;
}
}