Remove GLOBALS code

1.10.x
Julio Montoya 10 years ago
parent 8351ec9bf3
commit bf9f7fd603
  1. 11
      main/calendar/agenda_list.php
  2. 3
      main/document/edit_document.php
  3. 4
      main/inc/introductionSection.inc.php
  4. 10
      main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php

@ -11,13 +11,15 @@ $interbreadcrumb[] = array(
'name' => get_lang('Agenda')
);
$currentCourseId = api_get_course_int_id();
$agenda = new Agenda();
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$agenda->setType($type);
$events = $agenda->getEvents(
null,
null,
api_get_course_int_id(),
$currentCourseId,
api_get_group_id(),
null,
'array'
@ -25,7 +27,7 @@ $events = $agenda->getEvents(
$this_section = SECTION_MYAGENDA;
if (!empty($GLOBALS['_cid']) && $GLOBALS['_cid'] != -1) {
if (!empty($currentCourseId) && $currentCourseId != -1) {
// Agenda is inside a course tool
$url = api_get_self() . '?' . api_get_cidreq();
$this_section = SECTION_COURSES;
@ -38,11 +40,10 @@ if (!empty($GLOBALS['_cid']) && $GLOBALS['_cid'] != -1) {
}
}
$tpl = new Template(get_lang('Events'));
$actions = $agenda->displayActions('list');
$tpl = new Template(get_lang('Events'));
$tpl->assign('agenda_events', $events);
$actions = $agenda->displayActions('list');
$tpl->assign('url', $url);
$tpl->assign('actions', $actions);
$tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());

@ -566,9 +566,6 @@ function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc)
update_db_info('update', $source_file, $new_full_file_name); // fileManage API
Display::addFlash(Display::return_message(get_lang('fileModified')));
$GLOBALS['file_name'] = $rename_to;
$GLOBALS['doc'] = $rename_to;
return true;
} else {
Display::addFlash(Display::return_message(get_lang('FileExists')));

@ -322,7 +322,7 @@ if ($intro_dispCommand) {
if (empty($intro_content)) {
// Displays "Add intro" commands
$toolbar = '<div class="btn-group pull-right" rol="group">';
if (!empty ($GLOBALS['_cid'])) {
if (!empty($courseId)) {
$textIntro = '<a class="btn btn-default" title="' . get_lang('AddIntro') . '" href="'.api_get_self().'?' . api_get_cidreq().'&intro_cmdAdd=1">';
$textIntro .= '<i class="fa fa-file-text"></i> ';
$textIntro .= "</a>";
@ -336,7 +336,7 @@ if ($intro_dispCommand) {
} else {
// Displays "edit intro && delete intro" commands
$toolbar .= '<div class="btn-group pull-right" rol="group">';
if (!empty ($GLOBALS['_cid'])) {
if (!empty($courseId)) {
$toolbar .=
'<a class="btn btn-default" href="'.api_get_self().'?'.api_get_cidreq().'&intro_cmdEdit=1" title="'.get_lang('Modify').'">
<i class="fa fa-pencil"></i></a>';

@ -91,22 +91,14 @@ class HTML_QuickForm_RuleRegistry
// Regular expression
$rule =& $this->getRule('regex');
$rule->addData($ruleName, $data1);
//$GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['regex'];
} elseif ($type == 'function' || $type == 'callback') {
// Callback function
$rule =& $this->getRule('callback');
$rule->addData($ruleName, $data1, $data2, 'function' == $type);
//$GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = $GLOBALS['_HTML_QuickForm_registered_rules']['callback'];
} elseif (is_object($data1)) {
// An instance of HTML_QuickForm_Rule
$this->_rules[strtolower(get_class($data1))] = $data1;
//$GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower(get_class($data1)), null);
} else {
// Rule class name
//$GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName] = array(strtolower($data1), $data2);
}
}
@ -117,7 +109,7 @@ class HTML_QuickForm_RuleRegistry
* @access public
* @return HTML_QuickForm_Rule
*/
function &getRule($ruleName)
function getRule($ruleName)
{
if (empty($ruleName)) {
return false;

Loading…
Cancel
Save