if ($cat['is_public']) { $showfor = cmsCore::request('showfor', 'array_int', array()); if ($showfor) { $model->setCategoryAccess($cat_id, $showfor); } } else { $model->clearCategoryAccess($cat_id); } cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success'); cmsCore::redirect('?view=components&do=config&id='.$id.'&opt=list_cats'); } if ($opt == 'delete_cat') { $model->deleteCategory(cmsCore::request('item_id', 'int', 0)); cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success'); cmsCore::redirect('?view=components&do=config&id='. $id .'&opt=list_cats'); } if ($opt == 'list_cats') { echo '<h3>'. $_LANG['AD_CATALOG_RUBRICS'] .'</h3>'; $fields = array( array( 'title' => 'id', 'field' => 'id', 'width' => '40' ), array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=components&do=config&id='. $id .'&opt=edit_cat&item_id=%id%' ), array( 'title' => $_LANG['AD_PARENT'], 'field' => 'parent_id', 'width' => '200', 'prc' => 'cpCatalogCatById' ), array( 'title' => $_LANG['AD_IS_PUBLISHED'], 'field' => 'published', 'width' => '100', 'do' => 'opt', 'do_suffix' => '_cat' ) ); $actions = array(
} $cat['id'] = $model->addCategory($cat); if ($cat['is_public']) { $showfor = $_REQUEST['showfor']; if (sizeof($showfor) > 0) { $model->setCategoryAccess($cat['id'], $showfor); } } $inCore->redirect('?view=components&do=config&id=' . $_REQUEST['id'] . '&opt=list_cats'); } //=================================================================================================// //=================================================================================================// if ($opt == 'delete_cat') { if ($inCore->inRequest('item_id')) { $id = $inCore->request('item_id', 'int'); $model->deleteCategory($id); } $inCore->redirect('?view=components&do=config&id=' . $_REQUEST['id'] . '&opt=list_cats'); } //=================================================================================================// //=================================================================================================// if ($opt == 'update_cat') { if ($inCore->inRequest('item_id')) { $id = $inCore->request('item_id', 'int'); $cat['parent_id'] = $inCore->request('parent_id', 'int'); $cat['title'] = $inCore->request('title', 'str'); $cat['description'] = $inCore->request('description', 'html'); $cat['description'] = $inDB->escape_string($cat['description']); $cat['published'] = $inCore->request('published', 'int'); $cat['view_type'] = $inCore->request('view_type', 'str'); $cat['fields_show'] = $inCore->request('fieldsshow', 'int');