当前位置: 首页>>代码示例>>Python>>正文


Python Courses.get_topics_all方法代码示例

本文整理汇总了Python中oasis.lib.Courses.get_topics_all方法的典型用法代码示例。如果您正苦于以下问题:Python Courses.get_topics_all方法的具体用法?Python Courses.get_topics_all怎么用?Python Courses.get_topics_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oasis.lib.Courses的用法示例。


在下文中一共展示了Courses.get_topics_all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: exam_available_q_list

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_topics_all [as 别名]
def exam_available_q_list(course_id):
    """ Return a list of questions that can be used to create an assessment
    """
    topics = Courses.get_topics_all(course_id, archived=0, numq=False)
    for num, topic in topics.iteritems():
        topic_id = topics[num]['id']
        topics[num]['questions'] = get_q_list(topic_id)
    return topics
开发者ID:colincoghill,项目名称:oasisqe,代码行数:10,代码来源:API.py

示例2: get_create_exam_q_list

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_topics_all [as 别名]
def get_create_exam_q_list(course):
    """ Return a list of questions that can be used to create an assessment
    """

    topics = Courses.get_topics_all(course, archived=0, numq=False)
    for num, topic in topics.iteritems():
        topic_id = topics[num]['id']
        topics[num]['questions'] = _get_q_list_sorted(topic_id)
    return topics
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:11,代码来源:CourseAdmin.py

示例3: get_topics_list

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_topics_all [as 别名]
def get_topics_list(course_id, archived=2):
    """ Return a list of all topics in the course.
    """

    reload_if_needed()
    if not "topics" in COURSES[course_id]:
        COURSES[course_id]['topics'] = Courses.get_topics_all(course_id, archived, True)
    topics = COURSES[course_id]['topics']
    tlist = [topics[tid] for tid in topics]
    return tlist
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:12,代码来源:Courses2.py

示例4: cadmin_edit_topic

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_topics_all [as 别名]
def cadmin_edit_topic(course_id, topic_id):
    """ Present a page to view and edit a topic, including adding/editing
        questions and setting some parameters.
    """
    user_id = session['user_id']

    if not course_id:
        abort(404)

    course = Courses2.get_course(course_id)
    topic = {
        'id': topic_id,
        'position': Topics.get_pos(topic_id),
        'name': Topics.get_name(topic_id)
    }
    questions = [question
                 for question in Topics.get_qts(topic_id).values()]
    for question in questions:
        question['embed_id'] = DB.get_qt_embedid(question['id'])
        if question['embed_id']:
            question['embed_url'] = "%s/embed/question/%s/question.html" % \
                                    (OaConfig.parentURL, question['embed_id'])
        else:
            question['embed_url'] = None
        question['editor'] = DB.get_qt_editor(question['id'])

    all_courses = Courses2.get_course_list()
    all_courses = [crse
                   for crse in all_courses
                   if satisfy_perms(user_id, int(crse['id']),
                                    ("questionedit", "courseadmin",
                                    "sysadmin"))]
    all_courses.sort(lambda f, s: cmp(f['name'], s['name']))

    all_course_topics = []
    for crse in all_courses:
        topics = Courses.get_topics_all(crse['id'], numq=False)
        if topics:
            all_course_topics.append({'course': crse['name'], 'topics': topics})

    questions.sort(key=lambda k: k['position'])
    return render_template(
        "courseadmin_edittopic.html",
        course=course,
        topic=topic,
        questions=questions,
        all_course_topics=all_course_topics
    )
开发者ID:tkanesh,项目名称:oasisqe,代码行数:50,代码来源:views_cadmin.py

示例5: cadmin_view_topic

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_topics_all [as 别名]
def cadmin_view_topic(course_id, topic_id):
    """ Present a page to view a topic, including basic stats """
    user_id = session["user_id"]

    if not course_id:
        abort(404)

    course = Courses2.get_course(course_id)
    topic = {"id": topic_id, "position": Topics.get_pos(topic_id), "name": Topics.get_name(topic_id)}
    questions = [question for question in Topics.get_qts(topic_id).values()]
    for question in questions:
        question["embed_id"] = DB.get_qt_embedid(question["id"])
        if question["embed_id"]:
            question["embed_url"] = "%s/embed/question/%s/question.html" % (OaConfig.parentURL, question["embed_id"])
        else:
            question["embed_url"] = None
        question["editor"] = DB.get_qt_editor(question["id"])

    all_courses = Courses2.get_course_list()
    all_courses = [
        crse
        for crse in all_courses
        if satisfy_perms(user_id, int(crse["id"]), ("questionedit", "courseadmin", "sysadmin"))
    ]
    all_courses.sort(lambda f, s: cmp(f["name"], s["name"]))

    all_course_topics = []
    for crse in all_courses:
        topics = Courses.get_topics_all(crse["id"], numq=False)
        if topics:
            all_course_topics.append({"course": crse["name"], "topics": topics})

    questions.sort(key=lambda k: k["position"])
    return render_template(
        "courseadmin_viewtopic.html",
        course=course,
        topic=topic,
        questions=questions,
        all_course_topics=all_course_topics,
    )
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:42,代码来源:views_cadmin.py

示例6: get_topics

# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import get_topics_all [as 别名]
def get_topics(cid, archived=2):
    """ Return a dict of all topics in the course. """
    reload_if_needed()
    if not "topics" in COURSES[cid]:
        COURSES[cid]['topics'] = Courses.get_topics_all(cid, archived, True)
    return COURSES[cid]['topics']
开发者ID:jamesdoherty,项目名称:oasisqe,代码行数:8,代码来源:Courses2.py


注:本文中的oasis.lib.Courses.get_topics_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。