Ejemplo n.º 1
0
     $allow_user = isset($_POST['allow_user']) ? 1 : 0;
     $order_priority = isset($_POST['order_priority']) && !empty($_POST['order_priority']) ? intval($_POST['order_priority']) : 'null';
     if (empty($name)) {
         $tool_content .= "<div class='alert alert-danger'>" . $langEmptyNodeName . "<br>";
         $tool_content .= action_bar(array(array('title' => $langReturnToEditNode, 'url' => $_SERVER['SCRIPT_NAME'] . "?action=edit&amp;id={$id}", 'icon' => 'fa-reply', 'level' => 'primary-label')));
     } else {
         // OK Update the node
         validateParentLft(intval($_POST['nodelft']), isDepartmentAdmin());
         $tree->updateNode($id, $name, intval($_POST['nodelft']), intval($_POST['lft']), intval($_POST['rgt']), intval($_POST['parentLft']), $code, $allow_course, $allow_user, $order_priority);
         $tool_content .= "<div class='alert alert-success'>{$langEditNodeSuccess}</div><br />";
     }
 } else {
     // Get node information
     $id = intval($_GET['id']);
     $mynode = Database::get()->querySingle("SELECT name, lft, rgt, code, allow_course, allow_user, order_priority FROM hierarchy WHERE id = ?d", $id);
     $parentLft = $tree->getParent($mynode->lft, $mynode->rgt);
     $check_course = $mynode->allow_course == 1 ? " checked=1 " : '';
     $check_user = $mynode->allow_user == 1 ? " checked=1 " : '';
     // Display form for edit node information
     $tool_content .= "<div class='form-wrapper'>\n        <form role='form' class='form-horizontal' method='post' action='" . $_SERVER['SCRIPT_NAME'] . "?action=edit' onsubmit='return validateNodePickerForm();'>\n        <fieldset>\n        <div class='form-group'>\n            <label class='col-sm-3 control-label'>{$langNodeCode1}:</label>\n            <div class='col-sm-9'>\n                <input type='text' name='code' value='" . q($mynode->code) . "' />&nbsp;<i>" . $langCodeFaculte2 . "</i>\n            </div>\n        </div>";
     $is_serialized = false;
     $names = @unserialize($mynode->name);
     if ($names !== false) {
         $is_serialized = true;
     }
     $i = 0;
     foreach ($session->active_ui_languages as $key => $langcode) {
         $n = $is_serialized && isset($names[$langcode]) ? $names[$langcode] : '';
         if (!$is_serialized && $key == 0) {
             $n = $mynode->name;
         }