function getLOItemIndex($item_id) { global $connect; $rt = ""; $query = "select parent_id from ".db_table_name("cdio3_learningoutcomes")." where id='".db_quote($item_id)."' and status=1"; $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); if ($result->RecordCount() > 0) { $r = $result->FetchRow(); if ($r['parent_id'] != "-1") { $rt .= getLOItemIndex($r['parent_id']).$item_id; } else { $rt .= $item_id; } } return $rt; }
function genNewLOItemForm($root_id) { $tree = get_lo_subtree($root_id); $html = ''; $html .= "<form method=POST action=\"popup.php?action=new_lo_item&saved=true\" />"; $html .= "<input type='hidden' name='root_id' value='$root_id' />"; $html .= "Parent item: <select name='slParent'><option value='$root_id'>Root</option>".genLOItemSelectOption($tree)."</select><br />"; $html .= "Order: ".getLOItemIndex($root_id).".<input type='text' name='txtOrder' /><br />"; $html .= "Name: <input type='text' name='txtName' /><br />"; $html .= "Description: <br /> <textarea name='txtDesc' ></textarea><br />"; $html .= "<input type='submit' value='Add' />"; $html .= "<input type='button' value='Close' onclick=\"window.close(); return false;\" />"; return $html; }