Add gradebook param in api_get_cidreq()

Fix forum fatal error.
Fix forum UI
Fix PHP warnings
1.10.x
Julio Montoya 11 years ago
parent 4d4a651155
commit bd565e2013
  1. 4
      main/course_home/course_home.php
  2. 60
      main/forum/forumfunction.inc.php
  3. 34
      main/forum/newthread.php
  4. 3
      main/gradebook/index.php
  5. 19
      main/inc/lib/api.lib.php
  6. 1
      user_portal.php

@ -287,8 +287,10 @@ $tpl->assign('content', $content);
$tpl->assign('course_code', $course_code);
$tpl->display_one_col_template();
Session::erase('_gid');
// Deleting the objects
Session::erase('_gid');
Session::erase('oLP');
Session::erase('lpobject');
api_remove_in_gradebook('in_gradebook');
DocumentManager::removeGeneratedAudioTempFile();

@ -28,16 +28,6 @@ define('FORUM_NEW_POST', 0);
get_notifications_of_user();
$htmlHeadXtra[] = api_get_jquery_libraries_js(array('jquery-ui', 'jquery-upload'));
$htmlHeadXtra[] = '<script type="text/javascript">
function setFocus(){
$("#forum_title").focus();
$("#category_title").focus();
$("#search_title").focus();
}
$(document).ready(function () {
setFocus();
});
</script>';
$htmlHeadXtra[] = '<script>
function check_unzip() {
@ -175,7 +165,7 @@ function handle_forum_and_forumcategories($lp_id = null)
GradebookUtils::remove_resource_from_course_gradebook($link_info['id']);
}
}
$return_message = GradebookUtils::delete_forum_forumcategory_thread($get_content, $get_id);
$return_message = delete_forum_forumcategory_thread($get_content, $get_id);
Display::display_confirmation_message($return_message, false);
}
@ -217,7 +207,7 @@ function show_add_forumcategory_form($inputvalues = array(), $lp_id)
$form->addElement('hidden', 'lp_id', $lp_id);
// Setting the form elements.
$form->addElement('header', '', get_lang('AddForumCategory'));
$form->addElement('text', 'forum_category_title', get_lang('Title'), 'class="input_titles" id="category_title"');
$form->addElement('text', 'forum_category_title', get_lang('Title'), array('autofocus'));
$form->addElement('html_editor', 'forum_category_comment', get_lang('Description'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
//$form->applyFilter('forum_category_comment', 'html_filter');
@ -281,7 +271,7 @@ function show_add_forum_form($inputvalues = array(), $lp_id)
$form->addElement('hidden', 'lp_id', $lp_id);
// The title of the forum
$form->addElement('text', 'forum_title', get_lang('Title'), 'class="input_titles" id="forum_title"');
$form->addElement('text', 'forum_title', get_lang('Title'), array('autofocus'));
// The comment of the forum.
$form->addElement('html_editor', 'forum_comment', get_lang('Description'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
@ -470,7 +460,7 @@ function show_edit_forumcategory_form($inputvalues = array())
// Setting the form elements.
$form->addElement('header', '', get_lang('EditForumCategory'));
$form->addElement('hidden', 'forum_category_id');
$form->addElement('text', 'forum_category_title', get_lang('Title'), 'class="input_titles"');
$form->addElement('text', 'forum_category_title', get_lang('Title'));
$form->addElement(
'html_editor',
@ -2356,8 +2346,6 @@ function store_thread($current_forum, $values)
function show_add_post_form($current_forum, $forum_setting, $action = '', $id = '', $form_values = '')
{
$_user = api_get_user_info();
$courseId = api_get_course_int_id();
$gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
// Initialize the object.
@ -2368,12 +2356,10 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
$form = new FormValidator(
'thread',
'post',
api_get_self().'?forum='.Security::remove_XSS($my_forum).'&gradebook='.$gradebook.'&thread='.Security::remove_XSS($myThread).'&post='.Security::remove_XSS($my_post).'&action='.$action
api_get_self().'?forum='.Security::remove_XSS($my_forum).'&'.api_get_cidreq().'&thread='.Security::remove_XSS($myThread).'&post='.Security::remove_XSS($my_post).'&action='.$action
);
$form->setConstants(array('forum' => '5'));
$form->addElement('header', $text);
// Setting the form elements.
$form->addElement('hidden', 'forum_id', intval($my_forum));
$form->addElement('hidden', 'thread_id', intval($myThread));
@ -2386,8 +2372,7 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
}
$form->addElement('text', 'post_title', get_lang('Title'));
$form->addElement('html_editor', 'post_text', get_lang('Text'), true, api_is_allowed_to_edit(null, true) ? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '300') : array('ToolbarSet' => 'ForumStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student'));
$form->addHtmlEditor('post_text', get_lang('Text'), true, api_is_allowed_to_edit(null, true) ? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '300') : array('ToolbarSet' => 'ForumStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student'));
$form->addRule('post_text', get_lang('ThisFieldIsRequired'), 'required');
$iframe = null;
@ -2422,7 +2407,12 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'), 'value="0.00" Style="width:40px" onfocus="javascript: this.select();"');
$form->addElement(
'text',
'weight_calification',
get_lang('QualifyWeight'),
array('value' => '0.00', 'onfocus' => "javascript: this.select();")
);
$form->applyFilter('weight_calification', 'html_filter');
$form->addElement('html', '</div>');
@ -2822,9 +2812,23 @@ function show_edit_post_form($forum_setting, $current_post, $current_thread, $cu
$form->addElement('hidden', 'is_first_post_of_thread', '1');
}
$form->addElement('text', 'post_title', get_lang('Title'), 'class="input_titles"');
$form->addElement('text', 'post_title', get_lang('Title'));
$form->applyFilter('post_title', 'html_filter');
$form->addElement('html_editor', 'post_text', get_lang('Text'), null, api_is_allowed_to_edit(null, true) ? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '400') : array('ToolbarSet' => 'ForumStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student')
$form->addElement(
'html_editor',
'post_text',
get_lang('Text'),
null,
api_is_allowed_to_edit(null, true) ? array(
'ToolbarSet' => 'Forum',
'Width' => '100%',
'Height' => '400'
) : array(
'ToolbarSet' => 'ForumStudent',
'Width' => '100%',
'Height' => '400',
'UserStatus' => 'student'
)
);
$form->addRule('post_text', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('advanced_settings', '<a href="javascript://" onclick="return advanced_parameters()"><span id="img_plus_and_minus">'.Display::return_icon('div_show.gif', get_lang('Show'), array('style' => 'vertical-align:middle')).''.get_lang('AdvancedParameters').'</span></a>');
@ -2858,13 +2862,13 @@ function show_edit_post_form($forum_setting, $current_post, $current_thread, $cu
//Loading gradebook select
GradebookUtils::load_gradebook_select_in_tool($form);
$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'), 'value="'.$current_thread['thread_qualify_max'].'" style="width:40px"');
$form->addElement('text', 'numeric_calification', get_lang('QualificationNumeric'), array('value' => $current_thread['thread_qualify_max'], 'style' => 'width:40px'));
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'), 'value="'.$current_thread['thread_title_qualify'].'"');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'), array('value' => $current_thread['thread_title_qualify']));
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', array(get_lang('QualifyWeight'), null, ''), 'value="'.$current_thread['thread_weight'].'" style="width:40px"');
$form->addElement('text', 'weight_calification', array(get_lang('QualifyWeight'), null, ''), array('value' => $current_thread['thread_weight'], 'style' => 'width:40px'));
$form->applyFilter('weight_calification', 'html_filter');
$form->addElement('html', '</div>');
@ -3772,7 +3776,7 @@ function forum_search()
// Setting the form elements.
$form->addElement('header', '', get_lang('ForumSearch'));
$form->addElement('text', 'search_term', get_lang('SearchTerm'), array('id' =>'search_title'));
$form->addElement('text', 'search_term', get_lang('SearchTerm'), array('autofocus'));
$form->applyFilter('search_term', 'html_filter');
$form->addElement('static', 'search_information', '', get_lang('ForumSearchInformation'));
$form->addButtonSearch(get_lang('Search'));

@ -22,7 +22,6 @@
* @package chamilo.forum
*/
use \ChamiloSession as Session;
// Language file that need to be included.
@ -122,18 +121,17 @@ if (api_is_invitee()) {
api_not_allowed(true);
}
$session_toolgroup = 0;
if ($origin == 'group') {
$session_toolgroup = intval($_SESSION['toolgroup']);
$group_properties = GroupManager :: get_group_properties($session_toolgroup);
$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$session_toolgroup, 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'&amp;gidReq='.$session_toolgroup.'&amp;forum='.Security::remove_XSS($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => 'newthread.php?origin='.$origin.'&amp;forum='.Security::remove_XSS($_GET['forum']),'name' => get_lang('NewTopic'));
$groupId = api_get_group_id();
if (!empty($groupId)) {
$group_properties = GroupManager :: get_group_properties($groupId);
$interbreadcrumb[] = array('url' => '../group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array('url' => 'viewforum.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => 'newthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']),'name' => get_lang('NewTopic'));
} else {
$interbreadcrumb[] = array('url' => 'index.php?gradebook='.$gradebook, 'name' => $nameTools);
$interbreadcrumb[] = array('url' => 'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']);
$interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'&amp;forum='.Security::remove_XSS($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => $nameTools);
$interbreadcrumb[] = array('url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']);
$interbreadcrumb[] = array('url' => 'viewforum.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewTopic'));
}
@ -158,7 +156,7 @@ handle_forum_and_forumcategories();
// Action links
echo '<div class="actions">';
echo '<span style="float:right;">'.search_link().'</span>';
echo '<a href="viewforum.php?origin='.$origin.'&forum='.Security::remove_XSS($_GET['forum']).'&'.api_get_cidreq().'">'.
echo '<a href="viewforum.php?forum='.Security::remove_XSS($_GET['forum']).'&'.api_get_cidreq().'">'.
Display::return_icon('back.png',get_lang('BackToForum'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
@ -166,7 +164,13 @@ echo '</div>';
echo '<div class="row">';
echo '<div class="span12">';
getAttachedFiles($current_forum['forum_id'], 0, 0);
$values = show_add_post_form($current_forum, $forum_setting, 'newthread', '', isset($_SESSION['formelements']) ? $_SESSION['formelements'] : null);
$values = show_add_post_form(
$current_forum,
$forum_setting,
'newthread',
'',
isset($_SESSION['formelements']) ? $_SESSION['formelements'] : null
);
echo '</div></div>';
if (!empty($values) && isset($values['SubmitPost'])) {
// Add new thread in table forum_thread.
@ -174,7 +178,7 @@ if (!empty($values) && isset($values['SubmitPost'])) {
} else {
// Only show Forum attachment ajax form when do not pass form submit
echo '<div class="row"><div class="span12">';
$attachmentAjaxForm = getAttachmentAjaxForm($current_forum['forum_id'], $current_thread['thread_id'], 0);
$attachmentAjaxForm = getAttachmentAjaxForm($current_forum['forum_id'], 0, 0);
echo $attachmentAjaxForm;
echo '</div></div>';
}

@ -879,4 +879,7 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
}
}
}
api_set_in_gradebook();
Display :: display_footer();

