foreach ($questionList as $aQuestion) { $questionIdList[] = $aQuestion['id']; } $questionCondition = " AND Q.`id` NOT IN (" . implode(', ', array_map('intval', $questionIdList)) . ") "; } else { $questionCondition = ""; } // TODO probably need to adapt query with a left join on rel_exercise_question for filter $sql = "SELECT Q.`id`, Q.`title`, Q.`type`, Q.`id_category`\n FROM `" . $tbl_quiz_question . "` AS Q\n LEFT JOIN `" . $tbl_quiz_rel_exercise_question . "` AS REQ\n ON REQ.`questionId` = Q.`id`\n WHERE 1 = 1\n " . $questionCondition . "\n " . $filterCondition . "\n GROUP BY Q.`id`\n ORDER BY Q.`title`, Q.`id`"; } else { $sql = "SELECT Q.`id`, Q.`title`, Q.`type`, Q.`id_category`\n FROM `" . $tbl_quiz_question . "` AS Q\n LEFT JOIN `" . $tbl_quiz_rel_exercise_question . "` AS REQ\n ON REQ.`questionId` = Q.`id`\n WHERE 1 = 1\n " . $filterCondition . "\n GROUP BY Q.`id`\n ORDER BY Q.`title`, Q.`id`"; } } // get list $myPager = new claro_sql_pager($sql, $offset, get_conf('questionPoolPager', 25)); $questionList = $myPager->get_result_list(); /* * Output */ if (!is_null($exId)) { ClaroBreadCrumbs::getInstance()->prepend(get_lang('Exercise'), Url::Contextualize('./edit_exercise.php?exId=' . $exId)); ClaroBreadCrumbs::getInstance()->setCurrent(get_lang('Question pool'), Url::Contextualize($_SERVER['PHP_SELF'] . '?exId=' . $exId)); $pagerUrl = Url::Contextualize($_SERVER['PHP_SELF'] . '?exId=' . $exId); } else { if (!is_null($categoryId)) { $pagerUrl = Url::Contextualize($_SERVER['PHP_SELF'] . '?filter=' . $filter); } else { ClaroBreadCrumbs::getInstance()->setCurrent(get_lang('Question pool'), Url::Contextualize($_SERVER['PHP_SELF'])); $pagerUrl = Url::Contextualize($_SERVER['PHP_SELF']); } }
if (isset($_SESSION['admin_register_order_crit'])) { if ($_SESSION['admin_register_order_crit'] == 'user_id') { $toAdd = " ORDER BY `U`.`user_id` " . $_SESSION['admin_register_dir']; } else { $toAdd = " ORDER BY `" . $_SESSION['admin_register_order_crit'] . "` " . $_SESSION['admin_register_dir']; } $sql .= $toAdd; } //Build pager with SQL request if (!isset($_REQUEST['offset'])) { $offset = '0'; } else { $offset = (int) $_REQUEST['offset']; } $myPager = new claro_sql_pager($sql, $offset, $userPerPage); $userList = $myPager->get_result_list(); $isSearched = ''; //get the search keyword, if any if (!isset($_REQUEST['search'])) { $search = ''; } else { $search = $_REQUEST['search']; } $addToURL = isset($_REQUEST['addToURL']) ? $_REQUEST['addToURL'] : ''; $nameTools .= ' : ' . $courseData['name']; // search form if (isset($search) && $search != '') { $isSearched .= $search . '* '; } if ($isSearched == '' || !isset($isSearched)) { $title = '';
} $sortKeyList['s.last_edit_date'] = SORT_ASC; $sortKeyList['fb.last_edit_date'] = SORT_ASC; $sortKeyList['g.name'] = SORT_ASC; // get last submission titles $sql2 = "SELECT `s`.`group_id` as `authId`, `s`.`title`, DATE(`s`.`last_edit_date`) as date\n FROM `" . $tbl_wrk_submission . "` AS `s`\n LEFT JOIN `" . $tbl_wrk_submission . "` AS `s2`\n ON `s`.`group_id` = `s2`.`group_id`\n AND `s2`.`assignment_id` = " . (int) $req['assignmentId'] . "\n AND `s`.`last_edit_date` < `s2`.`last_edit_date`\n WHERE `s2`.`group_id` IS NULL\n AND `s`.`original_id` IS NULL\n AND `s`.`assignment_id` = " . (int) $req['assignmentId'] . "\n " . $submissionFilterSql . ""; } /*-------------------------------------------------------------------- WORK LIST --------------------------------------------------------------------*/ $offset = isset($_REQUEST['offset']) && !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $workPager = new claro_sql_pager($sql, $offset, $usersPerPage); foreach ($sortKeyList as $thisSortKey => $thisSortDir) { $workPager->add_sort_key($thisSortKey, $thisSortDir); } $workList = $workPager->get_result_list(); // add the title of the last submission in each displayed line $results = claro_sql_query_fetch_all($sql2); $lastWorkTitleList = array(); $last_edit_date_list = array(); foreach ($results as $result) { $lastWorkTitleList[$result['authId']] = $result['title']; $last_edit_date_list[$result['authId']] = $result['date']; } if (!empty($lastWorkTitleList)) { for ($i = 0; $i < count($workList); $i++) { if (isset($lastWorkTitleList[$workList[$i]['authId']])) { $workList[$i]['title'] = $lastWorkTitleList[$workList[$i]['authId']]; } if (isset($last_edit_date_list[$workList[$i]['authId']])) { $workList[$i]['last_edit_date'] = $last_edit_date_list[$workList[$i]['authId']];
if ($result[0] == $language) { $form .= "<option value={$result['0']} selected=\"selected\">" . $result[0] . "</option>"; } else { $form .= "<option value={$result['0']}>" . $result[0] . "</option>"; } } $form .= "</select>"; $form .= "<input type=\"submit\" value=\"OK\" />"; $form .= "</form>"; $dialogBox->form($form); echo $dialogBox->render(); // select variables with same content $sql = " SELECT DISTINCT L1.language , L1.varContent , L1.varName , L1.sourceFile\n FROM " . $tbl_translation . " L1,\n " . $tbl_translation . " L2,\n " . $tbl_used_lang . " U\n WHERE L1.language = \"" . $language . "\" and\n L1.language = L2.language and\n L1.varContent = L2.varContent and\n L1.varName <> L2.varName and\n L1.varName = U.varName\n ORDER BY L1.varContent, L1.varName"; // build pager $myPager = new claro_sql_pager($sql, $offset, $resultPerPage); $results = $myPager->get_result_list(); // display nb results echo '<p>' . get_lang('Total') . ': ' . $myPager->totalItemCount . '</p>'; // display pager echo $myPager->disp_pager_tool_bar($_SERVER['PHP_SELF'] . '?language=' . $language); // display table header echo "<table class=\"claroTable\" width=\"100%\">\n<thead>\n<tr class=\"headerX\">\n<th>N°</th>\n<th>language</th>\n<th>varName</th>\n<th>varContent</th>\n<th>sourceFile</th>\n</tr>\n</thead>\n<tbody>"; $varContent = ""; $i = $offset; $color = true; foreach ($results as $result) { if ($result['varContent'] != $varContent) { $varContent = $result['varContent']; $color = !$color; } if ($color == true) {
move_module_in_dock($module_id, $dock, 'down'); break; case 'remove': remove_module_dock($module_id, $dock); $dialogBox->success(get_lang('The module has been removed from this dock')); break; } //---------------------------------- // FIND INFORMATION //---------------------------------- $sql = "SELECT M.`id` AS `id`,\n M.`label` AS `label`,\n M.`name` AS `name`,\n M.`activation` AS `activation`,\n M.`type` AS `type`,\n D.`rank` AS `rank`\n FROM `" . $tbl_module . "` AS M, `" . $tbl_dock . "` AS D\n WHERE D.`module_id`= M.`id`\n AND D.`name` = '" . $dock . "'\n ORDER BY `rank`\n "; //pager creation $offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $myPager = new claro_sql_pager($sql, $offset, $modulePerPage); //$pagerSortDir = isset($_REQUEST['dir' ]) ? $_REQUEST['dir' ] : SORT_ASC; $moduleList = $myPager->get_result_list(); } //---------------------------------- // DISPLAY //---------------------------------- $out = ''; //display title $out .= claro_html_tool_title($nameTools); //Display Forms or dialog box(if needed) $out .= $dialogBox->render(); if (!empty($dock)) { //Display TOP Pager list $out .= $myPager->disp_pager_tool_bar('module_dock.php?dock=' . $dock); // start table... $out .= '<table class="claroTable emphaseLine" width="100%" border="0" cellspacing="2">' . '<thead>' . '<tr align="center" valign="top">' . '<th>' . get_lang('Icon') . '</th>' . '<th>' . get_lang('Module name') . '</th>' . '<th colspan="2">' . get_lang('Order') . '</th>' . '<th>' . get_lang('Remove from the dock') . '</th>' . '</tr>' . '</thead>' . '<tbody>'; $iteration = 1;
claro_disp_auth_form(true); } $is_allowedToEdit = claro_is_course_manager(); if (!$is_allowedToEdit) { claro_die(get_lang('Not allowed')); } require_once get_path('incRepositorySys') . '/lib/right/profile.class.php'; require_once get_path('incRepositorySys') . '/lib/pager.lib.php'; // Main section // Build profile list $itemPerPage = 10; $tbl_mdb_names = claro_sql_get_main_tbl(); $tblProfile = $tbl_mdb_names['right_profile']; $sql = " SELECT profile_id as id, name, description, locked, required\n FROM `" . $tblProfile . "`\n WHERE type = 'COURSE' "; $offset = isset($_REQUEST['offset']) && !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $profilePager = new claro_sql_pager($sql, $offset, $itemPerPage); $profileList = $profilePager->get_result_list(); $out = ''; $out .= claro_html_tool_title($nameTools); // Display table header $out .= '<table class="claroTable emphaseLine" >' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Name') . '</th>' . "\n" . '<th>' . get_lang('Rights') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>'; foreach ($profileList as $thisProfile) { $out .= '<tr align="center">' . "\n" . '<td align="left">' . get_lang($thisProfile['name']); if ($thisProfile['locked'] == '1') { $out .= ' <img src="' . get_icon_url('locked') . '" alt="' . get_lang('Lock') . '" />'; } $out .= '<br />' . "\n" . '<em>' . get_lang($thisProfile['description']) . '</em>' . "\n" . '<td>' . "\n" . '<a href="profile.php?cmd=rqEdit&display_profile=' . $thisProfile['id'] . '">' . '<img src="' . get_icon_url('settings') . '" alt="' . get_lang('Rights') . '" />' . "\n" . '</a>' . "\n" . '</td>' . "\n" . '</tr>' . "\n\n"; } $out .= '</tbody></table>'; $claroline->display->body->appendContent($out); echo $claroline->display->render();
} /** * PREPARE DISPLAY * * Display contains 2 parts: * * 1/ Filter/search panel * 2/ List of datas */ $sqlCourseList = prepare_get_filtred_course_list(); $myPager = new claro_sql_pager($sqlCourseList, $offsetC, get_conf('coursePerPage', 20)); $sortKey = isset($_GET['sort']) ? $_GET['sort'] : 'officialCode, intitule'; $sortDir = isset($_GET['dir']) ? $_GET['dir'] : SORT_ASC; $myPager->set_sort_key($sortKey, $sortDir); $myPager->set_pager_call_param_name('offsetC'); $courseList = $myPager->get_result_list(); if (is_array($courseList)) { $tbl_mdb_names = claro_sql_get_main_tbl(); foreach ($courseList as $courseKey => $course) { $sql = "SELECT\n count(IF(`isCourseManager`=0,1,null))\n AS `qty_stu`,\n #count only lines where user is not course manager\n\n count(IF(`isCourseManager`=1,1,null))\n AS `qty_cm`\n #count only lines where statut of user is 1\n FROM `" . $tbl_mdb_names['rel_course_user'] . "`\n WHERE code_cours = '" . claro_sql_escape($course['sysCode']) . "'\n GROUP BY code_cours"; $result = claro_sql_query_get_single_row($sql); $courseList[$courseKey]['qty_stu'] = $result['qty_stu']; $courseList[$courseKey]['qty_cm'] = $result['qty_cm']; } } // Prepare display of search/Filter panel $advanced_search_query_string = array(); $isSearched = ''; if (!empty($_REQUEST['search'])) { $isSearched .= trim($_REQUEST['search']) . ' '; }
if (!claro_is_allowed_to_edit()) { $sql .= " WHERE `visibility` = 'VISIBLE' "; } if (isset($_GET['sort'])) { $sortKeyList[$_GET['sort']] = isset($_GET['dir']) ? $_GET['dir'] : SORT_ASC; } else { $sortKeyList['end_date'] = SORT_ASC; $sortKeyList['title'] = SORT_ASC; } } $offset = isset($_REQUEST['offset']) && !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0; $assignmentPager = new claro_sql_pager($sql, $offset, $assignmentsPerPage); foreach ($sortKeyList as $thisSortKey => $thisSortDir) { $assignmentPager->add_sort_key($thisSortKey, $thisSortDir); } $assignmentList = $assignmentPager->get_result_list(); // Help URL $helpUrl = $is_allowedToEdit ? get_help_page_url('blockAssignmentsHelp', 'CLWRK') : null; // Command list $cmdList = array(); if ($is_allowedToEdit) { $cmdList[] = array('img' => 'assignment', 'name' => get_lang('Create a new assignment'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqMkAssig'))); if (claro_is_platform_admin() || get_conf('allow_download_all_submissions')) { $cmdList[] = array('img' => 'save', 'name' => get_lang('Download submissions'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=rqDownload'))); } if (get_conf('mail_notification', false) && !get_conf('automatic_mail_notification', false)) { $cmdList[] = array('img' => 'settings', 'name' => get_lang('Assignments preferences'), 'url' => claro_htmlspecialchars(Url::Contextualize('work_settings.php'))); } } $out = ''; $out .= claro_html_tool_title($nameTools, $helpUrl, $cmdList);
/* * Get list */ // pager initialisation if (!isset($_REQUEST['offset'])) { $offset = 0; } else { $offset = $_REQUEST['offset']; } $displayForm = $cmd == 'rqEdit' ? true : false; // prepare query // we need to check if exercise is used as a module in a learning path // to display a more complete confirm message for delete aciton $sql = "SELECT `id`, `title`, `description`\n FROM `" . $tbl_qwz_question_categorie . "`\n ORDER BY `title`"; $myPager = new claro_sql_pager($sql, $offset, get_conf('exercisesPerPage', 25)); $questionCategoryList = $myPager->get_result_list(); /* * Output */ ClaroBreadCrumbs::getInstance()->prepend(get_lang('Exercises'), Url::Contextualize('../exercise.php')); $nameTools = get_lang('Question categories'); $noQUERY_STRING = true; // Tool list $toolList = array(); if ($is_allowedToEdit) { $toolList[] = array('img' => 'quiz_new', 'name' => get_lang('New category'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=add'))); } $out = ''; $out .= $dialogBox->render(); $out .= claro_html_tool_title($nameTools, null, $toolList); if ($displayForm) {
if ($_REQUEST['order_crit'] == 'user_id') { $_SESSION['admin_course_class_order_crit'] = 'U`.`user_id'; } } if (isset($_SESSION['admin_course_class_order_crit'])) { $toAdd = " ORDER BY `" . $_SESSION['admin_course_class_order_crit'] . "` " . $_SESSION['admin_course_class_dir']; $sql .= $toAdd; } //Build pager with SQL request if (!isset($_REQUEST['offset'])) { $offset = "0"; } else { $offset = $_REQUEST['offset']; } $myPager = new claro_sql_pager($sql, $offset, $userPerPage); $resultList = $myPager->get_result_list(); } //------------------------------------ // DISPLAY //------------------------------------ $dialogBox = new DialogBox(); // Deal with interbredcrumps ClaroBreadCrumbs::getInstance()->prepend(get_lang('Classes'), get_path('rootAdminWeb') . 'admin_class.php'); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $nameTools = get_lang('Class members'); $out = ''; if (empty($class_id)) { $dialogBox->error(get_lang('Class not found')); $out .= $dialogBox->render(); } else { $cmdList = array();
$row = mysql_fetch_row($results); $count_total_diff_var = $row[0]; echo claro_html_tool_title($nameTools) . '<p>Total variables in Claroline scripts: <strong>' . $count_total_diff_var . '</strong></p>'; if (isset($_REQUEST['exCmd']) && $_REQUEST['exCmd'] == 'ToTranslate') { if (isset($_REQUEST['lang'])) { $language = $_REQUEST['lang']; } else { $language = DEFAULT_LANGUAGE; } printf("<p><a href=\"%s\">Back</a></p>", $_SERVER['PHP_SELF']); printf("<h4>Missing variables in %s</h4>", $language); // count missing lang var in devel complete file for this language $sql = " SELECT DISTINCT u.varName, u.sourceFile \n FROM " . $tbl_used_lang . " u \n LEFT JOIN " . $tbl_translation . " t ON \n (\n u.varName = t.varName \n AND t.language=\"" . $language . "\"\n ) \n WHERE t.varContent is NULL\n ORDER BY u.varName, u.sourceFile "; // build pager $myPager = new claro_sql_pager($sql, $offset, $resultPerPage); $result_missing_var = $myPager->get_result_list(); // display pager echo $myPager->disp_pager_tool_bar($_SERVER['PHP_SELF'] . '?exCmd=ToTranslate&lang=' . $language); // display table header echo "<table class=\"claroTable\" width=\"100%\" >\n"; echo "<thead>" . "<tr class=\"headerX\">" . "<th>VarName</th>" . "<th>SourceFile</th>" . "</tr>" . "</thead>" . "<tbody>\n"; // variables used to switch background color $varName = ''; $color = true; // browse missing variables foreach ($result_missing_var as $row_missing_var) { // get values $sourceFile = $row_missing_var['sourceFile']; if ($row_missing_var['varName'] != $varName) { $varName = $row_missing_var['varName']; $color = !$color;
$offset = $_REQUEST['offset']; } // prepare query if ($is_allowedToEdit) { // we need to check if exercise is used as a module in a learning path // to display a more complete confirm message for delete aciton $sql = "SELECT E.`id`, E.`title`, E.`visibility`, M.`module_id`\n FROM `" . $tbl_quiz_exercise . "` AS E\n LEFT JOIN `" . $tbl_lp_asset . "` AS A\n ON (A.`path` = E.`id` OR A.`path` IS NULL)\n LEFT JOIN `" . $tbl_lp_module . "` AS M\n ON A.`module_id` = M.`module_id`\n AND M.`contentType` = 'EXERCISE'\n ORDER BY `id`"; } else { if (claro_is_user_authenticated()) { $sql = "SELECT `id`, `title`\n FROM `" . $tbl_quiz_exercise . "`\n WHERE `visibility` = 'VISIBLE'\n ORDER BY `id`"; } else { $sql = "SELECT `id`, `title`\n FROM `" . $tbl_quiz_exercise . "`\n WHERE `visibility` = 'VISIBLE'\n AND `anonymousAttempts` = 'ALLOWED'\n ORDER BY `id`"; } } $myPager = new claro_sql_pager($sql, $offset, get_conf('exercisesPerPage', 25)); $exerciseList = $myPager->get_result_list(); // Display $nameTools = get_lang('Exercises'); $noQUERY_STRING = true; $helpUrl = $is_allowedToEdit ? get_help_page_url('blockExercisesHelp', 'CLQWZ') : null; $out = ''; if (!$inLP) { // Command list $cmdList = array(); $advancedCmdList = array(); if ($is_allowedToEdit) { $cmdList[] = array('img' => 'quiz_new', 'name' => get_lang('New exercise'), 'url' => claro_htmlspecialchars(Url::Contextualize('admin/edit_exercise.php?cmd=rqEdit'))); $advancedCmdList[] = array('img' => 'question_pool', 'name' => get_lang('Question pool'), 'url' => claro_htmlspecialchars(Url::Contextualize('admin/question_pool.php'))); $advancedCmdList[] = array('img' => 'question_pool', 'name' => get_lang('Question categories'), 'url' => claro_htmlspecialchars(Url::Contextualize('admin/question_category.php'))); $advancedCmdList[] = array('img' => 'import', 'name' => get_lang('Import exercise'), 'url' => claro_htmlspecialchars(Url::Contextualize('exercise.php?cmd=rqImport'))); }