Mage_AdminNotification_Helper_Data Class Reference

Inheritance diagram for Mage_AdminNotification_Helper_Data:

Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 getLatestNotice ()
 getUnreadNoticeCount ($severity)
 getPopupObjectUrl ($withExt=false)
 isReadablePopupObject ()

Public Attributes

const XML_PATH_POPUP_URL = 'system/adminnotification/popup_url'

Protected Attributes

 $_popupUrl
 $_popupReadable
 $_latestNotice
 $_unreadNoticeCounts


Detailed Description

Definition at line 35 of file Data.php.


Member Function Documentation

getLatestNotice (  ) 

Retrieve latest notice model

Returns:
Mage_AdminNotification_Model_Inbox

Definition at line 72 of file Data.php.

00073     {
00074         if (is_null($this->_latestNotice)) {
00075             $this->_latestNotice = Mage::getModel('adminnotification/inbox')->loadLatestNotice();
00076         }
00077         return $this->_latestNotice;
00078     }

getPopupObjectUrl ( withExt = false  ) 

Retrieve Widget Popup Notification Object URL

Parameters:
bool $withExt
Returns:
string

Definition at line 100 of file Data.php.

00101     {
00102         if (is_null($this->_popupUrl)) {
00103             $sheme = Mage::app()->getFrontController()->getRequest()->isSecure()
00104                 ? 'https://'
00105                 : 'http://';
00106 
00107             $this->_popupUrl = $sheme . Mage::getStoreConfig(self::XML_PATH_POPUP_URL);
00108         }
00109         return $this->_popupUrl . ($withExt ? '.swf' : '');
00110     }

getUnreadNoticeCount ( severity  ) 

Retrieve count of unread notes by type

Parameters:
int $severity
Returns:
int

Definition at line 86 of file Data.php.

00087     {
00088         if (is_null($this->_unreadNoticeCounts)) {
00089             $this->_unreadNoticeCounts = Mage::getModel('adminnotification/inbox')->getNoticeStatus();
00090         }
00091         return isset($this->_unreadNoticeCounts[$severity]) ? $this->_unreadNoticeCounts[$severity] : 0;
00092     }

isReadablePopupObject (  ) 

Check is readable Popup Notification Object

Returns:
bool

Definition at line 117 of file Data.php.

00118     {
00119         if (is_null($this->_popupReadable)) {
00120             $this->_popupReadable = false;
00121             $curl = new Varien_Http_Adapter_Curl();
00122             $curl->setConfig(array(
00123                 'timeout'   => 2
00124             ));
00125             $curl->write(Zend_Http_Client::GET, $this->getPopupObjectUrl(true));
00126             if ($curl->read()) {
00127                 if ($curl->getInfo(CURLINFO_HTTP_CODE) == 200) {
00128                     $this->_popupReadable = true;
00129                 }
00130             }
00131         }
00132         return $this->_popupReadable;
00133     }


Member Data Documentation

$_latestNotice [protected]

Definition at line 58 of file Data.php.

$_popupReadable [protected]

Definition at line 51 of file Data.php.

$_popupUrl [protected]

Definition at line 44 of file Data.php.

$_unreadNoticeCounts [protected]

Definition at line 65 of file Data.php.

const XML_PATH_POPUP_URL = 'system/adminnotification/popup_url'

Definition at line 37 of file Data.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:30 2009 for Magento by  doxygen 1.5.8