当前位置: 首页>>代码示例>>PHP>>正文


PHP get_work_assignment_by_id函数代码示例

本文整理汇总了PHP中get_work_assignment_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_work_assignment_by_id函数的具体用法?PHP get_work_assignment_by_id怎么用?PHP get_work_assignment_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_work_assignment_by_id函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: api_not_allowed

if (empty($workId)) {
    api_not_allowed(true);
}

$my_folder_data = get_work_data_by_id($workId);

if (empty($my_folder_data)) {
    api_not_allowed(true);
}

if ($my_folder_data['active'] != 1) {
    api_not_allowed(true);
}

$work_data = get_work_assignment_by_id($workId);
$tool_name = get_lang('StudentPublications');

$group_id = api_get_group_id();
$courseInfo = api_get_course_info();
$htmlHeadXtra[] = api_get_jqgrid_js();
$url_dir = api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq();

allowOnlySubscribedUser(api_get_user_id(), $workId, $courseInfo['real_id']);

if (!empty($group_id)) {
    $group_properties  = GroupManager :: get_group_properties($group_id);
    $show_work = false;

    if (api_is_allowed_to_edit(false, true)) {
        $show_work = true;
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:30,代码来源:work_list.php

示例2: getWorkPerUser

$workPerUser = getWorkPerUser($studentId);
$table = new HTML_Table(array('class' => 'data_table'));
$column = 0;
$row = 0;
$headers = array(get_lang('Title'), get_lang('HandedOutDate'), get_lang('HandOutDateLimit'), get_lang('Score'), get_lang('Actions'));
foreach ($headers as $header) {
    $table->setHeaderContents($row, $column, $header);
    $column++;
}
$row++;
$column = 0;
foreach ($workPerUser as $work) {
    $work = $work['work'];
    $scoreWeight = intval($work->qualification) == 0 ? null : $work->qualification;
    $workId = $work->id;
    $workExtraData = get_work_assignment_by_id($workId);
    foreach ($work->user_results as $userResult) {
        $table->setCellContents($row, $column, $work->title . ' [' . strip_tags($userResult['title']) . ']');
        $table->setCellAttributes($row, $column, array('width' => '300px'));
        $column++;
        $table->setCellContents($row, $column, $userResult['sent_date']);
        $column++;
        $dateQualification = !empty($workExtraData['expires_on']) && $workExtraData['expires_on'] != '0000-00-00 00:00:00' ? api_get_local_time($workExtraData['expires_on']) : '-';
        $table->setCellContents($row, $column, $dateQualification);
        $column++;
        $score = '-';
        if (!empty($scoreWeight)) {
            $score = strip_tags($userResult['qualification']) . "/" . $scoreWeight;
        }
        $table->setCellContents($row, $column, $score);
        $column++;
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:student_work.php

示例3: get_work_count_by_student

//  @todo add an option to allow/block multiple attempts.
/*
if (!empty($workInfo) && !empty($workInfo['qualification'])) {
    $count =  get_work_count_by_student($user_id, $work_id);
    if ($count >= 1) {
        Display::display_header();
        if (api_get_course_setting('student_delete_own_publication') == '1') {
            Display::display_warning_message(get_lang('CantUploadDeleteYourPaperFirst'));
        } else {
            Display::display_warning_message(get_lang('YouAlreadySentAPaperYouCantUpload'));
        }
        Display::display_footer();
        exit;
    }
}*/
$homework = get_work_assignment_by_id($workInfo['id']);
$validationStatus = getWorkDateValidationStatus($homework);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'work/work.php?' . api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'work/work_list.php?' . api_get_cidreq() . '&id=' . $work_id, 'name' => $workInfo['title']);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UploadADocument'));
$form = new FormValidator('form', 'POST', api_get_self() . "?" . api_get_cidreq() . "&id=" . $work_id, '', array('enctype' => "multipart/form-data"));
setWorkUploadForm($form, $workInfo['allow_text_assignment']);
$form->addElement('hidden', 'id', $work_id);
$form->addElement('hidden', 'sec_token', $token);
$error_message = null;
$succeed = false;
if ($form->validate()) {
    if ($student_can_edit_in_session && $check) {
        $values = $form->getSubmitValues();
        // Process work
        $error_message = processWorkForm($workInfo, $values, $course_info, $session_id, $group_id, $user_id);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:upload.php

示例4: exportAllStudentWorkFromPublication

/**
 * @param int $workId
 * @param array $courseInfo
 * @param int $sessionId
 * @param string $format
 * @return bool
 */
function exportAllStudentWorkFromPublication(
    $workId,
    $courseInfo,
    $sessionId,
    $format = 'pdf'
) {
    if (empty($courseInfo)) {
        return false;
    }

    $workData = get_work_data_by_id($workId);

    if (empty($workData)) {
        return false;
    }

    $assignment = get_work_assignment_by_id($workId);

    $courseCode = $courseInfo['code'];
    $header = get_lang('Course').': '.$courseInfo['title'];
    $teachers = CourseManager::get_teacher_list_from_course_code_to_string(
        $courseCode
    );

    if (!empty($sessionId)) {
        $sessionInfo = api_get_session_info($sessionId);
        if (!empty($sessionInfo)) {
            $header .= ' - ' . $sessionInfo['name'];
            $header .= '<br />' . $sessionInfo['description'];
            $teachers = SessionManager::getCoachesByCourseSessionToString(
                $sessionId,
                $courseCode
            );
        }
    }

    $header .= '<br />'.get_lang('Teachers').': '.$teachers.'<br />';
    $header .= '<br />'.get_lang('Date').': '.api_get_local_time().'<br />';
    $header .= '<br />'.get_lang('StudentPublication').': '.$workData['title'].'<br />';

    $content = null;
    $expiresOn = null;

    if (!empty($assignment) && isset($assignment['expires_on'])) {
        $content .= '<br /><strong>' . get_lang('ExpiryDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
        $expiresOn = api_get_local_time($assignment['expires_on']);
    }

    if (!empty($workData['description'])) {
        $content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
    }

    $workList = get_work_user_list(null, null, null, null, $workId);

    switch ($format) {
        case 'pdf':
            if (!empty($workList)) {
                require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';

                $table = new HTML_Table(array('class' => 'data_table'));
                $headers = array(
                    get_lang('Name'),
                    get_lang('User'),
                    get_lang('HandOutDateLimit'),
                    get_lang('SentDate'),
                    get_lang('Filename'),
                    get_lang('Score'),
                    get_lang('Feedback')
                );

                $column = 0;
                foreach($headers as $header) {
                    $table->setHeaderContents(0, $column, $header);
                    $column++;
                }

                $row = 1;

                //$pdf->set_custom_header($header);
                foreach ($workList as $work) {
                    $content .= '<hr />';
                    // getWorkComments need c_id
                    $work['c_id'] = $courseInfo['real_id'];

                    //$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
                    $score = null;
                    if (!empty($work['qualification_only'])) {
                        $score = $work['qualification_only'];
                    }
                    //$content .= get_lang('Description').': '.$work['description'].'<br />';
                    $comments = getWorkComments($work);

                    $feedback = null;
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:work.lib.php

示例5: api_not_allowed

require_once $lib_path.'fileManage.lib.php';
require_once 'work.lib.php';

// Section (for the tabs)
$this_section = SECTION_COURSES;

if (!api_is_allowed_to_edit()) {
    api_not_allowed(true);
}

$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$groupId = api_get_group_id();
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
$workData = get_work_data_by_id($workId);
$homework = get_work_assignment_by_id($workId);
$locked = api_resource_is_locked_by_gradebook($workId, LINK_STUDENTPUBLICATION);

if (api_is_platform_admin() == false && $locked == true) {
    api_not_allowed(true);
}

$htmlHeadXtra[] = to_javascript_work();
$interbreadcrumb[] = array(
    'url' => api_get_path(WEB_CODE_PATH) . 'work/work.php?' . api_get_cidreq(),
    'name' => get_lang('StudentPublications')
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));

$form = new FormValidator(
    'edit_dir',
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:edit_work.php

示例6: get_work_data_by_id

$has_ended = false;
$is_author = false;
$work_item = get_work_data_by_id($item_id);
// Get the author ID for that document from the item_property table
$is_author = user_is_author($item_id);
if (!$is_author) {
    api_not_allowed(true);
}
// Student's can't edit work only if he can delete his docs.
if (!api_is_allowed_to_edit()) {
    if (api_get_course_setting('student_delete_own_publication') != 1) {
        api_not_allowed(true);
    }
}
if (!empty($my_folder_data)) {
    $homework = get_work_assignment_by_id($my_folder_data['id']);
    if (!empty($homework['expires_on']) || !empty($homework['ends_on'])) {
        $time_now = time();
        if (!empty($homework['expires_on']) && !empty($homework['expires_on'])) {
            $time_expires = api_strtotime($homework['expires_on'], 'UTC');
            $difference = $time_expires - $time_now;
            if ($difference < 0) {
                $has_expired = true;
            }
        }
        if (empty($homework['expires_on'])) {
            $has_expired = false;
        }
        if (!empty($homework['ends_on'])) {
            $time_ends = api_strtotime($homework['ends_on'], 'UTC');
            $difference2 = $time_ends - $time_now;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:edit.php

示例7: 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
 * @return array
 */
function get_work_user_list($start, $limit, $column, $direction, $work_id, $where_condition, $studentId = null)
{
    $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);
    $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(null, true);
    $condition_session = api_get_session_condition($session_id);
    $locked = api_resource_is_locked_by_gradebook($work_id, LINK_STUDENTPUBLICATION);
    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) {
            $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) OR work.active = 1) ";
            } else {
                $extra_conditions .= ' AND work.active = 1 ';
            }
        }
        $extra_conditions .= " AND parent_id  = " . $work_id . "  ";
        $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';
        $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);
        if (!empty($studentId)) {
            $where_condition .= " AND u.user_id = " . intval($studentId);
        }
        $sql = "SELECT {$select}\n                FROM {$work_condition}  {$user_condition}\n                WHERE  {$extra_conditions} {$where_condition} {$condition_session} ";
        $sql .= " ORDER BY {$column} {$direction} ";
        $sql .= " LIMIT {$start}, {$limit}";
        $result = Database::query($sql);
        $works = array();
        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. */
            // $item_property_data = api_get_item_property_info(api_get_course_int_id(), 'work', $item_id, api_get_session_id());
            //if (!$is_allowed_to_edit && $item_property_data['insert_user_id'] == api_get_user_id()) {
            if (!$is_allowed_to_edit && $owner_id == api_get_user_id()) {
                $is_author = true;
            }
            if ($course_info['show_score'] == 0) {
                $can_read = true;
            }
            if ($work['accepted'] == '0') {
                $class = 'invisible';
            } else {
                $class = '';
            }
            $qualification_exists = false;
            if (!empty($work_data['qualification']) && intval($work_data['qualification']) > 0) {
                $qualification_exists = true;
            }
            $qualification_string = '';
            if ($qualification_exists) {
                if ($work['qualification'] == '') {
                    $qualification_string = Display::label('-');
                } else {
                    $qualification_string = Display::label($work['qualification'], 'info');
                }
            }
            $add_string = '';
            $time_expires = api_strtotime($work_assignment['expires_on'], 'UTC');
            if (!empty($work_assignment['expires_on']) && $work_assignment['expires_on'] != '0000-00-00 00:00:00' && $time_expires && $time_expires < api_strtotime($work['sent_date'], 'UTC')) {
                $add_string = Display::label(get_lang('Expired'), 'important');
            }
            if ($can_read && $work['accepted'] == '1' || $is_author && in_array($work['accepted'], array('1', '0')) || $is_allowed_to_edit) {
                // Firstname, lastname, username
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:work.lib.php


注:本文中的get_work_assignment_by_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。