本文整理汇总了PHP中CCourse类的典型用法代码示例。如果您正苦于以下问题:PHP CCourse类的具体用法?PHP CCourse怎么用?PHP CCourse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCourse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: CanUserViewLessonAsPublic
public static function CanUserViewLessonAsPublic($arParams)
{
// Parse options (user_id from $arParams will be automaticaly resolved)
$options = self::ParseParamsWithUser($arParams, array('COURSE_ID' => array('type' => 'strictly_castable_to_integer', 'mandatory' => true), 'LESSON_ID' => array('type' => 'strictly_castable_to_integer', 'mandatory' => true)));
// Is it course?
$linkedLessonId = CCourse::CourseGetLinkedLesson($options['COURSE_ID']);
if ($linkedLessonId === false) {
return false;
}
// Access denied
$lessonId = $options['LESSON_ID'];
$breakOnLessonId = $linkedLessonId;
// save resources
// Is lesson included into given course?
$isLessonChildOfCourse = false;
$arOPathes = CLearnLesson::GetListOfParentPathes($lessonId, $breakOnLessonId);
foreach ($arOPathes as $oPath) {
$topLessonId = $oPath->GetTop();
if ($topLessonId !== false && $topLessonId == $linkedLessonId) {
$isLessonChildOfCourse = true;
break;
}
}
if (!$isLessonChildOfCourse) {
return false;
}
// Access denied
// Check permissions for course
$isCourseAccessible = self::CanUserViewLessonContent(array('lesson_id' => $linkedLessonId));
// Permissions for all lessons/chapters in public are equivalent to course permissions
return $isCourseAccessible;
}
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:32,代码来源:clearnaccessmacroses.php
示例2: GetDataWoCache
protected static function GetDataWoCache($courseId)
{
$rsContent = CCourse::GetCourseContent($courseId, array(), array('LESSON_ID', 'NAME'));
$arContents = array();
while ($arContent = $rsContent->GetNext()) {
$arContents[] = $arContent;
}
return $arContents;
}
开发者ID:Satariall,项目名称:izurit,代码行数:9,代码来源:clearncacheoflessontreecomponent.php
示例3: 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;
}
开发者ID:Satariall,项目名称:izurit,代码行数:49,代码来源:certification.php
示例4: CCoursePackage
function CCoursePackage($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 (strlen($charset) <= 0) {
if (defined("SITE_CHARSET") && strlen(SITE_CHARSET) > 0) {
$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__ . "<br>Line: " . __LINE__);
while ($arRes = $res->Fetch()) {
$r = ++$this->RefID;
$this->arItems[$r] = $this->_CreateContent("TES", $arRes, $r);
$this->strItems .= '<item identifier="TES' . $r . '" identifierref="RES' . $r . '"><title>' . htmlspecialcharsbx($arRes["NAME"]) . '</title>';
$marksRes = $DB->Query("SELECT * FROM b_learn_test_mark WHERE TEST_ID = '" . (string) (int) $arRes['ID'] . "'", false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($arMarksRes = $marksRes->Fetch()) {
$r = ++$this->RefID;
$this->arItems[$r] = $this->CreateTMK($arMarksRes, $r);
$this->strItems .= '<item identifier="TMK' . $r . '" identifierref="RES' . $r . '">' . '<title>' . htmlspecialcharsbx($arMarksRes['MARK'] . ' (' . $arMarksRes['DESCRIPTION'] . ')') . '</title>' . '</item>';
}
$this->strItems .= '</item>';
$this->strResourses .= '<resource identifier="RES' . $r . '" type="webcontent" href="res' . $r . '.xml">' . $this->_GetResourceFiles($r) . '</resource>';
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:45,代码来源:export.php
示例5: GetFilter
public static function GetFilter($arFilter)
{
global $DBType;
if (!is_array($arFilter)) {
$arFilter = array();
}
$arSqlSearch = array();
foreach ($arFilter as $key => $val) {
$res = CLearnHelper::MkOperationFilter($key);
$key = $res["FIELD"];
$cOperationType = $res["OPERATION"];
$key = strtoupper($key);
switch ($key) {
case "ID":
case "SORT":
case "LESSON_ID":
case "POINT":
$arSqlSearch[] = CLearnHelper::FilterCreate("CQ." . $key, $val, "number", $bFullJoin, $cOperationType);
break;
case "COURSE_ID":
// was: $arSqlSearch[] = CLearnHelper::FilterCreate("C.".$key, $val, "number", $bFullJoin, $cOperationType);
$courseLessonId = CCourse::CourseGetLinkedLesson($val);
if ($courseLessonId === false) {
break;
}
// it is not a course, so skipping
if ($DBType === 'oracle') {
// This subquery gets ids of all childs lesson for given $courseLessonId
$subQuery = "\n\t\t\t\t\t\t\tSELECT TLE.TARGET_NODE\n\t\t\t\t\t\t\tFROM b_learn_lesson_edges TLE\n\t\t\t\t\t\t\tSTART WITH TLE.SOURCE_NODE=" . ($courseLessonId + 0) . "\n\t\t\t\t\t\t\tCONNECT BY NOCYCLE PRIOR TLE.TARGET_NODE = TLE.SOURCE_NODE";
// But we need also $courseLessonId itself, so final clause will be:
$arSqlSearch[] = '(CQ.LESSON_ID IN (' . $subQuery . ')
OR CQ.LESSON_ID = ' . ($courseLessonId + 0) . ')';
} elseif ($DBType === 'mysql' || $DBType === 'mssql') {
// MySQL & MSSQL supports "WHERE IN(...)" clause for more than 10 000 elements
// add to sql "WHERE" constraint: lessons id only from given array
$sqlCourseLessonsIdsList = '';
$oTree = CLearnLesson::GetTree($courseLessonId);
$arChildLessonForCourse = $oTree->GetLessonsIdListInTree();
// root lesson not in tree, so add it
$arChildLessonForCourse[] = $courseLessonId;
// We need escape data for SQL
$arChildLessonForCourseEscaped = array_map('intval', $arChildLessonForCourse);
$sqlCourseLessonsIdsList = implode(', ', $arChildLessonForCourseEscaped);
if (strlen($sqlCourseLessonsIdsList) > 0) {
$arSqlSearch[] = 'CQ.LESSON_ID IN (' . $sqlCourseLessonsIdsList . ')';
}
} else {
throw new LearnException('Unsupported DB engine: ' . $DBType, LearnException::EXC_ERR_ALL_GIVEUP);
}
break;
case "NAME":
$arSqlSearch[] = CLearnHelper::FilterCreate("CQ." . $key, $val, "string", $bFullJoin, $cOperationType);
break;
case "QUESTION_TYPE":
case "ACTIVE":
case "SELF":
case "CORRECT_REQUIRED":
$arSqlSearch[] = CLearnHelper::FilterCreate("CQ." . $key, $val, "string_equal", $bFullJoin, $cOperationType);
break;
}
}
return $arSqlSearch;
}
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:63,代码来源:question.php
示例6: _CreateAttemptQuestions
protected static function _CreateAttemptQuestions($arCallbackSqlFormer, $ATTEMPT_ID)
{
global $APPLICATION, $DB, $DBType;
$ATTEMPT_ID = intval($ATTEMPT_ID);
$attempt = CTestAttempt::GetByID($ATTEMPT_ID);
if (!($arAttempt = $attempt->Fetch())) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_ATTEMPT_ID_EX"), "ERROR_NO_ATTEMPT_ID");
return false;
}
$test = CTest::GetByID($arAttempt["TEST_ID"]);
if (!($arTest = $test->Fetch())) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_ID_EX"), "ERROR_NO_TEST_ID");
return false;
}
$strSql = "DELETE FROM b_learn_test_result WHERE ATTEMPT_ID = " . $ATTEMPT_ID;
if (!$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
return false;
}
/**
* QUESTIONS_FROM values:
* 'L' - X questions from every lesson in course
* 'C' - X questions from every lesson from every chapter in the course
* In this case questions taken from immediate lessons of all chapters (X per chapter) in the course.
* In new data model it means, get X questions from every lesson in the course, except
* 1) immediate lessons-childs of the course and
* 2) lessons, contains other lessons (because, in old data model chapters doesn't contains questions)
*
* 'H' - all questions from the selected chapter (recursive) in the course
* This case must be ignored, because converter to new data model updates 'H' to 'R', but in case
* when chapter is not exists updates didn't become. So QUESTIONS_FROM stayed in 'H' value. And it means,
* that there is no chapter exists with QUESTIONS_FROM_ID, so we can't do work. And we should just
* ignore, for backward compatibility (so, don't throw an error).
* 'S' - all questions from the selected lesson (unilesson_id in QUESTIONS_FROM_ID)
* 'A' - all questions of the course (nothing interesting in QUESTIONS_FROM_ID)
*
* new values:
* 'R' - all questions from the tree with root at selected lesson (include questions of selected lesson)
* in the course (unilesson_id in QUESTIONS_FROM_ID)
*/
if ($arTest["QUESTIONS_FROM"] == "C" || $arTest["QUESTIONS_FROM"] == "L") {
$courseId = $arTest['COURSE_ID'] + 0;
$courseLessonId = CCourse::CourseGetLinkedLesson($courseId);
if ($courseLessonId === false) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_IS_EMPTY"), "ERROR_TEST_IS_EMPTY");
return false;
}
$clauseAllChildsLessons = CLearnHelper::SQLClauseForAllSubLessons($courseLessonId);
if ($arTest["QUESTIONS_FROM"] == "C") {
$strSql = "SELECT Q.ID as QUESTION_ID, TLEUP.SOURCE_NODE as FROM_ID\n\t\t\t\tFROM b_learn_lesson L\n\t\t\t\tINNER JOIN b_learn_question Q ON L.ID = Q.LESSON_ID\n\t\t\t\tINNER JOIN b_learn_lesson_edges TLEUP ON L.ID = TLEUP.TARGET_NODE\n\t\t\t\tLEFT OUTER JOIN b_learn_lesson_edges TLEDOWN ON L.ID = TLEDOWN.SOURCE_NODE " . "WHERE L.ID IN (" . $clauseAllChildsLessons . ") \n" . " AND TLEDOWN.SOURCE_NODE IS NULL \n" . " AND TLEUP.SOURCE_NODE IN (" . $clauseAllChildsLessons . ") \n" . " AND Q.ACTIVE = 'Y' " . ($arTest["INCLUDE_SELF_TEST"] != "Y" ? "AND Q.SELF = 'N' " : "") . "ORDER BY " . ($arTest["RANDOM_QUESTIONS"] == "Y" ? CTest::GetRandFunction() : "L.SORT, Q.SORT");
} else {
$strSql = "SELECT Q.ID as QUESTION_ID, L.ID as FROM_ID " . "FROM b_learn_lesson L " . "INNER JOIN b_learn_question Q ON L.ID = Q.LESSON_ID " . "WHERE L.ID IN (" . $clauseAllChildsLessons . ") AND Q.ACTIVE = 'Y' " . ($arTest["INCLUDE_SELF_TEST"] != "Y" ? "AND Q.SELF = 'N' " : "") . "ORDER BY " . ($arTest["RANDOM_QUESTIONS"] == "Y" ? CTest::GetRandFunction() : "L.SORT, Q.SORT");
}
if (!($res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__))) {
return false;
}
$Values = array();
$tmp = array();
while ($arRecord = $res->Fetch()) {
if (is_set($tmp, $arRecord["FROM_ID"])) {
if ($tmp[$arRecord["FROM_ID"]] < $arTest["QUESTIONS_AMOUNT"]) {
$tmp[$arRecord["FROM_ID"]]++;
} else {
continue;
}
} else {
$tmp[$arRecord["FROM_ID"]] = 1;
}
$Values[] = $arRecord["QUESTION_ID"];
}
if (empty($Values)) {
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_IS_EMPTY"), "ERROR_TEST_IS_EMPTY");
return false;
}
$DB->StartTransaction();
foreach ($Values as $ID) {
$strSql = "INSERT INTO b_learn_test_result (ATTEMPT_ID, QUESTION_ID) VALUES (" . $ATTEMPT_ID . "," . $ID . ")";
if (!$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__)) {
$DB->Rollback();
return false;
}
}
$DB->Commit();
} elseif (($arTest["QUESTIONS_FROM"] == "H" || $arTest["QUESTIONS_FROM"] == "S" || $arTest["QUESTIONS_FROM"] == "R") && $arTest["QUESTIONS_FROM_ID"]) {
$WHERE = '';
if ($arTest["QUESTIONS_FROM"] == "H") {
/**
* 'H' - all questions from the selected chapter (recursive) in the course
* This case must be ignored, because converter to new data model updates 'H' to 'R', but in case
* when chapter is not exists updates didn't become. So QUESTIONS_FROM stayed in 'H' value. And it means,
* that there is no chapter exists with QUESTIONS_FROM_ID, so we can't do work. And we should just
* ignore, for backward compatibility (so, don't throw an error).
*/
$APPLICATION->ThrowException(GetMessage("LEARNING_BAD_TEST_IS_EMPTY"), "ERROR_TEST_IS_EMPTY");
return false;
} elseif ($arTest["QUESTIONS_FROM"] == 'R') {
$clauseAllChildsLessons = CLearnHelper::SQLClauseForAllSubLessons($arTest['QUESTIONS_FROM_ID']);
$WHERE = " (L.ID IN(" . $clauseAllChildsLessons . ") OR (L.ID = " . ($arTest['QUESTIONS_FROM_ID'] + 0) . ")) ";
} elseif ($arTest["QUESTIONS_FROM"] == 'S') {
$clauseAllChildsLessons = $arTest["QUESTIONS_FROM_ID"] + 0;
$WHERE = " (L.ID IN(" . $clauseAllChildsLessons . ") OR (L.ID = " . ($arTest['QUESTIONS_FROM_ID'] + 0) . ")) ";
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:attempt.php
示例7: __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);
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:menu.php
示例8: FilterCreate
/**
* This code writed not by me, but I rely on it in good state
*/
public static function FilterCreate($fname, $vals, $type, &$bFullJoin, $cOperationType = false, $bSkipEmpty = true)
{
global $DB;
if (!is_array($vals)) {
$vals = array($vals);
}
if (count($vals) < 1) {
return "";
}
if (is_bool($cOperationType)) {
if ($cOperationType === true) {
$cOperationType = "N";
} else {
$cOperationType = "E";
}
}
if ($cOperationType == "G") {
$strOperation = ">";
} elseif ($cOperationType == "GE") {
$strOperation = ">=";
} elseif ($cOperationType == "LE") {
$strOperation = "<=";
} elseif ($cOperationType == "L") {
$strOperation = "<";
} else {
$strOperation = "=";
}
$bFullJoin = false;
$bWasLeftJoin = false;
$res = array();
for ($i = 0; $i < count($vals); $i++) {
$val = $vals[$i];
if (!$bSkipEmpty || strlen($val) > 0 || is_bool($val) && $val === false) {
switch ($type) {
case "string_equal":
if (strlen($val) <= 0) {
$res[] = ($cOperationType == "N" ? "NOT" : "") . "(" . $fname . " IS NULL OR " . $DB->Length($fname) . "<=0)";
} else {
$res[] = "(" . ($cOperationType == "N" ? " " . $fname . " IS NULL OR NOT (" : "") . CCourse::_Upper($fname) . $strOperation . CCourse::_Upper("'" . $DB->ForSql($val) . "'") . ($cOperationType == "N" ? ")" : "") . ")";
}
break;
case "string":
if ($cOperationType == "?") {
if (strlen($val) > 0) {
$res[] = GetFilterQuery($fname, $val, "Y", array(), "N");
}
} elseif (strlen($val) <= 0) {
$res[] = ($cOperationType == "N" ? "NOT" : "") . "(" . $fname . " IS NULL OR " . $DB->Length($fname) . "<=0)";
} else {
if ($strOperation == "=") {
$res[] = "(" . ($cOperationType == "N" ? " " . $fname . " IS NULL OR NOT (" : "") . (strtoupper($DB->type) == "ORACLE" ? CCourse::_Upper($fname) . " LIKE " . CCourse::_Upper("'" . $DB->ForSqlLike($val) . "'") . " ESCAPE '\\'" : $fname . " " . ($strOperation == "=" ? "LIKE" : $strOperation) . " '" . $DB->ForSqlLike($val) . "'") . ($cOperationType == "N" ? ")" : "") . ")";
} else {
$res[] = "(" . ($cOperationType == "N" ? " " . $fname . " IS NULL OR NOT (" : "") . (strtoupper($DB->type) == "ORACLE" ? CCourse::_Upper($fname) . " " . $strOperation . " " . CCourse::_Upper("'" . $DB->ForSql($val) . "'") . " " : $fname . " " . $strOperation . " '" . $DB->ForSql($val) . "'") . ($cOperationType == "N" ? ")" : "") . ")";
}
}
break;
case "date":
if (strlen($val) <= 0) {
$res[] = ($cOperationType == "N" ? "NOT" : "") . "(" . $fname . " IS NULL)";
} else {
$res[] = "(" . ($cOperationType == "N" ? " " . $fname . " IS NULL OR NOT (" : "") . $fname . " " . $strOperation . " " . $DB->CharToDateFunction($DB->ForSql($val), "FULL") . ($cOperationType == "N" ? ")" : "") . ")";
}
break;
case "number":
if (strlen($val) <= 0) {
$res[] = ($cOperationType == "N" ? "NOT" : "") . "(" . $fname . " IS NULL)";
} else {
$res[] = "(" . ($cOperationType == "N" ? " " . $fname . " IS NULL OR NOT (" : "") . $fname . " " . $strOperation . " '" . DoubleVal($val) . ($cOperationType == "N" ? "')" : "'") . ")";
}
break;
/*
case "number_above":
if(strlen($val)<=0)
$res[] = ($cOperationType=="N"?"NOT":"")."(".$fname." IS NULL)";
else
$res[] = ($cOperationType=="N"?" ".$fname." IS NULL OR NOT ":"")."(".$fname." ".$strOperation." '".$DB->ForSql($val)."')";
break;
*/
}
// INNER JOIN in this case
if (strlen($val) > 0 && $cOperationType != "N") {
$bFullJoin = true;
} else {
$bWasLeftJoin = true;
}
}
}
$strResult = "";
for ($i = 0; $i < count($res); $i++) {
if ($i > 0) {
$strResult .= $cOperationType == "N" ? " AND " : " OR ";
}
$strResult .= $res[$i];
}
if (count($res) > 1) {
$strResult = "(" . $strResult . ")";
}
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:clearnhelper.php
示例9: 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
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:learn_certification_admin.php
示例10: _MakeItems
protected function _MakeItems($TITLE, $TYPE, $RES_ID, $PARENT_ID)
{
global $APPLICATION;
if ($PARENT_ID === 0) {
$linkToParentLessonId = CCourse::CourseGetLinkedLesson($this->COURSE_ID);
} else {
$linkToParentLessonId = (int) $PARENT_ID;
}
$createUnilesson = false;
if ($TYPE == "LES") {
$arFields = array('NAME' => $TITLE);
$createUnilesson = true;
} elseif ($TYPE == "CHA") {
$arFields = array('NAME' => $TITLE);
$createUnilesson = true;
} elseif ($TYPE == "QUE") {
$arFields = array("NAME" => $TITLE, "LESSON_ID" => $linkToParentLessonId);
$cl = new CLQuestion();
} elseif ($TYPE == "TES") {
$arFields = array("NAME" => $TITLE, "COURSE_ID" => $this->COURSE_ID);
$cl = new CTest();
} elseif ($TYPE === 'TMK') {
$arFields = array();
$cl = new CLTestMark();
} else {
return $PARENT_ID;
}
$r = new CDataXML();
if (!$r->Load($this->package_dir . "/" . strtolower($RES_ID) . ".xml")) {
$r = false;
}
if ($r !== false) {
if ($TYPE == "QUE") {
if (($data = $r->SelectNodes("/questestinterop/item/presentation/")) && ($resp = $r->SelectNodes("/questestinterop/item/resprocessing/"))) {
$arQ = array();
$arData = $data->__toArray();
$arResp = $resp->__toArray();
if (is_set($arData["#"]["material"][0]["#"], "mattext")) {
$arQ["NAME"] = $arData["#"]["material"][0]["#"]["mattext"][0]["#"];
}
if (is_set($arData["#"]["material"][0]["#"], "matimage")) {
$imageDescription = '';
if (is_set($arData["#"]["material"][0]["#"], 'image_description')) {
$imageDescription = $arData["#"]["material"][0]["#"]['image_description'][0]['#'];
}
$arQ["FILE_ID"] = array("MODULE_ID" => "learning", "name" => basename($arData["#"]["material"][0]["#"]["matimage"][0]["@"]["uri"]), "tmp_name" => $this->package_dir . "/" . $arData["#"]["material"][0]["#"]["matimage"][0]["@"]["uri"], "size" => @filesize($this->package_dir . "/" . $arData["#"]["material"][0]["#"]["matimage"][0]["@"]["uri"]), "type" => $arData["#"]["material"][0]["#"]["matimage"][0]["@"]["imagtype"], 'description' => $imageDescription);
}
if (is_set($arData["#"]["response_lid"][0]["@"], "rcardinality")) {
switch ($arData["#"]["response_lid"][0]["@"]["rcardinality"]) {
case "Multiple":
$arQ["QUESTION_TYPE"] = 'M';
break;
case "Text":
$arQ["QUESTION_TYPE"] = 'T';
break;
case "Sort":
$arQ["QUESTION_TYPE"] = 'R';
break;
default:
$arQ["QUESTION_TYPE"] = 'S';
break;
}
}
if (is_set($arResp["#"]["respcondition"][0]["#"], "setvar")) {
$arQ["POINT"] = $arResp["#"]["respcondition"][0]["#"]["setvar"][0]['#'];
}
//Additional
if ($bx = $r->SelectNodes("/questestinterop/item/bitrix/")) {
$arQ = array_merge($arQ, $this->_MakeFields($bx->__toArray(), $TYPE));
unset($bx);
}
$arFields = array_merge($arFields, $arQ);
$cl = new CLQuestion();
$ID = $cl->Add($arFields);
if ($ID > 0) {
$PARENT_ID = $ID;
$arCorrect = array();
if (is_set($arResp["#"]["respcondition"][0]["#"], "conditionvar") && is_set($arResp["#"]["respcondition"][0]["#"]["conditionvar"][0]["#"], "varequal")) {
foreach ($arResp["#"]["respcondition"][0]["#"]["conditionvar"][0]["#"]["varequal"] as $ar) {
$arCorrect[] = $ar["#"];
}
}
if (is_set($arData["#"]["response_lid"][0]["#"], "render_choice") && is_set($arData["#"]["response_lid"][0]["#"]["render_choice"][0]["#"], "response_label")) {
$i = 0;
foreach ($arData["#"]["response_lid"][0]["#"]["render_choice"][0]["#"]["response_label"] as $ar) {
$i += 10;
$cl = new CLAnswer();
$arFields = array("QUESTION_ID" => $PARENT_ID, "SORT" => $i, "CORRECT" => in_array($ar["@"]["ident"], $arCorrect) ? "Y" : "N", "ANSWER" => $ar["#"]["material"][0]["#"]["mattext"][0]["#"]);
$AswerID = $cl->Add($arFields);
$res = $AswerID > 0;
if (!$res) {
if ($e = $APPLICATION->GetException()) {
$this->arWarnings[$TYPE][] = array("TITLE" => $TITLE, "TEXT" => $e->GetString());
}
}
}
}
} else {
if ($e = $APPLICATION->GetException()) {
$this->arWarnings[$TYPE][] = array("TITLE" => $TITLE, "TEXT" => $e->GetString());
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:import.php
示例11: unset
}
}
unset($course);
}
if ($COURSE_ID > 0) {
$APPLICATION->SetTitle(str_replace("#ID#", $COURSE_ID, GetMessage("LEARNING_EDIT_TITLE2")));
} else {
$APPLICATION->SetTitle(GetMessage("LEARNING_EDIT_TITLE1"));
}
//Defaults
$str_ACTIVE = "Y";
$str_SORT = "500";
$str_DETAIL_TEXT_TYPE = $str_PREVIEW_TEXT_TYPE = "text";
$res = false;
if ($COURSE_ID > 0) {
$course = new CCourse();
$linkedLessonId = CCourse::CourseGetLinkedLesson($COURSE_ID);
if ($oAccess->IsLessonAccessible($linkedLessonId, CLearnAccess::OP_LESSON_READ)) {
$res = $course->GetByID($COURSE_ID);
} else {
$APPLICATION->SetTitle(GetMessage('LEARNING_ACCESS_D'));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$aContext = array(array("ICON" => "btn_list", "TEXT" => GetMessage("LEARNING_BACK_TO_ADMIN"), "LINK" => "learn_unilesson_admin.php?lang=" . LANG . '&PARENT_LESSON_ID=-1' . GetFilterParams("filter_"), "TITLE" => GetMessage("LEARNING_BACK_TO_ADMIN")));
$context = new CAdminContextMenu($aContext);
$context->Show();
CAdminMessage::ShowMessage(GetMessage("LEARNING_BAD_COURSE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
}
if ($res === false || !$res->ExtractFields("str_")) {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:learn_course_edit.php
示例12: 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']);
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php
示例13: 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
|
请发表评论