if (!empty($categoryId)) {
    $categoryInfo = getCategory($categoryId);
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
$errorMsg = '';
if (!empty($action)) {
    if ($action == 'delete') {
        if (api_get_multiple_access_url()) {
            if (api_get_current_access_url_id() == 1 || isset($_configuration['enable_multiple_url_support_for_course_category']) && $_configuration['enable_multiple_url_support_for_course_category']) {
                deleteNode($categoryId);
                Display::addFlash(Display::return_message(get_lang('Deleted')));
                header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
                exit;
            }
        } else {
            deleteNode($categoryId);
            Display::addFlash(Display::return_message(get_lang('Deleted')));
            header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
            exit;
        }
    } elseif (($action == 'add' || $action == 'edit') && isset($_POST['formSent']) && $_POST['formSent']) {
        if ($action == 'add') {
            $ret = addNode($_POST['code'], $_POST['name'], $_POST['auth_course_child'], $category);
            Display::addFlash(Display::return_message(get_lang('Created')));
        } else {
            $ret = editNode($_POST['code'], $_POST['name'], $_POST['auth_course_child'], $categoryId);
            Display::addFlash(Display::return_message(get_lang('Updated')));
        }
        if ($ret) {
            $action = '';
        } else {
if (isset($_SESSION['data'])) {
    $organik = $_SESSION['data'];
} else {
    $organik['funcion'] = "";
    $organik['titulo'] = "?";
    $organik['glosa'] = "";
    $organik['id'] = 1;
    $organik['hijos'] = array();
    $organik['url'] = "";
}
if (isset($_GET['n']) && isset($_GET['q'])) {
    if ($_GET['q'] == 'new') {
        $organik = addChild($organik, $_GET['n']);
    }
    if ($_GET['q'] == 'del') {
        $organik = deleteNode($organik, $_GET['n']);
    }
}
if (isset($_POST['funcion'])) {
    $info = array('funcion' => $_POST['funcion'], 'titulo' => $_POST['titulo'], 'glosa' => $_POST['glosa'], 'url' => $_POST['url']);
    $organik = updateInfo($organik, $_POST['id'], $info);
}
$_SESSION['data'] = $organik;
org_header("Editor de Estructuras Orgánicas");
?>

<form action="organica-d.php" method="post">
<input type="button" value="Volver"
onclick="location.href='organica2.php';" />
<input type="button" value="Generar"
onclick="location.href='organica-d.php';" />
Exemple #3
0
/**
 * Delete the Comment node with the given nodeid
 * and update the parent chat tree connection by removing the
 * @param nodeid the id of the node to delete.
 * @param parentconnid the connection id of the top chat tree item this comment belonged to.
 * (It has it's description updated to remove the child node id, without clocking the mod date.
 * @return Connection or Error
 */
function deleteComment($nodeid, $parentconnid = '')
{
    global $DB, $CFG, $HUB_SQL;
    $reply = deleteNode($nodeid);
    // if we know the parent connection,
    // update it's description with this new child node id
    // The parent connection modification date will be updated too
    // so it sorts to the top and it will know the id of the new child.
    if ($parentconnid != "") {
        // need to update this date even if the owner of the chat thread is someone else thatn the current user.
        // so overriding usual checks here.
        $conn = new Connection($parentconnid);
        $conn = $conn->load();
        if (!$conn instanceof Error) {
            $description = $conn->description;
            $pos = strpos($description, $nodeid);
            if ($pos === false) {
                // should never happen if all goes well
            } else {
                $description = str_replace($nodeid . ":", "", $description);
                $params = array();
                $params[0] = $description;
                $params[1] = $parentconnid;
                $sql = $HUB_SQL->APILIB_COMMENT_DELETE;
                $res = $DB->insert($sql, $params);
                if (!$res) {
                    return database_error();
                }
            }
        }
    }
    return $reply;
}
Exemple #4
0
    drawLines($storyID);
} else {
    if ($functionName == "drawNodes") {
        drawNodes($storyID);
    } else {
        if ($functionName == "reorderNodes") {
            reorderNodes($localhost, $user, $pw, $db, $storyID);
        } else {
            if ($functionName == "maxChildren") {
                maxChildren($storyID);
            } else {
                if ($functionName == "addNewNode") {
                    addNewNode($localhost, $user, $pw, $db, $storyID);
                } else {
                    if ($functionName == "deleteNode") {
                        deleteNode($localhost, $user, $pw, $db, $storyID);
                    } else {
                        if ($functionName == "isFirstNode") {
                            isFirstNode($storyID);
                        } else {
                            if ($functionName == "moveBranch") {
                                moveBranch($storyID);
                            } else {
                                if ($functionName == "reorderBranches") {
                                    reorderBranches($localhost, $user, $pw, $db, $storyID);
                                } else {
                                    if ($functionName == "addNodeAsChild") {
                                        addNodeAsChild($localhost, $user, $pw, $db, $storyID);
                                    } else {
                                        if ($functionName == "addBranchAsChild") {
                                            addBranchAsChild($localhost, $user, $pw, $db, $storyID);
Exemple #5
0
         $marc = $marcxml->saveXML();
         $myFile1 = base64_encode(trim($marc));
         $myFile2 = base64_encode(trim($dc));
         $agent->callModifyDatastreamByValue($val, $marcID, 'I', $marcLabel, $marc);
         $agent->callModifyDatastreamByValue($val, $dcID, 'A', $dcLabel, $dc);
     }
     $htmlFinal .= "<h1> Added </h1>Datafield '" . $datafieldtag . "'<h1>for Objects</h1>";
 } else {
     if ($_POST['function_type'] == "Delete") {
         // print_r($GLOBALS);
         $deleteDataField = $_POST['dataFieldtag'];
         foreach ($fields as $key => $val) {
             $xml_MARC = get_Datastream($val, $marcID);
             $xml_output_dc = get_Datastream($val, $dcID);
             $handle = retrieveHandle($xml_output_dc, $dictionary['HandleNamespace']);
             $marcxml = deleteNode($xml_MARC, $deleteDataField);
             $agent = new Agent();
             $dc_temp = $agent->transform2("./stylesheets/dc.xslt", $marcxml);
             //append identifiers information into DC i.e Handles (namespace:port and pid extracted from Val) and Pid = val
             $xmlDC = new simpleXMLElement($dc_temp);
             $namespace = $xmlDC->getNamespaces(true);
             $split = explode(":", $val);
             // $handle=$dictionary['HandleNamespace'].$split[1];
             $xmlDC->addChild('dc:identifier', $val, $namespace['dc']);
             $xmlDC->addChild('dc:identifier', $handle, $namespace['dc']);
             $dc = $xmlDC->saveXML();
             $marc = $marcxml->saveXML();
             $myFile1 = base64_encode(trim($marc));
             $myFile2 = base64_encode(trim($dc));
             $agent->callModifyDatastreamByValue($val, $marcID, 'I', $marcLabel, $marc);
             $agent->callModifyDatastreamByValue($val, $dcID, 'A', $dcLabel, $dc);
     $nodeid = required_param('nodeid', PARAM_TEXT);
     $enddatetime = optional_param('enddatetime', "", PARAM_TEXT);
     $response = updateNodeEndDate($nodeid, $enddatetime);
     break;
 case "updatenodelocation":
     $nodeid = required_param('nodeid', PARAM_ALPHANUMEXT);
     $location = optional_param('location', "", PARAM_TEXT);
     $loccountry = optional_param('loccountry', "", PARAM_TEXT);
     $address1 = optional_param('address1', "", PARAM_TEXT);
     $address2 = optional_param('address2', "", PARAM_TEXT);
     $postcode = optional_param('postcode', "", PARAM_TEXT);
     $response = updateNodeLocation($nodeid, $location, $loccountry, $address1, $address2, $postcode);
     break;
 case "deletenode":
     $nodeid = required_param('nodeid', PARAM_ALPHANUMEXT);
     $response = deleteNode($nodeid);
     break;
 case "getnodesbydate":
     $date = required_param('date', PARAM_INT);
     $response = getNodesByDate($date, $start, $max, $o, $s, $style, $status);
     break;
 case "getnodesbyname":
     $name = required_param('name', PARAM_TEXT);
     $response = getNodesByName($name, $start, $max, $o, $s, $style, $status);
     break;
 case "getnodesbytag":
     $tagid = required_param('tagid', PARAM_ALPHANUMEXT);
     $response = getNodesByTag($tagid, $start, $max, $o, $s, $style, $status);
     break;
 case "getnodesbyurl":
     $url = required_param('url', PARAM_URL);
        //get the element name attribute
        $rdaSubElementName = (string)$rdaSubElement['name'];
        $rdaSubMinOccurs   = (integer)$rdaSubElement['minOccurs'];

        $minSubChecked = (1 == $rdaSubMinOccurs) ? ' checked="checked"' : '';
        $optSubChecked = (1 != $rdaSubMinOccurs) ? ' checked="checked"' : '';

        $liName = $frbrElementName . "[" . $rdaElementName . "][" . $rdaSubElementName . "]";
        $docId = $frbrElementName . $rdaElementName . $rdaSubElementName;

        $rdaSubElementDoc = getDoc($rdaSubElement, 'xs:annotation/xs:documentation');

        //check to see if this node has been deleted
        if (count($rdaSelected) && !isset($rdaSelected[$frbrElementName][$rdaElementName][$rdaSubElementName]['include'])): //rdaSubElement node does not exist in POST
          //delete the node
          deleteNode($rdaSubElement);
        else: //rdaSubElement node exists in POST
          $rdaSubElement['minOccurs'] = (isset($rdaSelected[$frbrElementName][$rdaElementName][$rdaSubElementName]['min']) && "Mandatory" == $rdaSelected[$frbrElementName][$rdaElementName][$rdaSubElementName]['min']) ? "1" : "0";

          $rdaSubMinOccurs   = (integer)$rdaSubElement['minOccurs'];
          $rdaSubMaxOccurs   = (integer)$rdaSubElement['maxOccurs'];

          $minSubChecked = (1 == $rdaSubMinOccurs) ? ' checked="checked"' : '';
          $optSubChecked = (1 != $rdaSubMinOccurs) ? ' checked="checked"' : '';

        //display include checkbox -- the element name -- the mandatory (minOccurs > 1) checkbox
        //get/display the element documentation
  if ($displayOn):
?>
      <li>
        <input type="checkbox" name="<?php echo $liName ?>[include]" value="true" checked="checked" />
Exemple #8
0
     deleteSingPoint($coors, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "deleteCableLine") {
     deleteCableLine($CableLineId, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "addNode") {
     $NetworkBoxId = $obj->{'NetworkBoxId'};
     $apartment = NULL;
     $building = NULL;
     $note = $obj->{'note'};
     $name = $obj->{'name'};
     $place = $obj->{'place'};
     addNode($coors, $name, $NetworkBoxId, $note, NULL, $building, $apartment, $place, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "deleteNode") {
     deleteNode($coors, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "moveNode") {
     moveNode($coors, TRUE);
     setTmpMapLastEdit();
 } elseif ($_POST['mode'] == "divCableLine") {
     $nodeInfo['name'] = $obj->{'name'};
     $nodeInfo['NetworkBoxId'] = $obj->{'NetworkBoxId'};
     /*$nodeInfo[ 'apartment' ] = $obj->{'apartment'};
       $nodeInfo[ 'building' ] = $obj->{'building'};*/
     $nodeInfo['note'] = $obj->{'note'};
     $nodeInfo['place'] = $obj->{'place'};
     $ret = divCableLine($coors, $CableLineId, $nodeInfo, TRUE);
     if ($ret['error']) {
         print json_encode($ret);
     } else {
Exemple #9
0
for ($nodeIndex = 0; $nodeIndex < $nodeLenght; $nodeIndex++) {
    if ($nodeSearch->item($nodeIndex)->nodeValue == $id) {
        $nodeToBeRemove = $nodeSearch->item($nodeIndex);
    }
}
$whileLoopControler = 0;
//a loop controller to prevent below loop from overflowing
while ($nodeToBeRemove->nodeName != "contact") {
    $nodeToBeRemove = $nodeToBeRemove->parentNode;
    $whileLoopControler++;
    if ($whileLoopControler > 20) {
        break;
    }
}
//start of removale
print $nodeToBeRemove->getNodePath();
deleteNode($nodeToBeRemove);
function deleteNode($node)
{
    deleteChildren($node);
    $parent = $node->parentNode;
    $oldnode = $parent->removeChild($node);
}
function deleteChildren($node)
{
    while (isset($node->firstChild)) {
        deleteChildren($node->firstChild);
        $node->removeChild($node->firstChild);
    }
}
echo $xml->save("contactList.xml");
Exemple #10
0
 protected function setProperty($property, $value)
 {
     $dom = $this->getDom();
     $thisElement = $this->domElement;
     // Seek properties element
     $propertiesFound = false;
     $properties = $thisElement->firstChild;
     while ($properties != null) {
         if ($properties->tagName == "properties") {
             $propertiesFound = true;
             break;
         } else {
             $properties = $properties->nextSibling;
         }
     }
     if (!$propertiesFound) {
         $properties = $dom->createElement('properties');
         $thisElement->appendChild($properties);
     }
     // search property and update it
     $searchedProperty = getChildTagnamed($properties, $property);
     if ($searchedProperty != null) {
         deleteNode($searchedProperty);
     }
     $propertyTN = $dom->createTextNode($value);
     $propertyNode = $dom->createElement($property);
     $propertyNode->appendChild($propertyTN);
     $properties->appendChild($propertyNode);
 }
function deleteNode($org, $id)
{
    $new = array();
    $hijos = $org['hijos'];
    if ($hijos != array()) {
        foreach ($hijos as $X) {
            if ($X['id'] != $id) {
                $new[] = deleteNode($X, $id);
            }
        }
    }
    $org['hijos'] = $new;
    return $org;
}
Exemple #12
0
<?php

require_once 'config.php';
$link = mysql_pconnect($mysql_host, $mysql_user, $mysql_pasw);
mysql_select_db($mysql_db);
deleteNode($_POST["item_id"]);
mysql_close($link);
//insert item
function deleteNode($id)
{
    deleteBranch($id);
    deleteSingleNode($id);
    print "<script>top.doDeleteTreeItem('{$id}');</script>";
}
function deleteSingleNode($id)
{
    $d_sql = "Delete from tree where item_id=" . $id;
    $resDel = mysql_query($d_sql);
}
function deleteBranch($pid)
{
    $s_sql = "Select item_id from tree where item_parent_id={$pid}";
    $res = mysql_query($s_sql);
    if ($res) {
        while ($row = mysql_fetch_array($res)) {
            deleteBranch($row['item_id']);
            deleteSingleNode($row['item_id']);
        }
    }
}
$categoryCode = isset($_POST['categoryCode']) ? $_POST['categoryCode'] : null;
$categoryName = isset($_POST['categoryName']) ? $_POST['categoryName'] : null;
$formSent = isset($_POST['formSent']) ? $_POST['formSent'] : false;
$canHaveCourses = 0;
if (!empty($action)) {
    if ($action == 'delete') {
        if (api_get_multiple_access_url()) {
            if (api_get_current_access_url_id() == 1) {
                deleteNode($id);
                header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
                exit;
            } else {
                $delError = 1;
            }
        } else {
            deleteNode($_GET['id']);
            header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
            exit;
        }
    } elseif (($action == 'add' || $action == 'edit') && $_POST['formSent']) {
        $_POST['categoryCode'] = trim($_POST['categoryCode']);
        $_POST['categoryName'] = trim($_POST['categoryName']);
        if (!empty($_POST['categoryCode']) && !empty($_POST['categoryName'])) {
            if ($action == 'add') {
                $ret = addNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $category);
            } else {
                $ret = editNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $id);
            }
            if ($ret) {
                $action = '';
            } else {
Exemple #14
0
}
if ($par['p1'] == 'delete_link_in') {
    $db1 = $par['p2'];
    $object1 = $par['p3'];
    $db2 = $par['p4'];
    $object2 = $par['p5'];
    deleteNode($db1, $object1, $object2, 'type', 'linkIn');
    deleteNode($db2, $object2, $object1, 'type', 'linkOut');
}
if ($par['p1'] == 'delete_link_out') {
    $db1 = $par['p2'];
    $object1 = $par['p3'];
    $db2 = $par['p4'];
    $object2 = $par['p5'];
    deleteNode($db1, $object1, $object2, 'type', 'linkOut');
    deleteNode($db2, $object2, $object1, 'type', 'linkIn');
}
$temp = $_GET['a3_object_id'];
if ($temp) {
    $sel_object = $temp;
    $a3pr[$sys_id]['a3_object'] = $sel_object;
    $sel_name = getObjectName($sel_db, $sel_object);
    $a3pr[$sys_id]['a3_name'] = $sel_name;
    //     if($par['p1'] == 'delete' && $from && $from_father)
    //       {
    // 	deleteObject($sel_db,$from,$from_father);
    // 	$a3pr[$sys_id]['a3_index2']      = '';
    // 	$a3pr[$sys_id]['a3_from']        = '';
    // 	$a3pr[$sys_id]['a3_from_father'] = '';
    //         $a3pr[$sys_id]['a3_object']      = 1;
    //       }
Exemple #15
0
function deleteObject($db, $object_id, $father_id)
{
    deleteNode($db, $father_id, $object_id, 'type', 'node');
}
Exemple #16
0
//print $droit;
//die;
if (!$droit) {
    echo '{';
    echo '"ok" : false,';
    echo '"msg" : "' . $trad["Vous n\\'avez pas les droits pour effectuer cette action"] . '"';
    echo '}';
    die;
}
//on verifie que l'objet en cour de déplacement n'est pas supprimer
$sql = "select supprimer from " . __racinebd__ . "arbre where arbre_id=" . $dragID;
$link = query($sql);
$ligne = fetch($link);
if (isset($dropID) && $ligne["supprimer"] == 0) {
    if ($dropID == "_2") {
        $okDrop = deleteNode($dragID);
        $msg = 'Tout est ok';
        log_phantom($dragID, "Suppression du noeud");
    } else {
        if ($alias == 1) {
            $result = createAlias($dragID, $dropID);
            $okDrop = $result[0];
            $msg = $result[1];
            log_phantom($dragID, "Création d'un alias");
        } else {
            if ($hitMode == "before") {
                //print "ici jc";
                $okDrop = moveBeforeNode($dragID, $dropID);
                $msg = 'Tout est ok';
                log_phantom($dragID, "Déplacement du noeud");
            } else {