public function display($cachable = false, $url_params = false)
 {
     $user =& JFactory::getUser();
     $view = JRequest::getVar("view");
     if ($view == 'advancedopenportal') {
         JRequest::setVar("view", "listcases");
         $view = "listcases";
     }
     if (SugarCasesConnection::isValidPortalUser($user) && !SugarCasesConnection::isUserBlocked($user)) {
         parent::display($cachable, $url_params);
     } else {
         if (!$user->id) {
             $msg = JText::_('COM_ADVANCEDOPENPORTAL_LOGIN_REQUIRED');
         } elseif (SugarCasesConnection::isUserBlocked($user)) {
             $msg = JText::_('COM_ADVANCEDOPENPORTAL_PORTAL_USER_BLOCKED');
         } else {
             $msg = JText::_('COM_ADVANCEDOPENPORTAL_NO_PORTAL_ACCOUNT');
         }
         if ($view != 'listcases') {
             JFactory::getApplication()->redirect(JURI::base(), $msg, 'error');
         } else {
             JFactory::getApplication()->enqueueMessage($msg, 'error');
             parent::display($cachable, $url_params);
         }
     }
 }
 function display($tpl = null)
 {
     include_once 'components/com_advancedopenportal/models/SugarCasesConnection.php';
     $user =& JFactory::getUser();
     $this->errors = array();
     $contact_id = $user->getParam('sugarid');
     $caseConnection = SugarCasesConnection::getInstance();
     $this->cases = $caseConnection->getCases($contact_id);
     $this->states = $caseConnection->getStates();
     $this->validPortalUser = SugarCasesConnection::isValidPortalUser($user);
     $this->userBlocked = SugarCasesConnection::isUserBlocked($user);
     $this->contact = $caseConnection->getContact($contact_id);
     // Display the view
     parent::display($tpl);
 }