public function __construct($keys = null) { if (is_array($keys)) { $orgModel = new FM_Models_FM_Orgdata(); $orgTowns = new FM_Models_FM_OrgTown(); $org = $orgModel->getOrgByKeys($keys); if (is_array($org) && count($org)) { foreach ($org as $key => $value) { if (property_exists($this, $key)) { if ($key == 'keywords') { $keywords = explode(',', $value); if (!is_array($keywords)) { continue; } foreach ($keywords as $word) { $this->keywords[] = trim($word); } } else { $this->{$key} = $value; } } } $this->_orgConfig = new FM_Components_OrgConfig(array('orgId' => $this->id, 'type' => $this->type), $this->id); $this->logo = new FM_Components_Util_Logo(array('orgId' => $this->id)); $this->miniwebBanner = new FM_Components_Util_MiniwebBanner(array('orgId' => $this->id)); $this->icon = new FM_Components_Util_Icon(array('orgId' => $this->id)); $this->hits = FM_Components_HitCounter::getHits($this->id); $orgRegion = new FM_Models_FM_OrgRegion(); $regions = $orgRegion->getRecordsByKeys(array('orgId' => $this->id)); foreach ($regions as $region) { $this->regions[] = $region['regionId']; } $towns = $orgTowns->getTownIdsByKeys(array('orgId' => $org['id'])); foreach ($towns as $i => $val) { $this->towns[] = $val['townId']; } if (!count($towns)) { $this->towns[] = $this->getRegion(); } //print_r($this->logo);exit; return true; } return false; } return true; }
function init() { $this->_siteConfig = new FM_Components_SiteConfig(); if (!stristr($_SERVER['REQUEST_URI'], 'ajax')) { $this->view->layout()->payBanner = $this->_siteConfig->usePayBanners() ? FM_Components_Util_PayBanner::getRandom() : false; $this->view->layout()->fullBanner = $this->_siteConfig->useFullBanners() ? FM_Components_Util_FullBanner::getRandom() : false; $this->view->layout()->background = $this->_siteConfig->getBackground(); } $this->view->layout()->mediakit = FM_Components_Util_MediaKit::getLink(); if ($this->_getParam('id')) { FM_Components_HitCounter::update($this->_getParam('id')); } if (stristr($_SERVER['REQUEST_URI'], 'admin')) { $this->_admin = true; $this->view->layout()->admin = $this->_admin; } if (Zend_Auth::getInstance()->hasIdentity()) { $this->view->layout()->name = Zend_Auth::getInstance()->getIdentity(); } $namespace = new Zend_Session_Namespace('client'); if (isset($namespace->user) && $namespace->user instanceof FM_Components_Member) { $this->_user = $namespace->user; } }