File indexing completed on 2024-05-12 05:58:38

0001 <?php
0002 
0003 /**
0004  *  ocs-webserver
0005  *
0006  *  Copyright 2016 by pling GmbH.
0007  *
0008  *    This file is part of ocs-webserver.
0009  *
0010  *    This program is free software: you can redistribute it and/or modify
0011  *    it under the terms of the GNU Affero General Public License as
0012  *    published by the Free Software Foundation, either version 3 of the
0013  *    License, or (at your option) any later version.
0014  *
0015  *    This program is distributed in the hope that it will be useful,
0016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0018  *    GNU Affero General Public License for more details.
0019  *
0020  *    You should have received a copy of the GNU Affero General Public License
0021  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0022  **/
0023 class HomeController extends Local_Controller_Action_DomainSwitch
0024 {
0025     public function indexAction()
0026     {
0027        
0028         /** @var Default_Model_ConfigStore $storeConfig */        
0029         $storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null;
0030 
0031         if ($storeConfig) {
0032             $this->view->tag_filter = Zend_Registry::isRegistered('config_store_tags') ? Zend_Registry::get('config_store_tags') : null;
0033 
0034             if ($storeConfig->isShowHomepage()) {
0035                 $index = $this->getParam('index');
0036                 if ($index) {
0037                     if ((int)$index == 1) {
0038                         $this->_helper->viewRenderer('index-' . $storeConfig->config_id_name . '-test');
0039                     } else {
0040                         $this->_helper->viewRenderer('index-' . $storeConfig->config_id_name . '-test' . $index);
0041                     }
0042 
0043                     $this->view->index = $index;
0044                 } else {
0045                     //$this->_helper->viewRenderer('index-' . $storeConfig->config_id_name);
0046                     if ($storeConfig->config_id_name=='opendesktop' && Zend_Auth::getInstance()->hasIdentity()){
0047                             $this->redirect('/start');                           
0048                         }else{
0049                             $this->_helper->viewRenderer('index-' . $storeConfig->config_id_name);
0050                         }   
0051                                       
0052                 }
0053 
0054                 return;
0055             }
0056 
0057         }
0058         $params = array('ord' => 'latest');
0059         if ($this->hasParam('domain_store_id')) {
0060             $params['domain_store_id'] = $this->getParam('domain_store_id');
0061         }
0062         $this->forward('index', 'explore', 'default', $params);
0063     }
0064 
0065     public function startAction()
0066     {
0067         if (!Zend_Auth::getInstance()->hasIdentity()){
0068             $this->redirect('/login');
0069         }
0070 
0071         /** @var Default_Model_ConfigStore $storeConfig */
0072         $storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null;
0073 
0074         if ($storeConfig) {
0075             $this->view->tag_filter = Zend_Registry::isRegistered('config_store_tags') ? Zend_Registry::get('config_store_tags') : null;
0076             if ($storeConfig->isShowHomepage()) {
0077                 //index-opendesktop-start.phtml view
0078                 $this->_helper->viewRenderer('index-' . $storeConfig->config_id_name . '-start');
0079                 return;
0080                 
0081             }
0082         }
0083         $params = array('ord' => 'latest');
0084         if ($this->hasParam('domain_store_id')) {
0085             $params['domain_store_id'] = $this->getParam('domain_store_id');
0086         }
0087         $this->forward('index', 'explore', 'default', $params);
0088     }
0089 
0090     public function showfeatureajaxAction()
0091     {
0092         $this->_helper->layout->disableLayout();
0093         $modelInfo = new Default_Model_Info();
0094         $page = (int)$this->getParam('page');
0095         $type = '';
0096         if ($page == 0) {
0097             $featureProducts = $modelInfo->getRandProduct();
0098             $type = '';
0099 
0100         } elseif ($page == 1) {
0101             $featureProducts = $modelInfo->getRandFeaturedProduct();
0102             $type = 'Featured';
0103 
0104         } elseif ($page == 2) {
0105             $featureProducts = $modelInfo->getRandPlingedProduct();
0106             $type = 'Plinged';
0107 
0108         }
0109 
0110 
0111         $this->view->featureProducts = $featureProducts;
0112         $this->view->type = $type;
0113         $this->_helper->viewRenderer('/partials/featuredProducts');
0114     }
0115 
0116 
0117     public function showlastproductsjsonAction()
0118     {
0119 
0120         $this->_helper->layout->disableLayout();
0121         $modelInfo = new Default_Model_Info();
0122         $offset = (int)$this->getParam('offset', 0);
0123         $limit = (int)$this->getParam('limit', 5);
0124         $catIds = $this->getParam('catIDs');
0125         $tags = $this->getParam('ptype');
0126         $isOriginal = $this->getParam('isoriginal');
0127         $response = $modelInfo->getJsonLastProductsForHostStores($limit, $catIds, $tags, $isOriginal, $offset);
0128         $this->_helper->json(Zend_Json::decode($response));
0129     }
0130 
0131 
0132     public function getnewactiveplingedproductjsonAction()
0133     {
0134 
0135         $this->_helper->layout->disableLayout();
0136         $modelInfo = new Default_Model_Info();
0137         $offset = (int)$this->getParam('offset', 0);
0138         $limit = (int)$this->getParam('limit', 5);
0139         $response = $modelInfo->getJsonNewActivePlingProduct($limit, $offset);
0140         $this->_helper->json(Zend_Json::decode($response));
0141     }
0142 
0143 
0144     public function showfeaturejsonAction()
0145     {
0146 
0147         $this->_helper->layout->disableLayout();
0148         $this->_helper->viewRenderer->setNoRender(true);
0149         $modelInfo = new Default_Model_Info();
0150         $page = (int)$this->getParam('page');
0151         if ($page == 0) {
0152             $featureProducts = $modelInfo->getRandProduct();
0153             $featureProducts->setItemCountPerPage(1);
0154             $featureProducts->setCurrentPageNumber(1);
0155         } else {
0156             $featureProducts = $modelInfo->getFeaturedProductsForHostStores(100);
0157             if ($featureProducts->getTotalItemCount() > 0) {
0158                 $offset = (int)$this->getParam('page');
0159                 $irandom = rand(1, $featureProducts->getTotalItemCount());
0160                 $featureProducts->setItemCountPerPage(1);
0161                 $featureProducts->setCurrentPageNumber($irandom);
0162             }
0163         }
0164 
0165         $item = null;
0166         foreach ($featureProducts as $i) {
0167             $item = $i;
0168             break;
0169         }
0170         $helpCategories = new Default_View_Helper_FetchCategoriesForProductAsString();
0171         $response = array(
0172             'project_id'        => $item['project_id'],
0173             'member_id'         => $item['member_id'],
0174             'username'          => $item['username'],
0175             'profile_image_url' => $item['profile_image_url'],
0176             'featured'          => $item['featured'],
0177             'description'       => $item['description'],
0178             'title'             => $item['title'],
0179             'category'          => $helpCategories->fetchCategoriesForProductAsString($item['project_id']),
0180             'image_small'       => $item['image_small'],
0181             'laplace_score'     => $item['laplace_score'],
0182             'count_likes'       => $item['count_likes'],
0183             'count_dislikes'    => $item['count_dislikes'],
0184             'changed_at'        => $item['changed_at'],
0185             'created_at'        => $item['created_at'],
0186             'count_comments'    => $item['count_comments']
0187         );
0188         $this->_helper->json($response);
0189     }
0190 
0191 
0192     public function showspotlightjsonAction()
0193     {
0194 
0195         $this->_helper->layout->disableLayout();
0196         $this->_helper->viewRenderer->setNoRender(true);
0197         $modelInfo = new Default_Model_Info();
0198         $page = (int)$this->getParam('page');
0199         $mostplingedcreateor = $modelInfo->getMostPlingedCreators(1, $page);
0200 
0201         $creator = array_pop($mostplingedcreateor);
0202         $helperImage = new Default_View_Helper_Image();
0203         $creator['profile_image_url'] = $helperImage->Image($creator['profile_image_url'],
0204             array('width' => 200, 'height' => 200));
0205         $products = $modelInfo->getMostPlingedProductsForUser($creator['member_id'], 5, 0);
0206         foreach ($products as &$p) {
0207             $p['image_small'] = $helperImage->Image($p['image_small'], array('width' => 200, 'height' => 200));
0208         }
0209         $creator['products'] = $products;
0210         $this->_helper->json($creator);
0211     }
0212 
0213 
0214     public function metamenujsAction()
0215     {
0216         $this->_helper->layout()->disableLayout();
0217 
0218         header('Access-Control-Allow-Origin: *');
0219 
0220         $this->getResponse()
0221              ->setHeader('Access-Control-Allow-Origin', '*')
0222              ->setHeader('Access-Control-Allow-Credentials', 'true')
0223              ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
0224              ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
0225 
0226     }
0227 
0228     public function metamenubundlejsAction()
0229     {
0230         $this->_helper->layout()->disableLayout();
0231     }
0232 
0233     public function searchmemberAction()
0234     {
0235         $this->_helper->layout()->disableLayout();
0236         $this->_helper->viewRenderer->setNoRender(true);
0237         $username = $this->getParam('username');
0238         $results = null;
0239         if (strlen(trim($username)) > 2) {
0240             $model = new Default_Model_Member();
0241             $results = $model->findActiveMemberByName($username);
0242             $helperImage = new Default_View_Helper_Image();
0243             foreach ($results as &$value) {
0244                 $avatar = $helperImage->image($value['profile_image_url'],
0245                     array('width' => 100, 'height' => 100, 'crop' => 2));
0246                 $value['profile_image_url'] = $avatar;
0247             }
0248         }
0249         $this->_helper->json($results);
0250     }
0251 
0252     public function memberjsonAction()
0253     {
0254         $this->_helper->layout()->disableLayout();
0255         $this->_helper->viewRenderer->setNoRender(true);
0256         $member_id = $this->getParam('member_id');
0257         $results = null;
0258         if ($member_id) {
0259             $info = new Default_Model_Info();
0260             $commentsOpendeskop = $info->getDiscussionOpendeskop($member_id);
0261             $results = array('commentsOpendeskop' => $commentsOpendeskop);
0262         }
0263         $this->_helper->json($results);
0264     }
0265 
0266 
0267     public function baseurlajaxAction()
0268     {
0269         $this->_helper->layout()->disableLayout();
0270         $this->_helper->viewRenderer->setNoRender(true);
0271 
0272         header('Access-Control-Allow-Origin: *');
0273 
0274         $this->getResponse()
0275              ->setHeader('Access-Control-Allow-Origin', '*')
0276              ->setHeader('Access-Control-Allow-Credentials', 'true')
0277              ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
0278              ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
0279 
0280         $resultArray = array();
0281 
0282         $baseurl = Zend_Registry::get('config')->settings->client->default->baseurl;
0283 
0284         $resultArray['base_url'] = $baseurl;
0285 
0286         $resultAll = array();
0287         $resultAll['status'] = "success";
0288         $resultAll['data'] = $resultArray;
0289 
0290         $this->_helper->json($resultAll);
0291     }
0292 
0293     public function forumurlajaxAction()
0294     {
0295         $this->_helper->layout()->disableLayout();
0296         $this->_helper->viewRenderer->setNoRender(true);
0297 
0298         header('Access-Control-Allow-Origin: *');
0299 
0300         $this->getResponse()
0301              ->setHeader('Access-Control-Allow-Origin', '*')
0302              ->setHeader('Access-Control-Allow-Credentials', 'true')
0303              ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
0304              ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
0305 
0306 
0307         $resultArray = array();
0308 
0309         $url_forum = Zend_Registry::get('config')->settings->client->default->url_forum;
0310 
0311         $resultArray['url_forum'] = $url_forum;
0312 
0313         $resultAll = array();
0314         $resultAll['status'] = "success";
0315         $resultAll['data'] = $resultArray;
0316 
0317         $this->_helper->json($resultAll);
0318     }
0319 
0320     public function blogurlajaxAction()
0321     {
0322         $this->_helper->layout()->disableLayout();
0323         $this->_helper->viewRenderer->setNoRender(true);
0324 
0325         header('Access-Control-Allow-Origin: *');
0326 
0327         $this->getResponse()
0328              ->setHeader('Access-Control-Allow-Origin', '*')
0329              ->setHeader('Access-Control-Allow-Credentials', 'true')
0330              ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
0331              ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
0332 
0333         $resultArray = array();
0334 
0335         $url_blog = Zend_Registry::get('config')->settings->client->default->url_blog;
0336 
0337         $resultArray['url_blog'] = $url_blog;
0338 
0339         $resultAll = array();
0340         $resultAll['status'] = "success";
0341         $resultAll['data'] = $resultArray;
0342 
0343         $this->_helper->json($resultAll);
0344     }
0345 
0346 
0347     public function storenameajaxAction()
0348     {
0349         $this->_helper->layout()->disableLayout();
0350         $this->_helper->viewRenderer->setNoRender(true);
0351 
0352         header('Access-Control-Allow-Origin: *');
0353 
0354         $this->getResponse()
0355              ->setHeader('Access-Control-Allow-Origin', '*')
0356              ->setHeader('Access-Control-Allow-Credentials', 'true')
0357              ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
0358              ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
0359 
0360         $resultArray = array();
0361 
0362         $sname = Zend_Registry::get('store_host');
0363 
0364         $resultArray['store_name'] = $sname;
0365 
0366         $resultAll = array();
0367         $resultAll['status'] = "success";
0368         $resultAll['data'] = $resultArray;
0369 
0370         $this->_helper->json($resultAll);
0371     }
0372 
0373 
0374     public function loginurlajaxAction()
0375     {
0376         $this->_helper->layout()->disableLayout();
0377         $this->_helper->viewRenderer->setNoRender(true);
0378 
0379         header('Access-Control-Allow-Origin: *');
0380 
0381         $this->getResponse()
0382              ->setHeader('Access-Control-Allow-Origin', '*')
0383              ->setHeader('Access-Control-Allow-Credentials', 'true')
0384              ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
0385              ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
0386 
0387         $resultArray = array();
0388 
0389         $url = $this->getParam('url');
0390         $filterRedirect = new Local_Filter_Url_Encrypt();
0391 
0392         $loginUrl = '/login?redirect=' . $filterRedirect->filter($url);
0393 
0394         $resultArray['login_url'] = $loginUrl;
0395 
0396         $resultAll = array();
0397         $resultAll['status'] = "success";
0398         $resultAll['data'] = $resultArray;
0399 
0400         $this->_helper->json($resultAll);
0401     }
0402 
0403 
0404     public function domainsajaxAction()
0405     {
0406         $this->_helper->layout()->disableLayout();
0407         $this->_helper->viewRenderer->setNoRender(true);
0408 
0409         header('Access-Control-Allow-Origin: *');
0410 
0411         $this->getResponse()
0412              ->setHeader('Access-Control-Allow-Origin', '*')
0413              ->setHeader('Access-Control-Allow-Credentials', 'true')
0414              ->setHeader('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
0415              ->setHeader('Access-Control-Allow-Headers', 'origin, content-type, accept');
0416 
0417 
0418         $resultArray = array();
0419 
0420 
0421         $domainobjects = $this->fetchMetaheaderMenuJson();
0422         $resultArray['domains'] = $domainobjects;
0423 
0424         $storeobjects = $this->fetchStoresForCatTreeJson();
0425         $resultArray['storefortree'] = $storeobjects;
0426 
0427 
0428         $resultAll = array();
0429         $resultAll['status'] = "success";
0430         $resultAll['data'] = $resultArray;
0431 
0432         $this->_helper->json($resultAll);
0433     }
0434 
0435     private function fetchMetaheaderMenuJson()
0436     {
0437 
0438         $sname = Zend_Registry::get('store_host');
0439         /** @var Zend_Cache_Core $cache */
0440         $cache = Zend_Registry::get('cache');
0441         $cacheName = __FUNCTION__ . md5($sname);
0442 
0443         if (false == ($domainobjects = $cache->load($cacheName))) {
0444             $tbl = new Default_Model_DbTable_ConfigStore();
0445             $result = $tbl->fetchDomainObjects();
0446             // sort Desktop manuelly to the front
0447             $arrayDesktop = array();
0448             $arrayRest = array();
0449 
0450             foreach ($result as $obj) {
0451                 $o = $obj['order'];
0452                 $curOrder = floor($obj['order'] / 1000);
0453                 if ($curOrder < 10 or $curOrder > 50) {
0454                     continue;
0455                 }
0456                 $obj['calcOrder'] = $curOrder;
0457 
0458                 $tmp = array();
0459                 $tmp['order'] = $obj['order'];
0460                 $tmp['calcOrder'] = $obj['calcOrder'];
0461                 $tmp['host'] = $obj['host'];
0462                 $tmp['name'] = $obj['name'];
0463                 $tmp['is_show_in_menu'] = $obj['is_show_in_menu'];
0464                 $tmp['is_show_real_domain_as_url'] = $obj['is_show_real_domain_as_url'];
0465 
0466                 if ($curOrder == 30) {
0467                     // Desktop set calcOrder = 9 manuelly put desktop in front
0468                     $tmp['calcOrder'] = 9;
0469                     $arrayDesktop[] = $tmp;
0470                 } else {
0471                     $arrayRest[] = $tmp;
0472                 }
0473             }
0474             $domainobjects = array_merge($arrayDesktop, $arrayRest);
0475 
0476 
0477             $baseurl = Zend_Registry::get('config')->settings->client->default->baseurl;
0478             // set group name manully
0479             foreach ($domainobjects as &$obj) {
0480 
0481                 if ($sname == $obj['host']) {
0482                     $obj['menuactive'] = 1;
0483                 } else {
0484                     $obj['menuactive'] = 0;
0485                 }
0486 
0487                 $order = $obj['order'];
0488                 //OLD: z.b 150001 ende ==1 go real link otherwise /s/$name
0489                 /*$last_char_check = substr($order, -1);
0490                 if($last_char_check=='1')
0491                 {
0492                     $obj['menuhref'] = $obj['host'];
0493                 }else{
0494                     $obj['menuhref'] = $baseurl.'/s/'.$obj['name'];
0495                 }
0496                  *
0497                  */
0498                 $domainAsUrl = $obj['is_show_real_domain_as_url'];
0499                 if ($domainAsUrl) {
0500                     $obj['menuhref'] = $obj['host'];
0501                 } else {
0502                     $obj['menuhref'] = $baseurl . '/s/' . $obj['name'];
0503                 }
0504 
0505                 switch ($obj['calcOrder']) {
0506                     case 9:
0507                         $obj['menugroup'] = 'Desktops';
0508                         break;
0509                     case 10:
0510                         $obj['menugroup'] = 'Applications';
0511                         break;
0512                     case 20:
0513                         $obj['menugroup'] = 'Addons';
0514                         break;
0515                     case 40:
0516                         $obj['menugroup'] = 'Artwork';
0517                         break;
0518                     case 50:
0519                         $obj['menugroup'] = 'Other';
0520                         break;
0521                 }
0522 
0523             }
0524 
0525             $cache->save($domainobjects, $cacheName, array(), 28800);
0526         }
0527 
0528         return Zend_Json::encode($domainobjects);
0529     }
0530 
0531     private function fetchStoresForCatTreeJson()
0532     {
0533         $sname = Zend_Registry::get('store_host');
0534         /** @var Zend_Cache_Core $cache */
0535         $cache = Zend_Registry::get('cache');
0536         $cacheName = __FUNCTION__ . md5($sname);
0537 
0538         if (false == ($domain_objects = $cache->load($cacheName))) {
0539             $tbl = new Default_Model_DbTable_ConfigStore();
0540             $result = $tbl->fetchDomainObjects();
0541             // sort Desktop manually to the front
0542             $arrayDesktop = array();
0543             $arrayRest = array();
0544 
0545             foreach ($result as $obj) {
0546                 $tmp = array();
0547                 $tmp['order'] = $obj['order'];
0548                 $tmp['calcOrder'] = $obj['calcOrder'];
0549                 $tmp['host'] = $obj['host'];
0550                 $tmp['name'] = $obj['name'];
0551                 $tmp['is_show_in_menu'] = $obj['is_show_in_menu'];
0552                 $tmp['is_show_real_domain_as_url'] = $obj['is_show_real_domain_as_url'];
0553 
0554                 $arrayRest[] = $tmp;
0555             }
0556             $domain_objects = array_merge($arrayDesktop, $arrayRest);
0557 
0558 
0559             $baseurl = Zend_Registry::get('config')->settings->client->default->baseurl;
0560             // set group name manully
0561             foreach ($domain_objects as &$obj) {
0562 
0563                 if ($sname == $obj['host']) {
0564                     $obj['menuactive'] = 1;
0565                 } else {
0566                     $obj['menuactive'] = 0;
0567                 }
0568 
0569                 $order = $obj['order'];
0570                 //OLD: z.b 150001 ende ==1 go real link otherwise /s/$name
0571                 /*$last_char_check = substr($order, -1);
0572                 if($last_char_check=='1')
0573                 {
0574                     $obj['menuhref'] = $obj['host'];
0575                 }else{
0576                     $obj['menuhref'] = $baseurl.'/s/'.$obj['name'];
0577                 }
0578                  *
0579                  */
0580                 $domainAsUrl = $obj['is_show_real_domain_as_url'];
0581                 if ($domainAsUrl) {
0582                     $obj['menuhref'] = $obj['host'];
0583                 } else {
0584                     $obj['menuhref'] = $baseurl . '/s/' . $obj['name'];
0585                 }
0586             }
0587 
0588             $cache->save($domain_objects, $cacheName, array(), 28800);
0589         }
0590 
0591         return Zend_Json::encode($domain_objects);
0592     }
0593 
0594     /**
0595      * @throws Exception
0596      * @throws Zend_Exception
0597      * @throws Zend_Form_Exception
0598      */
0599     public function redirectmeAction()
0600     {
0601         $this->_helper->layout()->disableLayout();
0602         //$this->_helper->viewRenderer->setNoRender(true);
0603 
0604         $redir = "/";
0605         if (isset($_GET['redirect'])) {
0606             $redir = $_GET['redirect'];
0607             $filter = new Local_Filter_Url_Decrypt();
0608             $redir = $filter->filter($redir);
0609 
0610         }
0611         $this->view->redirect = $redir;
0612     }
0613 
0614     public function fetchforgitAction()
0615     {
0616         $this->_helper->layout()->disableLayout();
0617 
0618         $tableProject = new Default_Model_Project();
0619 
0620         $params = $this->getAllParams();
0621         $action = 'fetch-products-for-git-project-id';
0622         if ($this->hasParam('target')) {
0623             $action = $params['target'];
0624         }
0625 
0626         if ($action == 'fetch-products-for-git-project-id') {
0627 
0628 
0629             $gitProjectId = $params['project_id'];
0630             $this->view->products = null;
0631 
0632             if (isset($gitProjectId)) {
0633 
0634                 $products = $tableProject->fetchAll('status = 100 AND type_id = 1 AND is_gitlab_project = 1 AND gitlab_project_id = ' . $gitProjectId);
0635 
0636 
0637                 $helperImage = new Default_View_Helper_Image();
0638 
0639                 $viewArray = array();
0640                 $viewProjectArray = array();
0641                 foreach ($products as $product) {
0642                     $viewProjectArray = array();
0643                     $viewProjectArray['project_id'] = $product['project_id'];
0644                     $viewProjectArray['title'] = $product['title'];
0645                     $viewProjectArray['version'] = $product['version'];
0646                     $viewProjectArray['member_id'] = $product['member_id'];
0647                     $viewProjectArray['avatar'] = $helperImage->Image($product['image_small'],
0648                         array('width' => 100, 'height' => 100));
0649                     $viewArray[] = $viewProjectArray;
0650                 }
0651 
0652                 $this->view->viewdata = $viewArray;
0653 
0654             }
0655         } else {
0656             $this->view->viewdata = array();
0657         }
0658 
0659 
0660     }
0661 
0662     protected function setLayout()
0663     {
0664         $storeConfig = Zend_Registry::isRegistered('store_config') ? Zend_Registry::get('store_config') : null;
0665         if ($storeConfig && $storeConfig->layout_home) {
0666             $this->_helper->layout()->setLayout($storeConfig->layout_home);
0667         } else {
0668             $this->_helper->layout()->setLayout('home_template');
0669         }
0670     }
0671 
0672 }