Ejemplo n.º 1
0
            break;
        case $emanager->action->UPD:
            $item = json_decode($emanager->getItem());
            $item->keywords = explode(',', $item->keywords);
            for ($i = 0; $i < count($item->keywords); ++$i) {
                $item->keywords[$i] = rtrim(ltrim($item->keywords[$i]));
                if (strlen($item->keywords[$i]) < 4 || empty($item->keywords[$i])) {
                    array_splice($item->keywords, $i, 1);
                    $i = 0;
                }
            }
            $BILL->UpdateUrlCategoryKeywords($item->cid, $item->keywords);
            $BILL->UpdateUrlCategory($item->cid, array('title' => $item->title, 'title_ru' => $item->title_ru));
            break;
        case $emanager->action->DEL:
            $item = json_decode($emanager->getItem());
            if ($item->cid > 0) {
                $BILL->DeleteUrlCategory($item->cid);
            }
            break;
    }
    $emanager->eraseAction();
}
/**
 * Retrieve categories from the database
 */
$cats = $BILL->GetUrlCategories($cats_grid_pager->get_curpage(), $cats_grid_pager->get_pagesize(), $cats_grid->get_sorting(), $cats_grid->get_sort_direction(), $cats_grid->get_filterfield(), $cats_grid->get_filtering());
foreach ($cats as $cat) {
    $cat['keywords'] = implode(", ", $BILL->GetUrlCategoryKeywords($cat['cid']));
    $cats_ds->add_row(array($cat['cid'], $cat['title'], $cat['title_ru'], $cat));
}