include('cms/public/api.php');
if(!isset($_REQUEST['id']) || !is_numeric($id=$_REQUEST['id']) || !($obj = $api->objects->getFullObject($id)) ){
exit( header('location: /404.php') );
}
$vars = array(
"ru"=>array(
"attachedPages"=>'Прикреплённые страницы',
"attachedFiles"=>'Прикреплённые файлы',
"attachedPhotos"=>'Прикреплённые фото'
),
"en"=>array(
"attachedPages"=>'Attached pages',
"attachedFiles"=>'Attached files',
"attachedPhotos"=>'Attached pictures'
),
"kz"=>array()
);
$api->header(array('page-title'=>$obj['Название']));
# ВЛОЖЕННОСТЬ
$mothers = array();
function getMothers($id)
{
global $api;
global $mothers;
if (is_numeric($id) && ($id != 0) && ($o = $api->objects->getObject($id, false)) && (($o['class_id'] == 1) || ($o['class_id'] == 3)))
{
$mothers[] = $o['id'];
getMothers($o['head']);
}
}
getMothers($obj['head']);
$mothers = array_reverse($mothers);
# ХЛЕБНЫЕ КРОШКИ
if (sizeof($mothers) > 0)
{
$out = array();
foreach($mothers as $obj_id)
{
if (is_numeric($obj_id) && ($path_obj = $api->objects->getFullObject($obj_id, false))) $out[] = ''.$path_obj['Название'].'';
}
//echo '
';
# ВЛОЖЕННЫЕ СТРАНИЦЫ
if($api->auth())
{
if($pages = $api->objects->getFullObjectsListByClass($obj['id'], 3))
{
//echo '
'.$vars[$api->lang]['attachedPages'].'
';
$out = array();
foreach($pages as $page)
{
$out[] = '
'.$page['Название'].'
';
}
echo '
';
}
}
if($api->auth())
{
if($pages = $api->objects->getFullObjectsListByClass($obj['id'], 12))
{
//echo '
'.$vars[$api->lang]['attachedPages'].'
';
$out = array();
foreach($pages as $page)
{
$out[] = '
'.$page['Название'].'
';
}
echo '
';
}
}
# ВЛОЖЕННЫЕ ФАЙЛЫ
$lang = $api->lang;
$api->lang='ru';
if($files = $api->objects->getFullObjectsListByClass($obj['id'], 5))
{
//echo '
'.$vars[$lang]['attachedFiles'].'
';
$out = array();
foreach($files as $file)
{
$ico = _WWW_.'/ext/file.gif';
$ext = $api->lower($api->getFileExtension($file['Ссылка']));
if (file_exists(_WWW_ABS_.'/ext/'.$ext.'.gif')) $ico = _WWW_.'/ext/'.$ext.'.gif';
$out[] = '
'.($file['Ссылка']?'
'.$file['Название'].'.'.$ext.'':$file['Название']).'
';
}
echo '
';
}
# ФОТОГАЛЛЕРЕЯ
if ($obj['id'] != 63){
$onepage = 12;
$pages = $api->pages($api->objects->getObjectsCount($obj['id'], 4), $onepage, 5, array(), "/".$api->lang."/pages/".$obj['id']."_#pg#.html#photos-list");
if($photos = $api->objects->getFullObjectsListByClass($obj['id'], 4, "AND o.active='1' ORDER BY o.sort LIMIT ".$pages['start'].", $onepage"))
{
//echo '
'.$vars[$lang]['attachedPhotos'].'
';
$n=0;
$out = array();
foreach($photos as $photo){
$n++;
if ($n == 1) { $out[] = '
'; }
$out[] = '
| ';
if ($n == 3) { $out[] = '
'; $n = 0; }
}
if ($out[sizeof($out)-1] != '') $out[] = '';
echo '
';
}
$api->lang = $lang;
echo '
'.$pages['html'].'
';
}
echo '
';
# НАЗАД
if (sizeof($mothers) > 0) echo '