本文整理汇总了PHP中CCourse::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCourse::GetList方法的具体用法?PHP CCourse::GetList怎么用?PHP CCourse::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCourse
的用法示例。
在下文中一共展示了CCourse::GetList方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
function CheckFields(&$arFields, $ID = false)
{
global $DB, $APPLICATION;
if ($ID === false && !is_set($arFields, "STUDENT_ID")) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID"), "EMPTY_STUDENT_ID");
return false;
} elseif (is_set($arFields, "STUDENT_ID")) {
$dbResult = CUser::GetByID($arFields["STUDENT_ID"]);
if (!$dbResult->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_USER_ID_EX"), "ERROR_NO_STUDENT_ID");
return false;
}
}
if ($ID === false && !is_set($arFields, "COURSE_ID")) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_COURSE_ID"), "ERROR_EMPTY_COURSE_ID");
return false;
} elseif (is_set($arFields, "COURSE_ID")) {
if ($bCheckRights) {
$r = CCourse::GetByID($arFields["COURSE_ID"]);
} else {
$r = CCourse::GetList(array(), array("ID" => $arFields["COURSE_ID"], 'CHECK_PERMISSIONS' => 'N'));
}
if (!$r->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_COURSE_ID_EX"), "ERROR_NO_COURSE_ID");
return false;
}
}
if (is_set($arFields, "STUDENT_ID") && is_set($arFields, "COURSE_ID")) {
$res = CCertification::GetList(array(), array("STUDENT_ID" => $arFields["STUDENT_ID"], "COURSE_ID" => $arFields["COURSE_ID"]));
if ($res->Fetch()) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_CERTIFICATE_DUPLICATE"), "ERROR_CERTIFICATE_DUPLICATE");
return false;
}
}
if (is_set($arFields, "DATE_CREATE") && !$DB->IsDate($arFields["DATE_CREATE"], false, LANG, "FULL")) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_DATE_CREATE"), "EMPTY_DATE_CREATE");
return false;
}
if (is_set($arFields, "PUBLIC_PROFILE") && $arFields["PUBLIC"] != "N") {
$arFields["PUBLIC_PROFILE"] = "Y";
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "N") {
$arFields["ACTIVE"] = "Y";
}
if (is_set($arFields, "FROM_ONLINE") && $arFields["FROM_ONLINE"] != "N") {
$arFields["FROM_ONLINE"] = "Y";
}
return true;
}
示例2: serialize
if ($arParams['CHAPTER_ID'] > 0) {
$arRatingData = CRatings::GetRatingVoteResult('LEARN_LESSON', $arParams['CHAPTER_ID']);
$ratingTransistor = serialize($arRatingData);
}
$lastDirtyCacheTS = COption::GetOptionString('learning', CLearnCacheOfLessonTreeComponent::OPTION_TS, time());
// was: if($this->StartResultCache(false, $USER->GetGroups()))
$additionalCacheID = CLearnAccess::GetAccessSymbolsHashForSiteUser() . '|' . $ratingTransistor . '|' . $lastDirtyCacheTS;
if ($this->StartResultCache(false, $additionalCacheID)) {
//Module
if (!CModule::IncludeModule("learning")) {
$this->AbortResultCache();
ShowError(GetMessage("LEARNING_MODULE_NOT_FOUND"));
return;
}
//Course
$rsCourse = CCourse::GetList(array(), array("ID" => $arParams["COURSE_ID"], "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "SITE_ID" => LANG, "CHECK_PERMISSIONS" => 'N'));
if (!($arCourse = $rsCourse->GetNext())) {
$this->AbortResultCache();
ShowError(GetMessage("LEARNING_COURSE_DENIED"));
return;
}
// Resolve links "?COURSE_ID={SELF}". Don't relay on it, this behaviour
// can be changed in future without any notifications.
if (isset($arCourse['DETAIL_TEXT'])) {
$arCourse['DETAIL_TEXT'] = CLearnHelper::PatchLessonContentLinks($arCourse['DETAIL_TEXT'], $arCourse['ID']);
}
if (isset($arCourse['PREVIEW_TEXT'])) {
$arCourse['PREVIEW_TEXT'] = CLearnHelper::PatchLessonContentLinks($arCourse['PREVIEW_TEXT'], $arCourse['ID']);
}
$rsChapter = false;
//Chapter
示例3: __IncludeLang
}
if (!CModule::IncludeModule('learning')) {
return;
}
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
$dbResult = CCourse::GetList(array(), array("CODE" => "BX-ADM001"));
$pathToService = str_replace("\\", "/", dirname(__FILE__));
if (!($arCourse = $dbResult->Fetch())) {
$pathToCourse = $serviceRelativePath . "/" . LANGUAGE_ID . "/course/";
$package = new CCourseImport($pathToCourse, array("s1"));
if (strlen($package->LAST_ERROR) > 0) {
return;
}
$success = $package->ImportPackage();
if ($success) {
$dbResult = CCourse::GetList(array(), array("CODE" => "BX-ADM001"));
$arCourse = $dbResult->Fetch();
}
}
if (isset($arCourse["ID"])) {
CCourse::SetPermission($arCourse["ID"], array("2" => "R"));
}
//Public files
CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/public", $_SERVER["DOCUMENT_ROOT"] . "/communication/learning", $rewrite = false, $recursive = true);
//Left menu
DemoSiteUtil::AddMenuItem("/communication/.left.menu.php", array(GetMessage("SERVICE_LEARNING"), "/communication/learning/", array(), array(), ""));
//Template
CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/template", $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/learning", $rewrite = true, $recursive = true);
$obSite = CSite::GetByID("s1");
if (!($arSite = $obSite->Fetch())) {
return;
示例4: GetMessage
" size="47"></td>
</tr>
<tr>
<td><?php
echo GetMessage("LEARNING_ADMIN_COURSE_ID");
?>
:</td>
<td>
<select name="filter_course_id">
<option value=""><?php
echo GetMessage("LEARNING_ALL");
?>
</option>
<?php
$l = CCourse::GetList(array(), array());
while ($l->ExtractFields("l_")) {
?>
<option value="<?php
echo $l_ID;
?>
"<?php
if ($filter_course_id == $l_ID) {
echo " selected";
}
?>
><?php
echo $l_NAME;
?>
</option><?php
}
示例5: OnSearchReindex
public static function OnSearchReindex($NS = array(), $oCallback = null, $callback_method = '')
{
global $DB;
static $arCourseToSiteCache = array();
$arResult = array();
$arAllSitesPathes = array();
$elementStartId = 0;
$indexElementType = 'C';
// start reindex from courses
$by = $order = '';
$sites = CLang::GetList($by, $order, array('TYPE' => 'C'));
while ($site = $sites->Fetch()) {
$arAllSitesPathes[$site['LID']] = array('C' => CCourse::GetSitePathes($site['LID'], 'C'), 'H' => CCourse::GetSitePathes($site['LID'], 'H'), 'L' => CCourse::GetSitePathes($site['LID'], 'L'));
}
$arCoursesFilter = array();
$arLessonsFilter = array('LINKED_LESSON_ID' => '');
if ($NS['MODULE'] === 'learning' && strlen($NS['ID']) > 0) {
$indexElementType = substr($NS['ID'], 0, 1);
$elementStartId = (int) substr($NS['ID'], 1);
if (strlen($NS['SITE_ID']) > 0) {
$arCoursesFilter['SITE_ID'] = $NS['SITE_ID'];
}
}
$arCoursesFilter['>ID'] = $elementStartId;
if ($indexElementType === 'C') {
$rsCourse = CCourse::GetList(array('ID' => 'ASC'), $arCoursesFilter);
while ($arCourse = $rsCourse->Fetch()) {
try {
$arCourse["SITE_ID"] = CCourse::GetSiteId($arCourse['ID']);
$arPathes = $arAllSitesPathes[$arCourse['SITE_ID']]['C'];
$linkedLessonId = CCourse::CourseGetLinkedLesson($arCourse['ID']);
if ($linkedLessonId === false) {
continue;
}
$arGroupPermissions = CLearnAccess::GetSymbolsAccessibleToLesson($linkedLessonId, CLearnAccess::OP_LESSON_READ);
} catch (LearnException $e) {
continue;
// skip indexation of this item
}
$arSiteIds = array();
foreach ($arPathes as $k => $path) {
$arCourse["PATH"] = $path;
$Url = str_replace("#COURSE_ID#", $arCourse["ID"], $arCourse["PATH"]);
$arSiteIds[$arCourse['SITE_ID']] = $Url;
}
if ($arCourse["DETAIL_TEXT_TYPE"] !== 'text') {
$detailText = CSearch::KillTags($arCourse['DETAIL_TEXT']);
} else {
$detailText = strip_tags($arCourse['DETAIL_TEXT']);
}
if (strlen($detailText) > 0) {
$dataBody = $detailText;
} else {
$dataBody = $arCourse['NAME'];
}
$Result = array("ID" => "C" . $arCourse["ID"], "LAST_MODIFIED" => $arCourse["TIMESTAMP_X"], "TITLE" => $arCourse["NAME"], "BODY" => $dataBody, "SITE_ID" => $arSiteIds, "PERMISSIONS" => $arGroupPermissions, "COURSE_ID" => "C" . $arCourse["ID"]);
if ($oCallback) {
$res = call_user_func(array($oCallback, $callback_method), $Result);
if (!$res) {
return "C" . $arCourse["ID"];
}
} else {
$arResult[] = $Result;
}
}
// Reindex of courses finished. Let's reindex lessons now.
$indexElementType = 'U';
$elementStartId = 0;
}
$arLessonsFilter['>LESSON_ID'] = $elementStartId;
if ($indexElementType === 'U') {
$rsLessons = CLearnLesson::GetList(array('LESSON_ID' => 'ASC'), $arLessonsFilter);
while ($arLessonFromDb = $rsLessons->Fetch()) {
$arLessonsWithCourse = array();
// list of lessons in context of some course
$arOParentPathes = CLearnLesson::GetListOfParentPathes($arLessonFromDb['LESSON_ID']);
foreach ($arOParentPathes as $oParentPath) {
$arParentLessons = $oParentPath->GetPathAsArray();
foreach ($arParentLessons as $lessonId) {
$linkedCourseId = CLearnLesson::GetLinkedCourse($lessonId);
if ($linkedCourseId !== false && $linkedCourseId > 0) {
$arLessonsWithCourse[] = array_merge($arLessonFromDb, array('PARENT_COURSE_ID' => $linkedCourseId));
}
}
}
foreach ($arLessonsWithCourse as $arLesson) {
try {
$arGroupPermissions = CLearnAccess::GetSymbolsAccessibleToLesson($arLesson['LESSON_ID'], CLearnAccess::OP_LESSON_READ);
$courseId = $arLesson['PARENT_COURSE_ID'];
if (!isset($arCourseToSiteCache[$courseId])) {
$strSql = "SELECT SITE_ID FROM b_learn_course_site WHERE COURSE_ID=" . (int) $courseId;
$rc = $DB->Query($strSql, true);
if ($rc === false) {
continue;
}
$arCourseToSiteCache[$courseId] = array();
while ($arCourseSite = $rc->fetch()) {
$arCourseToSiteCache[$courseId][] = $arCourseSite['SITE_ID'];
}
}
//.........这里部分代码省略.........
示例6: array
if (sourceList.options[i].index == sourceList.selectedIndex)
needSelectedIndex = iSelectIndex;
test.options.add(newElem);
}
}
if (needSelectedIndex !== false)
test.selectedIndex = needSelectedIndex;
}
</script>
<select name="PREVIOUS_TEST_COURSE_ID" id="PREVIOUS_TEST_COURSE_ID" onchange="filterTests()">
<?php
// was: $course = CCourse::GetList(array("SORT" => "ASC"), array("MIN_PERMISSION" => "W"));
$course = CCourse::GetList(array("SORT" => "ASC"), array("ACCESS_OPERATIONS" => CLearnAccess::OP_LESSON_READ));
while ($course->ExtractFields("f_")) {
?>
<option value="<?php
echo $f_ID;
?>
" <?php
if (IntVal($f_ID) == $PREVIOUS_TEST_COURSE_ID || !isset($PREVIOUS_TEST_COURSE_ID) && IntVal($f_ID) == $COURSE_ID) {
echo "selected";
}
?>
><?php
echo $f_NAME;
?>
</option><?php
}
示例7: ShowError
//Module
if (!CModule::IncludeModule("learning")) {
ShowError(GetMessage("LEARNING_MODULE_NOT_FOUND"));
return;
}
//Params
$arParams["TESTS_LIST_TEMPLATE"] = strlen($arParams["TESTS_LIST_TEMPLATE"]) > 0 ? htmlspecialcharsbx($arParams["TESTS_LIST_TEMPLATE"]) : "course/test_list.php?COURSE_ID=#COURSE_ID#";
$arParams["COURSE_DETAIL_TEMPLATE"] = strlen($arParams["COURSE_DETAIL_TEMPLATE"]) > 0 ? htmlspecialcharsbx($arParams["COURSE_DETAIL_TEMPLATE"]) : "course/index.php?COURSE_ID=#COURSE_ID#";
$arResult = array("COURSES" => array(), "CERTIFICATES" => array());
//Certificates
$rsCertificate = CCertification::GetList(array("ID" => "DESC"), array("STUDENT_ID" => intval($USER->GetID()), "ACTIVE" => "Y"));
while ($arCertificate = $rsCertificate->GetNext()) {
$arResult["CERTIFICATES"][$arCertificate["COURSE_ID"]] = $arCertificate;
}
//Courses
$rsCourse = CCourse::GetList(array("SORT" => "ASC"), array("ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "SITE_ID" => LANG));
while ($arCourse = $rsCourse->GetNext()) {
//Test list Url
$arCourse["TESTS_LIST_URL"] = CComponentEngine::MakePathFromTemplate($arParams["TESTS_LIST_TEMPLATE"], array("COURSE_ID" => $arCourse["ID"]));
//Course Url
$arCourse["COURSE_DETAIL_URL"] = CComponentEngine::MakePathFromTemplate($arParams["COURSE_DETAIL_TEMPLATE"], array("COURSE_ID" => $arCourse["ID"]));
$arCourse["COMPLETED"] = array_key_exists($arCourse["ID"], $arResult["CERTIFICATES"]);
if (!$arCourse["COMPLETED"]) {
$rsTest = CTest::GetList(array(), array("COURSE_ID" => $arCourse["ID"], "ACTIVE" => "Y", 'CHECK_PERMISSIONS' => 'N'));
$rsTest->NavStart(1);
$arCourse["NO_TESTS"] = !$rsTest->SelectedRowsCount();
}
// Resolve links "?COURSE_ID={SELF}". Don't relay on it, this behaviour
// can be changed in future without any notifications.
if (isset($arCourse['DETAIL_TEXT'])) {
$arCourse['DETAIL_TEXT'] = CLearnHelper::PatchLessonContentLinks($arCourse['DETAIL_TEXT'], $arCourse['ID']);
示例8: isset
$arParams["COURSE_DETAIL_TEMPLATE"] = isset($arParams["COURSE_DETAIL_TEMPLATE"]) ? htmlspecialcharsbx($arParams["COURSE_DETAIL_TEMPLATE"]) : "course/index.php?COURSE_ID=#COURSE_ID#";
$arParams["COURSES_PER_PAGE"] = intval($arParams["COURSES_PER_PAGE"]) > 0 ? intval($arParams["COURSES_PER_PAGE"]) : 20;
//Set Title
$arParams["SET_TITLE"] = $arParams["SET_TITLE"] == "N" ? "N" : "Y";
if ($arParams["SET_TITLE"] == "Y") {
$APPLICATION->SetTitle(GetMessage("LEARNING_COURSE_LIST"));
}
//arResult
$arResult = array("COURSES" => array(), "NAV_SRTING" => "", "NAV_RESULT" => null);
$arNavParams = array();
$arNavParams = array();
if ((int) $arParams["COURSES_PER_PAGE"] > 0) {
$arNavParams['nPageSize'] = (int) $arParams["COURSES_PER_PAGE"];
$arNavParams['bDescPageNumbering'] = false;
}
$res = CCourse::GetList(array($arParams["SORBY"] => $arParams["SORORDER"]), array("ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "SITE_ID" => LANG, "CHECK_PERMISSIONS" => $arParams["CHECK_PERMISSIONS"]), $arNavParams);
$arResult["NAV_STRING"] = $res->GetPageNavString(GetMessage("LEARNING_COURSES_NAV"));
$arResult["NAV_RESULT"] = $res;
while ($arCourse = $res->GetNext()) {
$arCourse["COURSE_DETAIL_URL"] = CComponentEngine::MakePathFromTemplate($arParams["COURSE_DETAIL_TEMPLATE"], array("COURSE_ID" => $arCourse["ID"]));
$arCourse["PREVIEW_PICTURE_ARRAY"] = CFile::GetFileArray($arCourse["PREVIEW_PICTURE"]);
// Resolve links "?COURSE_ID={SELF}". Don't relay on it, this behaviour
// can be changed in future without any notifications.
if (isset($arCourse['DETAIL_TEXT'])) {
$arCourse['DETAIL_TEXT'] = CLearnHelper::PatchLessonContentLinks($arCourse['DETAIL_TEXT'], $arCourse['ID']);
}
if (isset($arCourse['PREVIEW_TEXT'])) {
$arCourse['PREVIEW_TEXT'] = CLearnHelper::PatchLessonContentLinks($arCourse['PREVIEW_TEXT'], $arCourse['ID']);
}
$arResult["COURSES"][] = $arCourse;
}
示例9: fetchDataFromDb
private function fetchDataFromDb()
{
if ($this->IsSearchMode()) {
$searchMode = $this->getSearchMode();
if ($searchMode === 'parents_candidates') {
//exit('1');
$accessOperations = CLearnAccess::OP_LESSON_READ | CLearnAccess::OP_LESSON_LINK_DESCENDANTS;
} elseif ($searchMode === 'childs_candidates') {
//exit('2');
$accessOperations = CLearnAccess::OP_LESSON_READ | CLearnAccess::OP_LESSON_LINK_TO_PARENTS;
} elseif ($searchMode === 'attach_question_to_lesson') {
$accessOperations = CLearnAccess::OP_LESSON_WRITE;
} else {
$accessOperations = CLearnAccess::OP_LESSON_READ;
}
} else {
$accessOperations = CLearnAccess::OP_LESSON_READ;
}
$this->arFilter['ACCESS_OPERATIONS'] = $accessOperations;
// fetch data
if ($this->IsListChildLessonsMode()) {
// shows only childs of requested lesson uid
$CDBResult = CLearnLesson::GetListOfImmediateChilds($this->requestedParentLessonId, $this->arSortOrder, $this->arFilter);
} elseif ($this->IsListAnyLessonsMode()) {
$CDBResult = CLearnLesson::GetList($this->arSortOrder, $this->arFilter);
} elseif ($this->IsListAnyCoursesMode()) {
$CDBResult = CCourse::GetList($this->arSortOrder, $this->arFilter);
}
return $CDBResult;
}
示例10: CanViewAdminMenu
public static function CanViewAdminMenu()
{
global $USER;
if ($USER->IsAdmin()) {
return true;
}
$oAccess = CLearnAccess::GetInstance($USER->GetID());
if ($oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_READ) && ($oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_CREATE) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_WRITE) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_REMOVE) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_CREATE) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_LINK_TO_PARENTS) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_UNLINK_FROM_PARENTS) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_LINK_DESCENDANTS) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_UNLINK_DESCENDANTS) || $oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_MANAGE_RIGHTS))) {
return true;
}
if ($oAccess->IsBaseAccess(CLearnAccess::OP_LESSON_CREATE)) {
return true;
}
$db = CCourse::GetList(array(), array("CHECK_PERMISSIONS" => "Y", "ACCESS_OPERATIONS" => CLearnAccess::OP_LESSON_CREATE | CLearnAccess::OP_LESSON_WRITE | CLearnAccess::OP_LESSON_REMOVE | CLearnAccess::OP_LESSON_LINK_TO_PARENTS | CLearnAccess::OP_LESSON_UNLINK_FROM_PARENTS | CLearnAccess::OP_LESSON_LINK_DESCENDANTS | CLearnAccess::OP_LESSON_UNLINK_DESCENDANTS | CLearnAccess::OP_LESSON_MANAGE_RIGHTS), array("nTopCount" => 1));
return $db->Fetch() !== false;
}
示例11: FetchData
public function FetchData()
{
if ($this->IsSearchMode()) {
$searchMode = $this->getSearchMode();
if ($searchMode === 'parents_candidates') {
//exit('1');
$accessOperations = CLearnAccess::OP_LESSON_READ | CLearnAccess::OP_LESSON_LINK_DESCENDANTS;
} elseif ($searchMode === 'childs_candidates') {
//exit('2');
$accessOperations = CLearnAccess::OP_LESSON_READ | CLearnAccess::OP_LESSON_LINK_TO_PARENTS;
} elseif ($searchMode === 'attach_question_to_lesson') {
$accessOperations = CLearnAccess::OP_LESSON_WRITE;
} else {
$accessOperations = CLearnAccess::OP_LESSON_READ;
}
} else {
$accessOperations = CLearnAccess::OP_LESSON_READ;
}
$this->arFilter['ACCESS_OPERATIONS'] = $accessOperations;
// fetch data
if ($this->IsListChildLessonsMode()) {
// shows only childs of requested lesson uid
$CDBResult = CLearnLesson::GetListOfImmediateChilds($this->requestedParentLessonId, $this->arSortOrder, $this->arFilter);
} elseif ($this->IsListAnyLessonsMode()) {
$CDBResult = CLearnLesson::GetList($this->arSortOrder, $this->arFilter);
} elseif ($this->IsListAnyCoursesMode()) {
$CDBResult = CCourse::GetList($this->arSortOrder, $this->arFilter);
}
$this->rsData = new CAdminResult($CDBResult, $this->tableID);
// navigation setup
$this->rsData->NavStart();
$this->oList->NavText($this->rsData->GetNavPrint(''));
return $this;
}
示例12: __learning_admin_get_menu
function __learning_admin_get_menu($THIS, $arPath = array(), $deep = 0, &$immediateChildsIds, $loadOnlySpecialEntities = false)
{
$immediateChildsIds = array();
// puts here ids of all immediate childs
$deep = (int) $deep;
// Index in path for current parentLessonId
$indexInPath = $deep - 1;
// Path doesn't include top root element ('all courses' or 'all unilessons')
$arMenu = array();
//$urlPath = $oPath->ExportUrlencoded();
// current lesson id (not exists only for top root)
if (isset($arPath[$deep])) {
$currentLessonIdInPath = (int) $arPath[$deep];
} else {
$currentLessonIdInPath = false;
}
// Path to current element
$arCurrentDeepPath = array();
foreach ($arPath as $key => $value) {
if ($key === $deep) {
break;
}
$arCurrentDeepPath[] = $value;
}
if ($deep === 0) {
// We are at the top level, so we must get list of all courses
$CDBResult = CCourse::GetList(array('COURSE_SORT' => 'ASC'));
} else {
// If not parent with such indexInPath => we are deep too much.
if (!isset($arPath[$indexInPath])) {
return $arMenu;
}
// no items
$parentLessonId = $arPath[$indexInPath];
$oCurrentDeepPath = new CLearnPath();
$oCurrentDeepPath->SetPathFromArray(array_merge($arCurrentDeepPath));
$urlPath = $oCurrentDeepPath->ExportUrlencoded();
$arMenu[] = array("text" => GetMessage("LEARNING_QUESTION"), "url" => "learn_question_admin.php?lang=" . LANG . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath . "&from=learn_menu", "icon" => "learning_icon_question", "more_url" => array("learn_question_admin.php?lang=" . LANG . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath . "&from=learn_menu", "learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $urlPath . "&from=learn_menu", "learn_question_admin.php?lang=" . LANG . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath, "learn_question_edit.php?lang=" . LANG . '&LESSON_PATH=' . $urlPath, "learn_question_admin.php?lang=" . LANG . '&LESSON_PATH=' . $urlPath), "title" => GetMessage("LEARNING_QUESTION_LIST"));
$CDBResult = CLearnLesson::GetListOfImmediateChilds($parentLessonId, array('EDGE_SORT' => 'ASC'));
// determine, is parent a course (only for courses in subroot level)?
if ($deep === 1) {
$immediateParentCourse = CLearnLesson::GetLinkedCourse($parentLessonId);
if ($immediateParentCourse !== false) {
// immediate parent is a course, so we must add entity 'Tests'
$arMenu[] = array('text' => GetMessage('LEARNING_TESTS'), 'url' => 'learn_test_admin.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&COURSE_ID=' . ($immediateParentCourse + 0) . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath, 'icon' => 'learning_icon_tests', 'more_url' => array('learn_test_admin.php?lang=' . LANG . '&set_filter=Y' . '&COURSE_ID=' . ($immediateParentCourse + 0) . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath, 'learn_test_edit.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&COURSE_ID=' . ($immediateParentCourse + 0) . '&PARENT_LESSON_ID=' . ($parentLessonId + 0) . '&LESSON_PATH=' . $urlPath), 'title' => GetMessage('LEARNING_TESTS_LIST'));
unset($urlPath);
unset($oCurrentDeepPath);
}
}
}
if ($loadOnlySpecialEntities) {
return $arMenu;
}
// When listing courses, limit it's count
if ($deep === 0) {
$items = 0;
$learning_menu_max_courses = (int) COption::GetOptionString("learning", "menu_max_courses", "10");
}
while ($arData = $CDBResult->GetNext()) {
// When listing courses, limit it's count
if ($deep === 0) {
if ($items >= $learning_menu_max_courses) {
// add element 'other courses'
$arMenu[] = array('text' => GetMessage('LEARNING_MENU_COURSES_OTHER'), 'url' => 'learn_unilesson_admin.php?lang=' . LANG . '&PARENT_LESSON_ID=-1', 'title' => GetMessage('LEARNING_MENU_COURSES_ALT'), 'more_url' => array('learn_test_admin.php', 'learn_test_edit.php', 'learn_unilesson_admin.php', 'learn_unilesson_edit.php', 'learn_question_admin.php', 'learn_question_edit.php'));
// stop adding courses to menu
break;
}
$items++;
}
$arSubImmediateChildsIds = false;
$arCurItemPath = $arCurrentDeepPath;
$arCurItemPath[] = $arData['LESSON_ID'] + 0;
// Remember all immediate childs
$immediateChildsIds[] = $arData['LESSON_ID'] + 0;
$oCurItemPath = new CLearnPath();
$oCurItemPath->SetPathFromArray($arCurItemPath);
$urlCurItemPath = $oCurItemPath->ExportUrlencoded();
$arItem = array('text' => $arData['NAME'], 'url' => 'learn_unilesson_admin.php?lang=' . LANG . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $oCurItemPath->ExportUrlencoded(), 'title' => $arData['NAME'], 'items_id' => 'menu_learning_courses_new_' . implode('_', $arCurItemPath), "icon" => "learning_icon_courses", 'module_id' => 'learning', 'more_url' => array('learn_unilesson_admin.php?lang=' . LANG . '&set_filter=Y' . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_admin.php?lang=' . LANG . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_admin.php?lang=' . LANG . '&set_filter=Y' . '&LESSON_PATH=' . $urlCurItemPath, 'learn_question_admin.php?lang=' . LANG . '&filter=Y&set_filter=Y' . '&LESSON_PATH=' . $urlCurItemPath, 'learn_question_edit.php?lang=' . LANG . '&set_filter=Y' . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_edit.php?lang=' . LANG . '&LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath, 'learn_unilesson_edit.php?lang=' . LANG . '&PARENT_LESSON_ID=' . ($arData['LESSON_ID'] + 0) . '&LESSON_PATH=' . $urlCurItemPath));
$arItem['items'] = array();
if ($deep === 0 && isset($arData['LINKED_LESSON_ID']) && $arData['LINKED_LESSON_ID'] > 0) {
$arItem['page_icon'] = $arItem['icon'] = 'learning_icon_courses';
$arItem['dynamic'] = true;
$loadOnlySpecialEntities = false;
// Load child items only for lesson in current path
if ($arData['LESSON_ID'] == $currentLessonIdInPath) {
$arItem['items'] = __learning_admin_get_menu($THIS, $arPath, $deep + 1, $arSubImmediateChildsIds);
}
} else {
$loadOnlySpecialEntities = false;
$childsCnt = CLearnLesson::CountImmediateChilds($arData['LESSON_ID']);
$questionsCnt = CLQuestion::GetCount(array('LESSON_ID' => (int) $arData['LESSON_ID']));
if ($childsCnt > 0) {
$arItem['page_icon'] = $arItem['icon'] = 'learning_icon_chapters';
} else {
$arItem['page_icon'] = $arItem['icon'] = 'learning_icon_lessons';
}
$arItem['dynamic'] = true;
// Load child items only for lesson in current path
if ($arData['LESSON_ID'] == $currentLessonIdInPath) {
$arItem['items'] = __learning_admin_get_menu($THIS, $arPath, $deep + 1, $arSubImmediateChildsIds);
//.........这里部分代码省略.........
示例13: array
if (!WIZARD_NEW_2011 && WIZARD_SITE_ID == 's1') {
$arCoursesSite = array("new_employee", "portal");
}
foreach ($arCourses as $key => $courseCode) {
try {
$dbResult = CCourse::GetList(array(), array("CODE" => $arCoursesSite[$key]));
$pathToService = WIZARD_SERVICE_ABSOLUTE_PATH;
if (!($arCourse = $dbResult->Fetch())) {
$pathToCourse = WIZARD_SERVICE_RELATIVE_PATH . "/" . LANGUAGE_ID . "/" . $courseCode . "/";
$package = new CCourseImport($pathToCourse, array(WIZARD_SITE_ID));
if (strlen($package->LAST_ERROR) > 0) {
return;
}
$success = $package->ImportPackage();
if ($success) {
$dbResult = CCourse::GetList(array(), array("CODE" => $courseCode));
$arCourse = $dbResult->Fetch();
$obCCourse = new CCourse();
$obCCourse->Update($arCourse["ID"], array("CODE" => $arCoursesSite[$key]));
}
}
/*
it's new rights model now, rights mudt be set for every lesson and/or for module at all
if (isset($arCourse["ID"])){
CCourse::SetPermission($arCourse["ID"], Array("2"=>"R"));
}
*/
CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/images/" . $courseCode . "/", WIZARD_SITE_PATH, $rewrite = false, $recursive = true);
} catch (LearnException $e) {
}
示例14: GetMessage
<?php
$tabControl->BeginNextTab();
if ($STEP < 2) {
?>
<tr>
<td><?php
echo GetMessage("LEARNING_COURSES");
?>
:</td>
<td>
<select name="COURSE_ID" style="width:300px;">
<?php
// was: $course = CCourse::GetList(array("SORT" => "ASC"), array("MIN_PERMISSION" => "W"));
// TODO: think about better way of rights check (for every exported lesson, I think).
$course = CCourse::GetList(array("SORT" => "ASC"), array('ACCESS_OPERATIONS' => CLearnAccess::OP_LESSON_READ | CLearnAccess::OP_LESSON_WRITE));
while ($course->ExtractFields("f_")) {
?>
<option value="<?php
echo $f_ID;
?>
" <?php
if (IntVal($f_ID) == $COURSE_ID) {
echo "selected";
}
?>
><?php
echo $f_NAME;
?>
</option><?php
}