Ejemplo n.º 1
0
function organization_categorize_sco()
{
    $language = isset($_SESSION['idCourse']) && defined("LMS") ? Docebo::course()->getValue('lang_code') : false;
    $idResource = Get::req('idResource', DOTY_INT, 0);
    $sco_id = Get::req('sco_id', DOTY_INT, 0);
    $idItem = Get::req('idItem', DOTY_INT, 0);
    $scormorg_title = Get::req('scormorg_title', DOTY_STRING, '');
    $back_url = 'index.php?modname=storage&op=org_select_sco
		&idResource=' . $idResource . '&title=' . $scormorg_title;
    $form_url = 'index.php?modname=storage&op=org_categorize_sco
		&idResource=' . $idResource . '&sco_id=' . $sco_id;
    $form_url = 'index.php?modname=storage&op=display';
    $qtxt = "SELECT idscorm_item, title, identifierref FROM\r\n\t\t" . $GLOBALS['prefix_lms'] . "_scorm_items WHERE idscorm_item='" . (int) $sco_id . "'\r\n\t\tAND idscorm_organization='" . (int) $idResource . "'";
    $q = sql_query($qtxt);
    $row = mysql_fetch_assoc($q);
    Util::widget('kbcategorize', array('original_name' => $row['title'], 'r_item_id' => (int) $sco_id, 'scormorg_id' => (int) $idResource, 'r_type' => 'scoitem', 'r_env' => 'course_lo', 'r_env_parent_id' => (int) $_SESSION['idCourse'], 'r_param' => 'chapter=' . $row['identifierref'], 'language' => $language, 'back_url' => $back_url, 'form_url' => $form_url, 'form_extra_hidden' => array('idItem' => $idItem)));
}
Ejemplo n.º 2
0
 function addItem($idParent, $title, $objectType, $idResource, $idCategory, $idUser, $idAuthor, $version, $difficult, $description, $language, $resource, $objective, $dateInsert, $otherData = NULL, $idCourse = FALSE)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
     $this->org_title = $title;
     $this->org_objectType = $objectType;
     $this->org_idResource = $idResource;
     $this->org_idCategory = $idCategory;
     $this->org_idUser = $idUser;
     $this->org_idAuthor = $idAuthor;
     $this->org_version = $version;
     $this->org_difficult = $difficult;
     $this->org_description = $description;
     $this->org_language = $language;
     $this->org_resource = $resource;
     $this->org_objective = $objective;
     $this->org_dateInsert = $dateInsert;
     $this->org_prerequisites = '';
     $this->org_isTerminator = 0;
     $this->org_visible = 1;
     if ($idCourse === FALSE) {
         $this->org_idCourse = $this->idCourse;
     } else {
         $this->org_idCourse = $idCourse;
     }
     require_once _lms_ . '/lib/lib.module.php';
     $lo = createLO($objectType);
     if ($lo) {
         // Add object to the uncategorized resources
         require_once _lms_ . '/lib/lib.kbres.php';
         $kbres = new KbRes();
         $lang = isset($_SESSION['idCourse']) && defined("LMS") ? Docebo::course()->getValue('lang_code') : false;
         $kbres->saveUncategorizedResource($title, $idResource, $objectType, 'course_lo', $this->org_idCourse, false, $lang);
     }
     $arrParamsInfo = $lo->getParamInfo();
     if ($arrParamsInfo !== FALSE) {
         $param = current($arrParamsInfo);
         $this->org_idParam = setLOParam(NULL, $param['param_name'], '');
         next($arrParamsInfo);
         while ($param = current($arrParamsInfo)) {
             setLOParam($this->org_idParam, $param['param_name'], '');
             next($arrParamsInfo);
         }
         reset($arrParamsInfo);
     } else {
         $this->org_idParam = setLOParam(NULL, 'idReference', '');
     }
     $idReference = TreeDb::addFolderById($idParent, $this->getNewPos($idParent));
     setLOParam($this->org_idParam, 'idReference', $idReference);
     return $idReference;
 }
