Commit f11607a5 authored by Sigrid Suski's avatar Sigrid Suski

Extended ordering without position implemented

parent d3dae87c
......@@ -223,6 +223,8 @@ class SPTemplateCtrl extends SPConfigAdmCtrl
}
$view->setCtrl( $this );
$entriesOrdering = $view->namesFields( null, true );
$params = [ 'position.asc', 'position.desc' ];
$entriesOrderingPlain = $view->namesFields( $params, true );
$entriesFields = $view->entryFields( true );
$categoryFields = $view->categoryFields( true );
$sid = Sobi::Section();
......@@ -231,6 +233,7 @@ class SPTemplateCtrl extends SPConfigAdmCtrl
->assign( $sid, 'sid' )
->assign( $templateSettings, 'settings' )
->assign( $entriesOrdering, 'entriesOrdering' )
->assign( $entriesOrderingPlain, 'entriesOrderingPlain' )
->assign( $entriesFields, 'entriesFields' )
->assign( $categoryFields, 'categoryFields' )
->assign( $plugins, 'apps' )
......
......@@ -272,6 +272,7 @@ class SPConfigAdmView extends SPAdmView implements SPView
* @param bool $ordering
*
* @return array
* @throws \Sobi\Error\Exception
*/
public function namesFields( $params = null, $ordering = false )
{
......@@ -311,23 +312,29 @@ class SPConfigAdmView extends SPAdmView implements SPView
Sobi::Txt( 'SEC.CFG.ENTRY_ORDER_BY_FIELDS' ) => $fData,
];
}
if ( $params ) {
$p = [ 'select', $params[ 1 ], $fData, $params[ 2 ], false ];
if ( isset( $params[ 3 ] ) ) {
$p[] = $params[ 3 ];
}
if ( isset( $params[ 4 ] ) ) {
$p[] = $params[ 4 ];
}
if ( isset( $params[ 5 ] ) ) {
$p[] = $params[ 5 ];
// params will not be used for a long time
// 11.2.19: reactivated with different meaning
if ( $params && is_array( $params ) ) {
foreach ( $params as $param ) {
unset ( $fData[ $param ] );
}
return $p;
}
else {
return $fData;
// $p = [ 'select', $params[ 1 ], $fData, $params[ 2 ], false ];
// if ( isset( $params[ 3 ] ) ) {
// $p[] = $params[ 3 ];
// }
// if ( isset( $params[ 4 ] ) ) {
// $p[] = $params[ 4 ];
// }
// if ( isset( $params[ 5 ] ) ) {
// $p[] = $params[ 5 ];
// }
//
// return $p;
}
// else {
return $fData;
// }
}
/**
......
......@@ -690,7 +690,7 @@
</values>
</field>
<field type="select" label="TP.CONFIG.LST_ORDERING" name="settings[config][collection][entries_ordering]"
values="entriesOrdering" selected="settings.config.collection.entries_ordering"
values="entriesOrderingPlain" selected="settings.config.collection.entries_ordering"
class="input-large"/> <!-- SobiPro setting! -->
<field type="toggle" name="settings[config][collection][comparison]" value="settings.config.collection.comparison"
label="TP.CONFIG.APPCOL_COMP" prefix="yes_no"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment