Zero108 Posted July 11, 2018 Share Posted July 11, 2018 (edited) Cтраница, где хотелось бы отсортировать маркеры по названию, а не по дате добавления/изменения. Еще одна страница, где хотелось бы отсортировать названия групп маркеров по названию, а не по дате добавления. 3.5.13.5.1 Edited July 11, 2018 by Zero108 Link to comment Share on other sites More sharing options...
newbie Posted July 11, 2018 Share Posted July 11, 2018 (edited) Cтраница, где хотелось бы отсортировать маркеры по названию, а не по дате добавления/изменения. \applications\membermap\modules\front\markers\groups.phpДобавить, например, перед$filterOptions = array($table->sortBy = \IPS\Request::i()->sortBy ? $table->sortBy : 'title'; $table->sortDirection = 'asc'; Еще одна страница, где хотелось бы отсортировать названия групп маркеров по названию, а не по дате добавления.Шаблон index{template="groupRow" group="markers" params="NULL, NULL, \IPS\membermap\Markers\Groups::roots( 'view' )"}заменить на {{$groups = \IPS\membermap\Markers\Groups::roots('view');}} {{usort($groups, function( $a, $b ) {$n1 = $a->_title; $n2 = $b->_title; \IPS\Member::loggedIn()->language()->parseOutputForDisplay($n1); \IPS\Member::loggedIn()->language()->parseOutputForDisplay($n2); return strcmp($n1, $n2);});}} {template="groupRow" group="markers" params="NULL, NULL, $groups"} Edited July 12, 2018 by newbie Link to comment Share on other sites More sharing options...
Zero108 Posted July 11, 2018 Author Share Posted July 11, 2018 (edited) Вторая часть не работает: группы маркеров вообще не отображаются. {{if !\IPS\Request::i()->isAjax()}} <div class="ipsPageHeader ipsPad_half ipsClearfix ipsSpacer_bottom" data-ipsSticky data-ipsSticky-disableIn='phone'> <h1 class="ipsType_pageTitle">{lang="membermap_marker_groups"}</h1> </div> <div class='ipsBox'> <h2 class='ipsType_sectionTitle ipsType_reset'>{lang="membermap_groups"}</h2> {{endif}} <ol class="ipsDataList"> {template="groupRow" group="markers" params="NULL, NULL, usort(\IPS\membermap\Markers\Groups::roots('view'), function($a, $B) {$n1 = $a->_title; $n2 = $b->_title; \IPS\Member::loggedIn()->language()->parseOutputForDisplay($n1); \IPS\Member::loggedIn()->language()->parseOutputForDisplay($n2); return strcmp($n1, $n2);})"} </ol> {{if !\IPS\Request::i()->isAjax()}} </div> {{endif}} Edited July 11, 2018 by Zero108 Link to comment Share on other sites More sharing options...
newbie Posted July 12, 2018 Share Posted July 12, 2018 Вторая часть не работает: группы маркеров вообще не отображаются. Потому что форум изменил кодfunction($a, $B)b должна быть, а не B 1 Link to comment Share on other sites More sharing options...
Zero108 Posted July 12, 2018 Author Share Posted July 12, 2018 (edited) Так тоже не работает: ничего не отображается (добавил пробел после b, чтобы не менялась тут): {{if !\IPS\Request::i()->isAjax()}} <div class="ipsPageHeader ipsPad_half ipsClearfix ipsSpacer_bottom" data-ipsSticky data-ipsSticky-disableIn='phone'> <h1 class="ipsType_pageTitle">{lang="membermap_marker_groups"}</h1> </div> <div class='ipsBox'> <h2 class='ipsType_sectionTitle ipsType_reset'>{lang="membermap_groups"}</h2> {{endif}} <ol class="ipsDataList"> {template="groupRow" group="markers" params="NULL, NULL, usort(\IPS\membermap\Markers\Groups::roots('view'), function($a, $b ) {$n1 = $a->_title; $n2 = $b->_title; \IPS\Member::loggedIn()->language()->parseOutputForDisplay($n1); \IPS\Member::loggedIn()->language()->parseOutputForDisplay($n2); return strcmp($n1, $n2);})"} </ol> {{if !\IPS\Request::i()->isAjax()}} </div> {{endif}} Edited July 12, 2018 by Zero108 Link to comment Share on other sites More sharing options...
newbie Posted July 12, 2018 Share Posted July 12, 2018 Поправил пост 1 Link to comment Share on other sites More sharing options...
Zero108 Posted July 12, 2018 Author Share Posted July 12, 2018 (edited) Заработало. Спасибо! Edited July 12, 2018 by Zero108 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now