public function doShow() { $area_name = 'blockset_' . $this->input['infoblock_id']; $blocks = fx::page()->getAreaInfoblocks($area_name); if ($this->getParam('is_fake')) { foreach (range(1, 3) as $n) { $blocks[] = $this->getFakeIb(); } } else { if ($this->getParam('add_new_infoblock')) { $blocks[] = $this->getFakeIb(); } } $res = parent::doShow(); $res += array('items' => $blocks, 'area' => $area_name); if (count($blocks) == 0 && !fx::isAdmin()) { $this->_meta['disabled'] = true; } return $res; }
public function process() { $res = parent::process(); $is_new = $this->isNewBlock(); $this->assign('is_overriden', $this->getParam('is_overriden')); if (isset($res['areas'])) { foreach ($res['areas'] as $i => &$area) { if (!isset($area['id'])) { $area['id'] = 'grid_' . (isset($area['keyword']) ? $area['keyword'] : $i) . '_' . $this->getParam('infoblock_id'); } $area['blocks'] = !$is_new ? fx::page()->getAreaInfoblocks($area['id']) : array(); if (!$area['name']) { $area['name'] = fx::alang('Column %s', null, $i + 1); } if (fx::isAdmin()) { if ($is_new || $this->getParam('is_overriden') && count($area['blocks']) === 0) { $area['placeholder'] = fx::alang('%s is empty, you can add blocks here', null, $area['name']); } } } } return $res; }