Created basic backend for club view
This commit is contained in:
@@ -173,7 +173,11 @@ abstract class AbstractClubsController extends BaseController
|
||||
continue;
|
||||
}
|
||||
|
||||
$value = (isset($values[$m]) && strlen($values[$m]) > 0) ? $values[$m] : null;
|
||||
if(isset($v['skip_null_check']))
|
||||
$value = $values[$m];
|
||||
else
|
||||
$value = (isset($values[$m]) && strlen($values[$m]) > 0) ? $values[$m] : null;
|
||||
|
||||
$obj->$functionName($value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,16 +107,7 @@ abstract class AbstractClubsModel
|
||||
$q = $dbo->getQuery(true);
|
||||
|
||||
$mappings = $this->getDataMappings();
|
||||
$values = array();
|
||||
foreach($mappings as $m)
|
||||
$values[$m] = $this->$m;
|
||||
|
||||
$this->filter($values);
|
||||
|
||||
foreach($mappings as $m)
|
||||
$values[$m] = $q->q($values[$m]);
|
||||
|
||||
$this->postQuoteFilter($values);
|
||||
$values = $this->getDataValues($mappings, $q);
|
||||
|
||||
$q->insert($this->getTableName())
|
||||
->columns(array_map(array($q, 'qn'), $mappings))
|
||||
@@ -139,16 +130,7 @@ abstract class AbstractClubsModel
|
||||
$q = $dbo->getQuery(true);
|
||||
|
||||
$mapping = $this->getDataMappings();
|
||||
$values = array();
|
||||
foreach($mapping as $m)
|
||||
$values[$m] = $this->$m;
|
||||
|
||||
$this->filter($values);
|
||||
|
||||
foreach($mapping as $m)
|
||||
$values[$m] = $q->q($values[$m]);
|
||||
|
||||
$this->postQuoteFilter($values);
|
||||
$values = $this->getDataValues($mapping, $q);
|
||||
|
||||
$q->update($this->getTableName());
|
||||
foreach($mapping as $m)
|
||||
@@ -159,6 +141,32 @@ abstract class AbstractClubsModel
|
||||
$dbo->execute();
|
||||
}
|
||||
|
||||
private function getDataValues($mapping, $q)
|
||||
{
|
||||
$rawValues = array();
|
||||
|
||||
foreach($mapping as $m)
|
||||
$rawValues[$m] = $this->$m;
|
||||
|
||||
$this->filter($rawValues);
|
||||
|
||||
$quotedValues = array();
|
||||
|
||||
foreach($mapping as $m)
|
||||
{
|
||||
if(is_bool($rawValues[$m]))
|
||||
$quotedValues[$m] = $rawValues[$m] ? 'TRUE' : 'FALSE';
|
||||
else if(is_numeric($rawValues[$m]))
|
||||
$quotedValues[$m] = $rawValues[$m];
|
||||
else
|
||||
$quotedValues[$m] = $q->q($rawValues[$m]);
|
||||
}
|
||||
|
||||
$this->postQuoteFilter($quotedValues);
|
||||
|
||||
return $quotedValues;
|
||||
}
|
||||
|
||||
protected function prepareDelete($dbo){}
|
||||
|
||||
public function delete()
|
||||
@@ -186,7 +194,7 @@ abstract class AbstractClubsModel
|
||||
{
|
||||
foreach($this->getRequiredDataMappings() as $m)
|
||||
{
|
||||
if(!isset($this->$m) || empty($this->$m) || $this->$m === null)
|
||||
if(!isset($this->$m) || is_null($this->$m) || $this->$m === null)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user