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

xen:helper sortArrow

Mythotical

Well-known member
#1
Ok I know I have to use an array of fetchOptions but have not figured that out. Guess that is due to me figuring out other features of my add-on. So I'm here asking for guidance.

Right now in my ControllerPublic file I have:
PHP:
    $fetchOptions['perPage'] = $options->xenWow_RosterLimit;

     $page = max(1, $this->_input->filterSingle('page', XenForo_Input::UINT));
     $roster = $rosterModel->getRosterList(array('perPage' => $fetchOptions['perPage'], 'page' => $page));
My Model call function:
PHP:
  public function getRosterList(array $fetchOptions)
   {
     $limitOptions = $this->prepareLimitFetchOptions($fetchOptions);

     return $this->_getDb()->fetchAll($this->limitQueryResults('
       SELECT roster.*, race.*, class.*, rank.*
       FROM xwow_roster AS roster
       LEFT JOIN xwow_races AS race ON roster.char_race = race.raceid
       LEFT JOIN xwow_class AS class ON roster.char_class = class.classid
       LEFT JOIN xwow_ranks AS rank ON roster.char_rank = rank.rank_id
       ORDER BY roster.char_rank ASC
       ', $limitOptions['limit'], $limitOptions['offset']
     ));
   }
EDIT: Template example that I'm looking at to make sure I have it correct when forming the link.
HTML:
<div class="guildBox guildCol2" style="border-left: 0px !IMPORTANT;">
                   <a href="{xen:link guild/roster, $rosterList, '_params={$orderParams.char_name}'}" class="title"><span>{xen:phrase xenWow_name}{xen:helper sortArrow, $rosterList, $orderDirection, char_name}</span></a>
                 </div>
I want to turn that into a fetch where it is ordered by char_name, char_level, char_race, char_rank, or char_achievePoints similar to how you can sort threads.

So a thread already created on the topic will do or examples will do or even a XenForo file or add-on will definitely do. Either way I'm sure I can figure it out from that.
 
Last edited:

Mythotical

Well-known member
#3
Oi, had a friend come in for a visit from out of state. I ended up away from my computer for 4 days straight, I was losing my mind. Anyway, that has put me behind quite a bit so I'm still working on the guide. First part will be the guide itself using text and screenshots, next part will be a straight video.