示例#1
0
             //print "No<br>\n";
         }
     } else {
         dol_syslog("Parent is root");
         $fk_parent = 0;
         // Parent is root
     }
     if ($fk_parent >= 0) {
         $ecmdirtmp->ref = 'NOTUSEDYET';
         $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
         $ecmdirtmp->description = '';
         $ecmdirtmp->fk_parent = $fk_parent;
         $txt = "We create directory " . $ecmdirtmp->label . " with parent " . $fk_parent;
         dol_syslog($txt);
         //print $ecmdirtmp->cachenbofdoc."<br>\n";exit;
         $id = $ecmdirtmp->create($user);
         if ($id > 0) {
             $newdirsql = array('id' => $id, 'id_mere' => $ecmdirtmp->fk_parent, 'label' => $ecmdirtmp->label, 'description' => $ecmdirtmp->description, 'fullrelativename' => $relativepathmissing);
             $sqltree[] = $newdirsql;
             // We complete fulltree for following loops
             //var_dump($sqltree);
             $adirwascreated = 1;
         } else {
             dol_syslog("Failed to create directory " . $ecmdirtmp->label, LOG_ERR);
         }
     } else {
         $txt = "Parent of " . $dirdesc['fullname'] . " not found";
         dol_syslog($txt);
         //print $txt."<br>\n";
     }
 }
    if (!empty($_POST["cancel"])) {
        header("Location: " . DOL_URL_ROOT . '/ecm/index.php?action=file_manager');
        exit;
    }
    $ecmdir->ref = trim($_POST["ref"]);
    $ecmdir->label = trim($_POST["label"]);
    $ecmdir->description = trim($_POST["desc"]);
    $ecmdir->fk_parent = $_POST["catParent"];
    $ok = true;
    if (!$ecmdir->label) {
        setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), 'errors');
        $action = 'create';
        $ok = false;
    }
    if ($ok) {
        $id = $ecmdir->create($user);
        if ($id > 0) {
            header("Location: " . DOL_URL_ROOT . '/ecm/index.php?action=file_manager');
            exit;
        } else {
            $langs->load("errors");
            setEventMessage($langs->trans($ecmdir->error), 'errors');
            setEventMessage($ecmdir->errors, 'errors');
            $action = 'create';
        }
    }
} else {
    if ($action == 'confirm_deletesection' && $confirm == 'yes') {
        $result = $ecmdir->delete($user);
        setEventMessage($langs->trans("ECMSectionWasRemoved", $ecmdir->label));
    }