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


PHP GradebookUtils类代码示例

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


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

示例1: deleteAllCertificates

 /**
  * @param int $catId
  */
 public static function deleteAllCertificates($catId)
 {
     $certificate_list = GradebookUtils::get_list_users_certificates($catId);
     if (!empty($certificate_list)) {
         foreach ($certificate_list as $index => $value) {
             $list_certificate = GradebookUtils::get_list_gradebook_certificates_by_user_id($value['user_id'], $catId);
             foreach ($list_certificate as $value_certificate) {
                 $certificate_obj = new Certificate($value_certificate['id']);
                 $certificate_obj->delete(true);
             }
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:16,代码来源:category.class.php

示例2: attendance_edit

 /**
  * edit attendances inside table
  * @param 	int	   attendance id
  * @param  	bool   true for adding link in gradebook or false otherwise (optional)
  * @return 	int    last id
  */
 public function attendance_edit($attendance_id, $link_to_gradebook = false)
 {
     $_course = api_get_course_info();
     $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
     $table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
     $session_id = api_get_session_id();
     $user_id = api_get_user_id();
     $attendance_id = intval($attendance_id);
     $course_code = $_course['code'];
     $course_id = $_course['real_id'];
     $title_gradebook = $this->attendance_qualify_title;
     $value_calification = 0;
     $weight_calification = floatval($this->attendance_weight);
     if (!empty($attendance_id)) {
         $params = ['name' => $this->name, 'description' => $this->description, 'attendance_qualify_title' => $title_gradebook, 'attendance_weight' => $weight_calification];
         Database::update($tbl_attendance, $params, ['c_id = ? AND id = ?' => [$course_id, $attendance_id]]);
         api_item_property_update($_course, TOOL_ATTENDANCE, $attendance_id, "AttendanceUpdated", $user_id);
         // add link to gradebook
         if ($link_to_gradebook && !empty($this->category_id)) {
             $description = '';
             $link_id = GradebookUtils::is_resource_in_course_gradebook($course_code, 7, $attendance_id, $session_id);
             if (!$link_id) {
                 GradebookUtils::add_resource_to_course_gradebook($this->category_id, $course_code, 7, $attendance_id, $title_gradebook, $weight_calification, $value_calification, $description, 1, $session_id);
             } else {
                 Database::query('UPDATE ' . $table_link . ' SET weight=' . $weight_calification . ' WHERE id=' . $link_id . '');
             }
         }
         return $attendance_id;
     }
     return null;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:37,代码来源:attendance.lib.php

示例3: api_get_self

    $url = api_get_self() . '?action=export_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id . '&filter=' . $filterOfficialCode;
    echo Display::url(get_lang('ExportAllCertificatesToPDF'), $url, array('class' => 'btn btn-default'));
}
echo '</div>';
echo $filterForm;
if (count($certificate_list) == 0) {
    echo Display::display_warning_message(get_lang('NoResultsAvailable'));
} else {
    echo '<br /><br /><table class="data_table">';
    foreach ($certificate_list as $index => $value) {
        echo '<tr>
                <td width="100%" class="actions">' . get_lang('Student') . ' : ' . api_get_person_name($value['firstname'], $value['lastname']) . ' (' . $value['username'] . ')</td>';
        echo '</tr>';
        echo '<tr><td>
            <table class="data_table">';
        $list_certificate = GradebookUtils::get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
        foreach ($list_certificate as $value_certificate) {
            echo '<tr>';
            echo '<td width="50%">' . get_lang('Score') . ' : ' . $value_certificate['score_certificate'] . '</td>';
            echo '<td width="30%">' . get_lang('Date') . ' : ' . api_convert_and_format_date($value_certificate['created_at']) . '</td>';
            echo '<td width="20%">';
            $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $value_certificate['id'];
            $certificates = Display::url(get_lang('Certificate'), $url, array('target' => '_blank', 'class' => 'btn btn-default'));
            echo $certificates;
            echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token=' . $token . '&cidReq=' . $course_code . '&action=delete&cat_id=' . $cat_id . '&certificate_id=' . $value_certificate['id'] . '">
                    ' . Display::return_icon('delete.png', get_lang('Delete')) . '
                  </a>';
            echo '</td></tr>';
        }
        echo '</table>';
        echo '</td></tr>';
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_display_certificate.php

示例4: get_lang

// Adavanced Parameters
if (Gradebook::is_active()) {
    if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
        $form->addButtonAdvancedSettings('id_qualify');
        $form->addElement('html', '<div id="id_qualify_options" style="display:block">');
        $form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'), array('checked' => 'true', 'onclick' => 'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}'));
        $form->addElement('html', '<div id="options_field" style="display:block">');
    } else {
        $form->addButtonAdvancedSettings('id_qualify');
        $form->addElement('html', '<div id="id_qualify_options" style="display:none">');
        $form->addElement('checkbox', 'attendance_qualify_gradebook', '', get_lang('QualifyAttendanceGradebook'), 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
        $form->addElement('html', '<div id="options_field" style="display:none">');
    }
    GradebookUtils::load_gradebook_select_in_tool($form);
    $form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
    $form->applyFilter('attendance_qualify_title', 'html_filter');
    $form->addElement('text', 'attendance_weight', get_lang('QualifyWeight'), 'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
    $form->applyFilter('attendance_weight', 'html_filter');
    $form->addElement('html', '</div>');
    $form->addElement('html', '</div>');
}
$form->addButtonUpdate(get_lang('Save'));
// set default values
$default['title'] = Security::remove_XSS($title);
$default['description'] = Security::remove_XSS($description, STUDENT);
$default['attendance_qualify_title'] = $attendance_qualify_title;
$default['attendance_weight'] = $attendance_weight;
$link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 7, $attendance_id, api_get_session_id());
$default['category_id'] = $link_info->getCategoryId();
$form->setDefaults($default);
$form->display();
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:attendance_edit.php

示例5: foreach

            if (!empty($diff)) {
                $weightToApply = $weight - $diff;
                $diffApplied = true;
            }
        }
        GradebookUtils::updateLinkWeight($link['id'], $link['resource_name'], $weightToApply);
    }
    foreach ($evaluations as $evaluation) {
        $weightToApply = $weight;
        if ($diffApplied == false) {
            if (!empty($diff)) {
                $weightToApply = $weight - $diff;
                $diffApplied = true;
            }
        }
        GradebookUtils::updateEvaluationWeight($evaluation['id'], $weightToApply);
    }
    header('Location:' . $currentUrl);
    exit;
}
// 	DISPLAY HEADERS AND MESSAGES
if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
    if (isset($_GET['studentoverview'])) {
        $interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $my_selectcat, 'name' => get_lang('Gradebook'));
        Display::display_header(get_lang('FlatView'));
    } elseif (isset($_GET['search'])) {
        $interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $my_selectcat, 'name' => get_lang('Gradebook'));
        Display::display_header(get_lang('SearchResults'));
    } else {
        $interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=1', 'name' => get_lang('Gradebook'));
        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditAllWeights'));
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_edit_all.php

示例6: store_edit_post

/**
 * This function stores the edit of a post in the forum_post table.
 *
 * @param array
 * @return void HTML
 *
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 * @version february 2006, dokeos 1.8
 */
function store_edit_post($values)
{
    $threadTable = Database::get_course_table(TABLE_FORUM_THREAD);
    $table_posts = Database::get_course_table(TABLE_FORUM_POST);
    $course_id = api_get_course_int_id();
    //check if this post is the first of the thread
    // First we check if the change affects the thread and if so we commit
    // the changes (sticky and post_title=thread_title are relevant).
    $posts = getPosts($values['thread_id']);
    $first_post = null;
    if (!empty($posts) && count($posts) > 0 && isset($posts[0])) {
        $first_post = $posts[0];
    }
    if (!empty($first_post) && $first_post['post_id'] == $values['post_id']) {
        $params = ['thread_title' => $values['post_title'], 'thread_sticky' => isset($values['thread_sticky']) ? $values['thread_sticky'] : null, 'thread_title_qualify' => $values['calification_notebook_title'], 'thread_qualify_max' => $values['numeric_calification'], 'thread_weight' => $values['weight_calification'], 'thread_peer_qualify' => $values['thread_peer_qualify']];
        $where = ['c_id = ? AND thread_id = ?' => [$course_id, $values['thread_id']]];
        Database::update($threadTable, $params, $where);
    }
    // Update the post_title and the post_text.
    $params = ['post_title' => $values['post_title'], 'post_text' => $values['post_text'], 'post_notification' => isset($values['post_notification']) ? $values['post_notification'] : ''];
    $where = ['c_id = ? AND post_id = ?' => [$course_id, $values['post_id']]];
    Database::update($table_posts, $params, $where);
    // Update attached files
    if (!empty($_POST['file_ids']) && is_array($_POST['file_ids'])) {
        foreach ($_POST['file_ids'] as $key => $id) {
            editAttachedFile(array('comment' => $_POST['file_comments'][$key], 'post_id' => $values['post_id']), $id);
        }
    }
    if (!empty($values['remove_attach'])) {
        delete_attachment($values['post_id']);
    }
    if (empty($values['id_attach'])) {
        add_forum_attachment_file(isset($values['file_comment']) ? $values['file_comment'] : null, $values['post_id']);
    } else {
        edit_forum_attachment_file(isset($values['file_comment']) ? $values['file_comment'] : null, $values['post_id'], $values['id_attach']);
    }
    if (api_is_course_admin() == true) {
        $ccode = api_get_course_id();
        $sid = api_get_session_id();
        $link_info = GradebookUtils::is_resource_in_course_gradebook($ccode, 5, $values['thread_id'], $sid);
        $link_id = $link_info['id'];
        $thread_qualify_gradebook = isset($values['thread_qualify_gradebook']) ? $values['thread_qualify_gradebook'] : null;
        if ($thread_qualify_gradebook != 1) {
            if ($link_info !== false) {
                GradebookUtils::remove_resource_from_course_gradebook($link_id);
            }
        } else {
            if ($link_info === false && !$_GET['thread']) {
                $weigthqualify = $values['weight_calification'];
                GradebookUtils::add_resource_to_course_gradebook($values['category_id'], $ccode, 5, $values['thread_id'], Database::escape_string(stripslashes($values['calification_notebook_title'])), $weigthqualify, $values['numeric_calification'], null, 0, $sid);
            }
        }
    }
    // Storing the attachments if any.
    //update_added_resources('forum_post', $values['post_id']);
    $message = get_lang('EditPostStored') . '<br />';
    $message .= get_lang('ReturnTo') . ' <a href="viewforum.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&">
            ' . get_lang('Forum') . '</a><br />';
    $message .= get_lang('ReturnTo') . ' <a href="viewthread.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . $values['thread_id'] . '&post=' . intval($_GET['post']) . '">' . get_lang('Message') . '</a>';
    Session::erase('formelements');
    Session::erase('origin');
    Session::erase('breadcrumbs');
    Session::erase('addedresource');
    Session::erase('addedresourceid');
    Display::display_confirmation_message($message, false);
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:75,代码来源:forumfunction.inc.php

示例7: parse_xml_data

     $results = parse_xml_data($file_name);
 }
 $nr_results_added = 0;
 foreach ($results as $index => $importedresult) {
     //check username & score
     $importedresult['user_id'] = UserManager::get_user_id_from_username($importedresult['username']);
     $added = '0';
     foreach ($allresults as $allresult) {
         if ($importedresult['user_id'] == $allresult->get_user_id()) {
             if ($importedresult['score'] != $allresult->get_score()) {
                 if (!isset($values['overwrite'])) {
                     header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&import_score_error=' . $importedresult['user_id']);
                     exit;
                     break;
                 } else {
                     GradebookUtils::overwritescore($allresult->get_id(), $importedresult['score'], $eval[0]->get_max());
                     $overwritescore++;
                     $added = '1';
                 }
             } else {
                 $added = '1';
             }
         }
     }
     if ($importedresult['user_id'] == null) {
         header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&incorrectdata=');
         exit;
     }
     $userinfo = api_get_user_info($importedresult['user_id']);
     if ($userinfo['lastname'] != $importedresult['lastname'] || $userinfo['firstname'] != $importedresult['firstname'] || $userinfo['official_code'] != $importedresult['official_code']) {
         if (!isset($values['ignoreerrors'])) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_view_result.php

示例8: header

    $lastname = $searchForm->getSubmitValue('lastname');
    $userList = UserManager::getUserByName($firstname, $lastname);
    if (empty($userList)) {
        Display::addFlash(Display::return_message(get_lang('NoResults'), 'warning'));
        header('Location: ' . api_get_self());
        exit;
    }
} elseif ($userId > 0) {
    $userInfo = api_get_user_info($userId);
    if (empty($userInfo)) {
        Display::addFlash(Display::return_message(get_lang('NoUser'), 'warning'));
        header('Location: ' . api_get_self());
        exit;
    }
    $courseList = GradebookUtils::getUserCertificatesInCourses($userId, false);
    $sessionList = GradebookUtils::getUserCertificatesInSessions($userId, false);
    if (empty($courseList) && empty($sessionList)) {
        Display::addFlash(Display::return_message(sprintf(get_lang('TheUserXNotYetAchievedCertificates'), $userInfo['complete_name']), 'warning'));
        header('Location: ' . api_get_self());
        exit;
    }
}
$template = new Template(get_lang('SearchCertificates'));
$template->assign('search_form', $searchForm->returnForm());
$template->assign('user_list', $userList);
$template->assign('user_info', $userInfo);
$template->assign('course_list', $courseList);
$template->assign('session_list', $sessionList);
$content = $template->fetch('default/gradebook/search.tpl');
$template->assign('header', get_lang('SearchCertificates'));
$template->assign('content', $content);
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:search.php

示例9: Exercise

 }
 // single exercise choice
 // construction of Exercise
 $objExerciseTmp = new Exercise();
 $check = Security::check_token('get');
 $exercise_action_locked = api_resource_is_locked_by_gradebook($exerciseId, LINK_EXERCISE);
 if ($objExerciseTmp->read($exerciseId)) {
     if ($check) {
         switch ($choice) {
             case 'delete':
                 // deletes an exercise
                 if ($exercise_action_locked == false) {
                     $objExerciseTmp->delete();
                     $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 1, $exerciseId, api_get_session_id());
                     if ($link_info !== false) {
                         GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
                     }
                     Display::display_confirmation_message(get_lang('ExerciseDeleted'));
                 }
                 break;
             case 'enable':
                 // enables an exercise
                 $objExerciseTmp->enable();
                 $objExerciseTmp->save();
                 api_item_property_update($courseInfo, TOOL_QUIZ, $objExerciseTmp->id, 'visible', $userId);
                 // "WHAT'S NEW" notification: update table item_property (previously last_tooledit)
                 Display::display_confirmation_message(get_lang('VisibilityChanged'));
                 break;
             case 'disable':
                 // disables an exercise
                 $objExerciseTmp->disable();
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:exercise.php

示例10: generate

 /**
  *  Generates an HTML Certificate and fills the path_certificate field in the DB
  **/
 public function generate($params = array())
 {
     // The user directory should be set
     if (empty($this->certification_user_path) && $this->force_certificate_generation == false) {
         return false;
     }
     $params['hide_print_button'] = isset($params['hide_print_button']) ? true : false;
     $my_category = Category::load($this->certificate_data['cat_id']);
     if (isset($my_category[0]) && $my_category[0]->is_certificate_available($this->user_id)) {
         $user = api_get_user_info($this->user_id);
         $scoredisplay = ScoreDisplay::instance();
         $scorecourse = $my_category[0]->calc_score($this->user_id);
         $scorecourse_display = isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable');
         // Prepare all necessary variables:
         $organization_name = api_get_setting('platform.institution');
         //$portal_name         = api_get_setting('platform.site_name');
         $stud_fn = $user['firstname'];
         $stud_ln = $user['lastname'];
         //@todo this code is not needed
         $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'), $organization_name, $stud_fn . ' ' . $stud_ln, $my_category[0]->get_name(), $scorecourse_display);
         $certif_text = str_replace("\\n", "\n", $certif_text);
         //If the gradebook is related to skills we added the skills to the user
         $courseId = api_get_real_course_id();
         $sessionId = api_get_session_id();
         $skill = new Skill();
         $skill->add_skill_to_user($this->user_id, $this->certificate_data['cat_id'], $courseId, $sessionId);
         if (is_dir($this->certification_user_path)) {
             if (!empty($this->certificate_data)) {
                 $new_content_html = GradebookUtils::get_user_certificate_content($this->user_id, $my_category[0]->get_course_code(), $my_category[0]->get_session_id(), false, $params['hide_print_button']);
                 if ($my_category[0]->get_id() == strval(intval($this->certificate_data['cat_id']))) {
                     $name = $this->certificate_data['path_certificate'];
                     $my_path_certificate = $this->certification_user_path . basename($name);
                     if (file_exists($my_path_certificate) && !empty($name) && !is_dir($my_path_certificate) && $this->force_certificate_generation == false) {
                         //Seems that the file was already generated
                         return true;
                     } else {
                         // Creating new name
                         $name = md5($this->user_id . $this->certificate_data['cat_id']) . '.html';
                         $my_path_certificate = $this->certification_user_path . $name;
                         $path_certificate = '/' . $name;
                         //Getting QR filename
                         $file_info = pathinfo($path_certificate);
                         $qr_code_filename = $this->certification_user_path . $file_info['filename'] . '_qr.png';
                         $my_new_content_html = str_replace('((certificate_barcode))', Display::img($this->certification_web_user_path . $file_info['filename'] . '_qr.png', 'QR'), $new_content_html['content']);
                         $my_new_content_html = mb_convert_encoding($my_new_content_html, 'UTF-8', api_get_system_encoding());
                         $result = @file_put_contents($my_path_certificate, $my_new_content_html);
                         if ($result) {
                             //Updating the path
                             self::update_user_info_about_certificate($this->certificate_data['cat_id'], $this->user_id, $path_certificate);
                             $this->certificate_data['path_certificate'] = $path_certificate;
                             if ($this->html_file_is_generated()) {
                                 if (!empty($file_info)) {
                                     $text = $this->parse_certificate_variables($new_content_html['variables']);
                                     $this->generate_qr($text, $qr_code_filename);
                                 }
                             }
                         }
                         return $result;
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:68,代码来源:certificate.lib.php

示例11: delete

 /**
  * Static admin function allowing removal of a learnpath
  * @param	string	Course code
  * @param	integer	Learnpath ID
  * @param	string	Whether to delete data or keep it (default: 'keep', others: 'remove')
  * @return	boolean	True on success, false on failure (might change that to return number of elements deleted)
  */
 public function delete($course = null, $id = null, $delete = 'keep')
 {
     $course_id = api_get_course_int_id();
     // TODO: Implement a way of getting this to work when the current object is not set.
     // In clear: implement this in the item class as well (abstract class) and use the given ID in queries.
     // If an ID is specifically given and the current LP is not the same, prevent delete.
     if (!empty($id) && $id != $this->lp_id) {
         return false;
     }
     $lp = Database::get_course_table(TABLE_LP_MAIN);
     $lp_item = Database::get_course_table(TABLE_LP_ITEM);
     $lp_view = Database::get_course_table(TABLE_LP_VIEW);
     $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
     // Delete lp item id.
     foreach ($this->items as $id => $dummy) {
         $sql = "DELETE FROM {$lp_item_view}\n                    WHERE c_id = {$course_id} AND lp_item_id = '" . $id . "'";
         Database::query($sql);
     }
     // Proposed by Christophe (nickname: clefevre)
     $sql = "DELETE FROM {$lp_item} WHERE c_id = " . $course_id . " AND lp_id = " . $this->lp_id;
     Database::query($sql);
     $sql = "DELETE FROM {$lp_view} WHERE c_id = " . $course_id . " AND lp_id = " . $this->lp_id;
     Database::query($sql);
     self::toggle_publish($this->lp_id, 'i');
     if ($this->type == 2 || $this->type == 3) {
         // This is a scorm learning path, delete the files as well.
         $sql = "SELECT path FROM {$lp}\n                    WHERE c_id = " . $course_id . " AND id = " . $this->lp_id;
         $res = Database::query($sql);
         if (Database::num_rows($res) > 0) {
             $row = Database::fetch_array($res);
             $path = $row['path'];
             $sql = "SELECT id FROM {$lp}\n                        WHERE c_id = " . $course_id . " AND path = '{$path}' AND id != " . $this->lp_id;
             $res = Database::query($sql);
             if (Database::num_rows($res) > 0) {
                 // Another learning path uses this directory, so don't delete it.
                 if ($this->debug > 2) {
                     error_log('New LP - In learnpath::delete(), found other LP using path ' . $path . ', keeping directory', 0);
                 }
             } else {
                 // No other LP uses that directory, delete it.
                 $course_rel_dir = api_get_course_path() . '/scorm/';
                 // scorm dir web path starting from /courses
                 $course_scorm_dir = api_get_path(SYS_COURSE_PATH) . $course_rel_dir;
                 // The absolute system path for this course.
                 if ($delete == 'remove' && is_dir($course_scorm_dir . $path) and !empty($course_scorm_dir)) {
                     if ($this->debug > 2) {
                         error_log('New LP - In learnpath::delete(), found SCORM, deleting directory: ' . $course_scorm_dir . $path, 0);
                     }
                     // Proposed by Christophe (clefevre).
                     if (strcmp(substr($path, -2), "/.") == 0) {
                         $path = substr($path, 0, -1);
                         // Remove "." at the end.
                     }
                     //exec('rm -rf ' . $course_scorm_dir . $path); // See Bug #5208, this is not OS-portable way.
                     rmdirr($course_scorm_dir . $path);
                 }
             }
         }
     }
     $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
     $link = 'newscorm/lp_controller.php?action=view&lp_id=' . $this->lp_id;
     // Delete tools
     $sql = "DELETE FROM {$tbl_tool}\n                WHERE c_id = " . $course_id . " AND (link LIKE '{$link}%' AND image='scormbuilder.gif')";
     Database::query($sql);
     $sql = "DELETE FROM {$lp} WHERE c_id = " . $course_id . " AND id = " . $this->lp_id;
     Database::query($sql);
     // Updates the display order of all lps.
     $this->update_display_order();
     api_item_property_update(api_get_course_info(), TOOL_LEARNPATH, $this->lp_id, 'delete', api_get_user_id());
     $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 4, $id, api_get_session_id());
     if ($link_info !== false) {
         GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
     }
     if (api_get_setting('search_enabled') == 'true') {
         require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
         delete_all_values_for_item($this->cc, TOOL_LEARNPATH, $this->lp_id);
     }
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:85,代码来源:learnpath.class.php

示例12: api_get_setting

            // Print certificates (without the common header/footer/watermark
            //  stuff) and return as one multiple-pages PDF
            $address = api_get_setting('platform.institution_address');
            $phone = api_get_setting('admin.administrator_phone');
            $address = str_replace('\\n', '<br />', $address);
            $pdf->custom_header = array('html' => "<h5 align='right'>{$address} <br />{$phone}</h5>");
            //  stuff) and return as one multiple-pages PDF
            $pdf->html_to_pdf($pdfList, null, null, false, true, true);
        }
        // Delete calc_score session data
        Session::erase('calc_score');
        break;
    case 'download':
        $userId = isset($_GET['user_id']) && $_GET['user_id'] ? $_GET['user_id'] : null;
        $cats = Category::load($cat_id, null, null, null, null, null, false);
        GradebookUtils::generateTable($userId, $cats);
        break;
}
$course_code = api_get_course_id();
$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradebookListOfStudentsReports'));
$this_section = SECTION_COURSES;
Display::display_header('');
$token = Security::get_token();
echo Display::page_header(get_lang('GradebookListOfStudentsReports'));
echo '<div class="btn-group">';
if (count($userList) > 0) {
    $url = api_get_self() . '?action=export_all&' . api_get_cidReq() . '&selectcat=' . $cat_id;
    echo Display::url(get_lang('ExportAllToPDF'), $url, array('class' => 'btn btn-default'));
}
echo '</div>';
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_display_summary.php

示例13: get_work_assignment_by_id

$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', 'post', api_get_path(WEB_CODE_PATH) . 'work/edit_work.php?id=' . $workId . '&' . api_get_cidreq());
$form->addElement('header', get_lang('Edit'));
$title = !empty($workData['title']) ? $workData['title'] : basename($workData['url']);
$defaults = $workData;
$defaults['new_dir'] = Security::remove_XSS($title);
$there_is_a_end_date = false;
if (Gradebook::is_active()) {
    $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), LINK_STUDENTPUBLICATION, $workId);
    if (!empty($link_info)) {
        $defaults['weight'] = $link_info['weight'];
        $defaults['category_id'] = $link_info['category_id'];
        $defaults['make_calification'] = 1;
    }
} else {
    $defaults['category_id'] = '';
}
if (!empty($homework['expires_on'])) {
    $homework['expires_on'] = api_get_local_time($homework['expires_on']);
    $there_is_a_expire_date = true;
    $defaults['enableExpiryDate'] = true;
} else {
    $homework['expires_on'] = null;
    $there_is_a_expire_date = false;
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:edit_work.php

示例14: getFormWork

/**
 * @param FormValidator $form
 * @param array $defaults
 * @return FormValidator
 */
function getFormWork($form, $defaults = array())
{
    if (!empty($defaults)) {
        if (isset($defaults['submit'])) {
            unset($defaults['submit']);
        }
    }
    // Create the form that asks for the directory name
    $form->addElement('text', 'new_dir', get_lang('AssignmentName'));
    $form->addRule('new_dir', get_lang('ThisFieldIsRequired'), 'required');
    $form->addHtmlEditor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar());
    $form->addButtonAdvancedSettings('advanced_params', get_lang('AdvancedParameters'));
    if (!empty($defaults) && (isset($defaults['enableEndDate']) || isset($defaults['enableExpiryDate']))) {
        $form->addElement('html', '<div id="advanced_params_options" style="display:block">');
    } else {
        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
    }
    // QualificationOfAssignment
    $form->addElement('text', 'qualification', get_lang('QualificationNumeric'));
    if (api_get_session_id() != 0 && Gradebook::is_active() || api_get_session_id() == 0) {
        $form->addElement('checkbox', 'make_calification', null, get_lang('MakeQualifiable'), array('id' => 'make_calification_id', 'onclick' => "javascript: if(this.checked) { document.getElementById('option1').style.display='block';}else{document.getElementById('option1').style.display='none';}"));
    } else {
        // QualificationOfAssignment
        $form->addElement('hidden', 'make_calification', false);
    }
    if (!empty($defaults) && isset($defaults['category_id'])) {
        $form->addElement('html', '<div id=\'option1\' style="display:block">');
    } else {
        $form->addElement('html', '<div id=\'option1\' style="display:none">');
    }
    // Loading Gradebook select
    GradebookUtils::load_gradebook_select_in_tool($form);
    $form->addElement('text', 'weight', get_lang('WeightInTheGradebook'));
    $form->addElement('html', '</div>');
    $form->addElement('checkbox', 'enableExpiryDate', null, get_lang('EnableExpiryDate'), 'id="expiry_date"');
    if (isset($defaults['enableExpiryDate']) && $defaults['enableExpiryDate']) {
        $form->addElement('html', '<div id="option2" style="display: block;">');
    } else {
        $form->addElement('html', '<div id="option2" style="display: none;">');
    }
    $currentDate = substr(api_get_local_time(), 0, 10);
    if (!isset($defaults['expires_on'])) {
        $date = substr($currentDate, 0, 10);
        $defaults['expires_on'] = $date . ' 23:59';
    }
    if (!isset($defaults['ends_on'])) {
        $date = substr($currentDate, 0, 10);
        $defaults['ends_on'] = $date . ' 23:59';
    }
    $form->addElement('date_time_picker', 'expires_on', get_lang('ExpiresAt'));
    $form->addElement('html', '</div>');
    $form->addElement('checkbox', 'enableEndDate', null, get_lang('EnableEndDate'), 'id="end_date"');
    if (isset($defaults['enableEndDate']) && $defaults['enableEndDate']) {
        $form->addElement('html', '<div id="option3" style="display: block;">');
    } else {
        $form->addElement('html', '<div id="option3" style="display: none;">');
    }
    $form->addElement('date_time_picker', 'ends_on', get_lang('EndsAt'));
    $form->addElement('html', '</div>');
    $form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar'));
    $form->addElement('select', 'allow_text_assignment', get_lang('DocumentType'), getUploadDocumentType());
    $form->addElement('html', '</div>');
    if (isset($defaults['enableExpiryDate']) && isset($defaults['enableEndDate'])) {
        $form->addRule(array('expires_on', 'ends_on'), get_lang('DateExpiredNotBeLessDeadLine'), 'comparedate');
    }
    if (!empty($defaults)) {
        $form->setDefaults($defaults);
    }
    return $form;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:75,代码来源:work.lib.php

示例15: get_evaluations_courses_in_sessions_graph

 /**
  * This method return a graph containing information about evaluations
  * inside courses in sessions, it's used inside get_block method for
  * showing it inside dashboard interface
  * @return string  img html
  */
 public function get_evaluations_courses_in_sessions_graph()
 {
     $graphs = array();
     if (!empty($this->sessions)) {
         $session_ids = array_keys($this->sessions);
         foreach ($session_ids as $session_id) {
             $courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
             $courses_graph = array();
             foreach ($courses_code as $course_code) {
                 $cats = Category::load(null, null, $course_code, null, null, $session_id);
                 if (isset($cats) && isset($cats[0])) {
                     $alleval = $cats[0]->get_evaluations(null, true, $course_code);
                     $alllinks = $cats[0]->get_links(null, true);
                     $users = GradebookUtils::get_all_users($alleval, $alllinks);
                     $datagen = new FlatViewDataGenerator($users, $alleval, $alllinks);
                     $evaluation_sumary = $datagen->get_evaluation_sumary_results();
                     if (!empty($evaluation_sumary)) {
                         $items = array_keys($evaluation_sumary);
                         $max = $min = $avg = array();
                         foreach ($evaluation_sumary as $evaluation) {
                             $max[] = $evaluation['max'];
                             $min[] = $evaluation['min'];
                             $avg[] = $evaluation['avg'];
                         }
                         // Dataset definition
                         $dataSet = new pData();
                         $dataSet->addPoints($min, 'Serie3');
                         $dataSet->addPoints($avg, 'Serie2');
                         $dataSet->addPoints($max, 'Serie1');
                         $dataSet->addPoints($items, 'Labels');
                         $dataSet->setSerieDescription('Serie1', get_lang('Max'));
                         $dataSet->setSerieDescription('Serie2', get_lang('Avg'));
                         $dataSet->setSerieDescription('Serie3', get_lang('Min'));
                         $dataSet->setAbscissa('Labels');
                         $dataSet->setAbscissaName(get_lang('EvaluationName'));
                         $dataSet->normalize(100, '%');
                         $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
                         // Cache definition
                         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
                         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
                         $chartHash = $myCache->getHash($dataSet);
                         if ($myCache->isInCache($chartHash)) {
                             $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
                             $myCache->saveFromCache($chartHash, $imgPath);
                             $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
                         } else {
                             /* Create the pChart object */
                             $widthSize = $this->bg_width;
                             $heightSize = $this->bg_height;
                             $fontSize = 8;
                             $angle = 50;
                             $myPicture = new pImage($widthSize, $heightSize, $dataSet);
                             /* Turn of Antialiasing */
                             $myPicture->Antialias = false;
                             /* Add a border to the picture */
                             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
                             /* Set the default font */
                             $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
                             /* Do NOT Write the chart title */
                             /* Define the chart area */
                             $myPicture->setGraphArea(50, 30, $widthSize - 20, $heightSize - 100);
                             /* Draw the scale */
                             $scaleSettings = array('GridR' => 200, 'GridG' => 200, 'GridB' => 200, 'DrawSubTicks' => true, 'CycleBackground' => true, 'Mode' => SCALE_MODE_MANUAL, 'ManualScale' => array('0' => array('Min' => 0, 'Max' => 100)), 'LabelRotation' => $angle);
                             $myPicture->drawScale($scaleSettings);
                             /* Turn on shadow computing */
                             $myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
                             /* Draw the chart */
                             $myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
                             $settings = array('DisplayValues' => true, 'DisplaySize' => $fontSize, 'DisplayR' => 0, 'DisplayG' => 0, 'DisplayB' => 0, 'DisplayOrientation' => ORIENTATION_HORIZONTAL, 'Gradient' => false, 'Surrounding' => 30, 'InnerSurrounding' => 25);
                             $myPicture->drawStackedBarChart($settings);
                             $legendSettings = array('Mode' => LEGEND_HORIZONTAL, 'Style' => LEGEND_NOBORDER);
                             $myPicture->drawLegend($widthSize / 2, 15, $legendSettings);
                             /* Write and save into cache */
                             $myCache->writeToCache($chartHash, $myPicture);
                             $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
                             $myCache->saveFromCache($chartHash, $imgPath);
                             $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
                         }
                         if (!empty($imgPath)) {
                             $courses_graph[$course_code] = '<img src="' . $imgPath . '">';
                         }
                     }
                 }
             }
             if (!empty($courses_graph)) {
                 $graphs[$session_id] = $courses_graph;
             }
         }
     }
     return $graphs;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:97,代码来源:block_evaluation_graph.class.php


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