aSpecialKeys = array('rate' => '', 'rate_cnt' => '');
}
function getProfileMatch( $memberID, $profileID ) {
$match_n = getProfilesMatch($memberID, $profileID); // impl
return DesignProgressPos ( _t("_XX match", $match_n), $GLOBALS['oTemplConfig']->iProfileViewProgressBar, 100, $match_n );;
}
function getProfileZodiac( $profileDate ) {
return ShowZodiacSign( $profileDate );
}
function TemplPageAddComponent($sKey) {
switch( $sKey ) {
case 'something':
return false; // return here additional components
default:
return false; // if you have not such component, return false!
}
}
/**
* Function will generate object's action link ;
*
* @param : $aObjectParamaters (array) contain special markers ;
* @param : $aRow (array) links's info ;
* @param : $sCssClass (string) additional css style ;
* @return : Html presentation data ;
*/
function genActionLink( &$aObjectParamaters, $aRow, $sCssClass = null, $sTemplateIndexActionLink = 'action') {
// ** init some needed variables ;
$sOutputHtml = null;
$aUsedTemplate = array (
'action' => 'action_link.html',
'action_submenu' => 'action_link_submenu.html',
);
// find and replace all special markers ;
foreach( $aRow AS $sKeyName => $sKeyValue ) {
if ( $sKeyName == 'Caption' ) {
$aRow[$sKeyName] = $this -> markerReplace($aObjectParamaters, $sKeyValue, $aRow['Eval'], true);
} else {
$aRow[$sKeyName] = $this -> markerReplace($aObjectParamaters, $sKeyValue, $aRow['Eval']);
}
}
$sKeyValue = trim($sKeyValue, '{}');
if ( array_key_exists($sKeyValue, $this -> aSpecialKeys) ) {
return $aRow['Eval'];
} else {
$sSiteUrl = (preg_match("/^(http|https|ftp|mailto)/", $aRow['Url'])) ? '' : BX_DOL_URL_ROOT;
// build the link components ;
//$sLinkSrc = (!$aRow['Script']) ? $aRow['Url'] : 'javascript:void(0)';
$sScriptAction = ( $aRow['Script'] ) ? ' onclick="' . $aRow['Script'] . '"' : '';
$sScriptAction = ($sScriptAction=='' && $aRow['Url']!='') ? " onclick=\"window.open ('{$sSiteUrl}{$aRow['Url']}','_self');\" " : $sScriptAction;
$sIcon = getTemplateIcon($aRow['Icon']);
if ( $aRow['Caption'] and ($aRow['Url'] or $aRow['Script'] ) ) {
$sCssClass = ( $sCssClass ) ? 'class="' . $sCssClass . '"' : null;
$aTemplateKeys = array (
'action_img_alt' => $aRow['Caption'],
'action_img_src' => $sIcon,
'action_caption' => $aRow['Caption'],
'extended_css' => $sCssClass,
'extended_action' => $sScriptAction,
);
$sOutputHtml .= $GLOBALS['oSysTemplate'] -> parseHtmlByName( $aUsedTemplate[$sTemplateIndexActionLink], $aTemplateKeys );
}
}
return $sOutputHtml;
}
/**
* Function will parse and replace all special markers ;
*
* @param $aMemberSettings (array) : all available member's information
* @param $sTransformText (text) : string that will to parse
* @param $bTranslate (boolean) : if isset this param - script will try to translate it used dolphin language file
* @return (string) : parsed string
*/
function markerReplace( &$aMemberSettings, $sTransformText, $sExecuteCode = null, $bTranslate = false ) {
$aMatches = array();
preg_match_all( "/([a-z0-9\-\_ ]{1,})|({([^\}]+)\})/i", $sTransformText, $aMatches );
if ( is_array($aMatches) and !empty($aMatches) ) {
// replace all founded markers ;
foreach( $aMatches[3] as $iMarker => $sMarkerValue ) {
if ( is_array($aMemberSettings) and array_key_exists($sMarkerValue, $aMemberSettings) and !array_key_exists($sMarkerValue, $this -> aSpecialKeys) ){
$sTransformText = str_replace( '{' . $sMarkerValue . '}', $aMemberSettings[$sMarkerValue], $sTransformText);
} else if ( $sMarkerValue == 'evalResult' and $sExecuteCode ) {
//find all special markers into Execute code ;
$sExecuteCode = $this -> markerReplace( $aMemberSettings, $sExecuteCode );
$sTransformText = str_replace( '{' . $sMarkerValue . '}', eval( $sExecuteCode ), $sTransformText);
} else {
// if isset into special keys ;
if ( array_key_exists($sMarkerValue, $this -> aSpecialKeys) ) {
return $aMemberSettings[$sMarkerValue];
} else {
// undefined keys
switch ($sMarkerValue) {
}
}
}
}
// try to translate item ;
if ( $bTranslate ) {
foreach( $aMatches[1] as $iMarker => $sMarkerValue ) if ( $sMarkerValue )
$sTransformText = str_replace( $sMarkerValue , _t( trim($sMarkerValue) ), $sTransformText);
}
}
return $sTransformText;
}
function msgBox($sText, $iTimer = 0, $sOnClose = "") {
$iId = mktime() . mt_rand(1, 1000);
return $GLOBALS['oSysTemplate']->parseHtmlByName('messageBox.html', array(
'id' => $iId,
'msgText' => $sText,
'bx_if:timer' => array(
'condition' => $iTimer > 0,
'content' => array(
'id' => $iId,
'time' => 1000 * $iTimer,
'on_close' => $sOnClose,
)
)
));
}
function loadingBox($sName) {
return $GLOBALS['oSysTemplate']->parseHtmlByName('loading.html', array(
'name' => $sName,
));
}
/**
* Get standard popup box.
*
* @param string $sTitle - translated title
* @param string $sContent - content of the box
* @param array $aActions - an array of actions. See an example below.
* @return string HTML of Standard Popup Box
*
* @see Example of actions
* $aActions = array(
* 'a1' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript: changeType(this)', 'class' => 'wall-ptype-ctl', 'icon' => 'post_text.png', 'title' => _t('_title_a1'), 'active' => 1),
* 'a2' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript: changeType(this)', 'class' => 'wall-ptype-ctl', 'icon' => 'post_text.png', 'title' => _t('_title_a2'))
* );
*/
function popupBox($sName, $sTitle, $sContent, $aActions = array()) {
$iId = !empty($sName) ? $sName : mktime();
$aButtons = array();
foreach($aActions as $sId => $aAction)
$aButtons[] = array(
'id' => $sId,
'title' => htmlspecialchars_adv(_t($aAction['title'])),
'class' => isset($aAction['class']) ? ' class="' . $aAction['class'] . '"' : '',
'icon' => isset($aAction['icon']) ? '' : '',
'href' => isset($aAction['href']) ? ' href="' . htmlspecialchars_adv($aAction['href']) . '"' : '',
'target' => isset($aAction['target']) ? ' target="' . $aAction['target'] . '"' : '',
'on_click' => isset($aAction['onclick']) ? ' onclick="' . $aAction['onclick'] . '"' : '',
'bx_if:hide_active' => array(
'condition' => !isset($aAction['active']) || $aAction['active'] != 1,
'content' => array()
),
'bx_if:hide_inactive' => array(
'condition' => isset($aAction['active']) && $aAction['active'] == 1,
'content' => array()
)
);
return $GLOBALS['oSysTemplate']->parseHtmlByName('popup_box.html', array(
'id' => $iId,
'title' => $sTitle,
'bx_repeat:actions' => $aButtons,
'content' => $sContent
));
}
function transBox($content, $isPlaceInCenter = false) {
return
($isPlaceInCenter ? '