<?php

namespace Market\ZodacoBundle\Controller;

use Symfony\Component\HttpFoundation\Request;

class InitController extends BaseController {

    public function copyRightAction() {
        return $this->render('MarketZodacoBundle:Init:copyRight.html.php', array());
    }

    public function setLangAction() {
        return $this->render('MarketZodacoBundle:Init:setLang.html.php', array());
    }

    public function setHeaderAction() {
        return $this->render('MarketZodacoBundle:Init:setHeader.html.php', array());
    }

    public function setLogoAction() {
        return $this->render('MarketZodacoBundle:Init:setLogo.html.php', array());
    }

    public function setReferersAction(Request $request) {
        $session = $request->getSession();
        $referers = $session->get("referers", array());
        if (count($referers) > 0) {
            try {
                $em = $this->getDoctrine()->getManager();
                $refe = new \Market\ZodacoBundle\Entity\Referers();
                $refe->setHost($referers["host"]);
                $refe->setReferer($referers["referer"]);
                $refe->setRemote($referers["remote"]);
                $refe->setUri($referers["uri"]);
                $refe->setTime($referers["time"]);
                $a = new \Datetime();
                $refe->setCreatedAt($a);
                $em->persist($refe);
                $em->flush();
            } catch (Exception $ex) {
                
            }
        }
        return $this->render('MarketZodacoBundle:Init:setReferers.html.php', array());
    }

}
