本文整理汇总了PHP中api_convert_and_format_date函数的典型用法代码示例。如果您正苦于以下问题:PHP api_convert_and_format_date函数的具体用法?PHP api_convert_and_format_date怎么用?PHP api_convert_and_format_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_convert_and_format_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Show this resource
*/
function show()
{
parent::show();
$extra = api_convert_and_format_date($this->obj->thread_date);
if ($this->obj->thread_poster_id) {
$user_info = api_get_user_info($this->obj->thread_poster_id);
$extra = $user_info['complete_name'] . ', ' . $extra;
}
echo $this->obj->thread_title . ' (' . $extra . ')';
}
示例2: return_form
/**
* Returns a Form validator Obj
* @todo the form should be auto generated
* @param string url
* @param string action add, edit
* @return obj form validator obj
*/
public function return_form($url, $action)
{
$oFCKeditor = new FCKeditor('description');
$oFCKeditor->ToolbarSet = 'careers';
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '200';
$oFCKeditor->Value = '';
$oFCKeditor->CreateHtml();
$form = new FormValidator('career', 'post', $url);
// Setting the form elements
$header = get_lang('Add');
if ($action == 'edit') {
$header = get_lang('Modify');
}
$form->addElement('header', $header);
$id = isset($_GET['id']) ? intval($_GET['id']) : '';
$form->addElement('hidden', 'id', $id);
$form->addElement('text', 'name', get_lang('Name'), array('size' => '70'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'careers', 'Width' => '100%', 'Height' => '250'));
$status_list = $this->get_status_list();
$form->addElement('select', 'status', get_lang('Status'), $status_list);
if ($action == 'edit') {
$form->addElement('text', 'created_at', get_lang('CreatedAt'));
$form->freeze('created_at');
}
if ($action == 'edit') {
$form->addElement('style_submit_button', 'submit', get_lang('Modify'), 'class="save"');
} else {
$form->addElement('style_submit_button', 'submit', get_lang('Add'), 'class="save"');
}
// Setting the defaults
$defaults = $this->get($id);
if (!empty($defaults['created_at'])) {
$defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
}
if (!empty($defaults['updated_at'])) {
$defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
}
$form->setDefaults($defaults);
// Setting the rules
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
return $form;
}
示例3: return_exercise_block
function return_exercise_block($personal_course_list)
{
$exercise_list = array();
if (!empty($personal_course_list)) {
foreach ($personal_course_list as $course_item) {
$course_code = $course_item['c'];
$session_id = $course_item['id_session'];
$exercises = ExerciseLib::get_exercises_to_be_taken($course_code, $session_id);
foreach ($exercises as $exercise_item) {
$exercise_item['course_code'] = $course_code;
$exercise_item['session_id'] = $session_id;
$exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');
$exercise_list[] = $exercise_item;
}
}
if (!empty($exercise_list)) {
$exercise_list = ArrayClass::msort($exercise_list, 'tms');
$my_exercise = $exercise_list[0];
$url = Display::url($my_exercise['title'], api_get_path(WEB_CODE_PATH) . 'exercice/overview.php?exerciseId=' . $my_exercise['id'] . '&cidReq=' . $my_exercise['course_code'] . '&id_session=' . $my_exercise['session_id']);
$this->tpl->assign('exercise_url', $url);
$this->tpl->assign('exercise_end_date', api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT));
}
}
}
示例4: api_get_user_info
if ($category[0]->is_certificate_available($user_id)) {
$user = api_get_user_info($user_id);
$scoredisplay = ScoreDisplay::instance();
$scorecourse = $category[0]->calc_score($user_id);
$scorecourse_display = isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable');
$cattotal = Category::load(0);
$scoretotal = $cattotal[0]->calc_score($user_id);
$scoretotal_display = isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable');
//prepare all necessary variables:
$organization_name = api_get_setting('Institution');
$portal_name = api_get_setting('siteName');
$stud_fn = $user['firstname'];
$stud_ln = $user['lastname'];
$certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'), $organization_name, $stud_fn . ' ' . $stud_ln, $category[0]->get_name(), $scorecourse_display);
$certif_text = str_replace("\\n", "\n", $certif_text);
$date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
$pdf = new Cezpdf('a4', 'landscape');
$pdf->selectFont(api_get_path(LIBRARY_PATH) . 'ezpdf/fonts/Courier.afm');
$pdf->ezSetMargins(30, 30, 50, 50);
//line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
$pdf->line(50, 50, 790, 50);
$pdf->line(50, 550, 790, 550);
$pdf->ezSetY(450);
//@todo replace image
//$pdf->ezImage(api_get_path(SYS_CODE_PATH).'img/dokeos_logo_certif.png',1,400,'','center','');
$pdf->ezSetY(480);
$pdf->ezText($certif_text, 28, array('justification' => 'center'));
//$pdf->ezSetY(750);
$pdf->ezSetY(50);
$pdf->ezText($date, 18, array('justification' => 'center'));
$pdf->ezSetY(580);
示例5: get_lang
?>
</th>
<th width="160px"><?php
echo get_lang('Date');
?>
</th>
</tr>
<?php
$sql = "SELECT *, quiz_question.question, firstname, lastname\n FROM {$TBL_TRACK_ATTEMPT_RECORDING} t, {$TBL_USER}, {$TBL_EXERCICES_QUESTION} quiz_question\n\t\tWHERE quiz_question.id = question_id AND\n user_id = author AND\n exe_id = '" . (int) $_GET['exe_id'] . "'\n ORDER BY position";
$query = Database::query($sql);
while ($row = Database::fetch_array($query)) {
echo '<tr';
if ($i % 2 == 0) {
echo 'class="row_odd"';
} else {
echo 'class="row_even"';
}
echo '>';
echo '<td>' . $row['question'] . '</td>';
echo '<td>' . $row['marks'] . '</td>';
if (!empty($row['teacher_comment'])) {
echo '<td>' . $row['teacher_comment'] . '</td>';
} else {
echo '<td>' . get_lang('WithoutComment') . '</td>';
}
echo '<td>' . (empty($row['firstname']) && empty($row['lastname']) ? '<i>' . get_lang('OriginalValue') . '</i>' : api_get_person_name($row['firstname'], $row['lastname'])) . '</td>';
echo '<td>' . api_convert_and_format_date($row['insert_date'], DATE_TIME_FORMAT_LONG) . '</td>';
echo '</tr>';
}
echo '</table>';
Display::display_footer();
示例6: array
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('Details'));
$interbreadcrumb[] = array('url' => 'gradebook_showlog_eval.php?visiblelog=' . Security::remove_XSS($_GET['visiblelog']) . '&selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('GradebookQualifyLog'));
$this_section = SECTION_COURSES;
Display::display_header('');
echo Display::page_header(get_lang('GradebookQualifyLog'));
$t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$t_user = Database::get_main_table(TABLE_MAIN_USER);
$visible_log = Security::remove_XSS($_GET['visiblelog']);
$evaledit = Evaluation::load($visible_log);
$sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM " . $t_linkeval_log . " le INNER JOIN " . $t_user . " us\n ON le.user_id_log=us.user_id where id_linkeval_log=" . $evaledit[0]->get_id() . " and type='evaluation';";
$result = Database::query($sql);
$list_info = array();
while ($row = Database::fetch_row($result)) {
$list_info[] = $row;
}
foreach ($list_info as $key => $info_log) {
$list_info[$key][5] = $info_log[5] ? api_convert_and_format_date($info_log[5]) : 'N/A';
$list_info[$key][3] = $info_log[3] == 1 ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
}
$parameters = array('visiblelog' => $visible_log, 'selectcat' => intval($_GET['selectcat']));
$table = new SortableTableFromArrayConfig($list_info, 1, 20, 'gradebookeval');
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('GradebookNameLog'));
$table->set_header(1, get_lang('GradebookDescriptionLog'));
$table->set_header(2, get_lang('GradebookPreviousWeight'));
$table->set_header(3, get_lang('GradebookVisibilityLog'));
$table->set_header(4, get_lang('ResourceType'));
$table->set_header(5, get_lang('Date'));
$table->set_header(6, get_lang('GradebookWhoChangedItLog'));
$table->display();
Display::display_footer();
示例7: api_get_cidreq
echo '<a href="viewthread.php?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&origin=' . $origin . '&thread=' . $row['thread_id'] . $origin_string . '&search=' . Security::remove_XSS(urlencode($my_search)) . '" ' . class_visible_invisible($row['visibility']) . '>' . prepare4display($row['thread_title']) . '</a></td>';
echo '<td>' . $row['thread_replies'] . '</td>';
echo '<td>' . $row['thread_views'] . '</td>';
// display the author name
$tab_poster_info = api_get_user_info($row['user_id']);
$poster_username = sprintf(get_lang('LoginX'), $tab_poster_info['username']);
if ($origin != 'learnpath') {
echo '<td>' . display_user_link($row['user_id'], api_get_person_name($row['firstname'], $row['lastname']), '', $poster_username) . '</td>';
} else {
echo '<td>' . Display::tag('span', api_get_person_name($row['firstname'], $row['lastname']), array("title" => api_htmlentities($poster_username, ENT_QUOTES))) . '</td>';
}
$last_post_info = get_last_post_by_thread($row['c_id'], $row['thread_id'], $row['forum_id'], is_allowed_to_edit());
$last_post = null;
if ($last_post_info) {
$poster_info = api_get_user_info($last_post_info['poster_id']);
$post_date = api_convert_and_format_date($last_post_info['post_date']);
$last_post = $post_date . ' ' . get_lang('By') . ' ' . display_user_link($last_post_info['poster_id'], $poster_info['complete_name'], '', $poster_info['username']);
}
/*
if ($row['last_poster_user_id'] == '0') {
$name = $row['poster_name'];
$last_poster_username = "";
} else {
$name = api_get_person_name($row['last_poster_firstname'], $row['last_poster_lastname']);
$tab_last_poster_info = api_get_user_info($row['last_poster_user_id']);
$last_poster_username = sprintf(get_lang('LoginX'), $tab_last_poster_info['username']);
}
// If the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread.
if (($row['visible'] == '1' OR api_is_allowed_to_edit(false, true)) && $origin != 'learnpath') {
$last_post = $post_date.' '.get_lang('By').' '.display_user_link($row['last_poster_user_id'], $name, '', $last_poster_username);
} elseif ($origin != 'learnpath') {
示例8: get_lang
$html .= Display::return_icon('post-forum.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
$html .= ' ' . $number_threads . '<br>' . $newPost . '</div>';
$html .= '<div class="col-md-6">';
// The last post in the forum.
if ($forum['last_poster_name'] != '') {
$name = $forum['last_poster_name'];
$poster_id = 0;
$username = "";
} else {
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id = $forum['last_poster_id'];
$userinfo = api_get_user_info($poster_id);
$username = sprintf(get_lang('LoginX'), $userinfo['username']);
}
if (!empty($forum['last_post_id'])) {
$html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' ' . api_convert_and_format_date($forum['last_post_date']) . '<br /> ' . get_lang('By') . ' ' . display_user_link($poster_id, $name, '', $username);
}
$html .= '</div>';
$html .= '<div class="col-md-4">';
if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval($sessionId) != 0)) {
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=delete&content=forum&id=' . $forum['forum_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
$html .= return_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility']);
$html .= return_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked']);
$html .= return_up_down_icon('forum', $forum['forum_id'], $forumsInCategory);
}
$iconnotify = 'notification_mail_na.png';
$session_forum_notification = isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : false;
if (is_array($session_forum_notification)) {
if (in_array($forum['forum_id'], $session_forum_notification)) {
$iconnotify = 'notification_mail.png';
示例9: getCourseMeetings
//.........这里部分代码省略.........
$mId = $meetingDB['id'];
}
if (empty($mId)) {
// if the id is still empty (should *never* occur as 'id' is
// the table's primary key), skip this conference
continue;
}
$recordingParams = array('meetingId' => $mId);
//To see the recording list in your BBB server do: bbb-record --list
$records = $this->api->getRecordingsWithXmlResponseArray($recordingParams);
if (!empty($records)) {
$count = 1;
if (isset($records['message']) && !empty($records['message'])) {
if ($records['messageKey'] == 'noRecordings') {
$recordArray[] = get_lang('NoRecording');
if ($meetingDB['visibility'] == 0) {
$actionLinksArray[] = Display::url(Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=publish&id=' . $meetingDB['id']);
} else {
$actionLinksArray[] = Display::url(Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=unpublish&id=' . $meetingDB['id']);
}
} else {
//$recordArray[] = $records['message'];
}
} else {
foreach ($records as $record) {
//if you get several recordings here and you used a
// previous version of Chamilo, you might want to
// only keep the last result for each chamilo conf
// (see show_links after the end of this loop)
if (is_array($record) && isset($record['recordId'])) {
$url = Display::url(get_lang('ViewRecord') . " [~" . $record['playbackFormatLength'] . "']", $record['playbackFormatUrl'], array('target' => '_blank'));
$actionLinks = '';
if ($this->isTeacher()) {
$actionLinks .= Display::url(Display::return_icon('link.gif', get_lang('CopyToLinkTool')), api_get_self() . '?' . api_get_cidreq() . '&action=copy_record_to_link_tool&id=' . $meetingDB['id']);
$actionLinks .= Display::url(Display::return_icon('agenda.png', get_lang('AddToCalendar')), api_get_self() . '?' . api_get_cidreq() . '&action=add_to_calendar&id=' . $meetingDB['id'] . '&start=' . api_strtotime($meetingDB['created_at']) . '&url=' . $record['playbackFormatUrl']);
$actionLinks .= Display::url(Display::return_icon('delete.png', get_lang('Delete')), api_get_self() . '?' . api_get_cidreq() . '&action=delete_record&id=' . $meetingDB['id']);
if ($meetingDB['visibility'] == 0) {
$actionLinks .= Display::url(Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=publish&id=' . $meetingDB['id']);
} else {
$actionLinks .= Display::url(Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=unpublish&id=' . $meetingDB['id']);
}
}
//$url .= api_get_self().'?action=publish&id='.$record['recordID'];
$count++;
$recordArray[] = $url;
$actionLinksArray[] = $actionLinks;
} else {
/*if (is_array($record) && isset($record['recordID']) && isset($record['playbacks'])) {
//Fix the bbb timestamp
//$record['startTime'] = substr($record['startTime'], 0, strlen($record['startTime']) -3);
//$record['endTime'] = substr($record['endTime'], 0, strlen($record['endTime']) -3);
//.' - '.api_convert_and_format_date($record['startTime']).' - '.api_convert_and_format_date($record['endTime'])
foreach($record['playbacks'] as $item) {
$url = Display::url(get_lang('ViewRecord'), $item['url'], array('target' => '_blank'));
//$url .= Display::url(get_lang('DeleteRecord'), api_get_self().'?action=delete_record&'.$record['recordID']);
if ($this->isTeacher()) {
$url .= Display::url(Display::return_icon('link.gif',get_lang('CopyToLinkTool')), api_get_self().'?action=copy_record_to_link_tool&id='.$meetingDB['id'].'&record_id='.$record['recordID']);
$url .= Display::url(Display::return_icon('agenda.png',get_lang('AddToCalendar')), api_get_self().'?action=add_to_calendar&id='.$meetingDB['id'].'&start='.api_strtotime($meetingDB['created_at']).'&url='.$item['url']);
$url .= Display::url(Display::return_icon('delete.png',get_lang('Delete')), api_get_self().'?action=delete_record&id='.$record['recordID']);
}
//$url .= api_get_self().'?action=publish&id='.$record['recordID'];
$count++;
$recordArray[] = $url;
}
}*/
}
}
}
} else {
$actionLinks = '';
if ($this->isTeacher()) {
if ($meetingDB['visibility'] == 0) {
$actionLinks .= Display::url(Display::return_icon('invisible.png', get_lang('MakeVisible'), array(), ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=publish&id=' . $meetingDB['id']);
} else {
$actionLinks .= Display::url(Display::return_icon('visible.png', get_lang('MakeInvisible'), array(), ICON_SIZE_MEDIUM), api_get_self() . '?' . api_get_cidreq() . '&action=unpublish&id=' . $meetingDB['id']);
}
}
$actionLinksArray[] = $actionLinks;
$item['action_links'] = implode('<br />', $actionLinksArray);
}
//var_dump($recordArray);
$item['show_links'] = implode('<br />', $recordArray);
$item['action_links'] = implode('<br />', $actionLinksArray);
}
$item['created_at'] = api_convert_and_format_date($meetingDB['created_at']);
//created_at
$meetingDB['created_at'] = $item['created_at'];
//avoid overwrite in array_merge() below
$item['publish_url'] = api_get_self() . '?' . api_get_cidreq() . '&action=publish&id=' . $meetingDB['id'];
$item['unpublish_url'] = api_get_self() . '?' . api_get_cidreq() . '&action=unpublish&id=' . $meetingDB['id'];
if ($meetingDB['status'] == 1) {
$joinParams = array('meetingId' => $meetingDB['remote_id'], 'username' => $this->user_complete_name, 'password' => $pass, 'createTime' => '', 'userID' => '', 'webVoiceConf' => '');
$item['go_url'] = $this->protocol . $this->api->getJoinMeetingURL($joinParams);
}
$item = array_merge($item, $meetingDB, $meetingBBB);
$newMeetingList[] = $item;
}
return $newMeetingList;
}
示例10: is_visible
/**
* Checks if the exercise is visible due a lot of conditions - visibility, time limits, student attempts
* @return bool true if is active
*/
public function is_visible($lp_id = 0, $lp_item_id = 0, $lp_item_view_id = 0, $filter_by_admin = true)
{
// 1. By default the exercise is visible
$is_visible = true;
$message = null;
// 1.1 Admins and teachers can access to the exercise
if ($filter_by_admin) {
if (api_is_platform_admin() || api_is_course_admin()) {
return array('value' => true, 'message' => '');
}
}
// Deleted exercise.
if ($this->active == -1) {
return array('value' => false, 'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false));
}
// Checking visibility in the item_property table.
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_QUIZ, $this->id, api_get_session_id());
if ($visibility == 0 || $visibility == 2) {
$this->active = 0;
}
// 2. If the exercise is not active.
if (empty($lp_id)) {
// 2.1 LP is OFF
if ($this->active == 0) {
return array('value' => false, 'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false));
}
} else {
// 2.1 LP is loaded
if ($this->active == 0 && !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) {
return array('value' => false, 'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false));
}
}
//3. We check if the time limits are on
$limit_time_exists = !empty($this->start_time) && $this->start_time != '0000-00-00 00:00:00' || !empty($this->end_time) && $this->end_time != '0000-00-00 00:00:00' ? true : false;
if ($limit_time_exists) {
$time_now = time();
if (!empty($this->start_time) && $this->start_time != '0000-00-00 00:00:00') {
$is_visible = $time_now - api_strtotime($this->start_time, 'UTC') > 0 ? true : false;
}
if ($is_visible == false) {
$message = sprintf(get_lang('ExerciseAvailableFromX'), api_convert_and_format_date($this->start_time));
}
if ($is_visible == true) {
if ($this->end_time != '0000-00-00 00:00:00') {
$is_visible = (api_strtotime($this->end_time, 'UTC') > $time_now) > 0 ? true : false;
if ($is_visible == false) {
$message = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($this->end_time));
}
}
}
if ($is_visible == false && $this->start_time != '0000-00-00 00:00:00' && $this->end_time != '0000-00-00 00:00:00') {
$message = sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($this->start_time), api_convert_and_format_date($this->end_time));
}
}
// 4. We check if the student have attempts
$exerciseAttempts = $this->selectAttempts();
if ($is_visible) {
if ($exerciseAttempts > 0) {
$attempt_count = Event::get_attempt_count_not_finished(api_get_user_id(), $this->id, $lp_id, $lp_item_id, $lp_item_view_id);
if ($attempt_count >= $exerciseAttempts) {
$message = sprintf(get_lang('ReachedMaxAttempts'), $this->name, $exerciseAttempts);
$is_visible = false;
}
}
}
if (!empty($message)) {
$message = Display::return_message($message, 'warning', false);
}
return array('value' => $is_visible, 'message' => $message);
}
示例11: display_question_list_by_attempt
/**
* Display the exercise results
* @param Exercise $objExercise
* @param int $exe_id
* @param bool $save_user_result save users results (true) or just show the results (false)
*/
public static function display_question_list_by_attempt($objExercise, $exe_id, $save_user_result = false)
{
global $origin;
// Getting attempt info
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
// Getting question list
$question_list = array();
if (!empty($exercise_stat_info['data_tracking'])) {
$question_list = explode(',', $exercise_stat_info['data_tracking']);
} else {
// Try getting the question list only if save result is off
if ($save_user_result == false) {
$question_list = $objExercise->get_validated_question_list();
}
}
$counter = 1;
$total_score = $total_weight = 0;
$exercise_content = null;
// Hide results
$show_results = false;
$show_only_score = false;
if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS) {
$show_results = true;
}
if (in_array($objExercise->results_disabled, array(RESULT_DISABLE_SHOW_SCORE_ONLY, RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES))) {
$show_only_score = true;
}
// Not display expected answer, but score, and feedback
$show_all_but_expected_answer = false;
if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY && $objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END) {
$show_all_but_expected_answer = true;
$show_results = true;
$show_only_score = false;
}
if ($show_results || $show_only_score) {
$user_info = api_get_user_info($exercise_stat_info['exe_user_id']);
//Shows exercise header
echo $objExercise->show_exercise_result_header($user_info, api_convert_and_format_date($exercise_stat_info['start_date'], DATE_TIME_FORMAT_LONG), $exercise_stat_info['duration'], $exercise_stat_info['user_ip']);
}
// Display text when test is finished #4074 and for LP #4227
$end_of_message = $objExercise->selectTextWhenFinished();
if (!empty($end_of_message)) {
Display::display_normal_message($end_of_message, false);
echo "<div class='clear'> </div>";
}
$question_list_answers = array();
$media_list = array();
$category_list = array();
// Loop over all question to show results for each of them, one by one
if (!empty($question_list)) {
foreach ($question_list as $questionId) {
// creates a temporary Question object
$objQuestionTmp = Question::read($questionId);
// This variable came from exercise_submit_modal.php
ob_start();
// We're inside *one* question. Go through each possible answer for this question
$result = $objExercise->manage_answer($exercise_stat_info['exe_id'], $questionId, null, 'exercise_result', array(), $save_user_result, true, $show_results, $objExercise->selectPropagateNeg(), array());
if (empty($result)) {
continue;
}
// In case of global score, make sure the calculated total score is integer
/*if (!is_int($result['score'])) {
$result['score'] = round($result['score']);
}*/
$total_score += $result['score'];
$total_weight += $result['weight'];
$question_list_answers[] = array('question' => $result['open_question'], 'answer' => $result['open_answer'], 'answer_type' => $result['answer_type']);
$my_total_score = $result['score'];
$my_total_weight = $result['weight'];
// Category report
$category_was_added_for_this_test = false;
if (isset($objQuestionTmp->category) && !empty($objQuestionTmp->category)) {
if (!isset($category_list[$objQuestionTmp->category]['score'])) {
$category_list[$objQuestionTmp->category]['score'] = 0;
}
if (!isset($category_list[$objQuestionTmp->category]['total'])) {
$category_list[$objQuestionTmp->category]['total'] = 0;
}
$category_list[$objQuestionTmp->category]['score'] += $my_total_score;
$category_list[$objQuestionTmp->category]['total'] += $my_total_weight;
$category_was_added_for_this_test = true;
}
if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) {
foreach ($objQuestionTmp->category_list as $category_id) {
$category_list[$category_id]['score'] += $my_total_score;
$category_list[$category_id]['total'] += $my_total_weight;
$category_was_added_for_this_test = true;
}
}
// No category for this question!
if ($category_was_added_for_this_test == false) {
if (!isset($category_list['none']['score'])) {
$category_list['none']['score'] = 0;
}
//.........这里部分代码省略.........
示例12: array
if ($file_type == 'csv') {
$alldata[] = array('username', 'official_code', 'lastname', 'firstname', 'score', 'date');
}
// export results to pdf file
if ($file_type == 'pdf') {
$number_decimals = api_get_setting('gradebook_number_decimals');
$datagen = new ResultsDataGenerator($eval[0], $allresults);
// set headers pdf
!empty($_user['official_code']) ? $officialcode = $_user['official_code'] . ' - ' : '';
$h1 = array(get_lang('Teacher'), $officialcode . $_user['firstName'] . ', ' . $_user['lastName']);
$h2 = array(get_lang('Score'), $eval[0]->get_max());
$h3 = array(get_lang('Course'), $_course['name']);
$h4 = array(get_lang('Weight'), $eval[0]->get_weight());
$h5 = array(get_lang('Session'), api_get_session_name(api_get_session_id()));
$date = date('d-m-Y H:i:s', time());
$h6 = array(get_lang('DateTime'), api_convert_and_format_date($date, "%d/%m/%Y %H:%M"));
$header_pdf = array($h1, $h2, $h3, $h4, $h5, $h6);
// set footer pdf
$f1 = '<hr />' . get_lang('Drh');
$f2 = '<hr />' . get_lang('Teacher');
$f3 = '<hr />' . get_lang('Date');
$footer_pdf = array($f1, $f2, $f3);
// set title pdf
$title_pdf = $eval[0]->get_name();
// set headers data table
$head_ape_name = '';
if (api_is_western_name_order()) {
$head_ape_name = get_lang('FirstName') . ', ' . get_lang('LastName');
} else {
$head_ape_name = get_lang('LastName') . ', ' . get_lang('FirstName');
}
示例13: array
if ($_GET['selectcat'] != null) {
$addparams = array('userid' => $my_user_id, 'selectcat' => Security::remove_XSS($_GET['selectcat']));
} else {
$addparams = array('userid' => $my_user_id, 'selecteval' => Security::remove_XSS($_GET['selecteval']));
}
$user_table = new UserTable($my_user_id, $allevals, $alllinks, $addparams);
if (isset($_GET['exportpdf'])) {
$datagen = new UserDataGenerator($my_user_id, $allevals, $alllinks);
$data_array = $datagen->get_data(UserDataGenerator::UDG_SORT_NAME, 0, null, true);
$newarray = array();
$displayscore = ScoreDisplay::instance();
foreach ($data_array as $data) {
$newarray[] = array_slice($data, 1);
}
$userinfo = api_get_user_info($my_user_id);
$html .= get_lang('Results') . ' : ' . api_get_person_name($userinfo['firstname'], $userinfo['lastname']) . ' (' . api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) . ')';
if ($displayscore->is_custom()) {
$header_names = array(get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'), get_lang('Result'), get_lang('Display'));
} else {
$header_names = array(get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'), get_lang('Result'));
}
$table = new HTML_Table(array('class' => 'data_table'));
$row = 0;
$column = 0;
foreach ($header_names as $item) {
$table->setHeaderContents($row, $column, $item);
$column++;
}
$row = 1;
if (!empty($newarray)) {
foreach ($newarray as $data) {
示例14: api_get_person_name
$html .= '<div class="row">';
$html .= '<div class="col-md-2">';
$html .= Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL);
$html .= ' ' . $my_number_threads . '<br>' . $newPost . '</div>';
// the last post in the forum
if ($forum['last_poster_name'] != '') {
$name = $forum['last_poster_name'];
$poster_id = 0;
} else {
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id = $forum['last_poster_id'];
}
$html .= '<div class="col-md-6">';
if (!empty($forum['last_post_id'])) {
$html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' ';
$html .= api_convert_and_format_date($forum['last_post_date']) . ' ' . get_lang('By') . ' ' . display_user_link($poster_id, $name);
}
$html .= '</div>';
$html .= '<div class="col-md-4">';
if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && $sessionId != 0)) {
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' . Security::remove_XSS($_GET['forumcategory']) . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' . Security::remove_XSS($_GET['forumcategory']) . '&action=delete&content=forum&id=' . $forum['forum_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
$html .= return_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility'], array('forumcategory' => $_GET['forumcategory']));
$html .= return_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked'], array('forumcategory' => $_GET['forumcategory']));
$html .= return_up_down_icon('forum', $forum['forum_id'], $forums_in_category);
}
$iconnotify = 'notification_mail_na.png';
if (is_array(isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : null)) {
if (in_array($forum['forum_id'], $_SESSION['forum_notification']['forum'])) {
$iconnotify = 'notification_mail.png';
}
示例15: show_documents
show_documents($folder);
//echo "<hr>";
}
/*
-----------------------------------------------------------
Ad Valvas
-----------------------------------------------------------
*/
if ($content == "Ad_Valvas") {
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$sql = "SELECT * FROM " . $tbl_announcement . " a, " . $item_property_table . " i WHERE i.tool = '" . TOOL_ANNOUNCEMENT . "' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result)) {
echo "<table width=\"100%\"><tr><td>";
echo "<img src='../img/valves.gif' alt='advalvas'>";
echo api_convert_and_format_date($myrow["end_date"], DATE_FORMAT_LONG, date_default_timezone_get());
echo "</td></tr><tr><td>";
echo $myrow["title"] . "<br />";
showorhide_addresourcelink($content, $myrow["id"]);
echo "</td></tr></table>";
}
}
/*
-----------------------------------------------------------
Forums
-----------------------------------------------------------
*/
if ($content == "Forum") {
$TBL_FORUMS = Database::get_course_table(TABLE_FORUM);
$TBL_CATAGORIES = Database::get_course_table(TABLE_FORUM_CATEGORY);
$TBL_FORUMTOPICS = Database::get_course_table(TABLE_FORUM_POST);