Index: branches/RC/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r9238 -r9256 --- branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 9238) +++ branches/RC/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 9256) @@ -1939,6 +1939,94 @@ return $list->getPrefixSpecial().'_'.$params['type']; } + + /** + * Returns edit tabs by specified preset name or false in case of error + * + * @param string $preset_name + * @return mixed + */ + function getEditTabs($preset_name) + { + $presets = $this->Application->getUnitOption($this->Prefix, 'EditTabPresets'); + + if (!$presets || !isset($presets[$preset_name]) || count($presets[$preset_name]) == 0) { + return false; + } + + return $presets[$preset_name]; + } + + /** + * Detects if specified preset has tabs in it + * + * @param Array $params + * @return bool + */ + function HasEditTabs($params) + { + return $this->getEditTabs($params['preset_name']) ? true : false; + } + + /** + * Sorts edit tabs based on their priority + * + * @param Array $tab_a + * @param Array $tab_b + * @return int + */ + function sortEditTabs($tab_a, $tab_b) + { + if ($tab_a['priority'] == $tab_b['priority']) { + return 0; + } + + return $tab_a['priority'] < $tab_b['priority'] ? -1 : 1; + } + + /** + * Prints edit tabs based on preset name specified + * + * @param Array $params + * @return string + */ + function PrintEditTabs($params) + { + $edit_tabs = $this->getEditTabs($params['preset_name']); + if (!$edit_tabs) { + return ; + } + usort($edit_tabs, Array (&$this, 'sortEditTabs')); + + $ret = ''; + $block_params = $this->prepareTagParams($params); + $block_params['name'] = $params['render_as']; + + foreach ($edit_tabs as $tab_info) { + $block_params['title'] = $tab_info['title']; + $block_params['template'] = $tab_info['t']; + $ret .= $this->Application->ParseBlock($block_params); + } + + return $ret; + } + + /** + * Performs image resize to required dimensions and returns resulting url (cached resized image) + * + * @param Array $params + * @return string + */ + /*function ImageSrc($params) + { + $max_width = isset($params['MaxWidth']) ? $params['MaxWidth'] : false; + $max_height = isset($params['MaxHeight']) ? $params['MaxHeight'] : false; + + $object =& $this->getObject($params); + + $field = $this->SelectParam($params, 'name,field'); + return $object->GetField($field, 'resize:'.$max_width.'x'.$max_height); + }*/ } ?> \ No newline at end of file