AnonSec Team
Server IP : 10.2.73.233  /  Your IP : 216.73.216.59
Web Server : Apache/2.4.59 (Debian)
System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : www-data ( 33)
PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/leksykografia/application/controllers/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/leksykografia/application/controllers/IndexController.php
<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $this->view->title = "Strona głowna";
        $this->view->showDictTools = true;
        
        $mapper = new Application_Model_DictionaryMapper();
        
        $options = array();
        
        $typeId = $this->_request->getParam("typeId");
        $rangeId = $this->_request->getParam("rangeId");
           
        if($typeId)
        	$options['where']['type'] = $typeId;
        if($rangeId)
       		 $options['where']['range'] = $rangeId;
        $options['where']['active'] ='Y'; 
        $options['order']['year'] = true;
       	$this->view->dictionaries = $mapper->fetchAll($options);

    }
    
    public function dictionaryAction()
    {
    	$this->view->title = "Strona głowna";
    	
    	$dictionaryId = $this->_request->getParam('dictionaryId');
    	
    	$mapper = new Application_Model_DictionaryMapper();
    	$dictionary = new Application_Model_Dictionary();
    	
    	if(!$mapper->find($dictionaryId,$dictionary))
    		$this->_redirect('/');
    	
    	$dictionaryTypeMapper = new Application_Model_DictionaryTypeMapper();
    	$dictionaryVocabularyRangeDictMapper = new Application_Model_DictionaryVocabularyRangeDictMapper();
    	$dictionaryVocabularyRangeMapper = new Application_Model_DictionaryVocabularyRangeMapper();
    	$dictionaryBackgroundMapper = new Application_Model_DictionaryBackgroundMapper();
    	
    	
    	$dictionaryType = new Application_Model_DictionaryType();
    	$dictionaryTypeMapper->find($dictionary->type, $dictionaryType);
    	$dictionaryVocabularies = $dictionaryVocabularyRangeMapper->fetchAll($dictionary->id);
 		
    	$aType =  array(1 => "ogólne", 2 => 'historyczne', 3 => "etymologiczne", 4 => "pisarzy");
    
    	
    	$this->view->dictionary = $dictionary;
    	$this->view->dictionaryType  = $dictionaryType;
    	$this->view->dictionaryVocabularies  = $dictionaryVocabularies;
    	$this->view->dictionaryVocabularyRangeDictMapper = $dictionaryVocabularyRangeDictMapper;
    	
   
    }
    
    
    public function compareDictionaryAction()
    {
    	
    	$actionType = $this->_request->getParam("actionType");
    	
    	$aTitle = array('entry' => "Wyświetl opis budowy artykułu hasłowego", 'compare' => "Porównaj artykuły hasłowe");
    	$this->view->title = $aTitle[$actionType];
    	 
    	$this->view->actionType = $actionType;
    	
    	
    	if($this->_request->isPost())
    	{
    		$dictionaryId1 = $this->_request->getParam('selectFirstDictionary');
    		$dictionaryId2 = $this->_request->getParam('selectSecondDictionary');
    		
    		$this->_redirect($this->view->url(
    		array("dictionaryId1" => $dictionaryId1, "dictionaryId2" => $dictionaryId2, "compareDictionary" )));
    	
    	}
    	
    	 
    	$dictionaryId1 = $this->_request->getParam('dictionaryId1');
    	$dictionaryId2 = $this->_request->getParam('dictionaryId2');
    	
    	
    	 
    	$mapper = new Application_Model_DictionaryMapper();
    	$dictionary1 = new Application_Model_Dictionary();
    	$dictionary2 = new Application_Model_Dictionary();
    	
    	$mapper->find($dictionaryId1,$dictionary1);
    	$mapper->find($dictionaryId2,$dictionary2);
    	
    	$this->view->dictionary1 = $dictionary1;
    	$this->view->dictionary2 = $dictionary2;
    	
    	$options['where']['active'] ='Y';
    	$this->view->dictionaries = $mapper->fetchAll($options);
    	     	 
    }
    
    public function dictionariesAction()
    {
    	
    	
    	$mapper = new Application_Model_DictionaryMapper();
    	
    	$sort = $this->_request->getParam("sort");
    	if(!$sort)
    		$sort = "data";
    	$this->view->sort = $sort;
    	
    	$actionType = $this->_request->getParam("actionType");

    	$aTitle = array('dictionary' => "Słowniki", 'entry' => "Hasła diagnostyczne", 'literature' => 'Literatura');
    	$this->view->title = $aTitle[$actionType];
    	
    	$this->view->actionType = $actionType;
    	$this->view->aSort = array('dictionary' => "dictionariesSort", 'entry' => "dictionariesEntrySort", 'literature' => 'dictionariesLiteratureSort');
    	
    	
    	$this->view->aType = array(1 => "ogólne", 2 => 'historyczne', 3 => "etymologiczne", 4 => "pisarzy");
    	
    	$this->view->sort = $sort;
    	 
    	$options = array();
    	
    	if($sort == 'data')
    	{
    		$options['order']['year'] = true;
    		
    	}
    	
    	if($sort == 'autor')
    	{
    		$options['order']['author_lastname'] = true;
    	
    	}
    	
    	if($sort == 'typ')
    	{
    		$options['order']['type'] = true;
    	
    	}
    	
    	if($sort == 'zakres')
    	{
    		$options['order']['range'] = true;
    	
    	}
    		
    	 
    	$options['where']['active'] ='Y';
    	$this->view->dictionaries = $mapper->fetchAll($options);
    }
    
    
    public function searchAction()
    {
    	 
    	$this->view->title = "Szukaj";
    	$search = $this->_request->getParam('search');
    	$this->view->search = $search;
    	$mapper = new Application_Model_DictionaryMapper();
		
    	$options['search'] = $search;
    	$options['where']['active'] ='Y';
    	$this->view->dictionaries = $mapper->fetchAll($options);
    	
    	$aTitle = array('introduction' => "Wprowadzenie", 'authors' => "Autorzy", 'thanks' => 'Podziękowania',
    	    	'links' => "Linki", 'contact' => "Kontakt");
    	 
    	$aStatic = array(1 => 'introduction',  5 => 'authors',  2 => 'thanks',
    	    	    	3 => 'links',  4 => 'contact');
    	
    	$staticMapper = new Application_Model_StaticMapper();
    	
    	$this->view->aStatic = $aStatic;
    	$this->view->aTitle = $aTitle;
    	
    	
    	$this->view->statics = $staticMapper->fetchAll($options);
    	
    }
    
    public function staticAction()
    {
    	$this->view->title = "Strona głowna";
    	
    	$actionType = $this->_request->getParam("actionType");
    	$this->view->actionType = $actionType;
    	
    	$aTitle = array('introduction' => "Wprowadzenie", 'authors' => "Autorzy", 'thanks' => 'Podziękowania',
    	'links' => "Linki", 'contact' => "Kontakt");
    	$this->view->title = $aTitle[$actionType];
    	
    	$aStatic = array('introduction' => 1, 'authors' => 5, 'thanks' => 2,
    	    	'links' => 3, 'contact' => 4);
    	
    	$mapper = new Application_Model_StaticMapper();
    	$static = new Application_Model_Static();
    	
    	$mapper->find($aStatic[$actionType] , $static);
    	
    	
    	$this->view->static = $static;
    	
    }
    
    public function sitemapAction()
    {
    	$this->view->title = "Mapa strony";
    	
    	$this->view->actionType = "sitemap";
    }
    
    public function updateProductsAction()
    {
    	$this->_helper->layout->disableLayout();
  		$this->_helper->viewRenderer->setNoRender(true);
    	
    	$categoryId = $this->_request->getParam('categoryId');
    	
    	$mapper = new Application_Model_ProductMapper();
    	$this->view->productTypeMapper = new Application_Model_ProductTypeMapper();
    	
    	
    	if($categoryId)
    	{
    		$this->view->products = $mapper->fetchAllActiveForIndex($categoryId);
    	
    		$obsoleteCount =  count($this->view->products[0]);
    		$allCount = $obsoleteCount + count($this->view->products[1]);
    		echo Zend_Json::encode(array("PRODUCTS" => $this->view->render("index/update-products.phtml"), "OBSOLETE_COUNT" =>$obsoleteCount, "ALL_COUNT" => $allCount));
    	}
    
    }
    
    
    
    public function becomeASpeakerAction()
    {
    	$this->view->title = "Zostań prelegentem";
    	$this->view->breadCrumb = $this->view->title;
    	$this->view->whiteContent = true;
    	
    	$static = new Application_Model_Static();
    	$mapper  = new Application_Model_StaticMapper();
    	$mapper->find(3, $static);
    	 
    	$this->view->static = $static;
    }
    
    public function becomeASponsorAction()
    {
    	$this->view->title = "Zostań sponsorem";
    	$this->view->breadCrumb = $this->view->title;
    	$this->view->whiteContent = true;
    	
    	$static = new Application_Model_Static();
    	$mapper  = new Application_Model_StaticMapper();
    	$mapper->find(4, $static);
    	 
    	$this->view->static = $static;
    }
    
    
    public function trainingOfferAction()
    {
    	$this->view->title = "Oferta szkoleniowa";
    	$this->view->breadCrumb = $this->view->title;
    	$this->view->whiteContent = true;
    	
    	$static = new Application_Model_Static();
    	$mapper  = new Application_Model_StaticMapper();
    	$mapper->find(1, $static);
    	
    	$this->view->static = $static;
    }
    
    public function contactAction()
    {
    	$this->view->title = "Kontakt";
    	$this->view->breadCrumb = $this->view->title;
    	$this->view->whiteContent = true;
    	
    	$static = new Application_Model_Static();
    	$mapper  = new Application_Model_StaticMapper();
    	$mapper->find(2, $static);
    	 
    	$this->view->static = $static;
    }
    
    public function transferDataAction()
    {
    	$this->view->title = "Dane do przelewu";
    	$this->view->breadCrumb = $this->view->title;
    	$this->view->whiteContent = true;
    }
    
    
    public function partnersAction()
    {
    	$this->view->whiteContent = true;
    	$mapper  = new Application_Model_PartnerMapper();
    	$this->view->partners = $mapper->fetchAllActive();
    	$this->view->title = "Partnerzy";
    	$this->view->breadCrumb = $this->view->title;
    }
    
    public function productsAction()
    {
    	$request = $this->getRequest();
    	$typeId = $request->getParam('typeId', false);
    	
    	$this->view->whiteContent = true;
    	
    	
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	
    	if(!$productTypeMapper->find($typeId, $productType))
    		$this->_redirect("/");
    	
    	$mapper = new Application_Model_ProductMapper();
    	
    	$this->view->title = $productType->name;
    	$this->view->class = $productType->class ? $productType->class : "event-bg";
    	
    	$this->view->products = $mapper->fetchAllActiveByType($typeId, 'term_from desc');
    	
    	
    	
    }
    public function productAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    	
    	$request = $this->getRequest();
        $productId = $request->getParam('product_id', false);
        $product = new Application_Model_Product();
       
        $mapper = new Application_Model_ProductMapper();
        if(!$mapper->find($productId, $product))
       		$this->_redirect("/");

        $this->view->product = $product;
        
        
        $productPartnersMapper = new Application_Model_ProductPartnersMapper();
         
        $this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
        $this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
        
        
        $productType = new Application_Model_ProductType();
        $productTypeMapper = new Application_Model_ProductTypeMapper();
        $productTypeMapper->find($product->productType, $productType);
        
        $this->view->productType = $productType;
        
        	
        $this->view->termFrom = date('d.m.Y',strtotime($product->termFrom));
        
       
       
    }
    
    public function productPlaceAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    	 
    	$request = $this->getRequest();
    	$productId = $request->getParam('product_id', false);
    	$product = new Application_Model_Product();
    	 
    	$mapper = new Application_Model_ProductMapper();
    	if(!$mapper->find($productId, $product))
    	$this->_redirect("/");
    
    	$this->view->product = $product;
    
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    	 
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    
    
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    
    	$this->view->productType = $productType;
    
    	 
    	$this->view->termFrom = date('d.m.Y',strtotime($product->termFrom));
    	 
    }
    
    public function productPriceAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    	 
    	$request = $this->getRequest();
    	$productId = $request->getParam('product_id', false);
    	$product = new Application_Model_Product();
    	 
    	$mapper = new Application_Model_ProductMapper();
    	if(!$mapper->find($productId, $product))
    	$this->_redirect("/");
    
    	$this->view->product = $product;
    
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    	 
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    
    
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    
    	$this->view->productType = $productType;
    
    	 
    	$this->view->termFrom = date('d.m.Y',strtotime($product->termFrom));
    	 
    }
    
    public function productPartnerAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    	 
    	$request = $this->getRequest();
    	$productId = $request->getParam('product_id', false);
    	$product = new Application_Model_Product();
    	 
    	$mapper = new Application_Model_ProductMapper();
    	if(!$mapper->find($productId, $product))
    	$this->_redirect("/");
    
    	$this->view->product = $product;
    
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    	 
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    
    
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    
    	$this->view->productType = $productType;
    
    	 
    	$this->view->termFrom = date('d.m.Y',strtotime($product->termFrom));
    	 
    }
    
    public function productSpeakerAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    	 
    	$request = $this->getRequest();
    	$productId = $request->getParam('product_id', false);
    	$product = new Application_Model_Product();
    	 
    	$mapper = new Application_Model_ProductMapper();
    	if(!$mapper->find($productId, $product))
    	$this->_redirect("/");
    
    	$this->view->product = $product;
    
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    	 
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    	
    	$productSpeakerMapper = new Application_Model_ProductSpeakerMapper();
    	
    	$this->view->currentProductModerators = $productSpeakerMapper->fetchAllActiveByType($product->id,1);
    	$this->view->currentProductSpeakers = $productSpeakerMapper->fetchAllActiveByType($product->id,2);
    	
    
    
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    
    	$this->view->productType = $productType;
    
    	 
    	$this->view->termFrom = date('d.m.Y',strtotime($product->termFrom));
    	 
    }
    
    
    public function productRegisterAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    
    	$request = $this->getRequest();
    	$productId = $request->getParam('product_id', false);
    	$product = new Application_Model_Product();
    
    	$mapper = new Application_Model_ProductMapper();
    	if(!$mapper->find($productId, $product))
    	$this->_redirect("/");
    
    	$this->view->product = $product;
    	
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    	
    	if($this->_request->isPost())
    	{
    		$productRegisterMapper = new Application_Model_ProductRegisterMapper();
    		$productRegisterUserMapper = new Application_Model_ProductRegisterUserMapper();
    		$productRegisterUserSessionMapper = new Application_Model_ProductRegisterUserSessionMapper();
    		
    		$productRegister = new Application_Model_ProductRegister($this->_request->getParams());
    		$productRegister->setProductId($product->id);
    		$productRegister->setStatus(0);
    		$productRegister->setSession(Zend_Session::getId());
    		
    		if($this->_request->getParam('discount'))
    			$productRegister->setDiscount("Y");
    		else
    			$productRegister->setDiscount("N");
    		
    		if($this->_request->getParam('discount2'))
    		$productRegister->setDiscount2("Y");
    		else
    		$productRegister->setDiscount2("N");
    		
    		if($this->_request->getParam('sameAddress'))
    			$productRegister->setSameAddress("Y");
    		else
    			$productRegister->setSameAddress("N");
    		
    		
    		
    		$productRegisterId = $productRegisterMapper->save($productRegister);
    		
    		
    		$i = 0;
    		foreach($this->_request->getParam('userFirstname') as $firstname)
    		{
    			$productRegisterUser = new Application_Model_ProductRegisterUser();
    			
    			
    			
    			
    			$userLastname = $this->_request->getParam('userLastname');
    			$userPosition = $this->_request->getParam('userPosition');
    			$userEmail = $this->_request->getParam('userEmail');
    			$userTel = $this->_request->getParam('userTel');
//     			echo $firstname.' ';
//     			echo $userLastname[$i].' ';
//     			echo $userPosition[$i].' ';
//     			echo $userEmail[$i].' ';
//     			echo $userTel[$i].'<br />';
    			$productRegisterUser->setProductRegisterId($productRegisterId);
    			$productRegisterUser->setFirstname($firstname);
    			$productRegisterUser->setLastname($userLastname[$i]);
    			$productRegisterUser->setPosition($userPosition[$i]);
    			$productRegisterUser->setEmail($userEmail[$i]);
    			$productRegisterUser->setTel($userTel[$i]);
    			
    			$productRegisterUserId = $productRegisterUserMapper->save($productRegisterUser);
    			
    			
    			
    			if($product->productType == 5)
    			{
    				
    				
    				$sessions = $this->_request->getParam('session-'.($i+1));
    				foreach($sessions as $session)
    				{
    					$productRegisterUserSession = new Application_Model_ProductRegisterUserSession();
    					$productRegisterUserSession->setProductRegisterUserId($productRegisterUserId);
    					$productRegisterUserSession->setSession($session);
    					
    					$productRegisterUserSessionMapper->save($productRegisterUserSession);

    				}
    				
    				
    			}
    			
    			
    			//print_r($productRegisterUser->getOptions()).'<br />';
    			 			
    			$i++;
    		}
    		
    		$productType->name = str_replace(" ", "-", $productType->name);
    		
    		
    		$this->_redirect($this->view->url(array("product_id" => $product->id, "type" => strtolower($productType->name), "slug" => $product->slug, 'session' => $productRegister->session) , "productRegisterStepTwo"));
    	}
    
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    	 
    	$productSpeakerMapper = new Application_Model_ProductSpeakerMapper();
    	 
    	$this->view->currentProductModerators = $productSpeakerMapper->fetchAllActiveByType($product->id,1);
    	$this->view->currentProductSpeakers = $productSpeakerMapper->fetchAllActiveByType($product->id,2);
    	 
    
    
    	
    
    	$this->view->productType = $productType;
    
    	
    	
    	$months_pl = array(1 => 'stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia');
    	
   		$priceTo = strtotime($product->priceTo);
   		
    
    	$this->view->priceTo = date('j',$priceTo) . " ". $months_pl[date('n',$priceTo)];
    
    }
    
    
    public function productRegisterStepTwoAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    
    	$request = $this->getRequest();
    	$productId = $request->getParam('product_id', false);
    	$product = new Application_Model_Product();
    
    	$mapper = new Application_Model_ProductMapper();
    
    	
    	if(!$mapper->find($productId, $product))
    		$this->_redirect("/");
    	
    	$session = $request->getParam('session', false);
    	
    	$productRegisterMapper = new Application_Model_ProductRegisterMapper();
    	
    	
    	$productRegister = $productRegisterMapper->fetchProductRegister($productId, $session);
    	
    	
    	if(!$productRegister)
    		$this->_redirect("/");
    	
    	$this->view->productRegister = $productRegister;
    	
    	$productRegisterUserMapper = new Application_Model_ProductRegisterUserMapper();
    	
    	$this->view->productRegisterUsers = $productRegisterUserMapper->fetchUsers($productRegister->id);
    	
    	
    	$priceTime = strtotime($product->priceTo);
 
    	$createdTime = strtotime($productRegister->created);
    	
    	$this->view->price2On = $createdTime < $priceTime;
    	
		if($this->view->price2On)
			$this->view->price = $product->price2;
		else 
			$this->view->price = $product->price1;
		
		$discount = 1;
		if($productRegister->discount == 'Y');
			$discount -= 0.1;
		if($productRegister->discount2 == 'Y');
			$discount -= 0.1;
			
		$this->view->price *= $discount;
		
		$this->view->usersCount = count($this->view->productRegisterUsers);
		
		$this->view->priceNetto = $this->view->usersCount * $this->view->price;
		$this->view->vat = round($this->view->priceNetto * 0.23,2);
		$this->view->priceVat = $this->view->priceNetto + $this->view->vat;
		
    
    	$this->view->product = $product;
    	
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    
    	$productSpeakerMapper = new Application_Model_ProductSpeakerMapper();
    
    	$this->view->currentProductModerators = $productSpeakerMapper->fetchAllActiveByType($product->id,1);
    	$this->view->currentProductSpeakers = $productSpeakerMapper->fetchAllActiveByType($product->id,2);
    
    
    
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    	
    	$productType->name = str_replace(" ", "-", $productType->name);
    	$this->view->productType = $productType;
    
    	 
    	 
    	$months_pl = array(1 => 'stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia');
    	 
    	$priceTo = strtotime($product->priceTo);
    
    	$this->view->priceTo = date('d') . " ". $months_pl[date('n',$priceTo)];
    
    }
    
	public function productRegisterStepThreeAction()
    {
    	$this->view->disableCategories = true;
    	$this->view->enableTopLogo = true;
    	$this->view->disableTop = true;
    
    	$request = $this->getRequest();
    	$productId = $request->getParam('product_id', false);
    	$product = new Application_Model_Product();
    
    	$mapper = new Application_Model_ProductMapper();
    
    	
    	if(!$mapper->find($productId, $product))
    		$this->_redirect("/");
    	
    	$session = $request->getParam('session', false);
    	
    	$productRegisterMapper = new Application_Model_ProductRegisterMapper();
    	
    	
    	$productRegister = $productRegisterMapper->fetchProductRegister($productId, $session);
    	
    	
    	if(!$productRegister)
    		$this->_redirect("/");
    	
    	$this->view->productRegister = $productRegister;
    	
    	$productRegisterUserMapper = new Application_Model_ProductRegisterUserMapper();
    	
    	$this->view->productRegisterUsers = $productRegisterUserMapper->fetchUsers($productRegister->id);
    	
    	
    	$priceTime = strtotime($product->priceTo);
 
    	$createdTime = strtotime($productRegister->created);
    	
    	$this->view->price2On = $createdTime < $priceTime;
    	
		if($this->view->price2On)
			$this->view->price = $product->price2;
		else 
			$this->view->price = $product->price1;
		
		$this->view->usersCount = count($this->view->productRegisterUsers);
		
		$this->view->priceNetto = $this->view->usersCount * $this->view->price;
		$this->view->vat = round($this->view->priceNetto * 0.23,2);
		$this->view->priceVat = $this->view->priceNetto + $this->view->vat;
		
    
    	$this->view->product = $product;
    	
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    
    	$productSpeakerMapper = new Application_Model_ProductSpeakerMapper();
    
    	$this->view->currentProductModerators = $productSpeakerMapper->fetchAllActiveByType($product->id,1);
    	$this->view->currentProductSpeakers = $productSpeakerMapper->fetchAllActiveByType($product->id,2);
    
    
    
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    
    	$this->view->productType = $productType;
    
    	 
    	 
    	$months_pl = array(1 => 'stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia');
    	 
    	$priceTo = strtotime($product->priceTo);
    
    	$this->view->priceTo = date('d') . " ". $months_pl[date('n',$priceTo)];
    
    
    
    	$productPartnersMapper = new Application_Model_ProductPartnersMapper();
    
    	$this->view->currentProductPartners = $productPartnersMapper->fetchByProduct($product->id,1);
    	$this->view->currentProductSponsors = $productPartnersMapper->fetchByProduct($product->id,2);
    
    	$productSpeakerMapper = new Application_Model_ProductSpeakerMapper();
    
    	$this->view->currentProductModerators = $productSpeakerMapper->fetchAllActiveByType($product->id,1);
    	$this->view->currentProductSpeakers = $productSpeakerMapper->fetchAllActiveByType($product->id,2);
    
    
    
    	$productType = new Application_Model_ProductType();
    	$productTypeMapper = new Application_Model_ProductTypeMapper();
    	$productTypeMapper->find($product->productType, $productType);
    
    	$this->view->productType = $productType;
    
    
    
    	$months_pl = array(1 => 'stycznia', 'lutego', 'marca', 'kwietnia', 'maja', 'czerwca', 'lipca', 'sierpnia', 'września', 'października', 'listopada', 'grudnia');
    
    	$priceTo = strtotime($product->priceTo);
    
    	$this->view->priceTo = date('d') . " ". $months_pl[date('n',$priceTo)];
    	
    	if($productRegister->status == 0)
    	{
    		$tmpl = new Zend_View();
    		$tmpl->setScriptPath(APPLICATION_PATH."/views/scripts/mail/");
    		$tmpl->assign(array(
    					"title"    => $product->getFullTitle(),
    				    "termFrom"	      => $product->termFrom,
    				    "place" => str_replace("</p>", " ",str_replace("<p>", " ",$product->place)),
    		));
    		if($product->productType == 5)
    			$message =  $tmpl->render("congress-register.phtml");
    		else
    			$message =  $tmpl->render("product-register.phtml");
    		
    		
	    	$mail = new Zend_Mail('utf-8');
	    	$mail->setBodyHtml($message,'utf-8','utf-8');
	    	$mail->setFrom('konferencje@rk-konferencje.pl', 'RK Konferencje');
	    	$mail->addBcc('konferencje@rk-konferencje.pl');
	    	$mail->addTo($productRegister->email);
	    	$mail->setSubject("Potwierdzenie rejestracji na konferencję");
	    	$mail->send();
	    	
	    	$productRegister->status = 1;
	    	
	    	$productRegisterMapper->save($productRegister);
	    	
    	}
    
    }
    
    
    

    public function pageAction()
    {
        $id = $this->_request->getParam('page_type', false);
        $pageType = new Application_Model_PageType();
        $pageTypeMapper = new Application_Model_PageTypeMapper();
        $pageTypeMapper->find($id, $pageType);
       
        if(!$pageType->getId())
            $this->_redirect('/');
        $pageMapper = new Application_Model_PageMapper();
        $pages = $pageMapper->fetchAllByType($pageType->getId());
        
        $this->view->pages = $pages;
        
        /*$pageId = $this->_request->getParam('page', false);
        $page = new Application_Model_Page();
        $pageMapper = new Application_Model_PageMapper();
        $pageMapper->find($pageId, $page);
        if(!$page)
            $this->_redirect('/');

        
        $this->view->pageType = $pageType;
        $this->view->page = $page;
        $this->view->pages = $pageMapper->fetchAllByType($pageType->getId());*/
        $this->view->title = $pages[0]->getTitle();
    }
    
 
    
    public function voteAction()
    {
        $request = $this->getRequest();
        $form    = new Application_Form_Vote();
        
        if ($this->getRequest()->isPost()) {
            if ($form->isValid($request->getPost())) {
                $voteMapper = new Application_Model_VoteMapper();
                $votes = $voteMapper->fetchAllActive();
                foreach($votes as $vote)
                {
                    $point = $request->getParam('voteRadio'.$vote->getId(), false);
                    if($point)
                    {
                        $setPoint = "setPoint$point";
                        $getPoint = "getPoint$point";
                        $vote->$setPoint($vote->$getPoint()+1);
                        $voteMapper->save($vote);
                        setcookie('voteRadio'.$vote->getId(),1,time()+864000);
                        
                    }
                    
                }
            }
            return $this->_redirect($this->view->url(array(), 'vote'));
        }
        
        $partner = new Application_Model_VoteMapper();
        $this->view->acitveCount = count($partner->fetchAllActive());
        $this->view->votes = $partner->fetchAll(true);
        
        $this->view->form = $form;
        
        $this->view->title = "Głosowanie publiczności";
    
    }


}


AnonSec - 2021