function updateComponent($component_id) { return true; // Обновить шаблоны $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2TPLS, 'tpl_id', array('tpl_id')); foreach ($aList as $k => $v) { cTasks::mAddTask('updateTpl', $k); } // Обновить модули $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2MODULES, 'module_id', array('module_id')); foreach ($aList as $k => $v) { cTasks::mAddTask('updateModule', $k); } // Обновить таблицы $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2TABLES, 'table_id', array('table_id')); foreach ($aList as $k => $v) { cTasks::mAddTask('updateTable', $k); } // Обновить страницы $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2PAGES, 'page_id', array('page_id')); foreach ($aList as $k => $v) { cTasks::mAddTask('updatePage', $k); } return true; }
function getTpls_Component($component_id) { if (!is_numeric($component_id)) { return; } $aAllTpls = tblGetAll(DB_TBL_TPLS); $aLinkedTpls = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2TPLS, 'tpl_id', array('tpl_id')); //dbg($aLinkedTpls); foreach ($aLinkedTpls as $k => $v) { $aAllTpls[$v['tpl_id']]['checked'] = 1; } //dbg($aAllTpls); $aClientTpls = array(); $aAdminTpls = array(); $aOtherTpls = array(); $aReturn = array(); foreach ($aAllTpls as $k => $v) { if (!isset($v['checked'])) { $v['checked'] = 0; } unset($v['file_id']); unset($v['file_id']); if ($v['type'] == 'client') { $aClientTpls[] = $v; } elseif ($v['type'] == 'admin') { $aAdminTpls[] = $v; } else { $aOtherTpls[] = $v; } } $aReturn = array($aClientTpls, $aAdminTpls, $aOtherTpls); return $aReturn; }