22 const OPTION_ID =
'~CLearnHelper::isUpdatedToGraph();';
35 static $arCourseLinksPatterns =
array(
39 $argsCheck = is_string($strContent)
40 && ($contextCourseId !==
false)
41 && ($contextCourseId > 0);
46 $arCourseResolvedLinks = str_replace(
48 (
string) ((
int) $contextCourseId),
49 $arCourseLinksPatterns
53 $arCourseLinksPatterns,
54 $arCourseResolvedLinks,
65 public static function FireEvent ($eventName, $eventParams)
68 while ($arEvent = $events->Fetch())
111 is_numeric($parentLessonId)
112 && is_int($parentLessonId + 0)
117 '$parentLessonId must be strictly castable to integer',
124 $arChildLessonsIds = $oTree->GetLessonsIdListInTree();
127 $arChildLessonsIdsEscaped = array_map(
'intval', $arChildLessonsIds);
129 $sqlChildLessonsIdsList = implode (
', ', $arChildLessonsIdsEscaped);
132 if ($sqlChildLessonsIdsList ==
'')
133 $sqlChildLessonsIdsList =
'NULL';
135 return ($sqlChildLessonsIdsList);
145 if(mb_substr(
$key, 0, 1) ==
"=")
148 $cOperationType =
"I";
153 $cOperationType =
"NI";
158 $cOperationType =
"S";
163 $cOperationType =
"NS";
168 $cOperationType =
"?";
173 $cOperationType =
"B";
178 $cOperationType =
"NB";
183 $cOperationType =
"GE";
188 $cOperationType =
"G";
193 $cOperationType =
"LE";
198 $cOperationType =
"L";
203 $cOperationType =
"N";
206 $cOperationType =
"E";
208 return Array(
"FIELD"=>
$key,
"OPERATION"=>$cOperationType);
214 public static function FilterCreate($fname, $vals,
$type, &$bFullJoin, $cOperationType=
false, $bSkipEmpty =
true)
223 if(is_bool($cOperationType))
225 if($cOperationType===
true)
226 $cOperationType =
"N";
228 $cOperationType =
"E";
231 if($cOperationType==
"G")
233 elseif($cOperationType==
"GE")
234 $strOperation =
">=";
235 elseif($cOperationType==
"LE")
236 $strOperation =
"<=";
237 elseif($cOperationType==
"L")
243 $bWasLeftJoin =
false;
250 if(!$bSkipEmpty || (
string)
$val <> '' || (is_bool(
$val) &&
$val===
false))
255 if((
string)
$val ==
'')
257 ($cOperationType==
"N"?
"NOT":
"").
259 $fname.
" IS NULL OR ".
$DB->Length($fname).
264 ($cOperationType==
"N"?
" ".$fname.
" IS NULL OR NOT (":
"").
266 ($cOperationType==
"N"?
")":
"").
270 if($cOperationType==
"?")
277 $res[] = ($cOperationType==
"N"?
"NOT":
"").
"(".$fname.
" IS NULL OR ".
$DB->Length($fname).
"<=0)";
281 if($strOperation==
"=")
284 ($cOperationType==
"N"?
" ".$fname.
" IS NULL OR NOT (":
"").
286 ($cOperationType==
"N"?
")":
"").
291 ($cOperationType==
"N"?
" ".$fname.
" IS NULL OR NOT (":
"").
294 ($cOperationType==
"N"?
")":
"").
299 if((
string)
$val ==
'')
300 $res[] = ($cOperationType==
"N"?
"NOT":
"").
"(".$fname.
" IS NULL)";
304 ($cOperationType==
"N"?
" ".$fname.
" IS NULL OR NOT (":
"").
305 $fname.
" ".$strOperation.
" ".
$DB->CharToDateFunction(
$DB->ForSql(
$val),
"FULL").
306 ($cOperationType==
"N"?
")":
"").
310 if((
string)
$val ==
'')
311 $res[] = ($cOperationType==
"N"?
"NOT":
"").
"(".$fname.
" IS NULL)";
315 ($cOperationType==
"N"?
" ".$fname.
" IS NULL OR NOT (":
"").
316 $fname.
" ".$strOperation.
" '".DoubleVal(
$val).
317 ($cOperationType==
"N"?
"')":
"'").
331 if((
string)
$val <> '' && $cOperationType!=
"N")
334 $bWasLeftJoin =
true;
342 $strResult .= ($cOperationType==
"N"?
" AND ":
" OR ");
347 $strResult =
"(".$strResult.
")";
350 if($bFullJoin && $bWasLeftJoin && $cOperationType!=
"N")
362 if (self::getUpdatedToGraphStatus() === self::GRAPH_STATUS_UPDATED_TO_GRAPH)
379 $isSaved = COption::SetOptionString(self::MODULE_ID, self::OPTION_ID,
394 $rc = COption::GetOptionString(self::MODULE_ID, self::OPTION_ID, self::DEFAULT_VALUE, self::SITE_ID);
397 if ($rc === self::DEFAULT_VALUE)
403 $allowed_statuses =
array (
404 self::GRAPH_STATUS_LEGACY,
405 self::GRAPH_STATUS_UPDATED_TO_GRAPH,
406 self::GRAPH_STATUS_UNDEFINED
409 if ( ! in_array($rc, $allowed_statuses,
true) )
411 AddMessage2Log(
'Invalid COption ~CLearnHelper::isUpdatedToGraph();: `'
412 . $rc .
'`;',
'learning');
414 $rc = self::GRAPH_STATUS_UNDEFINED;
426 || ( ! (preg_match(
"#^[^\\\/:*?\"\'~%<>|]+$#is",
$filename) > 0) );
428 return ( ! $isUnSafe );
432 public static function CopyDirFiles($path_from, $path_to, $ReWrite = True, $Recursive = False)
434 if (mb_strpos($path_to.
"/", $path_from.
"/") === 0 || realpath($path_to) === realpath($path_from))
437 if (is_dir($path_from))
441 elseif(is_file($path_from))
444 $path_to_dir = mb_substr($path_to, 0,
$p);
447 if (file_exists($path_to) && !$ReWrite)
450 @copy($path_from, $path_to);
451 if(is_file($path_to))
452 @chmod($path_to, BX_FILE_PERMISSIONS);
461 if (
$handle = @opendir($path_from))
463 while (($file = readdir(
$handle)) !==
false)
465 if ($file ==
"." || $file ==
"..")
472 if (is_dir($path_from.
"/".$file) && $Recursive)
476 elseif (is_file($path_from.
"/".$file))
478 if (file_exists($path_to.
"/".$file) && !$ReWrite)
481 @copy($path_from.
"/".$file, $path_to.
"/".$file);
482 @chmod($path_to.
"/".$file, BX_FILE_PERMISSIONS);
static isUpdatedToGraph()
const GRAPH_STATUS_UPDATED_TO_GRAPH
static PatchLessonContentLinks($strContent, $contextCourseId=false)
static CopyDirFiles($path_from, $path_to, $ReWrite=True, $Recursive=False)
static FilterCreate($fname, $vals, $type, &$bFullJoin, $cOperationType=false, $bSkipEmpty=true)
static IsBaseFilenameSafe($filename)
const GRAPH_STATUS_NOT_SET
const GRAPH_STATUS_UNDEFINED
static SQLClauseForAllSubLessons($parentLessonId)
static MkOperationFilter($key)
static getUpdatedToGraphStatus()
const GRAPH_STATUS_LEGACY
static FireEvent($eventName, $eventParams)
static setUpdatedToGraphStatus($status)
static GetTree( $lessonId, $arOrder=array('EDGE_SORT'=> 'asc'), $arFilter=array(), $publishProhibitionMode=true, $arSelectFields=array())
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(Loader::includeModule( 'bitrix24')) elseif(Loader::includeModule('intranet') &&CIntranetUtils::getPortalZone() !=='ru') $description
ExecuteModuleEventEx($arEvent, $arParams=[])
AddMessage2Log($text, $module='', $traceDepth=6, $showArgs=false)
bxstrrpos($haystack, $needle)
HasScriptExtension($check_name)
GetModuleEvents($MODULE_ID, $MESSAGE_ID, $bReturnArray=false)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"