• Модуль: learning
  • Путь к файлу: ~/bitrix/modules/learning/classes/general/export.php
  • Класс: CCoursePackage
  • Вызов: CCoursePackage::__construct
public function __construct($COURSE_ID)
{
	global $DB;
	$this->ID = intval($COURSE_ID);

	//Course exists?
	$res = CCourse::GetByID($this->ID);
	if (!$this->arCourse = $res->Fetch())
	{
		$this->LAST_ERROR = GetMessage("LEARNING_BAD_COURSE_ID_EX");
		return false;
	}

	$res = CCourse::GetSite($this->ID);
	if ($arSite = $res->GetNext())
	{
		$charset = $arSite["CHARSET"];
	}
	else
	{
		$this->LAST_ERROR = GetMessage("LEARNING_BAD_SITE_ID_EX");
		return false;
	}

	//Define charset
	if ($charset == '')
	{
		if (defined("SITE_CHARSET") && SITE_CHARSET <> '')
			$charset = SITE_CHARSET;
		else
			$charset = "windows-1251";
	}
	$this->charset = $charset;

	//Get chapters, lessons, questions
	$this->_GetCourseContent($this->arCourse['LESSON_ID']);

	//Get tests
	$strSql =
		"SELECT T.*, ".
		$DB->DateToCharFunction("T.TIMESTAMP_X")." as TIMESTAMP_X ".
		"FROM b_learn_test T ".
		"WHERE T.COURSE_ID = ".intval($this->ID)." ".
		"ORDER BY SORT ASC ";

	$res = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__); while ($arRes= $res->Fetch()) { $r = ++$this->RefID; $this->arItems[$r] = $this->_CreateContent("TES", $arRes, $r); $this->strItems .= ''.htmlspecialcharsbx($arRes["NAME"]).''; $marksRes = $DB->Query( "SELECT * FROM b_learn_test_mark WHERE TEST_ID = '" . (string) ((int) $arRes['ID']) . "'", false, "File: ".__FILE__."
Line: ".__LINE__ ); while ($arMarksRes= $marksRes->Fetch()) { $r = ++$this->RefID; $this->arItems[$r] = $this->CreateTMK($arMarksRes, $r); $this->strItems .= '' . '' . htmlspecialcharsbx($arMarksRes['MARK'] . ' (' . $arMarksRes['DESCRIPTION'] . ')') . '' . ''; } $this->strItems .= '
'; $this->strResourses .= ''.$this->_GetResourceFiles($r).''; } }