<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/

class Browserpush_Widget_PushController extends Engine_Content_Widget_Abstract {

  public function indexAction() {

    $settings = Engine_Api::_()->getApi('settings', 'core');
    $notificationpush = $settings->getSetting('browserpush.notificationpush',1);
    
    if(empty($notificationpush))
      return $this->setNoRender();

    $this->view->server_key = $server_key = $settings->getSetting('browserpush.serverkey');
		$browserpush_widget = Zend_Registry::isRegistered('browserpush_widget') ? Zend_Registry::get('browserpush_widget') : null;
    $this->view->script = $code = $settings->getSetting('browserpush.snippet');

    if(empty($server_key) || empty($code))
        return $this->setNoRender();

    $this->view->type = $settings->getSetting('browserpush.type',0);
		if(empty($browserpush_widget))
			return $this->setNoRender();
  }
}
