Jump to content

Trouble creating table on front page


GriefCode

Recommended Posts

Hey,

I'm trying to bring a page as front module, I used the same way as i used for an admin module, so my code is this:
 

	protected function manage()
	{
        $table = new \IPS\Helpers\Table\Db('dvstats_dota_elo_scores', \IPS\Http\Url::internal( 'app=dvstats&module=stats&controller=toplist' ));
        $table->langPrefix = 'elo_table_';

        $table->joins = array(
            array(
                'select' => 'conn.id, dvstats_dota_elo_scores.id as playerId',
                'from' => array( 'dvstats_forum_connections', 'conn' ),
                'where' => array( 'conn.dota_player_id=dvstats_dota_elo_scores.id' )
            )
        );

        $table->include = array('conn.id', 'name', 'score', 'games' );
        $table->mainColumn = 'score';
        $table->sortBy = $table->sortBy ?: 'score';
        $table->sortDirection = $table->sortDirection ?: 'desc';
        $table->quickSearch = 'name';
        $table->advancedSearch = array(
            'conn.id' => \IPS\Helpers\Table\SEARCH_MEMBER,
            'name' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT,
            'score' => \IPS\Helpers\Table\SEARCH_CONTAINS_TEXT
        );
        $table->parsers = array(
            'conn.id' => function ( $val, $row )
            {
                try
                {
                    $member = htmlentities( \IPS\Member::load( $val )->name, \IPS\HTMLENTITIES, 'UTF-8', FALSE );
                    return $member;
                }
                catch ( \OutOfRangeException $e )
                {
                    return '';
                }
            }
        );

        \IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'global', 'core' )->block( 'title', (string) $table );
	}

But on the front page i got that error:
 

Error: Class name must be a valid object or a string (0)
#0 [internal function]: IPS\Theme\theme_core_front_tables_rows(Object(IPS\Helpers\Table\Db), Array, Array)
#1 /var/www/forum/system/Theme/Dev/Template.php(163): call_user_func_array('IPS\\Theme\\theme...', Array)
#2 /var/www/forum/system/Theme/Theme.php(4085) : eval()'d code(511): IPS\Theme\Dev\_Template->__call('rows', Array)
#3 [internal function]: IPS\Theme\theme_core_front_tables_table(Object(IPS\Helpers\Table\Db), Array, Array, 'name', true)
#4 /var/www/forum/system/Theme/Dev/Template.php(163): call_user_func_array('IPS\\Theme\\theme...', Array)
#5 [internal function]: IPS\Theme\Dev\_Template->__call('table', Array)
#6 /var/www/forum/system/Helpers/Table/Table.php(496): call_user_func(Array, Object(IPS\Helpers\Table\Db), Array, Array, 'name', true)
#7 /var/www/forum/applications/dvstats/modules/front/stats/toplist.php(74): IPS\Helpers\Table\_Table->__toString()
#8 /var/www/forum/system/Dispatcher/Controller.php(96): IPS\dvstats\modules\front\stats\_toplist->manage()
#9 /var/www/forum/applications/dvstats/modules/front/stats/toplist.php(26): IPS\Dispatcher\_Controller->execute()
#10 /var/www/forum/system/Dispatcher/Dispatcher.php(129): IPS\dvstats\modules\front\stats\_toplist->execute()
#11 /var/www/forum/index.php(13): IPS\_Dispatcher->run()
#12 {main}

I do not get the reason for it, what did I wrong here?

Regards

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...