<?php
/**
* СодеÑÐ¶Ð¸Ñ ÐºÐ»Ð°ÑÑ BrotherDivisions
*
* @package energine
* @author dr.Pavka
* @copyright ColoCall 2006
* @version $Id: BrotherDivisions.class.php,v 1.5 2008/02/29 14:57:23 pavka Exp $
*/
//require_once('core/modules/share/components/ChildDivisions.class.php');
/**
* ÐлаÑÑ Ð¿ÐµÑедназнаÑен Ð´Ð»Ñ Ð²Ñвода доÑеÑниÑ
Ñазделов ÑекÑÑего Ñаздела
*
* @package energine
* @subpackage share
*
*/
class BrotherDivisions extends ChildDivisions {
/**
* ÐонÑÑÑÑкÑÐ¾Ñ ÐºÐ»Ð°ÑÑа
*
* @return void
*/
public function __construct($name, $module, Document $document, array $params = null) {
$params['active'] = false;
parent::__construct($name, $module, $document, $params);
$this->setParam('recordsPerPage', false);
}
/**
* УбиÑаем DescriptionRtf
*
* @return DataDescription
* @access protected
*/
protected function createDataDescription() {
$result = parent::createDataDescription();
$result->removeFieldDescription($result->getFieldDescriptionByName('DescriptionRtf'));
return $result;
}
/**
* ÐеÑеопÑеделеннÑй меÑод загÑÑзки даннÑÑ
*
* @return mixed
* @access protected
*/
protected function loadData() {
$sitemap = Sitemap::getInstance();
if (!$this->getParam('id')) {
$id = $this->document->getID();
}
else {
$id = $this->getParam('id');
}
$parentID = $sitemap->getDocumentInfo($id);
$parentID = $parentID['Pid'];
if (isset($parentID)) {
$data = $sitemap->getChilds($parentID);
}
$data = (empty($data))?false:$data;
if(is_array($data)) {
foreach ($data as $id => $current) {
$data[$id] = array(
'Id' => $id,
'Segment' => $current['Segment'],
'Name' => $current['Name']
);
}
}
return $data;
}
}