Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1178639
languages_tag_processor.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Oct 9, 1:54 PM
Size
3 KB
Mime Type
text/x-php
Expires
Sat, Oct 11, 1:54 PM (2 m, 34 s)
Engine
blob
Format
Raw Data
Handle
765005
Attached To
rINP In-Portal
languages_tag_processor.php
View Options
<?php
/**
* @version $Id: languages_tag_processor.php 16513 2017-01-20 14:10:53Z alex $
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined
(
'FULL_PATH'
)
or
die
(
'restricted access!'
);
class
LanguagesTagProcessor
extends
kDBTagProcessor
{
/**
* Sets content-type of page
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
SetContentType
(
$params
)
{
$content_type
=
isset
(
$params
[
'content_type'
])
?
$params
[
'content_type'
]
:
'text/html'
;
$include_charset
=
isset
(
$params
[
'include_charset'
])
?
$params
[
'include_charset'
]
:
null
;
$this
->
Application
->
setContentType
(
$content_type
,
$include_charset
);
return
''
;
}
/**
* Returns formatted date + time on current language
*
* @param Array $params
* @return string
*/
function
CurrentDate
(
$params
)
{
$format
=
$params
[
'format'
];
$date
=
adodb_mktime
();
if
(
strpos
(
$format
,
'l'
)
!==
false
)
{
$week_day
=
$this
->
Application
->
Phrase
(
'lu_weekday_'
.
adodb_date
(
'l'
));
$format
=
str_replace
(
'l'
,
'#@#'
,
$format
);
// replace with reserved char (preserves translation link)
return
str_replace
(
'#@#'
,
$week_day
,
adodb_date
(
$format
,
$date
));
}
return
adodb_date
(
$format
,
$date
);
}
function
ListLanguages
(
$params
)
{
$this
->
Init
(
$this
->
Prefix
,
'enabled'
);
return
$this
->
PrintList2
(
$params
);
}
function
LanguageName
(
$params
)
{
$object
=
$this
->
getObject
(
$params
);
return
$this
->
Application
->
Phrase
(
$params
[
'phrase_prefix'
].
$object
->
GetDBField
(
'PackName'
));
}
function
LanguageLink
(
$params
)
{
$object
=
$this
->
getObject
(
$params
);
$params
[
'm_lang'
]
=
$object
->
GetID
();
return
$this
->
Application
->
ProcessParsedTag
(
'm'
,
'Link'
,
$params
);
}
function
SelectedLanguage
(
$params
)
{
/** @var kDBList $object */
$object
=
$this
->
getObject
(
$params
);
if
(
array_key_exists
(
'type'
,
$params
)
&&
$params
[
'type'
]
==
'data'
)
{
// when using language selector on editing forms
return
$object
->
GetDBField
(
'LanguageId'
)
==
$this
->
Application
->
GetVar
(
'm_lang'
);
}
return
$object
->
GetDBField
(
'LanguageId'
)
==
$this
->
Application
->
Phrases
->
LanguageId
;
}
/**
* Returns path where exported languages should be saved
*
* @param Array $params
* @return string
* @access protected
*/
protected
function
ExportPath
(
$params
)
{
$ret
=
EXPORT_PATH
.
'/'
;
if
(
getArrayValue
(
$params
,
'as_url'
)
)
{
$ret
=
str_replace
(
FULL_PATH
.
'/'
,
$this
->
Application
->
BaseURL
(),
$ret
);
}
return
$ret
;
}
/**
* Returns true if system has more then 1 language installed
*
* @param Array $params
* @return bool
*/
function
IsMultiLanguage
(
$params
)
{
return
$this
->
TotalRecords
(
$params
)
>
1
;
}
function
IsPrimaryLanguage
(
$params
)
{
return
$this
->
Application
->
GetDefaultLanguageId
()
==
$this
->
Application
->
GetVar
(
'm_lang'
);
}
/* function Main_IsMetricUnits($params)
{
$object = $this->Application->recallObject($this->Prefix.'.current');
$measure_system = $object->GetDBField('UnitSystem');
return $measure_system == 1 ? 1 : 0;
}*/
}
Event Timeline
Log In to Comment