$course_instance_family = $courseInstanceObj->template_family; // no need to connect to DB ... // $cistatus = $dh->course_instance_status_get($sess_id_course_instance); $cistatus = $courseInstanceObj->status; if ($cistatus == ADA_COURSEINSTANCE_STATUS_PUBLIC and ($id_profile == AMA_TYPE_STUDENT or $id_profile == AMA_TYPE_GUEST)) { $user_status = ADA_STATUS_VISITOR; } } } //} } if (in_array('node', $thisUserNeededObjAr)) { /** * get Node Object */ $nodeObj = read_node_from_DB($id_node); if (ADA_Error::isError($nodeObj)) { $nodeObj->handleError(); } $node_family = $nodeObj->template_family; $node_author_id = $nodeObj->author; $node_type = $nodeObj->type; } // FIXME: verificare bene questa parte $reg_enabled = false; // links to bookmarks disabled $log_enabled = false; // links to history disabled $mod_enabled = false; // links to modify nodes disabled $com_enabled = false;
$nodePath = $nodeObj->findPathFN(); /* * determina l'id del nodo da inserire */ // $last_node = get_max_idFN($id_course); // $tempAr = explode ("_", $last_node); // $new_id =$tempAr[1] + 1; $new_node = $id_course . "_" . '999999999'; // $new_id; $node_to_edit = array('id' => $new_node, 'parent_id' => $id_parent, 'id_node_author' => $sess_id_user, 'level' => $nodeObj->level, 'order' => $nodeObj->order, 'version' => 0, 'creation_date' => $ymdhms, 'icon' => Utilities::getIconForNodeType($node_type), 'type' => $node_type, 'position' => '100,100,200,200', 'name' => $node_name, 'title' => $nodeObj->title, 'bg_color' => '#FFFFFF', 'color' => '', 'correctness' => '', 'copyright' => ''); $head_form = NodeEditingViewer::getHeadForm($sess_id_user, $user_level, $user_type, $nodeObj, $new_node, $node_type); } else { if (isset($id_course)) { $node_type = ADA_LEAF_TYPE; $default_parent_node = $id_course . "_" . ADA_DEFAULT_NODE; $nodeObj =& read_node_from_DB($default_parent_node); // gestione errore !!! /* * determina l'id del nodo da inserire */ // $last_node = get_max_idFN($id_course); // $tempAr = explode ("_", $last_node); // $new_id =$tempAr[1] + 1; $new_node = $id_course . "_" . '999999999'; // $new_id; $node_to_edit = array('id' => $new_node, 'parent_id' => $default_parent_node, 'id_node_author' => $sess_id_user, 'level' => $nodeObj->level, 'order' => $nodeObj->order, 'version' => 0, 'creation_date' => $ymdhms, 'icon' => Utilities::getIconForNodeType($node_type), 'type' => $node_type, 'position' => '100,100,200,200', 'name' => '', 'title' => $nodeObj->title, 'bg_color' => '#FFFFFF', 'color' => '', 'correctness' => '', 'copyright' => ''); $head_form = NodeEditingViewer::getHeadForm($sess_id_user, $user_level, $user_type, $nodeObj, $new_node, $node_type); } else { if (!isset($id_course) && !isset($id_parent) && !isset($type)) { // qui il codice necessario a generare la pagina di aggiunta per il nodo // quando non vengono passati parametri
function getNodeData($id_node) { $nodeObj = read_node_from_DB($id_node); if (AMA_DataHandler::isError($nodeObj)) { return $nodeObj; } $node_data = array('id' => $id_node, 'name' => $nodeObj->name, 'title' => $nodeObj->title, 'text' => $nodeObj->text, 'type' => $nodeObj->type, 'level' => $nodeObj->level, 'parent_id' => $nodeObj->parent_id, 'position' => $nodeObj->position, 'order' => $nodeObj->ordine, 'version' => $nodeObj->version, 'color' => $nodeObj->color, 'bgcolor' => $nodeObj->bgcolor, 'correctness' => $nodeObj->correctness, 'copyright' => $nodeObj->copyright, 'n_contacts' => $nodeObj->contacts, 'icon' => $nodeObj->icon, 'id_node_author' => $nodeObj->author['id'], 'creation_date' => $nodeObj->creation_date, 'id_instance' => $nodeObj->instance); if ($nodeObj->type == ADA_LEAF_WORD_TYPE or $nodeObj->type == ADA_GROUP_WORD_TYPE) { $node_data['hyphenation'] = $nodeObj->hyphenation; $node_data['grammar'] = $nodeObj->grammar; $node_data['semantic'] = $nodeObj->semantic; $node_data['notes'] = $nodeObj->notes; $node_data['examples'] = $nodeObj->examples; $node_data['ex_language'] = $nodeObj->language; } return $node_data; }
if (isset($tutor['username'])) { $tutor_uname = $tutor['username']; } } } } } } if (in_array('node', $thisUserNeededObjAr)) { /** * get Node Object */ /** * @var Object */ $nodeObj = read_node_from_DB(isset($id_node) ? $id_node : null); // mydebug(__LINE__,__FILE__,$nodeObj); if (ADA_Error::isError($nodeObj)) { $nodeObj->handleError(); } } $reg_enabled = true; // links to bookmarks enabled $log_enabled = true; // links to history enabled $mod_enabled = true; // links to modify nodes enabled $com_enabled = true; // links to comunicate among users enabled if ($id_profile == AMA_TYPE_STUDENT && ($user_status == ADA_STATUS_VISITOR || $user_status == ADA_STATUS_TERMINATED || $user_status == ADA_STATUS_COMPLETED)) { $reg_enabled = false;
$node_path = $nodeObj->findPathFN('map'); // THE MAP //$data = "<div><b>MAPPA DEL GRUPPO {$nodeObj->name}</b></div>\n\n"; $data = '<div><b>' . translateFN('MAPPA DEL GRUPPO') . " {$nodeObj->name}.</b></div>\n\n"; $data .= "<div id=\"map_content\" style=\"position:relative;top:0px;left:0px;\">\n"; $nodeList = $nodeObj->graph_indexFN(); $otherPos = array(0, 0, 0, 0); $tipo_mappa = returnMapType(); if (!AMA_DB::isError($nodeList) && is_array($nodeList) && count($nodeList) > 0) { // AND HIS CHILDS foreach ($nodeList as $key) { if ($nodeObj->level <= $userObj->livello) { // print_r($key); $nodePostId = 'input_' . $key['id_child']; // node id for javascript $childNodeObj = read_node_from_DB($key['id_child']); if ($childNodeObj instanceof Node) { // saving new positions if (isset($_POST[$nodePostId])) { $nodeArray = $childNodeObj->object2arrayFN(); $nodeArray['position'] = $_POST[$nodePostId]; // it is a string as requested by NodeEditing::saveNode() $nodeArray['icon'] = $key['icon_child']; // it does not function: NodeEditing::saveNode(), lines 210-214 // $res = NodeEditing::saveNode($nodeArray); $res = NodeEditing::saveNodePosition($nodeArray); if ($res == true) { // read from here new Position $p = split(",", $_POST[$nodePostId]); $width = $p[2] - $p[0]; if ($width < 0) {
$message = urlencode(translateFN("Nota pubblicata nel forum")); header("Location: " . $http_root_dir . "/browsing/view.php?cachemode=updatecache&id_node={$id_node}&msg={$message}"); exit; break; case ADA_NOTE_TYPE: // forum notes to nodes $id_toc = $sess_id_course . "_" . $courseObj->id_nodo_toc; $parent_node_id = $node_ha['parent_id']; $parent_node_type = $node_ha['type']; if ($parent_node_type == ADA_NOTE_TYPE or $parent_node_type == ADA_PRIVATE_NOTE_TYPE) { // cannot attach a noDe to a noTe ! $pathAr = $nodeObj->findLogicalPathFN(); while ($parent_node_type == ADA_NOTE_TYPE && $id_toc != $parent_node_id) { $path_element = array_shift($pathAr); $parent_node_id = $path_element[0]; $nodeObjTmp = read_node_from_DB($parent_node_id); $parent_node_type = $nodeObjTmp->type; } } if ($id_toc == $parent_node_id) { $message = urlencode(translateFN("Non è possibile pubblicare questa nota.")); // header("Location: " . $http_root_dir . "/browsing/view.php?id_node=$id_node&msg=$message"); } $node_ha['parent_id'] = $parent_node_id; $node_ha['type'] = ADA_LEAF_TYPE; $node_ha['id_instance'] = ""; $res = $dh->_edit_node($node_ha); //$GLOBALS['debug']=1; mydebug(__LINE__,__FILE__,$res); $GLOBALS['debug']=0; if (!AMA_datahandler::isError($res)) { $message = urlencode(translateFN("Nota pubblicata nel corso")); header("Location: " . $http_root_dir . "/browsing/view.php?cachemode=updatecache&id_node={$id_node}&msg={$message}");