<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Core_Widget_MenuLogoController extends Engine_Content_Widget_Abstract
{
  public function indexAction()
  {
    if(Engine_Api::_()->getDbTable('modules', 'core')->isModuleEnabled('serenity')) {
      $viewer_id = Engine_Api::_()->user()->getViewer()->getIdentity();
      $headerloggedinoptions = unserialize(Engine_Api::_()->getApi('settings', 'core')->getSetting('serenity.headerloggedinoptions', 'a:4:{i:0;s:6:"search";i:1;s:8:"miniMenu";i:2;s:8:"mainMenu";i:3;s:4:"logo";}'));
      $headernonloggedinoptions = unserialize(Engine_Api::_()->getApi('settings', 'core')->getSetting('serenity.headernonloggedinoptions', 'a:4:{i:0;s:6:"search";i:1;s:8:"miniMenu";i:2;s:8:"mainMenu";i:3;s:4:"logo";}'));
      if(!empty($viewer_id))
        empty($headerloggedinoptions) ? $this->setNoRender() : ((!engine_in_array('logo', $headerloggedinoptions)) ? $this->setNoRender() : '');
      else 
        empty($headernonloggedinoptions) ? $this->setNoRender() : ((!engine_in_array('logo', $headernonloggedinoptions)) ? $this->setNoRender() : '');
    }
    
    if(Engine_Api::_()->getDbTable('modules', 'core')->isModuleEnabled('elpis')) {
      $viewer_id = Engine_Api::_()->user()->getViewer()->getIdentity();
      $headerloggedinoptions = unserialize(Engine_Api::_()->getApi('settings', 'core')->getSetting('elpis.headerloggedinoptions', 'a:4:{i:0;s:6:"search";i:1;s:8:"miniMenu";i:2;s:8:"mainMenu";i:3;s:4:"logo";}'));
      $headernonloggedinoptions = unserialize(Engine_Api::_()->getApi('settings', 'core')->getSetting('elpis.headernonloggedinoptions', 'a:4:{i:0;s:6:"search";i:1;s:8:"miniMenu";i:2;s:8:"mainMenu";i:3;s:4:"logo";}'));
      if(!empty($viewer_id))
        empty($headerloggedinoptions) ? $this->setNoRender() : ((!engine_in_array('logo', $headerloggedinoptions)) ? $this->setNoRender() : '');
      else 
        empty($headernonloggedinoptions) ? $this->setNoRender() : ((!engine_in_array('logo', $headernonloggedinoptions)) ? $this->setNoRender() : '');
    }

    if(Engine_Api::_()->getDbTable('modules', 'core')->isModuleEnabled('prism')) {
      $viewer_id = Engine_Api::_()->user()->getViewer()->getIdentity();
      $headerloggedinoptions = unserialize(Engine_Api::_()->getApi('settings', 'core')->getSetting('prism.headerloggedinoptions', 'a:4:{i:0;s:6:"search";i:1;s:8:"miniMenu";i:2;s:8:"mainMenu";i:3;s:4:"logo";}'));
      $headernonloggedinoptions = unserialize(Engine_Api::_()->getApi('settings', 'core')->getSetting('prism.headernonloggedinoptions', 'a:4:{i:0;s:6:"search";i:1;s:8:"miniMenu";i:2;s:8:"mainMenu";i:3;s:4:"logo";}'));
      if(!empty($viewer_id))
        (empty($headerloggedinoptions) ? $this->setNoRender() : ((!engine_in_array('logo', $headerloggedinoptions)) ? $this->setNoRender() : ''));
      else 
        (empty($headernonloggedinoptions) ? $this->setNoRender() : ((!engine_in_array('logo', $headernonloggedinoptions)) ? $this->setNoRender() : ''));
    }
    
    $this->view->logo = $this->_getParam('logo');
    $this->view->disableLink = $this->_getParam('disableLink',0);
  }

  public function getCacheKey()
  {
    //return true;
  }
}
