Exemplo n.º 1
0
function assignCourse()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $lang =& DoceboLanguage::createInstance('code');
    $code_manager = new CodeManager();
    $selector = new Selector_Course();
    $id_code_group = Get::req('id_code_group', DOTY_INT, '0');
    if (Get::req('confirm', DOTY_MIXED, '')) {
        $selector->parseForState($_POST);
        $course_selected = $selector->getSelection();
        if ($code_manager->insertCourseAssociation($course_selected, $id_code_group)) {
            Util::jump_to('index.php?modname=code&op=list&result=ok');
        }
        Util::jump_to('index.php?modname=code&op=list&result=err');
    }
    $array_course_associated = $code_manager->getCourseAssociated($id_code_group);
    $selector->resetSelection($array_course_associated);
    cout(getTitleArea(array('index.php?modname=code&amp;op=list' => $lang->def('_CODE'), $lang->def('_COURSES'))) . '<div class="std_block">');
    $selector->parseForState($_POST);
    cout(Form::openForm('add_group_code_form', 'index.php?modname=code&amp;op=assign_course&amp;id_code_group=' . $id_code_group) . $selector->loadCourseSelector(true));
    cout(Form::openButtonSpace() . Form::getButton('confirm', 'confirm', $lang->def('_INSERT')) . Form::getButton('undo_group', 'undo_group', $lang->def('_UNDO')) . Form::closeButtonSpace());
    cout('</div>');
}