Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/db/db_tag_processor.php
Show All 11 Lines | |||||
* See http://www.in-portal.org/license for copyright notices and details. | * See http://www.in-portal.org/license for copyright notices and details. | ||||
*/ | */ | ||||
defined('FULL_PATH') or die('restricted access!'); | defined('FULL_PATH') or die('restricted access!'); | ||||
class kDBTagProcessor extends kTagProcessor { | class kDBTagProcessor extends kTagProcessor { | ||||
/** | /** | ||||
* Mapping between "list_name" tag attribute values and generated Specials. | |||||
* | |||||
* @var array | |||||
*/ | |||||
protected $nameToSpecialMapping = array(); | |||||
/** | |||||
* Returns true if "new" button was pressed in toolbar | * Returns true if "new" button was pressed in toolbar | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
function IsNewMode($params) | function IsNewMode($params) | ||||
{ | { | ||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Line(s) | |||||
$params['no_table'] = 1; | $params['no_table'] = 1; | ||||
return $this->PrintList2($params); | return $this->PrintList2($params); | ||||
} | } | ||||
function InitList($params) | function InitList($params) | ||||
{ | { | ||||
$list_name = isset($params['list_name']) ? $params['list_name'] : ''; | $list_name = isset($params['list_name']) ? $params['list_name'] : ''; | ||||
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping', Array ()); | if ( getArrayValue($this->nameToSpecialMapping, $list_name) === false ) { | ||||
if ( getArrayValue($names_mapping, $this->Prefix, $list_name) === false ) { | |||||
$list =& $this->GetList($params); | $list =& $this->GetList($params); | ||||
} | } | ||||
} | } | ||||
function BuildListSpecial($params) | function BuildListSpecial($params) | ||||
{ | { | ||||
return $this->Special; | return $this->Special; | ||||
} | } | ||||
Show All 28 Lines | |||||
$list_name = $this->SelectParam($params, 'list_name,name'); | $list_name = $this->SelectParam($params, 'list_name,name'); | ||||
if ( !$list_name ) { | if ( !$list_name ) { | ||||
$list_name = $this->Application->Parser->GetParam('list_name'); | $list_name = $this->Application->Parser->GetParam('list_name'); | ||||
} | } | ||||
$requery = isset($params['requery']) && $params['requery']; | $requery = isset($params['requery']) && $params['requery']; | ||||
$main_list = array_key_exists('main_list', $params) && $params['main_list']; | $main_list = array_key_exists('main_list', $params) && $params['main_list']; | ||||
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping', Array ()); | |||||
if ( !array_key_exists($this->Prefix, $names_mapping) ) { | |||||
// create prefix-based array to special mapping storage | |||||
$names_mapping[$this->Prefix] = Array (); | |||||
} | |||||
if ( $list_name && !$requery ) { | if ( $list_name && !$requery ) { | ||||
// list with "list_name" parameter | // list with "list_name" parameter | ||||
if ( !array_key_exists($list_name, $names_mapping[$this->Prefix]) ) { | if ( !array_key_exists($list_name, $this->nameToSpecialMapping) ) { | ||||
// special missing -> generate one | // special missing -> generate one | ||||
$special = $main_list ? $this->Special : $this->BuildListSpecial($params); | $special = $main_list ? $this->Special : $this->BuildListSpecial($params); | ||||
} | } | ||||
else { | else { | ||||
// get special, formed during list initialization | // get special, formed during list initialization | ||||
$special = $names_mapping[$this->Prefix][$list_name]; | $special = $this->nameToSpecialMapping[$list_name]; | ||||
} | } | ||||
} | } | ||||
else { | else { | ||||
// list without "list_name" parameter | // list without "list_name" parameter | ||||
$special = $main_list ? $this->Special : $this->BuildListSpecial($params); | $special = $main_list ? $this->Special : $this->BuildListSpecial($params); | ||||
} | } | ||||
$prefix_special = rtrim($this->Prefix . '.' . $special, '.'); | $prefix_special = rtrim($this->Prefix . '.' . $special, '.'); | ||||
Show All 16 Lines | |||||
if ( array_key_exists('offset', $params) ) { | if ( array_key_exists('offset', $params) ) { | ||||
$list->SetOffset($list->GetOffset() - $params['offset']); // remove custom offset | $list->SetOffset($list->GetOffset() - $params['offset']); // remove custom offset | ||||
} | } | ||||
} | } | ||||
$this->Init($this->Prefix, $special); | $this->Init($this->Prefix, $special); | ||||
if ( $list_name ) { | if ( $list_name ) { | ||||
$names_mapping[$this->Prefix][$list_name] = $special; | $this->nameToSpecialMapping[$list_name] = $special; | ||||
$this->Application->SetVar('NamesToSpecialMapping', $names_mapping); | |||||
} | } | ||||
return $list; | return $list; | ||||
} | } | ||||
function ListMarker($params) | function ListMarker($params) | ||||
{ | { | ||||
$list =& $this->GetList($params); | $list =& $this->GetList($params); | ||||
▲ Show 20 Lines • Show All 2754 Lines • Show Last 20 Lines |