Handing SessionActivity for online List

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
Hi, how can i handle different "actions" in the getSessionActicityDetailsForList ??
In my controller i have this:
PHP:
/**
     * return the action for the online list
     * @param array $activities
     * @return phrase
     */
    public static function getSessionActivityDetailsForList(array $activities)
    {
        $do = $activities[0]['params']['page'];

        switch ($do) {......
For me it's working fine, but a user wrote, that he's getting this error:
Code:
Server Error

Undefined offset: 0
XenForo_Application::handlePhpError() in Ragtek/InfoPage/ControllerPublic/Info.php at line 43
Ragtek_InfoPage_ControllerPublic_Info::getSessionActivityDetailsForList()
call_user_func() in XenForo/Model/Session.php at line 310
XenForo_Model_Session->addSessionActivityDetailsToList() in XenForo/ControllerPublic/Online.php at line 50
XenForo_ControllerPublic_Online->actionIndex() in XenForo/FrontController.php at line 310
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
XenForo_FrontController->run() in /var/www/web3/html/index.php at line 15
Line 43 is $do = $activities[0]['params']['page'];

Anybody know, why he didn't have the same array values as i?
 
I do something like this...


PHP:
    public static function getSessionActivityDetailsForList(array $activities)
    {
        foreach ($activities AS $key => $activity)
        {
            $action = $activity['controller_action'];

            switch ($action)
            {
                case 'Index':
                    return new XenForo_Phrase('viewing...');
                case 'Card':
                    return new XenForo_Phrase('viewing...');
                case 'Add':
                    return new XenForo_Phrase('adding...');
                case 'Edit':
                    return new XenForo_Phrase('editing...');
                case 'Delete':
                    return new XenForo_Phrase('removing...');
            }
        }
    }
 
Yea, i've seen this also, but i don't understand why i have to make a foreach.

$activities is a array and in all my cases a $acitivities[0] existed :(

But thx, i'll try this now
 
That is something I don't quite understand either, aside from the fact that you can return it by the array key for multiple items. Maybe it's for something that's not fully implemented yet?
 
Top Bottom