@ -1662,11 +1662,27 @@ function api_get_cidreq($addSessionId = true, $addGroupId = true)
}
}
$url .= '&gradebook='.intval(api_is_in_gradebook());
$url .= '&origin='.$origin;
return $url;
}
function api_is_in_gradebook()
{
return Session::read('in_gradebook', false);
}
function api_set_in_gradebook()
{
Session::write('in_gradebook', true);
}
function api_remove_in_gradebook()
{
Session::erase('in_gradebook');
}
/**
* Returns the current course info array see api_format_course_array()
* If the course_code is given, the returned array gives info about that
@ -7584,6 +7600,7 @@ function api_get_origin()
return null;
}
/**
* Get the entire setting row
* @param string $variable
@ -7901,7 +7918,7 @@ function api_mail_html(
if ($platform_email['SMTP_UNIQUE_SENDER']) {
$senderName = $platform_email['SMTP_FROM_NAME'];
$senderEmail = $platform_email['SMTP_FROM_EMAIL'];
}
}
$mail->SetFrom($senderEmail, $senderName);
$mail->Subject = $subject;

@ -208,3 +208,4 @@ $controller->tpl->display_two_col_template();
// Deleting the session_id.
Session::erase('session_id');
api_remove_in_gradebook('in_gradebook');

Loading…
Cancel
Save