static function refreshCategoryParentId(&$categories)
 {
     global $database;
     foreach ($categories as $category) {
         if ($category->parent_id == 0 && $category->old_parent_id != 0) {
             foreach ($categories as $category2) {
                 if ($category2->old_id == $category->old_parent_id) {
                     $category->parent_id = $category2->id;
                     $row = new mainBooklibraryCategories($database);
                     // for 1.6
                     $row->load($category->id);
                     $row->parent_id = $category->parent_id;
                     if (!$row->check()) {
                         echo "error in import4 !";
                         exit;
                         exit;
                     }
                     if (!($mess = $row->store())) {
                         // echo "err-mess_".$mess."_";
                         echo "error in import5 !: " . $mess;
                         exit;
                     }
                     $row->updateOrder("section='com_booklibrary' AND parent_id='{$row->parent_id}'");
                     //for 1.6
                     break;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
/**
 * changes the access level of a record
 *
 * @param integer $ The increment to reorder by
 */
function accessCategory($uid, $access)
{
    global $database;
    $row = new mainBooklibraryCategories($database);
    //for 1.6
    $row->load($uid);
    $row->access = $access;
    if (!$row->check()) {
        return $row->getError();
    }
    if (!$row->store()) {
        return $row->getError();
    }
    mosRedirect('index.php?option=com_booklibrary&extension=categories');
}