public function CheckFields(&$arFields, $ID = false) { global $DB, $USER; $arMsg = array(); if ((is_set($arFields, "NAME") || $ID === false) && strlen(trim($arFields["NAME"])) <= 0) { $arMsg[] = array("id" => "NAME", "text" => GetMessage("LEARNING_BAD_NAME")); } if (is_set($arFields, "FILE_ID")) { $error = CFile::CheckImageFile($arFields["FILE_ID"]); if (strlen($error) > 0) { $arMsg[] = array("id" => "FILE_ID", "text" => $error); } } if (strlen($this->LAST_ERROR) <= 0) { if ($ID === false && !is_set($arFields, "LESSON_ID") || is_set($arFields, "LESSON_ID") && intval($arFields["LESSON_ID"]) < 1) { $arMsg[] = array("id" => "LESSON_ID", "text" => GetMessage("LEARNING_BAD_LESSON_ID")); } elseif (is_set($arFields, "LESSON_ID")) { $res = CLearnLesson::GetByID($arFields["LESSON_ID"]); if ($arRes = $res->Fetch()) { $oAccess = CLearnAccess::GetInstance($USER->GetID()); $bAccessLessonModify = $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_WRITE) || $oAccess->IsLessonAccessible($arFields["LESSON_ID"], CLearnAccess::OP_LESSON_WRITE); if (!$bAccessLessonModify) { $arMsg[] = array("id" => "LESSON_ID", "text" => GetMessage("LEARNING_BAD_LESSON_ID_EX")); } } else { $arMsg[] = array("id" => "LESSON_ID", "text" => GetMessage("LEARNING_BAD_LESSON_ID_EX")); } } } if (!empty($arMsg)) { $e = new CAdminException($arMsg); $GLOBALS["APPLICATION"]->ThrowException($e); return false; } if (is_set($arFields, "QUESTION_TYPE") && !in_array($arFields["QUESTION_TYPE"], array("S", "M", "T", "R"))) { $arFields["QUESTION_TYPE"] = "S"; } if (is_set($arFields, "DESCRIPTION_TYPE") && $arFields["DESCRIPTION_TYPE"] != "html") { $arFields["DESCRIPTION_TYPE"] = "text"; } if (is_set($arFields, "DIRECTION") && $arFields["DIRECTION"] != "H") { $arFields["DIRECTION"] = "V"; } if (is_set($arFields, "SELF") && $arFields["SELF"] != "Y") { $arFields["SELF"] = "N"; } if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") { $arFields["ACTIVE"] = "N"; } if (is_set($arFields, "EMAIL_ANSWER") && $arFields["EMAIL_ANSWER"] != "Y") { $arFields["EMAIL_ANSWER"] = "N"; } if (is_set($arFields, "CORRECT_REQUIRED") && $arFields["CORRECT_REQUIRED"] != "Y") { $arFields["CORRECT_REQUIRED"] = "N"; } return true; }
echo $str_QUESTION_TYPE; ?> "> </td> </tr> <?php $tabControl->EndCustomField("QUESTION_TYPE"); $tabControl->BeginCustomField("LESSON_ID", GetMessage("LEARNING_LESSON"), false); ?> <tr class="adm-detail-required-field"> <td><?php echo $tabControl->GetCustomLabelHTML(); ?> :</td> <td><?php $rsLesson = CLearnLesson::GetByID($LESSON_ID); $arLesson = $rsLesson->GetNext(); $curDir = $APPLICATION->GetCurDir(); if (substr($curDir, -1) !== '/') { $curDir .= '/'; } ?> <script> function module_learning_js_admin_function_change_attached_lesson(lesson_id, name) { BX('attached_lesson_id').value = lesson_id; BX('attached_lesson_name').innerHTML = name; } </script> <div style="padding:0px;"> <span id="attached_lesson_name"><?php
} ?> </td> </tr> <?php if ($bContentReadOnly) { $tabControl->EndCustomField('EDGE_SORT'); } else { $tabControl->EndCustomField('EDGE_SORT', '<input type="hidden" id="EDGE_SORT" name="EDGE_SORT" value="' . $str_EDGE_SORT . '">'); } } unset($resParentLessonData, $arParentLessonData); } // PUBLISH_PROHIBITED - Only in context of most top course if ($topCourseLessonId !== false) { $resRootLessonData = CLearnLesson::GetByID($topCourseLessonId); $arRootLessonData = $resRootLessonData->Fetch(); if (is_array($arRootLessonData)) { $tabControl->BeginCustomField('PUBLISH_PROHIBITED', GetMessage('LEARNING_COURSE_ADM_PUBLISH_PROHIBITED'), false); ?> <!-- PUBLISH_PROHIBITED --> <tr> <td><?php echo $tabControl->GetCustomLabelHTML(); ?> :</td> <td> <label> <?php if ($bContentReadOnly) { echo $str_PUBLISH_PROHIBITED;
public function GetPathAsHumanReadableString($delimiter = ' / ', $pattern = '#NAME#') { $arHumanReadablePath = array(); foreach ($this->arPath as $lessonId) { $rc = CLearnLesson::GetByID($lessonId); $rc = $rc->Fetch(); $id = '???'; $name = '???'; if (isset($rc['LESSON_ID'])) { $id = $rc['LESSON_ID']; } if (isset($rc['NAME'])) { $name = htmlspecialcharsbx($rc['NAME']); } $txt = $pattern; $txt = str_replace('#LESSON_ID#', $id, $txt); $txt = str_replace('#NAME#', $name, $txt); $arHumanReadablePath[] = $txt; } return implode($delimiter, $arHumanReadablePath); }
?> "> </td> </tr> <?php $tabControl->EndCustomField("CODE"); $tabControl->BeginCustomField("COURSE_LESSON_ID", GetMessage("LEARNING_ADMIN_ATTACHED_COURSE"), $required = true); ?> <tr class="adm-detail-required-field"> <td><?php echo $tabControl->GetCustomLabelHTML(); ?> :</td> <td><?php if ($str_COURSE_LESSON_ID) { $rsLesson = CLearnLesson::GetByID($str_COURSE_LESSON_ID); $arLesson = $rsLesson->Fetch(); $curDir = $APPLICATION->GetCurDir(); if (substr($curDir, -1) !== '/') { $curDir .= '/'; } } ?> <script> function module_learning_js_admin_function_change_attached_lesson(lesson_id, name) { BX('attached_lesson_id').value = lesson_id; BX('attached_lesson_name').innerHTML = name; } </script> <div style="padding:0px;">
$rsQuestion = CLQuestion::GetByID($arTestResult["QUESTION_ID"]); if ($arQuestion = $rsQuestion->GetNext()) { // Resolve links "?COURSE_ID={SELF}". Don't relay on it, this behaviour // can be changed in future without any notifications. if (isset($arQuestion['DESCRIPTION'])) { $arQuestion['DESCRIPTION'] = CLearnHelper::PatchLessonContentLinks($arQuestion['DESCRIPTION'], $arParams['COURSE_ID']); } if ($arQuestion["QUESTION_TYPE"] != "T") { if ($arTest["SHOW_ERRORS"] == "Y" && $result["CORRECT"] == "N" && $result["ANSWERED"] == "Y" && $arQuestion["INCORRECT_MESSAGE"]) { $sessIncorrectMessage = $arQuestion; if ($arTest["NEXT_QUESTION_ON_ERROR"] == "N" && $arTest["PASSAGE_TYPE"] == 2) { $arResult["REDIRECT_PAGE"] = str_replace("#PAGE_ID#", array_key_exists($arParams["PAGE_NUMBER_VARIABLE"], $_REQUEST) ? $arResult["NAV"]["PAGE_NUMBER"] - 1 : 1, $arResult["PAGE_TEMPLATE"]); } } } elseif ($arQuestion["EMAIL_ANSWER"] == "Y") { $rsLesson = CLearnLesson::GetByID($arQuestion['LESSON_ID']); if ($arLesson = $rsLesson->GetNext()) { $rsTeacher = CUser::GetByID($arLesson["CREATED_BY"]); if ($arTeacher = $rsTeacher->GetNext()) { $courseName = ""; $rsCourse = CCourse::GetByID($arTest["COURSE_ID"]); if ($arCourse = $rsCourse->GetNext()) { $courseName = $arCourse["NAME"]; } $arEventFields = array("ID" => $testResultID, "ATTEMPT_ID" => $sessAttemptID, "TEST_NAME" => $arTest["NAME"], "COURSE_NAME" => $courseName, "USER" => "(" . $USER->GetLogin() . ")" . (strlen($USER->GetFullName()) > 0 ? " " . $USER->GetFullName() : ""), "DATE" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), time()), "QUESTION_TEXT" => $arQuestion["NAME"], "ANSWER_TEXT" => $_REQUEST["answer"], "EMAIL_FROM" => COption::GetOptionString("main", "email_from", "*****@*****.**"), "EMAIL_TO" => $arTeacher["EMAIL"], "MESSAGE_TITLE" => GetMessage("LEARNING_NEW_TEXT_ANSWER")); $arrSITE = LANG; CEvent::Send("NEW_LEARNING_TEXT_ANSWER", $arrSITE, $arEventFields, "N"); } } } }