• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Render Alerts

silence

Well-known member
#1
Yes it's me again :C
This function in the Alert model:
PHP:
    public function getAlertsForUser($userId, $fetchMode, array $fetchOptions = array(), array $viewingUser = null)
It get's the alerts for a user, however how exactly is the alert rendered on the controller?
I was looking in one of the alert templates and it was being called simply with one variable ($alert.template) so which function renders an alert into a single string?

Thanks!
 

silence

Well-known member
#2
Alright I got a bit further with this, I'm attempting to grab the template and render it, then use a regex to remove all html content and leave me with just the raw text of the template. However, I can't figure out how to get said template and view it raw! Here is what I have so far.

PHP:
<?php

class Teamspeak_Model_Alert extends XFCP_Teamspeak_Model_Alert
{
    public function renderAlert($alert)
    {
        $template = $this->_getAlertTemplate($alert['content_type'], $alert['action']);
    }

    protected function _getAlertTemplate($contentType, $action)
    {
        return 'alert_' . $contentType . '_' . $action;
    }
}