<?php

class XenPushover_DataWriter_User extends XFCP_XenPushover_DataWriter_User
{
	/**
	 * Post-save handling.
	 */
	protected function _postSave()
	{
		if ($this->isChanged('user_state') && $this->get('user_state') == 'moderated')
		{
			/** @var $pushoverModel XenPushover_Model_Pushover */
			$pushoverModel = $this->getModelFromCache('XenPushover_Model_Pushover');

			$alertType = $pushoverModel->getAdminAlertType('user_approval');
			$pushoverModel->pushAdminAlert($alertType);
		}

		parent::_postSave();
	}
}