本文整理汇总了PHP中CourseManager::isUserSubscribedInCourseAsDrh方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::isUserSubscribedInCourseAsDrh方法的具体用法?PHP CourseManager::isUserSubscribedInCourseAsDrh怎么用?PHP CourseManager::isUserSubscribedInCourseAsDrh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::isUserSubscribedInCourseAsDrh方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_protect_course_script
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
*/
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
api_protect_course_script(true);
api_block_anonymous_users();
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), api_get_course_info());
if (!$isDrhOfCourse) {
GradebookUtils::block_students();
}
if (isset($_POST['submit']) && isset($_POST['keyword'])) {
header('Location: ' . api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&search=' . Security::remove_XSS($_POST['keyword']));
exit;
}
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?selectcat=1', 'name' => get_lang('ToolGradebook'));
$showeval = isset($_POST['showeval']) ? '1' : '0';
$showlink = isset($_POST['showlink']) ? '1' : '0';
if ($showlink == '0' && $showeval == '0') {
$showlink = '1';
$showeval = '1';
}
$cat = Category::load($_REQUEST['selectcat']);
if (isset($_GET['userid'])) {
$userid = Security::remove_XSS($_GET['userid']);
} else {
$userid = '';
示例2: display_header_gradebook
//.........这里部分代码省略.........
}
$line = isset($line) ? $line : '';
if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
$header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
} else {
$header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
}
$line = '';
}
$header .= '</select></form></td>';
if (!empty($simple_search_form) && $message_resource === false) {
$header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
} else {
$header .= '<td></td>';
}
if ($is_course_admin && $message_resource === false && $_GET['selectcat'] != 0) {
/* $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
if ($is_course_admin && $message_resource===false) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() .'"><img src="../img/acces_tool.gif" alt="' . get_lang('ScoreEdit') . '" /> ' . get_lang('ScoreEdit') . '</a>';
} */
} elseif (!isset($_GET['studentoverview'])) {
if ($message_resource === false) {
//$header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
}
} else {
$header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">
<img src="../img/icons/32/pdf.png" alt="' . get_lang('ExportPDF') . '" /> ' . get_lang('ExportPDF') . '</a>';
}
$header .= '</td></tr>';
$header .= '</table></div>';
}
// for course admin & platform admin add item buttons are added to the header
$header .= '<div class="actions">';
$my_category = $catobj->shows_all_information_an_category($catobj->get_id());
$user_id = api_get_user_id();
$my_api_cidreq = api_get_cidreq();
//$course_code = $my_category['course_code'];
//$status_user = api_get_status_of_user_in_course ($user_id,$course_code);
if (api_is_allowed_to_edit(null, true)) {
if (empty($grade_model_id) || $grade_model_id == -1) {
$header .= '<a href="gradebook_add_cat.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM) . '</a></td>';
}
if ($selectcat == '0') {
} else {
$my_category = $catobj->shows_all_information_an_category($catobj->get_id());
if ($my_api_cidreq == '') {
$my_api_cidreq = 'cidReq=' . $my_category['course_code'];
}
if ($show_add_link && !$message_resource) {
$header .= '<td><a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' . Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . '</a>';
$cats = Category::load($selectcat);
if ($cats[0]->get_course_code() != null && !$message_resource) {
$header .= '<td><a href="gradebook_add_link.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
} else {
$header .= '<td><a href="gradebook_add_link_select_course.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
}
}
if (!$message_resource) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
$header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?' . $my_api_cidreq . '&cat_id=' . (int) $_GET['selectcat'] . '">' . Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '</a>';
// Right icons
$modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session=' . $catobj->get_session_id() . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
$modify_icons .= '<a href="../document/document.php?curdirpath=/certificates&' . $my_api_cidreq . '&origin=gradebook&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM) . '</a>';
if (empty($categories)) {
$modify_icons .= '<a href="gradebook_edit_all.php?id_session=' . api_get_session_id() . '&' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM) . '</a>';
}
$score_display_custom = api_get_setting('gradebook_score_display_custom');
if (api_get_setting('teachers_can_change_score_settings') == 'true' && $score_display_custom['my_display_custom'] == 'true') {
$modify_icons .= '<a href="gradebook_scoring_system.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
}
$header .= Display::div($modify_icons, array('class' => 'right'));
}
}
} elseif (isset($_GET['search'])) {
$header .= '<b>' . get_lang('SearchResults') . ' :</b>';
}
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), api_get_course_info());
if ($isDrhOfCourse) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
/*$header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?' . $my_api_cidreq . '&cat_id=' . (int) $_GET['selectcat'] . '">' .
Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '</a>';*/
}
$header .= '</div>';
echo $header;
if (api_is_allowed_to_edit(null, true)) {
$weight = intval($catobj->get_weight()) > 0 ? $catobj->get_weight() : 0;
$weight = get_lang('TotalWeight') . ' : ' . $weight;
$min_certification = intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0;
$min_certification = get_lang('CertificateMinScore') . ' : ' . $min_certification;
$edit_icon = '<a class="right_link" href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session=' . $catobj->get_session_id() . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
//$msg = Display::tag('h3', $weight.' - '.$min_certification);
$msg = Display::tag('h4', $weight . ' - ' . $min_certification . $edit_icon);
//@todo show description
$description = $catobj->get_description() == "" || is_null($catobj->get_description()) ? '' : '<strong>' . get_lang('GradebookDescriptionLog') . '</strong>' . ': ' . $catobj->get_description();
Display::display_normal_message($msg, false);
if (!empty($description)) {
echo Display::div($description, array());
}
}
}
示例3: get_attendance_data
/**
* Get the attendaces to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
* @see SortableTable#get_table_data($from)
*/
public static function get_attendance_data($from, $number_of_items, $column, $direction)
{
$tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id);
$column = intval($column);
$from = intval($from);
$number_of_items = intval($number_of_items);
if (!in_array($direction, array('ASC', 'DESC'))) {
$direction = 'ASC';
}
$active_plus = '';
if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true' || !api_is_allowed_to_edit(null, true)) {
$active_plus = ' AND att.active = 1';
}
$sql = "SELECT\n att.id AS col0,\n att.name AS col1,\n att.description AS col2,\n att.attendance_qualify_max AS col3,\n att.locked AS col4,\n att.active AS col5,\n att.session_id\n\t\t\t\tFROM {$tbl_attendance} att\n\t\t\t\tWHERE\n\t\t\t\t\tatt.active <> 2 AND\n\t\t\t\t\tc_id = {$course_id} {$active_plus} {$condition_session}\n\t\t\t\tORDER BY col{$column} {$direction}\n\t\t\t\tLIMIT {$from},{$number_of_items} ";
$res = Database::query($sql);
$attendances = array();
$user_info = api_get_user_info();
$allowDelete = api_get_setting('attendance.allow_delete_attendance');
while ($attendance = Database::fetch_row($res)) {
$student_param = '';
if (api_is_drh() && $_GET['student_id']) {
$student_param = '&student_id=' . intval($_GET['student_id']);
}
$session_star = '';
if (api_get_session_id() == $attendance[6]) {
$session_star = api_get_session_image(api_get_session_id(), $user_info['status']);
}
if ($attendance[5] == 1) {
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), api_get_course_info());
if (api_is_allowed_to_edit(null, true) || $isDrhOfCourse) {
// Link to edit
$attendance[1] = '<a href="index.php?' . api_get_cidreq() . '&action=attendance_sheet_list&attendance_id=' . $attendance[0] . $student_param . '">' . $attendance[1] . '</a>' . $session_star;
} else {
// Link to view
$attendance[1] = '<a href="index.php?' . api_get_cidreq() . '&action=attendance_sheet_list_no_edit&attendance_id=' . $attendance[0] . $student_param . '">' . $attendance[1] . '</a>' . $session_star;
}
} else {
$attendance[1] = '<a class="muted" href="index.php?' . api_get_cidreq() . '&action=attendance_sheet_list&attendance_id=' . $attendance[0] . $student_param . '">' . $attendance[1] . '</a>' . $session_star;
}
if ($attendance[5] == 1) {
$attendance[3] = '<center>' . $attendance[3] . '</center>';
} else {
$attendance[3] = '<center><span class="muted">' . $attendance[3] . '</span></center>';
}
$attendance[3] = '<center>' . $attendance[3] . '</center>';
if (api_is_allowed_to_edit(null, true)) {
$actions = '';
$actions .= '<center>';
if (api_is_platform_admin()) {
$actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_edit&attendance_id=' . $attendance[0] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a> ';
// Visible
if ($attendance[5] == 1) {
$actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_set_invisible&attendance_id=' . $attendance[0] . '">' . Display::return_icon('visible.png', get_lang('Hide'), array(), ICON_SIZE_SMALL) . '</a>';
} else {
$actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_set_visible&attendance_id=' . $attendance[0] . '">' . Display::return_icon('invisible.png', get_lang('Show'), array(), ICON_SIZE_SMALL) . '</a>';
$attendance[2] = '<span class="muted">' . $attendance[2] . '</span>';
}
if ($allowDelete === 'true') {
$actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0] . '">' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
}
} else {
$is_locked_attendance = self::is_locked_attendance($attendance[0]);
if ($is_locked_attendance) {
$actions .= Display::return_icon('edit_na.png', get_lang('Edit')) . ' ';
$actions .= Display::return_icon('visible.png', get_lang('Hide'));
} else {
$actions .= '<a href="index.php?' . api_get_cidreq() . '&action=attendance_edit&attendance_id=' . $attendance[0] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a> ';
if ($attendance[5] == 1) {
$actions .= ' <a href="index.php?' . api_get_cidreq() . '&action=attendance_set_invisible&attendance_id=' . $attendance[0] . '">' . Display::return_icon('visible.png', get_lang('Hide'), array(), ICON_SIZE_SMALL) . '</a>';
} else {
$actions .= ' <a href="index.php?' . api_get_cidreq() . '&action=attendance_set_visible&attendance_id=' . $attendance[0] . '">' . Display::return_icon('invisible.png', get_lang('Show'), array(), ICON_SIZE_SMALL) . '</a>';
$attendance[2] = '<span class="muted">' . $attendance[2] . '</span>';
}
if ($allowDelete === 'true') {
$actions .= ' <a href="index.php?' . api_get_cidreq() . '&action=attendance_delete&attendance_id=' . $attendance[0] . '">' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
}
}
}
// display lock/unlock icon
$is_done_all_calendar = self::is_all_attendance_calendar_done($attendance[0]);
if ($is_done_all_calendar) {
$locked = $attendance[4];
if ($locked == 0) {
if (api_is_platform_admin()) {
$message_alert = get_lang('AreYouSureToLockTheAttendance');
} else {
$message_alert = get_lang('UnlockMessageInformation');
}
$actions .= ' <a onclick="javascript:if(!confirm(\'' . $message_alert . '\')) return false;" href="index.php?' . api_get_cidreq() . '&action=lock_attendance&attendance_id=' . $attendance[0] . '">' . Display::return_icon('unlock.png', get_lang('LockAttendance')) . '</a>';
//.........这里部分代码省略.........
示例4: attendance_sheet
/**
* It's used for controlling attendance sheet (list, add),
* render to attendance_sheet view
* @param string $action
* @param int $attendance_id
* @param int $student_id
* @param bool $edit
*/
public function attendance_sheet($action, $attendance_id, $student_id = 0, $edit = true)
{
$attendance = new Attendance();
$data = array();
$data['attendance_id'] = $attendance_id;
$groupId = isset($_REQUEST['group_id']) ? $_REQUEST['group_id'] : null;
$data['users_in_course'] = $attendance->get_users_rel_course($attendance_id, $groupId);
$filter_type = 'today';
if (!empty($_REQUEST['filter'])) {
$filter_type = $_REQUEST['filter'];
}
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), api_get_course_info());
if ($edit == true) {
if (api_is_allowed_to_edit(null, true) || $isDrhOfCourse) {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, 0, $groupId);
}
} else {
if (!empty($student_id)) {
$user_id = intval($student_id);
} else {
$user_id = api_get_user_id();
}
if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api_get_course_int_id()) || $isDrhOfCourse) {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, 0, $groupId);
} else {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, $user_id, $groupId);
}
$data['faults'] = $attendance->get_faults_of_user($user_id, $attendance_id, $groupId);
$data['user_id'] = $user_id;
}
$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (isset($_POST['hidden_input'])) {
foreach ($_POST['hidden_input'] as $cal_id) {
$users_present = array();
if (isset($_POST['check_presence'][$cal_id])) {
$users_present = $_POST['check_presence'][$cal_id];
}
$attendance->attendance_sheet_add($cal_id, $users_present, $attendance_id);
}
}
$data['users_in_course'] = $attendance->get_users_rel_course($attendance_id, $groupId);
$my_calendar_id = null;
if (is_numeric($filter_type)) {
$my_calendar_id = $filter_type;
$filter_type = 'calendar_id';
}
$data['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id, $filter_type, $my_calendar_id, $groupId);
$data['attendant_calendar_all'] = $attendance->get_attendance_calendar($attendance_id, 'all', null, $groupId);
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, 0, $groupId);
$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);
} else {
$data['attendant_calendar_all'] = $attendance->get_attendance_calendar($attendance_id, 'all', null, $groupId);
$data['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id, $filter_type, null, $groupId);
}
$data['edit_table'] = intval($edit);
$data['is_locked_attendance'] = $attendance->is_locked_attendance($attendance_id);
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('attendance_sheet');
$this->view->render();
}
示例5: isset
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
require_once 'work.lib.php';
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$work = get_work_data_by_id($id);
if (empty($id) || empty($work)) {
api_not_allowed(true);
}
if ($work['active'] != 1) {
api_not_allowed(true);
}
$interbreadcrumb[] = array('url' => 'work.php', 'name' => get_lang('StudentPublications'));
$my_folder_data = get_work_data_by_id($work['parent_id']);
$courseInfo = api_get_course_info();
protectWork(api_get_course_info(), $work['parent_id']);
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), $courseInfo);
if (user_is_author($id) || $isDrhOfCourse || (api_is_allowed_to_edit() || api_is_coach()) || $courseInfo['show_score'] == 0 && $work['active'] == 1 && $work['accepted'] == 1) {
if (api_is_allowed_to_edit() || api_is_coach() || api_is_drh()) {
$url_dir = 'work_list_all.php?id=' . $my_folder_data['id'];
} else {
$url_dir = 'work_list.php?id=' . $my_folder_data['id'];
}
$userInfo = api_get_user_info($work['user_id']);
$interbreadcrumb[] = array('url' => $url_dir, 'name' => $my_folder_data['title']);
$interbreadcrumb[] = array('url' => '#', 'name' => $userInfo['complete_name']);
$interbreadcrumb[] = array('url' => '#', 'name' => $work['title']);
if ($courseInfo['show_score'] == 0 && $work['active'] == 1 && $work['accepted'] == 1 || (api_is_allowed_to_edit() || api_is_coach()) || user_is_author($id) || $isDrhOfCourse) {
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : null;
if ($page == 'edit') {
$url = api_get_path(WEB_CODE_PATH) . 'work/edit.php?id=' . $my_folder_data['id'] . '&item_id=' . $work['id'] . '&' . api_get_cidreq();
示例6: get_work_user_list
/**
* @param int $start
* @param int $limit
* @param int $column
* @param string $direction
* @param int $work_id
* @param array $where_condition
* @param int $studentId
* @param bool $getCount
* @return array
*/
function get_work_user_list(
$start,
$limit,
$column,
$direction,
$work_id,
$where_condition = null,
$studentId = null,
$getCount = false
) {
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$group_id = api_get_group_id();
$course_info = api_get_course_info(api_get_course_id());
$work_id = intval($work_id);
$column = !empty($column) ? Database::escape_string($column) : 'sent_date';
$start = intval($start);
$limit = intval($limit);
if (!in_array($direction, array('asc','desc'))) {
$direction = 'desc';
}
$work_data = get_work_data_by_id($work_id);
$is_allowed_to_edit = api_is_allowed_to_edit() || api_is_coach();
$condition_session = api_get_session_condition($session_id);
$locked = api_resource_is_locked_by_gradebook($work_id, LINK_STUDENTPUBLICATION);
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
api_get_user_id(),
$course_info
);
if (!empty($work_data)) {
if (!empty($group_id)) {
$extra_conditions = " work.post_group_id = '".intval($group_id)."' ";
// set to select only messages posted by the user's group
} else {
$extra_conditions = " work.post_group_id = '0' ";
}
if ($is_allowed_to_edit || $isDrhOfCourse) {
$extra_conditions .= ' AND work.active IN (0, 1) ';
} else {
if (isset($course_info['show_score']) &&
$course_info['show_score'] == 1
) {
$extra_conditions .= " AND (u.user_id = ".api_get_user_id()." AND work.active IN (0, 1)) ";
} else {
$extra_conditions .= ' AND work.active IN (0, 1) ';
}
}
$extra_conditions .= " AND parent_id = ".$work_id." ";
$select = 'SELECT DISTINCT
u.user_id,
work.id as id,
title as title,
description,
url,
sent_date,
contains_file,
has_properties,
view_properties,
qualification,
weight,
allow_text_assignment,
u.firstname,
u.lastname,
u.username,
parent_id,
accepted,
qualificator_id';
if ($getCount) {
$select = "SELECT DISTINCT count(u.user_id) as count ";
}
$user_condition = "INNER JOIN $user_table u ON (work.user_id = u.user_id) ";
$work_condition = "$iprop_table prop INNER JOIN $work_table work
ON (prop.ref = work.id AND prop.c_id = $course_id AND work.c_id = $course_id ) ";
$work_assignment = get_work_assignment_by_id($work_id);
//.........这里部分代码省略.........
示例7: api_get_js
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/qtip2/jquery.qtip.min.css');
// Access control
api_protect_course_script(true);
// including additional libraries
require_once 'hotpotatoes.lib.php';
/* Constants and variables */
$is_allowedToEdit = api_is_allowed_to_edit(null, true);
$is_tutor = api_is_allowed_to_edit(true);
$is_tutor_course = api_is_course_tutor();
$courseInfo = api_get_course_info();
$courseId = $courseInfo['real_id'];
$userInfo = api_get_user_info();
$userId = $userInfo['id'];
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh($userId, $courseInfo);
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
// document path
$documentPath = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . "/document";
// picture path
$picturePath = $documentPath . '/images';
// audio path
$audioPath = $documentPath . '/audio';
// hot potatoes
$uploadPath = DIR_HOTPOTATOES;
//defined in main_api
$exercisePath = api_get_self();
示例8: get_work_user_list
/**
* @param int $start
* @param int $limit
* @param int $column
* @param string $direction
* @param int $work_id
* @param array $where_condition
* @param int $studentId
* @param bool $getCount
* @return array
*/
function get_work_user_list($start, $limit, $column, $direction, $work_id, $where_condition = null, $studentId = null, $getCount = false)
{
$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$iprop_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$user_table = Database::get_main_table(TABLE_MAIN_USER);
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$course_info = api_get_course_info();
$course_id = $course_info['real_id'];
$work_id = intval($work_id);
$column = !empty($column) ? Database::escape_string($column) : 'sent_date';
$start = intval($start);
$limit = intval($limit);
if (!in_array($direction, array('asc', 'desc'))) {
$direction = 'desc';
}
$work_data = get_work_data_by_id($work_id);
$is_allowed_to_edit = api_is_allowed_to_edit() || api_is_coach();
$condition_session = api_get_session_condition($session_id, true, false, 'work.session_id');
$locked = api_resource_is_locked_by_gradebook($work_id, LINK_STUDENTPUBLICATION);
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), $course_info);
if (!empty($work_data)) {
if (!empty($group_id)) {
$extra_conditions = " work.post_group_id = '" . intval($group_id) . "' ";
// set to select only messages posted by the user's group
} else {
$extra_conditions = " work.post_group_id = '0' ";
}
if ($is_allowed_to_edit || $isDrhOfCourse) {
$extra_conditions .= ' AND work.active IN (0, 1) ';
} else {
if (isset($course_info['show_score']) && $course_info['show_score'] == 1) {
$extra_conditions .= " AND (u.user_id = " . api_get_user_id() . " AND work.active IN (0, 1)) ";
} else {
$extra_conditions .= ' AND work.active IN (0, 1) ';
}
}
$extra_conditions .= " AND parent_id = " . $work_id . " ";
$select = 'SELECT DISTINCT
u.user_id,
work.id as id,
title as title,
description,
url,
sent_date,
contains_file,
has_properties,
view_properties,
qualification,
weight,
allow_text_assignment,
u.firstname,
u.lastname,
u.username,
parent_id,
accepted,
qualificator_id,
url_correction
';
if ($getCount) {
$select = "SELECT DISTINCT count(u.user_id) as count ";
}
$user_condition = "INNER JOIN {$user_table} u ON (work.user_id = u.user_id) ";
$work_condition = "{$iprop_table} prop INNER JOIN {$work_table} work\n ON (prop.ref = work.id AND prop.c_id = {$course_id} AND work.c_id = {$course_id} ) ";
$work_assignment = get_work_assignment_by_id($work_id);
if (!empty($studentId)) {
$where_condition .= " AND u.user_id = " . intval($studentId);
}
$sql = " {$select}\n FROM {$work_condition} {$user_condition}\n WHERE {$extra_conditions} {$where_condition} {$condition_session}\n AND u.status != " . INVITEE . "\n ORDER BY {$column} {$direction}";
if (!empty($start) && !empty($limit)) {
$sql .= " LIMIT {$start}, {$limit}";
}
$result = Database::query($sql);
$works = array();
if ($getCount) {
$work = Database::fetch_array($result, 'ASSOC');
return $work['count'];
}
$url = api_get_path(WEB_CODE_PATH) . 'work/';
$unoconv = api_get_configuration_value('unoconv.binaries');
while ($work = Database::fetch_array($result, 'ASSOC')) {
$item_id = $work['id'];
// Get the author ID for that document from the item_property table
$is_author = false;
$can_read = false;
$owner_id = $work['user_id'];
/* Because a bug found when saving items using the api_item_property_update()
the field $item_property_data['insert_user_id'] is not reliable. */
if (!$is_allowed_to_edit && $owner_id == api_get_user_id()) {
//.........这里部分代码省略.........