mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 15:32:17 +00:00
Models
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user