public static function getUserLearningTrackerCourses()
    {
        $userData = self::getUserData();
        $resultAttribute = 'Courses';

        $method = 'GetUserAllCourses';
        $parameters = array(
            'AuthenticationKey'  => self::getAuthentificationKey(),
            'UserID'             => $userData['UID'],
            'CountryCode'        => $userData['CID'],
            'LastAccessDateTime' => self::getOldestFetchDate()
        );

        try
        {
            $command = self::getWebserviceClient()->getCommand( $method, $parameters );
            $command->prepare();
            $response = $command->getResponse()->xml();
        }
        catch(Exception $e)
        {
            throw new Exception($e);
        }

        return array(
            'results' => LearningTrackerWebservice::extractDatasLearningTrackerList( $response->$resultAttribute ),
            'facetCounts' => array(),
            'userCourses' => array(),
        );
    }
    /**
     * @return array
     */
    protected function getCourseCompletion()
    {
        if( !$this->user() )
            return false;
        
        $regexp = array(
            'options' => array(
                'regexp'    =>  "/^[a-zA-Z0-9]*$/",
            )
        );
        $courseId       = (isset($_REQUEST['cid']) && filter_var($_REQUEST['cid'], FILTER_VALIDATE_REGEXP, $regexp)) ? $_REQUEST['cid'] : null;
        $uuid           = $this->user()->attribute('uuid');
        $completion     = 0;
        $status         = '';
        $found          = false;
        $inError        = false;
        $countryUuid    = $uuid;
        $dueDate        = null;

        //if learning tracker is enabled
        if( SolrSafeOperatorHelper::featureIsActive( 'MyLearningTracker' ) && SolrSafeOperatorHelper::getCustomParameter($this->getApplicationIdentifier(), 'HasLearningTracker', 'application_localized') )
        {
            $xml = LearningTrackerWebservice::getUserCoursesStatus($courseId);

            if( $xml !== false )
            {
                if( $xml->CourseStatus != null)
                {
                    $found          = true;
                    $status         = (string)$xml->CourseStatus;
                    $dueDate        = (string)$xml->DueDate;
                }
            }
            else
            {
                $inError = true;
            }
        }
        else
        {
        	/*$url            = $this->getCustomParameter('WSCompletionUrl');
        	$timeout        = 5;
        	$countryUuid    = $uuid;

		    if( $this->getCustomParameter('WSTimeout') )
		    {
		        $timeout = $this->getCustomParameter('WSTimeout');
		    }

		    $ch = curl_init();
		    curl_setopt( $ch, CURLOPT_URL, $url );
		    curl_setopt( $ch, CURLOPT_HEADER, 0 );
		    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
		    curl_setopt( $ch, CURLOPT_TIMEOUT, $timeout );
		    curl_setopt( $ch, CURLOPT_POST, 1 );
		    curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( array(
		        'AuthenticationKey' => 'medicusconnect',
		        'UserID'            => $countryUuid,
		        'CourseID'          => $courseId
		    )) );

		    $x          = curl_exec($ch);
		    $inError    = false;

            if( $x === false )
            {
                $inError = true;
                eZDebug::writeError( print_r(array($url, curl_errno($ch), curl_error($ch)), true ), 'Call to eLearning WS failed' );
            }
            else
            {
                $xml = simplexml_load_string($x);

                if( $xml !== false )
                {
                    if( $xml->Course != null && $xml->Course->coursecompletion != null )
                    {
                        $completion     = (string)$xml->Course->coursecompletion;
                        $status         = (string)$xml->Course->coursestatus;
                        $found          = true;
                        $dueDate        = (string)$xml->Course->duedate;
                    }
                }
            }*/
        }

        return array(
            'uuid'          => $countryUuid,
            'completion'    => $completion,
            'status'        => $status,
            'found'         => $found,
            'courseId'      => $courseId,
            'inError'       => $inError,
            'errorMsg'      => $inError ? ezpI18n::tr( 'merck', 'NO COMPLETION AVAILABLE' ) : '',
            'dueDate'       => $dueDate,
        );
    }
 /**
  * @return string
  */
 protected function statusFromUserAndCourseID()
 {
     if( isset( $_POST['cid'] ) && filter_var($_POST['cid'], FILTER_VALIDATE_INT) )
     {
         $wsResult = LearningTrackerWebservice::getUserCoursesStatus( $_POST['cid'] );
         if( isset( $wsResult->CourseStatus ) )
         {
             $courseStatusFromWs = (string)$wsResult->CourseStatus;
             switch( $courseStatusFromWs )
             {
                 case 'On going':
                     $showResults = SolrSafeOperatorHelper::feature( 'MyLearningTracker', 'showResults' );
                     if( $showResults && $wsResult->PC == 100 ) return 'failed';
                     return 'ongoing';
                 case 'Planned':
                     return 'planned';
                 case 'Done':
                     return 'completed';
                 default:
                     return false;
             }
         }
     }
     return false;
 }