本文整理汇总了PHP中ca_locales::localeIDToName方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_locales::localeIDToName方法的具体用法?PHP ca_locales::localeIDToName怎么用?PHP ca_locales::localeIDToName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_locales
的用法示例。
在下文中一共展示了ca_locales::localeIDToName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCaptionFileList
/**
* Returns list of caption/subtitle files attached to a representation
* The return value is an array key'ed on the caption_id; array values are arrays
* with keys set to values for each file returned. They keys are:
* path = The absolute file path to the file
* url = The URL for the file
* caption_id = a unique identifier for each attached caption file
*
* @param int $pn_representation_id The representation_id of the representation to return files for. If omitted the currently loaded representation is used. If no representation_id is specified and no row is loaded null will be returned.
* @param array $pa_locale_ids
* @param array $pa_options
* @return array A list of caption files attached to the representations. If no files are associated an empty array is returned.
*/
public function getCaptionFileList($pn_representation_id = null, $pa_locale_ids = null, $pa_options = null)
{
if (!($vn_representation_id = $pn_representation_id)) {
if (!($vn_representation_id = $this->getPrimaryKey())) {
return null;
}
}
$t_locale = new ca_locales();
$va_locale_ids = array();
if ($pa_locale_ids) {
if (!is_array($pa_locale_ids)) {
$pa_locale_ids = array($pa_locale_ids);
}
foreach ($pa_locale_ids as $vn_i => $vm_locale) {
if (is_numeric($vm_locale) && (int) $vm_locale) {
$va_locale_ids[] = (int) $vm_locale;
} else {
if ($vn_locale_id = $t_locale->localeCodeToID($vm_locale)) {
$va_locale_ids[] = $vn_locale_id;
}
}
}
}
$vs_locale_sql = '';
$va_params = array((int) $vn_representation_id);
if (sizeof($va_locale_ids) > 0) {
$vs_locale_sql = " AND locale_id IN (?)";
$va_params[] = $va_locale_ids;
}
$o_db = $this->getDb();
$qr_res = $o_db->query("\n \t\t\tSELECT *\n \t\t\tFROM ca_object_representation_captions\n \t\t\tWHERE\n \t\t\t\trepresentation_id = ?\n \t\t\t{$vs_locale_sql}\n \t\t", $va_params);
$va_files = array();
while ($qr_res->nextRow()) {
$vn_caption_id = $qr_res->get('caption_id');
$vn_locale_id = $qr_res->get('locale_id');
$va_files[$vn_caption_id] = $qr_res->getRow();
unset($va_files[$vn_caption_id]['caption_file']);
$va_files[$vn_caption_id]['path'] = $qr_res->getFilePath('caption_file');
$va_files[$vn_caption_id]['url'] = $qr_res->getFileUrl('caption_file');
$va_files[$vn_caption_id]['filesize'] = caFormatFileSize(filesize($va_files[$vn_caption_id]['path']));
$va_files[$vn_caption_id]['caption_id'] = $vn_caption_id;
$va_files[$vn_caption_id]['locale_id'] = $vn_locale_id;
$va_files[$vn_caption_id]['locale'] = $t_locale->localeIDToName($vn_locale_id);
$va_files[$vn_caption_id]['locale_code'] = $t_locale->localeIDToCode($vn_locale_id);
}
return $va_files;
}