10 if (mb_substr($curDir, -1) !==
'/')
15 function module_learning_js_admin_function_add_parent(lesson_id, name)
17 module_learning_js_admin_function_add_child_or_parent(
'LEARNING_LIST_OF_PARENTS',
'RELATION_PARENT[]', lesson_id, name);
20 function module_learning_js_admin_function_add_child(lesson_id, name)
22 module_learning_js_admin_function_add_child_or_parent(
'LEARNING_LIST_OF_DESCENDANTS',
'RELATION_CHILD[]', lesson_id, name);
25 function module_learning_js_admin_function_add_child_or_parent(targetNode, fieldName, lesson_id, name)
27 var elemId =
'RELATION_PARENT_LID_' + lesson_id;
29 var oDIV = BX.create(
'DIV', {
'props': {
'id': elemId}});
35 'className':
'access-delete',
46 document.getElementById(elemId).parentNode.removeChild(document.getElementById(elemId));
51 var oINPUT = BX.create(
62 var oSPAN = BX.create(
65 'text':
'[' + lesson_id +
'] ' + name
68 var oSPAN_space = BX.create(
76 oDIV.appendChild(oSPAN_space);
77 oDIV.appendChild(oINPUT);
78 oDIV.appendChild(oSPAN);
79 BX(targetNode).appendChild(oDIV);
87 $isChapter = $isCourse =
false;
89 while ($arChild = $resChilds->Fetch())
92 $arChilds[
'RELATION_CHILD_' .
$key++] =
array(
93 'elemName' =>
'RELATION_CHILD[]',
94 'lessonId' => $arChild[
'LESSON_ID'],
95 'Name' =>
'[<a href="' .
htmlspecialcharsbx($curDir) .
'learn_unilesson_edit.php?lang=' . LANG
96 .
'&LESSON_ID=' . ($arChild[
'LESSON_ID'] + 0) .
'&LESSON_PATH=' . (
int) $arChild[
'LESSON_ID'] .
'" target=_blank>'
97 . (
int) $arChild[
'LESSON_ID']
107 <div
style=
"padding:10px;">
108 <div
id=
"LEARNING_LIST_OF_PARENTS" style=
"padding:10px 0;">
109 <h3><?php echo
GetMessage(
'LEARNING_LIST_OF_PARENTS') .
':'; ?></h3>
111 $arParents =
array();
113 while ($arParent = $resParents->Fetch())
115 $arParents[
'RELATION_PARENT_' .
$key++] =
array(
116 'elemName' =>
'RELATION_PARENT[]',
117 'lessonId' => $arParent[
'LESSON_ID'],
118 'Name' =>
'[<a href="' .
htmlspecialcharsbx($curDir) .
'learn_unilesson_edit.php?lang=' . LANG
119 .
'&LESSON_ID=' . ($arParent[
'LESSON_ID'] + 0) .
'&LESSON_PATH=' . (
int) $arParent[
'LESSON_ID'] .
'" target=_blank>'
120 . (
int) $arParent[
'LESSON_ID'] .
'</a>] '
125 foreach ($arParents as $elemId => $arElem)
128 <div
id=
"<?php echo $elemId; ?>">
144 onclick=
"document.getElementById('<?php echo $elemId; ?>').parentNode.removeChild(document.getElementById('<?php echo $elemId; ?>'))"
145 class=
"access-delete"
146 style=
"position:relative; top:3px; margin-right:1px;"
151 <input type=
"hidden" name=
"<?php echo ($arElem['elemName']); ?>" value=
"<?php echo (int) $arElem['lessonId']; ?>">
152 <span
style=
"font-style:italic;"><?php echo ($arElem[
'Name']); ?></span>
165 <div
style=
"padding:0px;">
166 <a href=
"javascript:void(0);" class=
"bx-action-href"
167 onclick=
"window.open('<?php echo addslashes(htmlspecialcharsbx($curDir)); ?>learn_unilesson_admin.php?lang=<?php echo LANGUAGE_ID;
168 ?>&search_retpoint=module_learning_js_admin_function_add_parent&search_mode_type=parents_candidates',
169 'module_learning_js_admin_window_select_lessons_for_relations',
170 'scrollbars=yes,resizable=yes,width=960,height=500,top='+Math.floor((screen.height - 560)/2-14)+',left='+Math.floor((screen.width - 960)/2-5));"
171 ><?php echo
GetMessage(
'LEARNING_ADD_ELEMENT'); ?></a>
177 <div
id=
"LEARNING_LIST_OF_DESCENDANTS" style=
"padding:10px 0;">
178 <h3><?php echo
GetMessage(
'LEARNING_LIST_OF_DESCENDANTS') .
':'; ?></h3>
180 foreach ($arChilds as $elemId => $arElem)
183 <div
id=
"<?php echo $elemId; ?>">
198 <a href=
"javascript:void(0);"
199 onclick=
"document.getElementById('<?php echo $elemId; ?>').parentNode.removeChild(document.getElementById('<?php echo $elemId; ?>'))"
200 class=
"access-delete"></a>
204 <input type=
"hidden" name=
"<?php echo ($arElem['elemName']); ?>" value=
"<?php echo (int) $arElem['lessonId']; ?>">
205 <span
style=
"font-style:italic;"><?php echo ($arElem[
'Name']); ?></span>
217 <div
style=
"padding:0px;">
218 <a href=
"javascript:void(0);" class=
"bx-action-href"
219 onclick=
"window.open('<?php echo addslashes(htmlspecialcharsbx($curDir)); ?>learn_unilesson_admin.php?lang=<?php echo LANGUAGE_ID;
220 ?>&search_retpoint=module_learning_js_admin_function_add_child',
221 'module_learning_js_admin_window_select_lessons_for_relations',
222 'scrollbars=yes,resizable=yes,width=960,height=500,top='+Math.floor((screen.height - 560)/2-14)+',left='+Math.floor((screen.width - 960)/2-5));"
223 ><?php echo
GetMessage(
'LEARNING_ADD_ELEMENT'); ?></a>
230 <div
id=
"LEARNING_LIST_OF_ALL_PARENT_PATHES" style=
"padding:10px 0;">
233 $cntParentPathes =
count($arOPathes);
235 $langPhraseBase =
'LEARNING_LIST_OF_ALL_PARENT_PATHES_FOR_';
237 $lessonType =
'LESSON';
239 $lessonType =
'COURSE';
241 $lessonType =
'CHAPTER';
244 if ($cntParentPathes === 0)
245 $isEmpty =
'_IS_EMPTY';
247 echo
'<h3>' .
GetMessage($langPhraseBase . $lessonType . $isEmpty) .
'</h3>';
249 if ($cntParentPathes > 0)
252 .
'&LESSON_ID=#LESSON_ID#&LESSON_PATH=#LESSON_ID#" target="_blank">#LESSON_ID#</a>] #NAME#';
254 foreach ($arOPathes as $oPath)
256 echo $oPath->GetPathAsHumanReadableString(
' / ',
$pattern);
258 if ($oPath->Count() >= 1)
261 echo
' <span style="color:grey;">(' .
GetMessage(
'LEARNING_LESSON_IS_PUBLISH_PROHIBITED') .
')</span>';
276 $isAccessUseCache =
true;
288 $arCurParentsIds =
array();
290 while ($arParent = $resParents->Fetch())
291 $arCurParentsIds[] = (int) $arParent[
'LESSON_ID'];
293 $arDestParentsIds =
array();
295 if (isset($_POST[
'RELATION_PARENT']) && is_array($_POST[
'RELATION_PARENT']))
296 foreach ($_POST[
'RELATION_PARENT'] as
$key => $relatedLessonId)
297 $arDestParentsIds[] = (int) $relatedLessonId;
304 $arRemoveIds = array_diff ($arCurParentsIds, $arDestParentsIds);
305 foreach ($arRemoveIds as $relatedLessonId)
321 $arAddIds = array_diff ($arDestParentsIds, $arCurParentsIds);
322 foreach ($arAddIds as $relatedLessonId)
341 $arCurChildsIds =
array();
343 while ($arChild = $resChilds->Fetch())
344 $arCurChildsIds[] = (int) $arChild[
'LESSON_ID'];
346 $arDestChildsIds =
array();
348 if (isset($_POST[
'RELATION_CHILD']) && is_array($_POST[
'RELATION_CHILD']))
349 foreach ($_POST[
'RELATION_CHILD'] as
$key => $relatedLessonId)
350 $arDestChildsIds[] = (int) $relatedLessonId;
357 $arRemoveIds = array_diff ($arCurChildsIds, $arDestChildsIds);
358 foreach ($arRemoveIds as $relatedLessonId)
374 $arAddIds = array_diff ($arDestChildsIds, $arCurChildsIds);
375 foreach ($arAddIds as $relatedLessonId)