public static function getUserData()
    {
        $user = MMUsers::getCurrentUserObject();

        return array(
            'UID' => MMeLearningList::getCountryPrefixForElearning() . $user->attribute( 'uuid' ),
            'CID' => CertificatesWebservice::getProperCountryId( $user ),
        );
    }
    /**
     * @return ezcLog
     */
    public static function getLogger()
    {
        if ( !isset(self::$logger) )
        {
            // Logger
            $filter           = new ezcLogFilter();
            $filter->severity = ezcLog::ERROR | ezcLog::INFO | ezcLog::WARNING;
            self::$logger     = ezcLog::getInstance();

            self::$logger->getMapper()->appendRule(new ezcLogFilterRule(
                $filter,
                new ezcLogUnixFileWriter( "var/log/", self::LOG_FILE, 157286400, 3 ),
                true )
            );
        }

        return self::$logger;
    }
    protected function redirectToCertificate()
    {
        if ( !isset( $_GET['course_id'] ) )
        {
            return false;
        }

        $courseId = $_GET['course_id'];

        CertificatesWebservice::redirectCertificateGeneratedUrl( $courseId );
    }
    /**
     * @return array
     */
    public function getPublicResult()
    {
        header('esi-enabled: 1');
        $Result = array();

        if(filter_var($_POST['from'], FILTER_SANITIZE_STRING) == '' || filter_var($_POST['to'], FILTER_SANITIZE_STRING) == '' || !$this->canRead())
        {
            return null;
        }
        else
        {
            $entryPointTemplateIni  = self::iniMerck()->variable('TemplateSettings', 'EntryPointTemplate');
            $Result['pagelayout']   = self::iniMerck()->variable('TemplateSettings', 'PublicPagelayoutTemplate');
            $templateContent        = $entryPointTemplateIni['certificate'];
        }

        foreach ( $this->_result as $variableName => $variableValue )
        {
            $this->tpl()->setVariable( $variableName, $variableValue );
        }

        //works if to less than from
        $dateTo = ( DateTime::createFromFormat('d-m-Y', $_POST['to']) ? DateTime::createFromFormat('d-m-Y', $_POST['to'])->getTimestamp() : time() );
        $dateFrom = ( DateTime::createFromFormat('d-m-Y', $_POST['from']) ? DateTime::createFromFormat('d-m-Y', $_POST['from'])->getTimestamp() : time() );
        if( $dateTo < $dateFrom )
        {
            $temp = $_POST['to'];
            $_POST['to'] = $_POST['from'];
            $_POST['from'] = $temp;
        }

        $this->tpl()->setVariable('clusterIdentifier', ClusterTool::clusterIdentifier());
        $this->tpl()->setVariable('from', $this->formatDate('d-m-Y', $_POST['from']));
        $this->tpl()->setVariable('to', $this->formatDate('d-m-Y', $_POST['to']));

        //get firstname and lastname
        $userData = CertificatesWebservice::readUserData(MMUsers::getCurrentUserObject());
        $this->tpl()->setVariable('firstname', $userData['FirstName']);
        $this->tpl()->setVariable('lastname', $userData['LastName']);

        $userData = LearningTrackerWebservice::getUserData();
        $results = LearningTrackerWebservice::getUserCertificates($userData['UID'], $userData['CID']);

        //filter date
        $results = $this->sortResultsByDate($_POST['from'], $_POST['to'], $results['results']);
        //add duration and credits to results
        $this->fillResults($results);
        //sort by
        $this->sortResultByType($_POST['order'], $_POST['sort'], $results);

        foreach($results as &$course)
        {
            $course['Duration'] = gmdate("H:i:s", $course['Duration']);
        }

        $this->tpl()->setVariable( 'userCourses', $results);

        $Result['content'] = $this->tpl()->fetch( "design:$templateContent" );

        return $Result;
    }