Project

General

Profile

Actions

Feature #17650

closed

option end for HMENU / and negative values for begin and end

Added by Daniel Poetzinger about 17 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2007-10-04
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

For special requirements we needed something like:

1=HMENU
1 {
end=-1
begin=-2
..
}

So we needed to adjust tslib_menu to allow:
  • the parameter end to configure a endpoint
  • allow negative values for begin and end, so you can define a offset from the end of the menuitems

I provide a patch later. Here is the new code for function makeMenu

$begin = tslib_cObj::calc($this->mconf['begin'] ? $this->mconf['begin'] : $this->conf['begin']);
$endat = tslib_cObj::calc($this->mconf['end'] ? $this->mconf['end'] : $this->conf['end']);

$banUidArray = $this->getBannedUids();
// Fill in the menuArr with elements that should go into the menu:
$this->menuArr = Array();
foreach($temp as $data) {
$spacer = (t3lib_div::inList($this->spacerIDList,$data['doktype']) || !strcmp($data['ITEM_STATE'],'SPC')) ? 1 : 0; // if item is a spacer, $spacer is set
if ($this->filterMenuPages($data, $banUidArray, $spacer)) {
$c_b++;
if ($begin<=$c_b) { // If the beginning item has been reached.
$this->menuArr[$c] = $data;
$this->menuArr[$c]['isSpacer'] = $spacer;
$c++;
if ($maxItems && $c>=$maxItems) {
break;
}
}
if ($endat>0 && $endat<=$c_b) {
break;
}
}
}
//delete last items if endat is negative
if ($endat&lt;0) {
$_end=$c+$endat;
if ($_end&lt;0)
$_end=0;
for ($i=$c;$i>=$_end; $i--) {
unset($this->menuArr[$i]);
}
}
//delete the first items if begin was negative
if ($begin&lt;0) {
$_begin=$c+$begin;
if ($_begin&lt;0)
$_begin=0;
for ($i=0; $i<$_begin; $i++) {
array_shift($this->menuArr);
}
}

(issue imported from #M6452)


Files

bug6452.txt (1.24 KB) bug6452.txt Administrator Admin, 2008-01-03 16:44
patch6452_class.tslib_menu.txt (1.35 KB) patch6452_class.tslib_menu.txt Administrator Admin, 2008-01-07 23:36
Actions

Also available in: Atom PDF