/** * @desc */ private function prepareBlogSelect($blogIdCurrent = false, $force = false, $template = 'default') { if ($blogIdCurrent && !$force) { return; } static $bInited = false; static $sBlock, $sOption; static $aBlogList = array(); if (!$bInited) { list($sBlock, $sOption) = self::loadTemplates('blogs20/' . $template, 'blog_choose_block', 'blog_choose_line'); $sel = new umiSelection(); $hierarchy_type_id = umiHierarchyTypesCollection::getInstance()->getTypeByName("blogs20", "blog")->getId(); $sel->addElementType($hierarchy_type_id); $sel->addPermissions(); $sel->setPermissionsLevel(2); $result = umiSelectionsParser::runSelection($sel); $oHierarchy = umiHierarchy::getInstance(); foreach ($result as $blogId) { $aBlogList[$blogId] = $oHierarchy->getElement($blogId)->getValue('title'); } $bInited = true; } $aLines = array(); foreach ($aBlogList as $blogId => $blogTitle) { $aLines[] = self::parseTemplate($sOption, array('bid' => $blogId, 'title' => $blogTitle, 'selected' => $blogId == $blogIdCurrent ? 'selected' : '')); } return self::parseTemplate($sBlock, array('subnodes:options' => $aLines)); }