Esempio n. 1
0
             } else {
                 // Remove that lesson from the list by swapping it with the last lesson - no questions left to dig
                 $directions_to_cover[$directionId]['lessons'][$selected_lesson] = $directions_to_cover[$directionId]['lessons'][$directions_to_cover[$directionId]['lessonsCount'] - 1];
                 $directions_to_cover[$directionId]['lessonsCount']--;
                 // Do not decrease the questions - none was assigned
             }
         }
     }
 }
 if (G_VERSIONTYPE == 'enterprise') {
     #cpp#ifdef ENTERPRISE
     // For enterprise edition include also any skill or skill_categories requested
     /************** Step 1: Create all the skills involved array in $skills_to_cover ***********/
     foreach ($skill_categories_to_cover as $categoryId => $category) {
         // Get all skill_category lessons
         $skill_category_skills = EfrontSkill::getCategorySkills($categoryId);
         $skill_categories_to_cover[$categoryId]['skills'] = array();
         $skill_categories_to_cover[$categoryId]['skillsCount'] = sizeof($skill_category_skills);
         // used with rand()
         foreach ($skill_category_skills as $skillId => $skill) {
             $skill_categories_to_cover[$categoryId]['skills'][] = $skillId;
             if (!isset($skills_to_cover[$skillId])) {
                 $skills_to_cover[$skillId] = array("id" => $skillId, "questions_asked" => 0, "total_questions" => 0, "questions" => array());
             }
         }
     }
     /********** Step 2: Get all questions related with those questions********/
     $all_implicated_questions = eF_getTableData("questions_to_skills JOIN questions ON id = questions_id", "id, skills_ID", "skills_ID in ('" . implode("','", array_keys($skills_to_cover)) . "') AND type <> 'raw_text'");
     foreach ($all_implicated_questions as $question) {
         $skills_to_cover[$question['skills_ID']]['total_questions']++;
         $skills_to_cover[$question['skills_ID']]['questions'][] = $question['id'];