diff --git a/src/admin/common/abstract/model.php b/src/admin/common/abstract/model.php index b87f6fa..e3c4ce8 100644 --- a/src/admin/common/abstract/model.php +++ b/src/admin/common/abstract/model.php @@ -127,7 +127,7 @@ abstract class AbstractCommonClubsModel { foreach($this->getFactory()->getAttributes() as $k => $v) { - if($v['type'] !== 'ref') + if(empty($v['type']) || $v['type'] !== 'ref') continue; if(empty($v['ref'])) @@ -148,7 +148,7 @@ abstract class AbstractCommonClubsModel return $factory->loadById($value); } - private static const CLASSNAME_MAP = array( + private const CLASSNAME_MAP = array( ); diff --git a/src/admin/common/abstract/modelfactory.php b/src/admin/common/abstract/model/factory.php similarity index 94% rename from src/admin/common/abstract/modelfactory.php rename to src/admin/common/abstract/model/factory.php index ac3ce15..d27f5c8 100644 --- a/src/admin/common/abstract/modelfactory.php +++ b/src/admin/common/abstract/model/factory.php @@ -62,7 +62,7 @@ abstract class AbstractCommonClubsModelFactory // } $q->select('main.id AS id');//->select($columns); - $q->from($this->getTableName(), 'main'); + $q->from($this->getTableName() . ' AS main'); // TODO Joins @@ -72,13 +72,11 @@ abstract class AbstractCommonClubsModelFactory $db->setQuery($q); $db->execute(); - $it = $db->getIterator(); + $rows = $db->loadAssocList(); $ret = array(); - while($it->valid()) + foreach($rows as $row) { - $row = $it->current(); $ret[] = $this->generateObject($row); - $it->next(); } return $ret; @@ -109,7 +107,7 @@ abstract class AbstractCommonClubsModelFactory protected function generateObject($row) { $obj = $this->generatePlainObject($row['id']); - $obj->marksAsNew(false); + $obj->markAsNew(false); //unset($row['id']); //$obj->setValues($row); diff --git a/src/admin/common/models/club.php b/src/admin/common/models/club.php index 12ed40a..024ebdb 100644 --- a/src/admin/common/models/club.php +++ b/src/admin/common/models/club.php @@ -11,4 +11,50 @@ class CommonClubsModelClub extends AbstractCommonClubsModel return new CommonClubsModelFactoryClub(); } + public function getName() + { + return $this->getValues()['name']; + } + + public function getAddress() + { + return $this->getValues()['address']; + } + + public function getCity() + { + return $this->getValues()['city']; + } + + public function getHomepage() + { + return $this->getValues()['homepage']; + } + + public function getMail() + { + return $this->getValues()['mail']; + } + + public function getIban() + { + return $this->getValues()['iban']; + } + + public function getBic() + { + return $this->getValues()['bic']; + } + + public function isCharitable() + { + return $this->getValues()['charitable']; + } + + public function getPresident() + { + return $this->getValues()['president']; + } + + } diff --git a/src/admin/views/test/tmpl/default.php b/src/admin/views/test/tmpl/default.php new file mode 100644 index 0000000..9c82d19 --- /dev/null +++ b/src/admin/views/test/tmpl/default.php @@ -0,0 +1,16 @@ + + +ClubName: club->getName(); ?>
+ClubName: club->getAddress(); ?>
+ClubName: club->getCity(); ?>
+ClubName: club->getHomepage(); ?>
+ClubName: club->getMail(); ?>
+ClubName: club->getIban(); ?>
+ClubName: club->getBic(); ?>
+ClubName: club->isCharitable(); ?>
+ClubName: club->getPresident(); ?>
diff --git a/src/admin/views/test/view.html.php b/src/admin/views/test/view.html.php new file mode 100644 index 0000000..dd1fc89 --- /dev/null +++ b/src/admin/views/test/view.html.php @@ -0,0 +1,35 @@ +clubs = $factory->loadElements(); + + $this->club = $this->clubs[0]; + + parent::display($tpl); + } + + protected function getViewName() + { + return 'club'; + } + protected function getElementController() + { + return new ClubsControllerClub(); + } + + +}