Mage_AdminNotification_Model_Mysql4_Inbox Class Reference

Inheritance diagram for Mage_AdminNotification_Model_Mysql4_Inbox:

Mage_Core_Model_Mysql4_Abstract Mage_Core_Model_Resource_Abstract

List of all members.

Public Member Functions

 loadLatestNotice (Mage_AdminNotification_Model_Inbox $object)
 getNoticeStatus (Mage_AdminNotification_Model_Inbox $object)
 parse (Mage_AdminNotification_Model_Inbox $object, array $data)

Protected Member Functions

 _construct ()


Detailed Description

Definition at line 35 of file Inbox.php.


Member Function Documentation

_construct (  )  [protected]

Resource initialization

Reimplemented from Mage_Core_Model_Resource_Abstract.

Definition at line 37 of file Inbox.php.

00038     {
00039         $this->_init('adminnotification/inbox', 'notification_id');
00040     }

getNoticeStatus ( Mage_AdminNotification_Model_Inbox object  ) 

Definition at line 61 of file Inbox.php.

00062     {
00063         $select = $this->_getReadAdapter()->select()
00064             ->from($this->getMainTable(), array(
00065                 'severity'     => 'severity',
00066                 'count_notice' => 'COUNT(' . $this->getIdFieldName() . ')'))
00067             ->group('severity')
00068             ->where('is_remove=?', 0)
00069             ->where('is_read=?', 0);
00070         $return = array();
00071         $rowSet = $this->_getReadAdapter()->fetchAll($select);
00072         foreach ($rowSet as $row) {
00073             $return[$row['severity']] = $row['count_notice'];
00074         }
00075         return $return;
00076     }

loadLatestNotice ( Mage_AdminNotification_Model_Inbox object  ) 

Definition at line 42 of file Inbox.php.

00043     {
00044         $select = $this->_getReadAdapter()->select()
00045             ->from($this->getMainTable())
00046             ->order($this->getIdFieldName() . ' desc')
00047             ->where('is_read <> 1')
00048             ->where('is_remove <> 1')
00049             ->limit(1);
00050         $data = $this->_getReadAdapter()->fetchRow($select);
00051 
00052         if ($data) {
00053             $object->setData($data);
00054         }
00055 
00056         $this->_afterLoad($object);
00057 
00058         return $this;
00059     }

parse ( Mage_AdminNotification_Model_Inbox object,
array data 
)

Definition at line 78 of file Inbox.php.

00079     {
00080         $write = $this->_getWriteAdapter();
00081         foreach ($data as $item) {
00082             $select = $write->select()
00083                 ->from($this->getMainTable())
00084                 ->where('url=?', $item['url']);
00085             $row = $write->fetchRow($select);
00086 
00087             if (!$row) {
00088                 $write->insert($this->getMainTable(), $item);
00089             }
00090         }
00091     }


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