<?php

/**
 * @name          : Joomla Social Pinboard
 ** @version	  : 2.0
 * @package       : apptha
 * @since         : Joomla 1.5
 * @author        : Apptha - http://www.apptha.com
 * @copyright     : Copyright (C) 2011 Powered by Apptha
 * @license       : http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 * @abstract      : Social Pinboard Component userfollow controller file
 * @Creation Date : March 2013
 * @Modified Date : March 2013
 * */
// No direct Access
defined('_JEXEC') or die('Restricted access');

// import Joomla controlleradmin library
jimport('joomla.application.component.controller');
jimport('joomla.application.component.controllerform');

class wishlogueControllerUserfollow extends WishlogueController {

    function display($cachable = false, $urlparams = false) {

		$user = JFactory::getUser();
        $user_id = $user->id;
		$app = JFactory::getApplication();

		if( $user_id == '' || $user_id == null || $user_id <= 0 )
		{
			$return = JRoute::_('index.php?option=com_wishlogue&view=home');
			$url = "index.php?option=com_wishlogue&view=people";
			$url .= '&returnURL=' . base64_encode($return);
			$onclickURL = JRoute::_($url);

			$app->redirect($onclickURL);
		}

		$model = $this->getModel('userfollow');
		$checkActivation = $model->checkActivation();
		if ($checkActivation == 'success') {
			$app->redirect(JRoute::_('index.php?option=com_wishlogue&view=home', false));
		}

        $followusercompl = JRequest::getVar('followusercompl');

        if ($followusercompl == 'CreateBoards') {
            $model = $this->getModel('userfollow');
            $createBoards = $model->createBoards();
            $updateActivation = $model->updateActivation();
        }

        parent::display();
    }
}