Beispiel #1
0
 function admin()
 {
     if (!isset($_REQUEST['partial']) || !$_REQUEST['partial'] == true) {
         $this->base();
         return;
     }
     $notesController = new NotesController();
     $notesController->mostrarForm();
     $coursesController = new CoursesController();
     $coursesController->mostrarForm();
 }
Beispiel #2
0
    // Nothing to do
}
$nameTools = getCourseCatalogNameTools($action);
if (empty($nameTools)) {
    $nameTools = get_lang('CourseManagement');
} else {
    if (!in_array($action, array('sortmycourses', 'createcoursecategory', 'display_random_courses', 'display_courses', 'subscribe'))) {
        $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'auth/courses.php', 'name' => get_lang('CourseManagement'));
    }
    if ($action == 'createcoursecategory') {
        $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'auth/courses.php?action=sortmycourses', 'name' => get_lang('SortMyCourses'));
    }
    $interbreadcrumb[] = array('url' => '#', 'name' => $nameTools);
}
// course description controller object
$courses_controller = new CoursesController();
// We are moving a course or category of the user up/down the list (=Sort My Courses).
if (isset($_GET['move'])) {
    if (isset($_GET['course'])) {
        if ($ctok == $_GET['sec_token']) {
            $courses_controller->move_course($_GET['move'], $_GET['course'], $_GET['category']);
        }
    }
    if (isset($_GET['category']) && !$_GET['course']) {
        if ($ctok == $_GET['sec_token']) {
            $courses_controller->move_category($_GET['move'], $_GET['category']);
        }
    }
}
// We are moving the course of the user to a different user defined course category (=Sort My Courses).
if (isset($_POST['submit_change_course_category'])) {
Beispiel #3
0
                $courseTopics = $descriptionTool;
                break;
        }
    }
    $courses[] = ['course' => $sessionCourse, 'description' => $courseDescription, 'tags' => $courseTags, 'objectives' => $courseObjectives, 'topics' => $courseTopics, 'coaches' => $coachesData, 'extra_fields' => $courseValues->getAllValuesForAnItem($sessionCourse->getId())];
}
$sessionDates = SessionManager::parseSessionDates(['display_start_date' => $session->getDisplayStartDate(), 'display_end_date' => $session->getDisplayEndDate(), 'access_start_date' => $session->getAccessStartDate(), 'access_end_date' => $session->getAccessEndDate(), 'coach_access_start_date' => $session->getCoachAccessStartDate(), 'coach_access_end_date' => $session->getCoachAccessEndDate()]);
$sessionRequirements = $sequenceResourceRepo->getRequirements($session->getId(), SequenceResource::SESSION_TYPE);
$hasRequirements = false;
foreach ($sessionRequirements as $sequence) {
    if (!empty($sequence['requirements'])) {
        $hasRequirements = true;
        break;
    }
}
$courseController = new CoursesController();
/* View */
//$template = new Template($session->getName(), true, true, false, true, false);
$template = \Chamilo\CoreBundle\Framework\Container::getTwig();
$template->addGlobal('show_tutor', api_get_setting('session.show_session_coach') === 'true' ? true : false);
$template->addGlobal('pageUrl', api_get_path(WEB_PATH) . "session/{$session->getId()}/about/");
$template->addGlobal('session', $session);
$template->addGlobal('session_date', $sessionDates);
$template->addGlobal('is_subscribed', SessionManager::isUserSubscribedAsStudent($session->getId(), api_get_user_id()));
$template->addGlobal('subscribe_button', $courseController->getRegisteredInSessionButton($session->getId(), $session->getName(), $hasRequirements));
$template->addGlobal('courses', $courses);
$template->addGlobal('essence', \Essence\Essence::instance());
$template->addGlobal('session_extra_fields', $sessionValues->getAllValuesForAnItem($session->getId(), true));
$template->addGlobal('has_requirements', $hasRequirements);
$template->addGlobal('sequences', $sessionRequirements);
//$templateFolder = api_get_configuration_value('default_template');
Beispiel #4
0
 case ConfigApp::$ACTION_SIDEBAR:
     $uiController = new UIController();
     $uiController->sidebar();
     break;
 case ConfigApp::$ACTION_ADD_NOTE:
     $notesController = new NotesController();
     $notesController->addNote();
     break;
 case ConfigApp::$ACTION_DELETE_NOTE:
     $notesController = new NotesController();
     $notesController->closeNote();
     break;
     //Courses
 //Courses
 case ConfigApp::$ACTION_VIEW_COURSES:
     $coursesController = new CoursesController();
     $coursesController->mostrar();
     break;
 case ConfigApp::$ACTION_ADD_MEDIA:
     $mediaController = new MediaController();
     $mediaController->addMedia();
     break;
     //ADMIN
 //ADMIN
 case ConfigApp::$ACTION_VIEW_ADMIN:
     $uiController = new UIController();
     $uiController->admin();
     break;
 default:
     echo 'Pagina no encontrada';
     break;
                } else {
                    // Update
                    $sequenceResource->getSequence()->setGraphAndSerialize($graph);
                }
                $em->persist($sequenceResource);
                $em->flush();
                echo Display::return_message(get_lang('Saved'), 'success');
                break;
        }
        break;
    case 'get_requirements':
        $userId = api_get_user_id();
        switch ($type) {
            case SequenceResource::SESSION_TYPE:
                $session = api_get_session_info($id);
                $sequences = $repository->getRequirements($session['id'], $type);
                if (count($sequences) === 0) {
                    break;
                }
                $sequenceList = SequenceResourceManager::checkRequirementsForUser($sequences, $type, $userId);
                $allowSubscription = SequenceResourceManager::checkSequenceAreCompleted($sequenceList);
                $courseController = new CoursesController();
                $subscribeButton = '';
                if ($allowSubscription) {
                    $subscribeButton = $courseController->getRegisteredInSessionButton($session['id'], $session['name'], false);
                }
                echo Container::getTemplating()->render('@template_style/sequence_resource/session_requirements.html.twig', ['sequences' => $sequenceList, 'allow_subscription' => $allowSubscription, 'subscribe_button' => $subscribeButton]);
                break;
        }
        break;
}
Beispiel #6
0
                }
                $em->persist($sequenceResource);
                $em->flush();
                echo Display::return_message(get_lang('Saved'), 'success');
                break;
        }
        break;
    case 'get_requirements':
        $userId = api_get_user_id();
        switch ($type) {
            case SequenceResource::SESSION_TYPE:
                $session = api_get_session_info($id);
                $sequences = $repository->getRequirements($session['id'], $type);
                if (count($sequences) === 0) {
                    break;
                }
                $sequenceList = SequenceResourceManager::checkRequirementsForUser($sequences, $type, $userId);
                $allowSubscription = SequenceResourceManager::checkSequenceAreCompleted($sequenceList);
                $courseController = new CoursesController();
                $view = new Template(null, false, false, false, false, false);
                $view->assign('sequences', $sequenceList);
                $view->assign('allow_subscription', $allowSubscription);
                if ($allowSubscription) {
                    $view->assign('subscribe_button', $courseController->getRegisteredInSessionButton($session['id'], $session['name'], false));
                }
                $template = $view->get_template('sequence_resource/session_requirements.tpl');
                $view->display($template);
                break;
        }
        break;
}
}
if (un_hash_val($_SESSION['current_user_type']) != constantss::$user_type_admin) {
    header("Location:main_page.php");
    exit;
}
if (isset($_SESSION['course'])) {
    $hashed_course_id = $_SESSION['course'];
} else {
    $hashed_course_id = -1;
}
if (isset($_SESSION['user_type'])) {
    $hashed_user_type = $_SESSION['user_type'];
} else {
    $hashed_user_type = -1;
}
$CoursesController = new CoursesController();
$UsersCoursesController = new UsersCoursesController();
$UsersCoursesController->set_id($hashed_course_id);
$UsersCoursesController->set_user_type($hashed_user_type);
?>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">


        <!-- Bootstrap -->
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/custom.css?<?php 
echo time();