Ejemplo n.º 3
0
function logIntoCourse($id_course, $gotofirst_page = true)
{
    // Reset previous opened track session if any
    if (!Docebo::user()->isAnonymous() && isset($_SESSION['idCourse'])) {
        require_once _lms_ . '/lib/lib.track_user.php';
        TrackUser::setActionTrack(getLogUserId(), $_SESSION['idCourse'], '', '');
    }
    // Unset possibile previous session setting
    if (isset($_SESSION['direct_play'])) {
        unset($_SESSION['direct_play']);
    }
    $re_course = sql_query("\r\n\tSELECT level, status, waiting\r\n\tFROM %lms_courseuser\r\n\tWHERE idCourse = " . (int) $id_course . " AND idUser = "******"");
    list($level_c, $status_user, $waiting_user) = sql_fetch_row($re_course);
    Docebo::setCourse($id_course);
    $course_info = Docebo::course()->getAllInfo();
    $course_info['course_status'] = $course_info['status'];
    $course_info['user_status'] = $status_user;
    $course_info['waiting'] = $waiting_user;
    $course_info['level'] = $level_c;
    // Can the user enter into the course ?
    if (!Man_Course::canEnterCourse($course_info)) {
        return false;
    }
    // Disable tracking for ghost level
    $_SESSION['is_ghost'] = $course_info['level'] == 2 ? true : false;
    // If it's the first time we need to change the course status
    if ($course_info['user_status'] == _CUS_SUBSCRIBED) {
        require_once _lms_ . '/lib/lib.stats.php';
        saveTrackStatusChange(getLogUserId(), $id_course, _CUS_BEGIN);
    }
    // Setup some session data
    $_SESSION['timeEnter'] = date("Y-m-d H:i:s");
    $_SESSION['idCourse'] = $id_course;
    $_SESSION['levelCourse'] = $course_info['level'];
    //we need to redo this
    //$_SESSION['idEdition'] 		= $id_e;
    Docebo::user()->loadUserSectionST('/lms/course/private/' . $course_info['level'] . '/');
    Docebo::user()->SaveInSession();
    // Initialize the session into the course
    TrackUser::createSessionCourseTrack();
    $first_page = firstPage();
    $_SESSION['current_main_menu'] = $first_page['idMain'];
    $_SESSION['sel_module_id'] = $first_page['idModule'];
    $jumpurl = 'index.php?modname=' . $first_page['modulename'] . '&op=' . $first_page['op'] . '&id_module_sel=' . $first_page['idModule'];
    // course in direct play or assessment
    if ($course_info['direct_play'] == 1 || $course_info['course_type'] == 'assessment') {
        if ($_SESSION['levelCourse'] >= 4) {
            // direct play with a teacher, basically it's not ok
            // check if we are managing the LOs from admin: if yes, jump into the test management
            if ($course_info['course_type'] == 'assessment' && Get::req('from_admin', DOTY_INT, 0) > 0) {
                // enter the assessment course and go to test editing if there is a test with no question in it
                $query = "SELECT idOrg, idResource " . " FROM %lms_organization " . " WHERE idCourse = " . (int) $_SESSION['idCourse'] . " AND objectType = 'test' " . " ORDER BY path ASC, title ASC " . " LIMIT 0,1";
                $res = sql_query($query);
                if ($res && sql_num_rows($res) > 0) {
                    list($id_org, $id_test) = sql_fetch_row($res);
                    if ($id_test > 0) {
                        require_once _lms_ . '/lib/lib.test.php';
                        $tman = new TestManagement($id_test);
                        if ($tman->getNumberOfQuestion() <= 0) {
                            Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $id_test . '&back_url=' . urlencode($jumpurl));
                        }
                    }
                }
            }
        } else {
            // direct play with a student
            // i need to play directly the course if it's not completed and is the only object of the course
            require_once _lms_ . '/lib/lib.orgchart.php';
            $orgman = new OrganizationManagement($_SESSION['idCourse']);
            $first_lo =& $orgman->getInfoWhereType(false, $_SESSION['idCourse']);
            if (count($first_lo) == 1) {
                $_SESSION['direct_play'] = 1;
                $obj = array_shift($first_lo);
                Util::jump_to('index.php?modname=organization&op=custom_playitem&id_item=' . $obj['id_org'] . '');
            } elseif (count($first_lo) >= 2) {
                $obj = array_shift($first_lo);
                // if we have more than an object we need to play the first one until it's completed
                $query = "SELECT status FROM %lms_commontrack WHERE idReference = " . (int) $obj['id_org'] . " AND idUser = "******"assessment") {
    		//check if we are managing the LOs from admin: if yes, jump into the test management
    		if (Get::req('from_admin', DOTY_INT, 0) > 0) {
    			//enter the assessment course and go to test editing
    			$query = "SELECT idOrg, idResource FROM %lms_organization WHERE idCourse=".(int)$_SESSION['idCourse']." AND objectType='test' "
    				." ORDER BY path ASC, title ASC LIMIT 0,1";
    			$res = sql_query($query);
    			if ($res && sql_num_rows($res)>0) {
    
    				list($id_org, $id_test) = sql_fetch_row($res);
    
    				if ($id_test > 0) {
    					require_once(_lms_.'/lib/lib.test.php');
    					$tman = new TestManagement($id_test);
    
    					if ($tman->getNumberOfQuestion() <= 0) {
    						Util::jump_to('index.php?modname=test&op=modtestgui&idTest='.$id_test.'&back_url='.urlencode($jumpurl));
    					}
    				}
    			}
    		}
    	}
    	if($gotofirst_page) Util::jump_to($jumpurl);
    	else return true;
    }
    
    
    switch($course_info['course_type']) {
    	case "assessment" : {
    
    		if($_SESSION['levelCourse'] <= 3) {
    
    			// i need to play directly the test
    			require_once($GLOBALS['where_lms'].'/lib/lib.orgchart.php');
    			$orgman = new OrganizationManagement($_SESSION['idCourse']);
    			$test =& $orgman->getInfoWhereType('test', $_SESSION['idCourse']);
    
    			if(count($test) == 1) {
    				$obj = array_shift($test);
    				$_SESSION['test_assessment'] = 1;
    				Util::jump_to('index.php?modname=organization&op=custom_playitem&id_item='.$obj['id_org'].'');
    			}
    			if($gotofirst_page) Util::jump_to($jumpurl);
    			else return true;
    		} else {
    			if($gotofirst_page) {
    				//...
    				Util::jump_to($jumpurl);
    			}
    			else return true;
    		}
    	};break;
    	default: {
    		if($gotofirst_page) Util::jump_to($jumpurl);
    		else return true;
    	}
    }
    /* not used in
    // now analyze the course type and select the acton to perform
    if(isset($_GET['showresult'])) {
    
    	require_once(_lms_.'/lib/lib.orgchart.php');
    	$orgman = new OrganizationManagement($_SESSION['idCourse']);
    	$scorm =& $orgman->getInfoWhereType('scormorg', $_SESSION['idCourse']);
    
    	if(count($scorm) == '1') {
    		$obj = array_shift($scorm);
    		Util::jump_to('index.php?modname=organization&op=scorm_track&id_user='******'&id_org='.$obj['id_resource'].'&amp;back='.$GLOBALS['course_descriptor']->getValue('direct_play'));
    	}
    	Util::jump_to('index.php?modname=course&op=showresults&id_course='.$_SESSION['idCourse']);
    }
    */
}
Ejemplo n.º 4
0
    if (Docebo::course()->getValue('show_progress') == 1) {
        require_once $GLOBALS['where_lms'] . '/lib/lib.stats.php';
        $total = getNumCourseItems($_SESSION['idCourse'], FALSE, getLogUserId(), FALSE);
        $tot_complete = getStatStatusCount(getLogUserId(), $_SESSION['idCourse'], array('completed', 'passed'));
        $tot_incomplete = $total - $tot_complete;
        $tot_passed = getStatStatusCount(getLogUserId(), $_SESSION['idCourse'], array('passed'));
        $tot_failed = getStatStatusCount(getLogUserId(), $_SESSION['idCourse'], array('failed'));
    }
    // print progress bar -------------------------------------------------
    $user_stats_table = "";
    if (Docebo::course()->getValue('show_progress') == 1 && true) {
        $user_stats_table = '<table id="user_stats" class="quick_table">' . '<thead><tr>' . (isset($user_stats['head'][0]) ? '<th scope="col">' . $user_stats['head'][0] . '</th>' : '') . (isset($user_stats['head'][1]) ? '<th scope="col">' . $user_stats['head'][1] . '</th>' : '') . (isset($user_stats['head'][2]) ? '<th scope="col">' . $user_stats['head'][2] . '</th>' : '') . '</tr></thead><tbody><tr>' . (isset($user_stats['body'][0]) ? '<td>' . $user_stats['body'][0] . '</td>' : '') . (isset($user_stats['body'][1]) ? '<td>' . $user_stats['body'][1] . '</td>' : '') . (isset($user_stats['body'][2]) ? '<td>' . $user_stats['body'][2] . '</td>' : '') . '</tr></tbody>' . '</table>';
        $all_stats .= "</br>Progress:</span>" . renderProgress($tot_complete, $tot_failed, $total, false);
    }
    $course_stats_table = "";
    if (Docebo::course()->getValue('show_progress') == 1 && true) {
        $course_stats_table .= '<table id="course_stats" class="quick_table">' . '<thead><tr>' . '<th scope="col">' . Lang::t('_PROGRESS_ALL', 'course') . '</th>' . '<th scope="col">' . Lang::t('_PROGRESS_COMPLETED', 'course') . '</th>' . '<th scope="col">' . Lang::t('_PROGRESS_INCOMPLETE', 'course') . '</th>' . '</tr></thead><tbody><tr>' . '<td>' . $total . '</td>' . '<td>' . $tot_complete . '</td>' . '<td>' . $tot_incomplete . '</td>' . '</tr></tbody>' . '</table>';
        $course_stats_table .= "\n";
    }
    $course_ex_stats_table = "";
    if (Docebo::course()->getValue('show_progress') == 1 && true) {
        $course_ex_stats_table .= '<table id="course_exstats" class="quick_table">' . '<thead><tr>' . '<th scope="col">' . Lang::t('_PROGRESS_PASSED', 'course') . '</th>' . '<th scope="col">' . Lang::t('_PROGRESS_FAILED', 'course') . '</th>' . '</tr></thead><tbody><tr>' . '<td>' . $tot_passed . '</td>' . '<td>' . $tot_failed . '</td>' . '</tr></tbody>' . '</table>';
        $course_ex_stats_table .= "\n";
    }
    $all_stats .= '<div id="arrow"></div><div class="clear"></div>';
    $all_stats .= '</h3><div>' . $user_stats_table . '' . $course_stats_table . '' . $course_ex_stats_table . $sponsor_img . '</div>';
    $all_stats .= '</div>';
    $menu_bottom .= $menu_left . $menu_right . '</div>';
    $menu_reborn .= $all_stats . '<div class="clear"></div>' . $menu_bottom;
    cout($menu_reborn, 'menu');
}