if ('delete' == $do) { if ($courseToDelete->delete()) { $dialogBox->success(get_lang('The course has been successfully deleted')); $noQUERY_STRING = true; } } /** * 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
while ($result = mysql_fetch_row($results)) { 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; }
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();
$sqlJoinType = " LEFT JOIN `" . $tbl_dock . "` AS D " . "\n" . " ON D.`module_id`= M.id " . "\n"; $orderType = ""; break; case 'tool': $sqlSelectType = " CT.`id` AS courseToolId, " . "\n" . " CT.`icon` AS icon," . "\n" . " CT.`script_url` AS script_url," . "\n" . " CT.`def_rank` AS rank," . "\n" . " CT.`def_access` AS visibility," . "\n"; $sqlJoinType = " LEFT JOIN `" . $tbl_course_tool . "` AS CT " . "\n" . " ON CT.`claro_label`= M.label " . "\n"; $orderType = "ORDER BY `def_rank` \n"; break; default: $sqlSelectType = ""; $sqlJoinType = ""; $orderType = ""; } $sql = "\n SELECT M.`id` AS `id`,\n M.`label` AS `label`,\n M.`name` AS `name`,\n M.`activation` AS `activation`,\n " . $sqlSelectType . "\n M.`type` AS `type`\n FROM `" . $tbl_module . "` AS M\n " . $sqlJoinType . "\n WHERE M.`type` = '" . claro_sql_escape($typeReq) . "'\n GROUP BY `id`\n " . $orderType . "\n "; //pager creation $myPager = new claro_sql_pager($sql, $offset, $modulePerPage); $moduleList = $myPager->get_result_list(); //find docks in which the modules do appear. $module_dock = array(); $dockList = get_dock_list($typeReq); // will be usefull to display correctly the dock names foreach ($moduleList as $module) { $module_dock[$module['id']] = array(); $module_dock[$module['id']] = get_module_dock_list($module['id']); if (!file_exists(get_module_path($module['label']))) { $dialogBox->warning(get_lang('<b>Warning : </b>') . get_lang('There is a module installed in DB : <b><i>%module_name</i></b> for which there is no folder on the server.', array('%module_name' => $module['label']))); } } //do a check of modules to see if there is anyhting to install $modules_found = check_module_repositories(); foreach ($modules_found['folder'] as $module_folder) {
} if ($cmd == 'exLock') { $profile->setIsLocked(true); } // save profile $profile->save(); } } } // 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']) ? (int) $_REQUEST['offset'] : 0; $profilePager = new claro_sql_pager($sql, $offset, $itemPerPage); $profileList = $profilePager->get_result_list(); // Command list $cmdList = array(); $cmdList[] = array('img' => 'default_new', 'name' => get_lang('Add new profile'), 'url' => $_SERVER['PHP_SELF'] . '?cmd=rqAdd'); // Display // Define breadcrumb ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $nameTools = get_lang('Course profile list'); $noQUERY_STRING = TRUE; $out = ''; switch ($display) { case DISPLAY_FORM: // Display form if (empty($profile->id)) { $out .= claro_html_tool_title(get_lang('Add new profile', null, $cmdList));
} } } $searchInfo = prepare_search(); $isSearched = $searchInfo['isSearched']; $addtoAdvanced = $searchInfo['addtoAdvanced']; if (count($searchInfo['isSearched'])) { $isSearched = array_map('strip_tags', $isSearched); $isSearchedHTML = implode('<br />', $isSearched); } else { $isSearchedHTML = ''; } //get the search keyword, if any $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; $sql = get_sql_filtered_user_list(); $myPager = new claro_sql_pager($sql, $offset, $userPerPage); if (array_key_exists('sort', $_GET)) { $dir = array_key_exists('dir', $_GET) && $_GET['dir'] == SORT_DESC ? SORT_DESC : SORT_ASC; $sortKey = strip_tags($_GET['sort']); $myPager->add_sort_key($sortKey, $dir); } $defaultSortKeyList = array('isPlatformAdmin' => SORT_DESC, 'name' => SORT_ASC, 'firstName' => SORT_ASC); foreach ($defaultSortKeyList as $thisSortKey => $thisSortDir) { $myPager->add_sort_key($thisSortKey, $thisSortDir); } $userList = $myPager->get_result_list(); if (is_array($userList)) { $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_course = $tbl_mdb_names['course']; $tbl_category = $tbl_mdb_names['category']; $tbl_rel_course_user = $tbl_mdb_names['rel_course_user'];
$dialogBox->error(get_lang('You cannot unsubscribe the last course manager of the course')); break; case 'course_manager_cannot_unsubscribe_himself': $dialogBox->error(get_lang('Course manager cannot unsubscribe himself')); break; default: } } } // Build and call DB to get info about current course (for title) if needed : $courseData = claro_get_course_data($cidToEdit); //---------------------------------- // Build query and find info in db //---------------------------------- $sql = "SELECT U.user_id AS user_id,\n U.nom AS name,\n U.prenom AS firstname,\n U.username AS username,\n CU.profile_id AS profileId,\n CU.isCourseManager\n FROM `" . $tbl_mdb_names['user'] . "` AS U\n , `" . $tbl_mdb_names['rel_course_user'] . "` AS CU\n WHERE CU.`user_id` = U.`user_id`\n AND CU.`code_cours` = '" . claro_sql_escape($cidToEdit) . "'"; $myPager = new claro_sql_pager($sql, $pager_offset, get_conf('userPerPage', 20)); $sortKey = isset($_GET['sort']) ? $_GET['sort'] : 'user_id'; $sortDir = isset($_GET['dir']) ? $_GET['dir'] : SORT_ASC; $myPager->set_sort_key($sortKey, $sortDir); $myPager->set_pager_call_param_name('pager_offset'); $userList = $myPager->get_result_list(); // Start the list of users $userDataList = array(); foreach ($userList as $lineId => $user) { $userDataList[$lineId]['user_id'] = $user['user_id']; $userDataList[$lineId]['name'] = $user['name']; $userDataList[$lineId]['firstname'] = $user['firstname']; $userDataList[$lineId]['profileId'] = claro_get_profile_name($user['profileId']); if ($user['isCourseManager']) { $userDataList[$lineId]['isCourseManager'] = '<img class="qtip" src="' . get_icon_url('manager') . '" ' . 'alt="' . get_lang('Course manager') . '" ' . 'title="' . get_lang('Course manager') . '" />'; } else {
$sortKeyList[$_GET['sort']] = SORT_ASC; } if (!isset($sortKeyList['submissionCount'])) { $sortKeyList['submissionCount'] = SORT_DESC; } $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']])) {
$results = claro_sql_query($sql); $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'];
$_SESSION['admin_course_class_order_crit'] = $_REQUEST['order_crit']; 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 {
} else { switch (claro_failure::get_last_failure()) { case 'cannot_unsubscribe_the_last_course_manager': $dialogBox->error(get_lang('You cannot unsubscribe the last course manager of the course')); break; case 'course_manager_cannot_unsubscribe_himself': $dialogBox->error(get_lang('Course manager cannot unsubscribe himself')); break; default: $dialogBox->error(get_lang('Unknow error during unsubscribing')); } } } $addToUrl = 'ulist' == $cfrom ? '&cfrom=ulist' : ''; $sqlUserCourseList = prepare_sql_get_courses_of_a_user($uidToEdit); $myPager = new claro_sql_pager($sqlUserCourseList, $offset, get_conf('coursePerPage', 20)); $myPager->set_sort_key($pagerSortKey, $pagerSortDir); $userCourseList = $myPager->get_result_list(); $userCourseGrid = array(); foreach ($userCourseList as $courseKey => $course) { $userCourseGrid[$courseKey]['officialCode'] = $course['officialCode']; $iconUrl = get_course_access_icon($course['access']); $userCourseGrid[$courseKey]['name'] = '<img class="iconDefinitionList" src="' . $iconUrl . '" alt="" />' . '<a href="' . get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars($course['sysCode']) . '">' . $course['name'] . '</a><br />' . $course['titular']; $userCourseGrid[$courseKey]['profileId'] = claro_get_profile_name($course['profileId']); if ($course['isCourseManager']) { $userCourseGrid[$courseKey]['isCourseManager'] = '<img class="qtip" src="' . get_icon_url('manager') . '" alt="' . get_lang('Course manager') . '" />'; } else { $userCourseGrid[$courseKey]['isCourseManager'] = '<img class="qtip" src="' . get_icon_url('user') . '" alt="' . get_lang('Student') . '" />'; } $userCourseGrid[$courseKey]['edit_course_user'] = '******' . $course['sysCode'] . '&uidToEdit=' . $uidToEdit . '&ccfrom=uclist">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Course manager') . '" title="' . get_lang('User\'s course settings') . '" />' . '</a>'; $userCourseGrid[$courseKey]['delete'] = '<a href="' . $_SERVER['PHP_SELF'] . '?uidToEdit=' . $uidToEdit . '&cmd=unsubscribe' . $addToUrl . '&courseId=' . claro_htmlspecialchars($course['sysCode']) . '&sort=' . $pagerSortKey . '&dir=' . $pagerSortDir . '&offset=' . $offset . '"' . ' onclick="return ADMIN.confirmationUnReg(\'' . clean_str_for_javascript($userData['firstname'] . ' ' . $userData['lastname']) . '\');">' . "\n" . '<img src="' . get_icon_url('unenroll') . '" alt="' . get_lang('Delete') . '" />' . "\n" . '</a>' . "\n";
// end if allowed to edit $courseUserList = new Claro_CourseUserList(claro_get_current_course_id()); if ($courseUserList->has_registrationPending()) { $usersPanelUrl = claro_htmlspecialchars(Url::Contextualize(get_module_entry_url('CLUSR'))); $dialogBox->warning(get_lang('You have to validate users to give them access to this course through the <a href="%url">course user list</a>', array('%url' => $usersPanelUrl))); } /*---------------------------------------------------------------------- Get Course informations ----------------------------------------------------------------------*/ $sql = "SELECT `course`.`registration`\n FROM `" . $tbl_courses . "` AS course\n WHERE `course`.`code`='" . claro_sql_escape(claro_get_current_course_id()) . "'"; $course = claro_sql_query_get_single_row($sql); /*---------------------------------------------------------------------- Get User List ----------------------------------------------------------------------*/ $sqlGetUsers = "\n SELECT \n `user`.`user_id` AS `user_id`,\n `user`.`nom` AS `nom`,\n `user`.`prenom` AS `prenom`,\n `user`.`email` AS `email`,\n `course_user`.`profile_id`,\n `course_user`.`isCourseManager`,\n `course_user`.`isPending`,\n `course_user`.`tutor` AS `tutor`,\n `course_user`.`role` AS `role`,\n `course_user`.`enrollment_date`,\n `course_user`.`count_class_enrol`,\n `course_user`.`count_user_enrol`,\n\n\tGROUP_CONCAT(`grp`.name ORDER BY `grp`.name SEPARATOR ',' ) AS `groups`\n\n FROM \n \n `{$tbl_users}` AS user,\n `{$tbl_rel_course_user}` AS course_user\n\n LEFT JOIN `{$tbl_rel_users_groups}` AS user_group\n ON user_group.user = `course_user`.`user_id`\n\n LEFT JOIN `{$tbl_groups}` AS `grp`\n ON `grp`.id = user_group.team\n\n WHERE ( `user`.`user_id`=`course_user`.`user_id`\n AND `course_user`.`code_cours`='" . claro_sql_escape(claro_get_current_course_id()) . "' )\n\n GROUP BY user.user_id"; $myPager = new claro_sql_pager($sqlGetUsers, $offset, $userPerPage); if (isset($_GET['sort'])) { $myPager->add_sort_key($_GET['sort'], isset($_GET['dir']) ? $_GET['dir'] : SORT_ASC); } $defaultSortKeyList = array('course_user.isCourseManager' => SORT_DESC, 'course_user.tutor' => SORT_DESC, 'user.nom' => SORT_ASC, 'user.prenom' => SORT_ASC, 'groups' => SORT_ASC, 'enrollment_date' => SORT_ASC); foreach ($defaultSortKeyList as $thisSortKey => $thisSortDir) { $myPager->add_sort_key($thisSortKey, $thisSortDir); } $userList = $myPager->get_result_list(); $userTotalNb = $myPager->get_total_item_count(); /*---------------------------------------------------------------------- Prepare display ----------------------------------------------------------------------*/ $nameTools = get_lang('Users'); // Command list $cmdList = array();
} else { if ($_SESSION['admin_class_reg_user_dir'] == 'ASC') { $toAdd = " ORDER BY `" . $_SESSION['admin_class_reg_user_order_crit'] . "` " . $_SESSION['admin_class_reg_user_dir'] . ",`prenom` ASC "; } else { $toAdd = " ORDER BY `" . $_SESSION['admin_class_reg_user_order_crit'] . "` " . $_SESSION['admin_class_reg_user_dir'] . ",`prenom` DESC "; } } $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 //------------------------------------ // Deal with interbredcrumps // We have to prepend in reverse order !!! ClaroBreadCrumbs::getInstance()->prepend(get_lang('Class members'), get_path('rootAdminWeb') . 'admin_class_user.php?class_id=' . $class_id); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Classes'), get_path('rootAdminWeb') . 'admin_class.php'); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $nameTools = get_lang('Register users to class'); $out = ''; if (empty($class_id)) { $dialogBox->error(get_lang('Class not found')); $out .= $dialogBox->render();
break; case 'down': 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...
} /* * 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 (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)) {
$sortKeyList['title'] = SORT_ASC; } } else { $sql = "SELECT `id`,\n `title`,\n `def_submission_visibility`,\n `visibility`,\n `assignment_type`,\n unix_timestamp(`start_date`) as `start_date_unix`,\n unix_timestamp(`end_date`) as `end_date_unix`\n FROM `" . $tbl_wrk_assignment . "`"; 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')));
if (is_array($questionList) && !empty($questionList)) { 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']); }
} else { $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')));