<?php
/**
* СодеÑÐ¶Ð¸Ñ ÐºÐ»Ð°ÑÑ LangSwitcher
*
* @package energine
* @author dr.Pavka
* @copyright ColoCall 2006
* @version $Id: LangSwitcher.class.php,v 1.6 2007/12/17 14:16:14 pavka Exp $
*/
//require_once('core/modules/share/components/DataSet.class.php');
//require_once('core/framework/Language.class.php');
/**
* пеÑеклÑÑаÑÐµÐ»Ñ ÑзÑков
*
* @package energine
* @subpackage share
*/
final class LangSwitcher extends DataSet {
/**
* ÐонÑÑÑÑкÑÐ¾Ñ ÐºÐ»Ð°ÑÑа
*
* @return void
*/
public function __construct($name, $module, Document $document, array $params = null) {
parent::__construct($name, $module, $document, $params);
$this->setType(self::COMPONENT_TYPE_LIST);
}
/**
* Method Description
*
* @return type
* @access protected
*/
protected function loadData() {
$lang = Language::getInstance();
$data = $lang->getLanguages();
foreach ($data as $langID => $LangInfo) {
$result[$langID] = $LangInfo;
$result[$langID]['lang_id'] = $langID;
$result[$langID]['lang_url'] = $result[$langID]['lang_abbr'].'/'.Request::getInstance()->getPath(Request::PATH_WHOLE, true);
}
return $result;
}
/**
* Создаем пеÑеÑÐµÐ½Ñ Ð¿Ð¾Ð»ÐµÐ¹
*
* @return DataDescription
* @access protected
*/
protected function createDataDescription() {
$result = new DataDescription();
$f = new FieldDescription('lang_id');
$f->setType(FieldDescription::FIELD_TYPE_INT);
$result->addFieldDescription($f);
$f = new FieldDescription('lang_abbr');
$f->setType(FieldDescription::FIELD_TYPE_STRING);
$result->addFieldDescription($f);
$f = new FieldDescription('lang_name');
$f->setType(FieldDescription::FIELD_TYPE_STRING);
$result->addFieldDescription($f);
$f = new FieldDescription('lang_url');
$f->setType(FieldDescription::FIELD_TYPE_STRING);
$result->addFieldDescription($f);
return $result;
}
}