本文整理汇总了PHP中Display::return_message方法的典型用法代码示例。如果您正苦于以下问题:PHP Display::return_message方法的具体用法?PHP Display::return_message怎么用?PHP Display::return_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::return_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
/**
* @Route("/edit/{tool}")
* @Method({"GET"})
*
* @param string $tool
* @return Response
*/
public function editAction($tool)
{
$message = null;
// @todo use proper functions not api functions.
$courseId = api_get_course_int_id();
$sessionId = api_get_session_id();
$tool = \Database::escape_string($tool);
$TBL_INTRODUCTION = \Database::get_course_table(TABLE_TOOL_INTRO);
$url = $this->generateUrl('introduction.controller:editAction', array('tool' => $tool, 'course' => api_get_course_id()));
$form = $this->getForm($url, $tool);
if ($form->validate()) {
$values = $form->exportValues();
$content = $values['content'];
$sql = "REPLACE {$TBL_INTRODUCTION}\n SET c_id = {$courseId},\n id = '{$tool}',\n intro_text='" . \Database::escape_string($content) . "',\n session_id='" . intval($sessionId) . "'";
\Database::query($sql);
$message = \Display::return_message(get_lang('IntroductionTextUpdated'), 'confirmation', false);
} else {
$sql = "SELECT intro_text FROM {$TBL_INTRODUCTION}\n WHERE c_id = {$courseId} AND id='" . $tool . "' AND session_id = '" . intval($sessionId) . "'";
$result = \Database::query($sql);
$content = null;
if (\Database::num_rows($result) > 0) {
$row = \Database::fetch_array($result);
$content = $row['intro_text'];
}
$form->setDefaults(array('content' => $content));
}
$this->getTemplate()->assign('content', $form->return_form());
$this->getTemplate()->assign('message', $message);
$response = $this->getTemplate()->renderLayout('layout_1_col.tpl');
return new Response($response, 200, array());
}
示例2: response
/**
* Display a standard json responce.
*
* @param bool $success
* @param string $message
* @param object $data
* @return bool|void
* @assert () === null
*/
public function response($success = false, $message = '', $data = null)
{
$message = trim($message);
$response = (object) array();
$response->success = $success;
if ($message) {
$response->message = Display::return_message($message, $success ? 'normal' : 'error');
} else {
$response->message = '';
}
$response->data = $data;
$this->render_json($response);
}
示例3: display_free_answer
/**
* Shows the answer to a free-answer question, as HTML
* @param string Answer text
* @param int Exercise ID
* @param int Question ID
* @return void
*/
static function display_free_answer($feedback_type, $answer, $exe_id, $questionId, $questionScore = null)
{
$comments = get_comments($exe_id, $questionId);
if (!empty($answer)) {
echo '<tr><td>';
echo nl2br(Security::remove_XSS($answer, COURSEMANAGERLOWSECURITY));
echo '</td></tr>';
}
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
if ($questionScore > 0 || !empty($comments)) {
} else {
echo '<tr>';
echo Display::tag('td', Display::return_message(get_lang('notCorrectedYet')), array());
echo '</tr>';
}
}
}
示例4: display_form
function display_form()
{
$html = '';
$sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
// Actions
// Link back to the documents overview
$actionsLeft = '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
$html .= Display::toolbarAction('toolbar-copysession', array(0 => $actionsLeft));
$html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'), 'warning');
$html .= '<form class="form-horizontal" name="formulaire" method="post" action="' . api_get_self() . '" >';
$html .= '<div class="form-group">';
// origin
$html .= '<label class="col-sm-2 control-label">' . get_lang('OriginCoursesFromSession') . ': </label>';
$html .= '<div class="col-sm-5">' . make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')) . '</div>';
$html .= '<div class="col-sm-5" id="ajax_list_courses_origin">';
$html .= '<select id="origin" class="form-control" name="SessionCoursesListOrigin[]" ></select>';
$html .= '</div></div>';
//destination
$html .= '<div class="form-group">';
$html .= '<label class="col-sm-2 control-label">' . get_lang('DestinationCoursesFromSession') . ': </label>';
$html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">';
$html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
$html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option></select ></div>';
$html .= '<div class="col-sm-5" id="ajax_list_courses_destination">';
$html .= '<select id="destination" class="form-control" name="SessionCoursesListDestination[]" ></select>';
$html .= '</div></div>';
$options = '<div class="radio"><label><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
$options .= get_lang('FullCopy') . '</label></div>';
$options .= '<div class="radio"><label><input type="radio" id="copy_option_2" name="copy_option" value="select_items" disabled="disabled"/>';
$options .= ' ' . get_lang('LetMeSelectItems') . '</label></div>';
$options .= '<div class="checkbox"><label><input type="checkbox" id="copy_base_content_id" name="copy_only_session_items" />' . get_lang('CopyOnlySessionItems') . '</label></div>';
$html .= Display::panel($options, get_lang('TypeOfCopy'));
$html .= '<div class="form-group"><div class="col-sm-12">';
$html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;"><em class="fa fa-files-o"></em> ' . get_lang('CopyCourse') . '</button>';
// Add Security token
$html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">';
$html .= '</div></div>';
$html .= '</form>';
echo $html;
}
示例5: display_form
function display_form()
{
$html = '';
$sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
// Actions
$html .= '<div class="actions">';
// Link back to the documents overview
$html .= '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
$html .= '</div>';
$html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'));
$html .= '<form name="formulaire" method="post" action="' . api_get_self() . '" >';
$html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
// origin
$html .= '<tr><td width="15%"><b>' . get_lang('OriginCoursesFromSession') . ':</b></td>';
$html .= '<td width="10%" align="left">' . make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')) . '</td>';
$html .= '<td width="50%"><div id="ajax_list_courses_origin">';
$html .= '<select id="origin" name="SessionCoursesListOrigin[]" style="width:380px;"></select></div></td></tr>';
//destination
$html .= '<tr><td width="15%"><b>' . get_lang('DestinationCoursesFromSession') . ':</b></td>';
$html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">';
$html .= '<select name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
$html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option></select ></div></td>';
$html .= '<td width="50%">';
$html .= '<div id="ajax_list_courses_destination">';
$html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>';
$html .= '</tr></table>';
$html .= '<h4>' . get_lang('TypeOfCopy') . '</h4>';
$html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
$html .= get_lang('FullCopy') . '</label><br/>';
$html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items" disabled="disabled"/>';
$html .= ' ' . get_lang('LetMeSelectItems') . '</label><br/>';
$html .= '<label class="checkbox"><input type="checkbox" id="copy_base_content_id" name="copy_only_session_items" />' . get_lang('CopyOnlySessionItems') . '</label><br /><br/>';
$html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;"><i class="fa fa-files-o"></i> ' . get_lang('CopyCourse') . '</button>';
// Add Security token
$html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">';
$html .= '</form>';
echo $html;
}
示例6: reuseQuestionAction
/**
* @param Application $app
* @param int $exerciseId
* @param int $questionId
* @return Response
*/
public function reuseQuestionAction(Application $app, $exerciseId, $questionId)
{
/** @var \Question $question */
$question = \Question::read($questionId);
if ($question) {
// adds the exercise ID represented by $fromExercise into the list of exercises for the current question
$question->addToList($exerciseId);
$objExercise = new \Exercise();
$objExercise->read($exerciseId);
// adds the question ID represented by $recup into the list of questions for the current exercise
$objExercise->addToList($exerciseId);
Session::write('objExercise', $objExercise);
/*$params = array(
'cidReq' => api_get_course_id(),
'id_session' => api_get_session_id(),
'id' => $questionId,
'exerciseId' => $exerciseId
);
$url = $app['url_generator']->generate('exercise_question_pool', $params);
return $app->redirect($url);*/
$response = \Display::return_message(get_lang('QuestionReused') . ": " . $question->question);
return new Response($response, 200, array());
}
}
示例7: addAction
function addAction(Application $app)
{
$timeline = new Timeline();
$url = $app['url_generator']->generate('add');
$form = $timeline->return_item_form($url, 'edit');
// The validation or display
if ($form->validate()) {
$values = $form->exportValues();
$values['type'] = 0;
$values['status'] = 0;
$my_timeline = new CTimeline();
$my_timeline->setCId(api_get_course_int_id());
$my_timeline->setHeadline($values['headline']);
$my_timeline->setType($values['type']);
$my_timeline->setStartDate($values['start_date']);
$my_timeline->setEndDate($values['end_date']);
$my_timeline->setText($values['text']);
$my_timeline->setMedia($values['media']);
$my_timeline->setMediaCredit($values['media_credit']);
$my_timeline->setMediaCaption($values['media_caption']);
$my_timeline->setTitleSlide($values['title_slide']);
$my_timeline->setParentId($values['parent_id']);
$my_timeline->setStatus($values['status']);
$app['orm.em']->persist($my_timeline);
$app['orm.em']->flush();
$message = Display::return_message(sprintf(get_lang('ItemUpdated'), $values['name']), 'confirmation');
//$app['session']->setFlash('error', $message);
return $app->redirect($app['url_generator']->generate('view', array('id' => $my_timeline->getId())), 201);
} else {
$actions = '<a href="' . $app['url_generator']->generate('index') . '">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>';
$content = $form->return_form();
}
$app['template']->assign('content', $content);
$response = $app['template']->render_layout('layout_1_col.tpl');
return new Response($response, 200, array());
}
示例8: header
// submit button
$form->addButtonSave(get_lang('SaveSettings'));
if ($form->validate()) {
$values = $form->exportValues();
// Storing the users (we first remove all users and then add only those who were selected)
GroupManager::unsubscribe_all_users($current_group['id']);
if (isset($_POST['group_members']) && count($_POST['group_members']) > 0) {
GroupManager::subscribe_users($values['group_members'], $current_group['id']);
}
// Returning to the group area (note: this is inconsistent with the rest of chamilo)
$cat = GroupManager::get_category_from_group($current_group['id']);
if (isset($_POST['group_members']) && count($_POST['group_members']) > $max_member && $max_member != GroupManager::MEMBER_PER_GROUP_NO_LIMIT) {
Display::addFlash(Display::return_message(get_lang('GroupTooMuchMembers'), 'warning'));
header('Location: group.php?' . api_get_cidreq(true, false));
} else {
Display::addFlash(Display::return_message(get_lang('GroupSettingsModified'), 'success'));
header('Location: group.php?' . api_get_cidreq(true, false) . '&category=' . $cat['id']);
}
exit;
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
switch ($action) {
case 'empty':
if (api_is_allowed_to_edit(false, true)) {
GroupManager::unsubscribe_all_users($group_id);
Display::display_confirmation_message(get_lang('GroupEmptied'));
}
break;
}
$defaults = $current_group;
$defaults['group_members'] = $selected_users;
示例9: get_lang
$skillList = [0 => get_lang('None')];
$gradebookList = [];
foreach ($allSkills as $skill) {
$skillList[$skill['id']] = $skill['name'];
}
foreach ($allGradebooks as $gradebook) {
$gradebookList[$gradebook['id']] = $gradebook['name'];
}
/* Form */
$createForm = new FormValidator('skill_create');
$createForm->addHeader(get_lang('CreateSkill'));
$createForm->addText('name', get_lang('Name'), true, ['id' => 'name']);
$createForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']);
$createForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']);
$createForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]);
$createForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]);
$createForm->addButtonSave(get_lang('Save'));
$createForm->addHidden('id', null);
$createForm->setDefaults($formDefaultValues);
if ($createForm->validate()) {
$created = $objSkill->add($createForm->getSubmitValues());
if ($created) {
Display::return_message(get_lang('TheSkillHasBeenCreated'), 'success');
} else {
Display::return_message(get_lang('CannotCreateSkill'), 'error');
}
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
exit;
}
//$tpl = new Template(get_lang('CreateSkill'));
echo $createForm->returnForm();
示例10: api_register_campus
}
/* ACTION HANDLING */
if (!empty($_POST['Register'])) {
api_register_campus(!$_POST['donotlistcampus']);
$message = Display::return_message(get_lang('VersionCheckEnabled'), 'confirmation');
}
$keyword_url = Security::remove_XSS(empty($_GET['keyword']) ? '' : $_GET['keyword']);
}
if (isset($_GET['msg']) && isset($_GET['type'])) {
if (in_array($_GET['msg'], array('ArchiveDirCleanupSucceeded', 'ArchiveDirCleanupFailed'))) {
switch ($_GET['type']) {
case 'error':
$message = Display::return_message(get_lang($_GET['msg']), 'error');
break;
case 'confirmation':
$message = Display::return_message(get_lang($_GET['msg']), 'confirm');
}
}
}
$blocks = array();
// Instantiate Hook Event for Admin Block
$hook = HookAdminBlock::create();
if (!empty($hook)) {
// If not empty, then notify Pre process to Hook Observers for Admin Block
$hook->setEventData(array('blocks' => $blocks));
$data = $hook->notifyAdminBlock(HOOK_EVENT_TYPE_PRE);
// Check if blocks data is not null
if (isset($data['blocks'])) {
// Get modified blocks
$blocks = $data['blocks'];
}
示例11: get_lang
$see_message_import = get_lang('FileImported');
}
if (count($errors) != 0) {
$warning_message = '<ul>';
foreach ($errors as $index => $error_user) {
$warning_message .= '<li><b>' . $error_user['error'] . '</b>: ';
$warning_message .= '<strong>' . $error_user['UserName'] . '</strong> (' . api_get_person_name($error_user['FirstName'], $error_user['LastName']) . ')';
$warning_message .= '</li>';
}
$warning_message .= '</ul>';
}
// if the warning message is too long then we display the warning message trough a session
if ($error_kind_file) {
Display::addFlash(Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption')));
} else {
Display::addFlash(Display::return_message($see_message_import));
header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/user_list.php?&sec_token=' . $tok);
exit;
}
}
Display::display_header($tool_name);
$form = new FormValidator('user_update_import', 'post', api_get_self());
$form->addElement('header', $tool_name);
$form->addElement('hidden', 'formSent');
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$group = array();
$form->addButtonImport(get_lang('Import'));
$defaults['formSent'] = 1;
$defaults['sendMail'] = 0;
$defaults['file_type'] = 'csv';
$form->setDefaults($defaults);
示例12: show_qualify
$current_qualify_thread = show_qualify('1', $row_student_list['user_id'], $_GET['id']);
$table_list .= '<td><a href="' . $forumUrl . 'forumqualify.php?' . api_get_cidreq() . '&forum=' . Security::remove_XSS($my_forum) . '&thread=' . Security::remove_XSS($_GET['id']) . '&user=' . $row_student_list['user_id'] . '&user_id=' . $row_student_list['user_id'] . '&idtextqualify=' . $current_qualify_thread . '&origin=' . $origin . '">' . Display::return_icon($icon_qualify, get_lang('Qualify')) . '</a></td></tr>';
}
$counter_stdlist++;
}
} else {
if ($_GET['list'] == 'qualify') {
$table_list .= '<tr><td colspan="2">' . get_lang('ThereIsNotQualifiedLearners') . '</td></tr>';
} else {
$table_list .= '<tr><td colspan="2">' . get_lang('ThereIsNotUnqualifiedLearners') . '</td></tr>';
}
}
$table_list .= '</table></center>';
$table_list .= '<br />';
} else {
$table_list .= Display::return_message(get_lang('NoParticipation'), 'warning');
}
}
if ($origin == 'learnpath') {
echo '<div style="height:15px"> </div>';
}
/* Display the action messages */
if (!empty($message)) {
Display::display_confirmation_message($message);
}
/* Action links */
echo '<div class="actions">';
if ($origin != 'learnpath') {
if ($origin == 'group') {
echo '<a href=' . api_get_path(WEB_CODE_PATH) . '"group/group_space.php?' . api_get_cidreq() . '&gradebook=' . $gradebook . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('Groups'), '', ICON_SIZE_MEDIUM) . '</a>';
} else {
示例13: api_is_allowed_to_edit
// check access permissions (edit permission is needed to add a document or a LP)
$is_allowed_to_edit = api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("Doc"));
$nameTools = get_lang("OogieConversionPowerPoint");
Display::display_header($nameTools);
$message = get_lang("WelcomeOogieConverter");
if (!empty($errorMessage)) {
echo Display::return_message($errorMessage, 'warning', false);
}
$div_upload_limit = get_lang('UploadMaxSize') . ' : ' . ini_get('post_max_size');
$form = new FormValidator('upload_ppt', 'POST', '', '');
$form->addElement('header', get_lang("WelcomeOogieSubtitle"));
$form->addElement('html', Display::return_message($message, 'info', false));
$form->addElement('file', 'user_file', array(Display::return_icon('powerpoint_big.gif'), $div_upload_limit));
$form->addElement('checkbox', 'take_slide_name', '', get_lang('TakeSlideName'));
if (api_get_setting('search.search_enabled') == 'true') {
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
$specific_fields = get_specific_field_list();
$form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
$form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
foreach ($specific_fields as $specific_field) {
$form->addElement('text', $specific_field['code'], $specific_field['name'] . ' : ');
}
}
$form->addButtonUpload(get_lang('ConvertToLP'), 'convert');
$form->addElement('hidden', 'ppt2lp', 'true');
$form->add_real_progress_bar(md5(rand(0, 10000)), 'user_file', 1, true);
$defaults = array('take_slide_name' => 'checked="checked"', 'index_document' => 'checked="checked"');
示例14: api_not_allowed
/* For licensing terms, see /license.txt */
//require_once '../inc/global.inc.php';
$type = $_REQUEST['type'];
$src = Security::remove_XSS($_REQUEST['source']);
if (empty($type) || empty($src)) {
api_not_allowed();
}
$iframe = '';
switch ($type) {
case 'youtube':
$src = 'http://www.youtube.com/embed/' . $src;
$iframe .= '<div id="content" style="width: 700px ;margin-left:auto; margin-right:auto;"><br />';
$iframe .= '<iframe class="youtube-player" type="text/html" width="640" height="385" src="' . $src . '" frameborder="0"></iframe>';
$iframe .= '</div>';
break;
case 'vimeo':
$src = 'http://player.vimeo.com/video/' . $src;
$iframe .= '<div id="content" style="width: 700px ;margin-left:auto; margin-right:auto;"><br />';
$iframe .= '<iframe src="' . $src . '" width="640" height="385" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
$iframe .= '</div>';
break;
case 'nonhttps':
$icon = ' <em class="icon-external-link icon-2x"></em>';
$iframe = Display::return_message(Display::url($src . $icon, $src, ['class' => 'btn', 'target' => '_blank']), 'normal', false);
break;
}
$htmlHeadXtra[] = "\n<style>\nbody { background: none;}\n</style>\n";
Display::display_reduced_header();
echo $iframe;
Display::display_footer();
示例15: header
}
Display::addFlash(Display::return_message(get_lang('AnnouncementModified'), 'success'));
header('Location: ' . $homeUrl);
exit;
}
} else {
// Insert mode
if (true) {
$file = $_FILES['user_upload'];
$file_comment = $data['file_comment'];
if (empty($group_id)) {
$insert_id = AnnouncementManager::add_announcement($data['title'], $data['content'], $data['users'], $file, $file_comment, null, $sendToUsersInSession);
} else {
$insert_id = AnnouncementManager::add_group_announcement($data['title'], $data['content'], array('GROUP:' . $group_id), $data['users'], $file, $file_comment, $sendToUsersInSession);
}
Display::addFlash(Display::return_message(get_lang('AnnouncementAdded'), 'success'));
/* MAIL FUNCTION */
if (isset($data['email_ann']) && $data['email_ann']) {
AnnouncementManager::send_email($insert_id, $sendToUsersInSession);
}
header('Location: ' . $homeUrl);
exit;
}
// end condition token
}
}
$content = $form->returnForm();
break;
}
if (!empty($_GET['remind_inactive'])) {
$to[] = 'USER:' . intval($_GET['remind_inactive']);