function GetTree($key) { global $sqlcn; $sql = "SELECT * FROM cloud_dirs WHERE parent = {$key}"; $result = $sqlcn->ExecuteSQL($sql) or die('Не могу прочитать папку! ' . mysqli_error($sqlcn->idsqlconnection)); $cnt = mysqli_num_rows($result); if ($cnt != 0) { $pz = 0; while ($row = mysqli_fetch_array($result)) { $name = $row['name']; $key = $row['id']; echo '{"title":"' . $name . '","isFolder":true,"key":"' . $key . '","children":['; GetTree($key); echo ']}'; $pz++; if ($pz < $cnt) { echo ','; } } } }
function GetTree($key) { global $sqlcn; $sql = "select * from cloud_dirs where parent={$key}"; $result = $sqlcn->ExecuteSQL($sql) or die("Не могу прочитать папку!!" . mysqli_error($sqlcn->idsqlconnection)); $cnt = mysqli_num_rows($result); if ($cnt != 0) { $pz = 0; while ($row = mysqli_fetch_array($result)) { $name = $row["name"]; $key = $row["id"]; echo "{"; echo "\"title\": \"{$name}\",\"isFolder\": true,\"key\": \"{$key}\",\"children\": ["; GetTree($key); echo "]}"; $pz++; if ($pz < $cnt) { echo ","; } } } }
function GetPage($res = '', $number) { $c_date = date('Y-m-d H:i:s'); $num = 0; if ($res[phone] == "") { $num = $number; } else { $num = $res[phone]; } $increm = mysql_query("\tSELECT `name`,\n \t `rand_name`,\n \t `id`\n \t FROM \t`file`\n \t WHERE `incomming_call_id` = {$res['id']}\n \t "); $data .= ' <!-- jQuery Dialog --> <div id="add-edit-goods-form" title="საქონელი"> <!-- aJax --> </div> <div id="dialog-form"> <div style="float: left; width: 800px;"> <fieldset > <fieldset style="width:300px; float:left;"> <legend>ძირითადი ინფორმაცია</legend> <table width="500px" class="dialog-form-table"> <tr> <td style="width: 180px;"><label for="">მომართვა №</label></td> <td style="width: 180px;"><label for="">თარიღი</label></td> </tr> <tr> <td style="width: 180px;"> <input type="text" id="id" class="idle" onblur="this.className=\'idle\'" value="' . ($res['id'] != '' ? $res['id'] : increment('incomming_call')) . '" disabled="disabled" /> <input style="display:none;" type="text" id="h_id" class="idle" onblur="this.className=\'idle\'" value="' . $res['id'] . '" disabled="disabled" /> </td> <td style="width: 180px;"> <input type="text" id="c_date" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField date\'" value="' . ($res['call_date'] != '' ? $res['call_date'] : $c_date) . '" disabled="disabled" /> </td> </tr> <tr> <td style="width: 180px;"><label for="phone">ტელეფონი</label></td> <td><label for="person_name">აბონენტის სახელი</label></td> </tr> <tr> <td style="width: 180px;"> <input type="text" id="phone" class="idle" onblur="this.className=\'idle\'" value="' . $num . '" /> </td> <td style="width: 69px;"> <input type="text" id="person_name" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['first_name'] . '" /> </td> </tr> <tr> <td> </td> </tr> <tr> <td style="width: 69px;"> <button id="button_calls" class="calls">ნომრები</button> </td> </tr> </table> </fieldset> <fieldset style="width:220px; float:left; margin-left:10px; "> <legend>მომართვის ავტორი</legend> <table id="" class="dialog-form-table" width="220px"> <tr> <td style="width: 220px;"><input style="float:left;" type="radio" name="x" value="1" ' . ($res['type_id'] == '1' ? "checked" : "") . ' checked><span style="margin-top:5px; display:block;">ფიზიკური</span></td> <td style="width: 220px;"><input style="float:left;" type="radio" name="x" value="2" ' . ($res['type_id'] == '2' ? "checked" : "") . '><span style="margin-top:5px; display:block;"">იურიდიული</span></td> </tr> </table> </fieldset> <fieldset style="width:220px; float:left; margin-left:10px; "> <legend>ზარის ტიპი</legend> <table id="" class="dialog-form-table" width="220px"> <tr> <td style="width: 220px;"><input style="float:left;" type="radio" name="xx" value="1" ' . ($res['call_type_id'] == '1' ? "checked" : "") . ' checked><span style="margin-top:5px; display:block;">ინფორმაცია</span></td> <td style="width: 220px;"><input style="float:left;" type="radio" name="xx" value="2" ' . ($res['call_type_id'] == '2' ? "checked" : "") . ' ><span style="margin-top:5px; display:block;"">პრეტენზია</span></td> </tr> <tr> <td style="width: 220px;"><input style="float:left;" type="radio" name="xx" value="3" ' . ($res['call_type_id'] == '3' ? "checked" : "") . '><span style="margin-top:5px; display:block;"">სხვა</span></td> </tr> </table> </fieldset> <fieldset style="width:756px; float:left;"> <legend>ინფორმაცია</legend> <table id="" class="dialog-form-table" width="500px"> <tr> <td style="width: 600px;"> <label style="float:left; margin-top:7px; margin-right:5px;">სრულწლოვანი (18)</label> <input style="float:left;" type="radio" name="status_1" value="1" ' . ($res['status_1'] == '1' ? "checked" : "") . '><span style="margin-top:8px; display:block; float: left;"">კი</span> <input style="float:left;" type="radio" name="status_1" value="2" ' . ($res['status_1'] == '2' ? "checked" : "") . '><span style="margin-top:8px; display:block; float: left;"">არა</span> </td> <td style="width: 400px;"> <label style="float:left; margin-top:7px; margin-right:5px;">მწეველი</label> <input style="float:left;" type="radio" name="status_2" value="1" ' . ($res['status_2'] == '1' ? "checked" : "") . '><span style="margin-top:8px; display:block; float: left;"">კი</span> <input style="float:left;" type="radio" name="status_2" value="2" ' . ($res['status_2'] == '2' ? "checked" : "") . '><span style="margin-top:8px; display:block; float: left;"">არა</span> </td> </tr> </table> </fieldset> <fieldset style="width: 400px; float:left;"> <legend>ზარის დაზუსტება</legend> <table id="" class="dialog-form-table" width="150px"> <tr> <td><textarea style="width: 400px; height: 50px;" id="call_comment" class="idle" name="call_comment" cols="300" >' . $res['call_comment'] . '</textarea></td> </tr> </table> </fieldset> <fieldset style="width: 317px; margin-left:10px; height:55px; float:left;"> <legend>მომართვის შინაარსი</legend> <table id="" class="dialog-form-table" width="150px"> <tr> <td><select style="width: 310px; margin-left:5px;" id="call_status_id" class="idls object">' . Getcall_status($res['call_status_id']) . '</select></td> </tr> </table> </fieldset>'; $data .= ' <fieldset style="margin-top: 5px;"> <legend>დავალების ფორმირება</legend> <table class="dialog-form-table" style="width: 750px;"> <tr> <td style="width: 180px;"><label for="task_type_id">დავალების ტიპი</label></td> <td style="width: 180px;"><label for="task_department_id">განყოფილება</label></td> <td style="width: 180px;"><label for="persons_id">პასუხისმგებელი პირი</label></td> <td style="width: 180px;"><label for="priority_id">პრიორიტეტი</label></td> </tr> <tr> <td><select style="width: 180px;" id="task_type_id" class="idls object">' . Gettask_type($res['task_type_id']) . '</select></td> <td><select style="width: 180px;" id="task_department_id" class="idls object">' . Getdepartment($res['task_department_id']) . '</select></td> <td><select style="width: 180px;" id="persons_id" class="idls object">' . Getpersons($res['persons_id']) . '</select></td> <td><select style="width: 180px;" id="priority_id" class="idls object">' . Getpriority($res['priority_id']) . '</select></td> </tr> </table> <table class="dialog-form-table" style="width: 750px;"> <tr> <td style="width: 150px;"><label>შესრულების პერიოდი</label></td> <td style="width: 150px;"><label></label></td> <td style="width: 150px;"><label>კომენტარი</label></td> </tr> <tr> <td><input id="done_start_time" style="width: 150px; float:left;" class="idle" type="text" value="' . $res['done_start_time'] . '"><span style="margin-left:5px; ">დან</span></td> <td><input id="done_end_time" style="width: 150px; float:left;" class="idle" type="text" value="' . $res['done_end_time'] . '"><span style="margin-left:5px; ">მდე</span></td> <td> <textarea style="width: 300px; resize: none;" id="comment" class="idle" name="content" cols="300" >' . $res['comment'] . '</textarea> </td> </tr> </table> </fieldset> </div> <div> </fieldset> </div> <div style="float: right; width: 355px;"> <fieldset style="width: 334px; float:left;"> <legend>ტაგები</legend> <div id="tree"> ' . GetTree() . ' </div> </fieldset> <fieldset style="margin-top: 10px; width: 150px; margin-left:10px; float: right;"> <legend>ფაილი</legend> <table style="float: right; border: 1px solid #85b1de; width: 150px; text-align: center;"> <tr> <td> <div class="file-uploader"> <input id="choose_file" type="file" name="choose_file" class="input" style="display: none;"> <button id="choose_button" class="center">აირჩიეთ ფაილი</button> <input id="hidden_inc" type="text" value="' . increment('action') . '" style="display: none;"> </div> </td> </tr> </table> <table style="float: right; border: 1px solid #85b1de; width: 150px; text-align: center;"> <tr style="border-bottom: 1px solid #85b1de;"> <td colspan="3">მიმაგრებული ფაილი</td> </tr> </table> <table id="file_div" style="float: right; border: 1px solid #85b1de; width: 150px; text-align: center;">'; while ($increm_row = mysql_fetch_assoc($increm)) { $data .= ' <tr style="border-bottom: 1px solid #85b1de;"> <td style="width:110px; display:block;word-wrap:break-word;">' . $increm_row[name] . '</td> <td ><button type="button" value="media/uploads/file/' . $increm_row[rand_name] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none;background-image:url(\'media/images/get.png\');" id="download" ></button><input type="text" style="display:none;" id="download_name" value="' . $increm_row[rand_name] . '"> </td> <td ><button type="button" value="' . $increm_row[id] . '" style="cursor:pointer; border:none; margin-top:25%; display:block; height:16px; width:16px; background:none; background-image:url(\'media/images/x.png\');" id="delete"></button></td> </tr>'; } $data .= ' </table> </fieldset> '; if (!empty($res[phone])) { $data .= GetRecordingsSection($res); } $data .= ' <button type="button" class="save-dialog" id="save-dialog" style="margin-top:10px;">შენახვა</button> </div> </div> </div>'; return $data; }
} if (!function_exists('CreateMapStructure')) { function CreateMapStructure($arMap) { $arReturn = array(); foreach ($arMap as $key => $arMapItem) { $arChildrenItems = $arMapItem["CHILDREN"]; unset($arMapItem["CHILDREN"]); $arMapItem["STRUCT_KEY"] = $key; $arReturn[] = $arMapItem; if (is_array($arChildrenItems) && count($arChildrenItems) > 0) { $arChildren = CreateMapStructure($arChildrenItems); $arReturn = array_merge($arReturn, $arChildren); } } return $arReturn; } } $additionalCacheID = $USER->GetGroups(); if ($this->StartResultCache(false, $additionalCacheID)) { $sl = CLang::GetList($dummy1 = "", $dummy2 = ""); while ($slr = $sl->Fetch()) { if ($slr["LID"] == LANG) { $lang_dir = $slr["DIR"]; break; } } $arResult["arMapStruct"] = GetTree($_SERVER["DOCUMENT_ROOT"] . $lang_dir, $arParams["LEVEL"], $arParams["SHOW_DESCRIPTION"] == "Y"); $arResult["arMap"] = CreateMapStructure($arResult["arMapStruct"]); $this->IncludeComponentTemplate(); }
if ($cat_name != '' && $cat_id == '') { if (!CheckCategoryExist($cat_name, $par_id)) { AddCategory($cat_name, $par_id, $hint); } else { $error = '"' . $cat_name . '" უკვე არის სიაში!'; } } else { SaveCategory($cat_id, $cat_name, $par_id, $hint); } break; case 'disable': $cat_id = $_REQUEST['id']; DisableCategory($cat_id); break; case 'get_tree': $page = GetTree(); $data = array('page' => $page); break; default: $error = 'Action is Null'; } $data['error'] = $error; echo json_encode($data); /* ****************************** * Category Functions * ****************************** */ function AddCategory($cat_name, $par_id, $hint) { $user_id = $_SESSION['USERID']; mysql_query("INSERT INTO `tage`\r\n\t\t\t\t\t(`user_id`,`name`, `parent_id`, `hint`) \r\n\t\t\t\t VALUES\r\n\t\t\t\t\t('{$user_id}','{$cat_name}', {$par_id}, '{$hint}')");
function GetTree($tree_Res, $flag = '') { global $DBConn; if ($tree_Row = mysqli_fetch_assoc($tree_Res)) { do { if (empty($_REQUEST['RID']) || ($tree_Row['Release_ID'] == $_REQUEST['RID'] || Num_Children($tree_Row['AID']) != 0)) { echo '<li id="' . $tree_Row['AID'] . '" data-nodndflag="' . $flag . '" data-iteration="' . Get_Iteration_Name($tree_Row['Iteration_ID'], False) . '" data-iid="' . $tree_Row['Iteration_ID'] . '" data-pid="' . $tree_Row['Project_ID'] . '" >'; echo '<div class="treebox">'; PrintStory($tree_Row); echo '</div>'; // if i have children, then go and fetch them $sql = 'SELECT * FROM story WHERE story.Parent_Story_ID=' . $tree_Row['AID'] . ' order by story.Epic_Rank'; $Child_Res = mysqli_query($DBConn, $sql); if ($Child_Res) { echo '<ul>'; GetTree($Child_Res, $flag); echo '</ul>'; } echo '</li>'; } } while ($tree_Row = mysqli_fetch_assoc($tree_Res)); } }