require_once dirname(__FILE__) . '/CADBiS/recognize.php';
        foreach ($url_cats as $url) {
            $catname = Recognizer::recognizeByUrlCheck($url['url']);
            if (!empty($catname)) {
                $BILL->UpdateUrlCategoryMatchByName($url['url'], $catname);
            }
        }
    }
    switch ($emanager->getAction()) {
        case $emanager->action->UPD:
            $item = json_decode($emanager->getItem());
            $BILL->UpdateUrlCategoryMatch($item->u2cid, $item->url, $item->cid);
            break;
        case $emanager->action->DEL:
            $item = json_decode($emanager->getItem());
            $BILL->DeleteUrlCategoryMatch($item->u2cid);
            break;
        case $emanager->action->ADD:
            $item = json_decode($emanager->getItem());
            $BILL->AddUrlCategoryMatch($item->url, $item->cid);
            break;
    }
    $emanager->eraseAction();
}
/**
 * Retrieve urls matchescategories from the database
 */
$url_cats = $BILL->GetUrlCategoriesMatch($url_cats_unmatched_grid_pager->get_curpage(), 10, $url_cats_unmatched_grid->get_sorting(), $url_cats_unmatched_grid->get_sort_direction(), array(0), array(), $url_cats_unmatched_grid->get_filterfield(), $url_cats_unmatched_grid->get_filtering());
foreach ($url_cats as $cat) {
    $url_cats_unmatched_ds->add_row(array($cat['u2cid'], $cat['url'], $cat['cid'], $cat));
}