Explorar el Código

Merge pull request #62 from chamilo/1.9.x

1.9.x
ycastillo hace 10 años
padre
commit
c57aac4c04

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 10 - 0
main/admin/db.php


+ 15 - 3
main/admin/index.php

@@ -7,6 +7,7 @@
 /**
  * Code
  */
+
 // Language files that need to be included.
 $language_file = array('admin', 'tracking','coursebackup');
 
@@ -228,9 +229,20 @@ if (api_is_platform_admin()) {
 		$items[] = array('url'=>'filler.php', 	'label' => get_lang('DataFiller'));
 	}
 	$items[] = array('url'=>'archive_cleanup.php', 	'label' => get_lang('ArchiveDirCleanup'));
-        if (api_get_setting('server_type') === 'test') {
-            $items[] = array('url'=>'system_management.php', 'label' => get_lang('SystemManagement'));
-        }
+    if (api_get_setting('server_type') === 'test') {
+        $items[] = array('url'=>'system_management.php', 'label' => get_lang('SystemManagement'));
+    }
+
+    if (isset($_configuration['db_manager_enabled']) &&
+        $_configuration['db_manager_enabled'] == true &&
+        api_is_global_platform_admin()
+    ) {
+        $host = $_configuration['db_host'];
+        $username = $_configuration['db_user'];
+        $databaseName = $_configuration['main_database'];
+
+        $items[] = array('url'=>"db.php?username=$username&db=$databaseName&server=$host", 'label' => get_lang('Database Manager'));
+    }
 
 	$blocks['settings']['items'] = $items;
     $blocks['settings']['extra'] = null;

+ 39 - 18
main/admin/system_announcements.php

@@ -24,6 +24,8 @@ require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 $_SESSION['this_section']=$this_section;
 
+$action = isset($_GET['action']) ? $_GET['action'] : null;
+
 // Access restrictions
 api_protect_admin_script(true);
 
@@ -33,15 +35,15 @@ $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAd
 $tool_name = null;
 
 if (empty($_GET['lang'])) {
-    $_GET['lang'] = $_SESSION['user_language_choice'];
+    $_GET['lang'] = isset($_SESSION['user_language_choice']) ? $_SESSION['user_language_choice'] : null;
 }
 
-if (isset($_GET['action'])) {
+if (!empty($action)) {
     $interbreadcrumb[] = array ("url" => "system_announcements.php", "name" => get_lang('SystemAnnouncements'));
-    if ($_GET['action'] == 'add') {
+    if ($action == 'add') {
         $interbreadcrumb[] = array ("url" => '#', "name" => get_lang('AddAnnouncement'));
     }
-    if ($_GET['action'] == 'edit') {
+    if ($action == 'edit') {
         $interbreadcrumb[] = array ("url" => '#', "name" => get_lang('Edit'));
     }
 } else {
@@ -51,7 +53,7 @@ if (isset($_GET['action'])) {
 // Displaying the header.
 Display :: display_header($tool_name);
 
-if ($_GET['action'] != 'add' && $_GET['action'] != 'edit') {
+if ($action != 'add' && $action != 'edit') {
     echo '<div class="actions">';
     echo '<a href="?action=add">'.Display::return_icon('add.png', get_lang('AddAnnouncement'), array(), 32).'</a>';
     echo '</div>';
@@ -96,6 +98,10 @@ switch($action) {
         // Set default time window: NOW -> NEXT WEEK
         $values['start'] = date('Y-m-d H:i:s',api_strtotime(api_get_local_time()));
         $values['end']   = date('Y-m-d H:i:s',api_strtotime(api_get_local_time()) + (7 * 24 * 60 * 60));
+
+        $values['range'] =
+            substr(api_get_local_time(api_get_local_time()), 0, 16).' / '.
+            substr(api_get_local_time(api_get_local_time()) + (7 * 24 * 60 * 60), 0, 16);
         $action_todo = true;
         break;
     case 'edit':
@@ -106,6 +112,11 @@ switch($action) {
         $values['content']			= $announcement->content;
         $values['start'] 			= api_get_local_time($announcement->date_start);
         $values['end'] 				= api_get_local_time($announcement->date_end);
+
+        $values['range'] =
+            substr(api_get_local_time($announcement->date_start), 0, 16).' / '.
+            substr(api_get_local_time($announcement->date_end), 0, 16);
+
         $values['visible_teacher'] 	= $announcement->visible_teacher;
         $values['visible_student'] 	= $announcement->visible_student ;
         $values['visible_guest'] 	= $announcement->visible_guest ;
@@ -139,7 +150,8 @@ if ($action_todo) {
     } else {
         $form->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'PortalNews', 'Width' => '100%', 'Height' => '300'));
     }
-    $form->add_timewindow('start','end',get_lang('StartTimeWindow'),get_lang('EndTimeWindow'));
+    $form->addDateRangePicker('range', get_lang('StartTimeWindow'), true, array('id' => 'date_range'));
+
     $group = array();
 
     $group[]= $form->createElement('checkbox', 'visible_teacher', null, get_lang('Teacher'));
@@ -151,8 +163,13 @@ if ($action_todo) {
     $form->addElement('hidden', 'id');
 
     $group_list = GroupPortalManager::get_groups_list();
-    $group_list[0]  = get_lang('All');
-	$form->addElement('select', 'group',get_lang('AnnouncementForGroup'),$group_list);
+    $group_list[0] = get_lang('All');
+    $form->addElement(
+        'select',
+        'group',
+        get_lang('AnnouncementForGroup'),
+        $group_list
+    );
     $values['group'] = isset($values['group']) ? $values['group'] : '0';
 
     $form->addElement('checkbox', 'send_mail', null, get_lang('SendMail'));
@@ -161,21 +178,22 @@ if ($action_todo) {
         $form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar'));
         $text=get_lang('AddNews');
         $class='add';
-        $form->addElement('hidden', 'action','add');
+        $form->addElement('hidden', 'action', 'add');
 
-    } elseif (isset($_REQUEST['action']) && $_REQUEST['action']=='edit') {
+    } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
         $text=get_lang('EditNews');
         $class='save';
-        $form->addElement('hidden', 'action','edit');
+        $form->addElement('hidden', 'action', 'edit');
     }
 
     $form->addElement('checkbox', 'send_email_test', null, get_lang('SendOnlyAnEmailToMySelfToTest'));
 
-    $form->addElement('style_submit_button', 'submit', $text,'class="'.$class.'"');
+    $form->addElement('style_submit_button', 'submit', $text, 'class="'.$class.'"');
     if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
         $values['content'] = WCAG_Rendering::HTML_to_text($values['content']);
     }
     $form->setDefaults($values);
+
     if ($form->validate()) {
         $values = $form->exportValues();
         if ( !isset($values['visible_teacher'])) {
@@ -193,18 +211,21 @@ if ($action_todo) {
         if (api_get_setting('wcag_anysurfer_public_pages') == 'true') {
             //$values['content'] = WCAG_Rendering::text_to_HTML($values['content']);
         }
+
+        $sendMail = isset($values['send_mail']) ? $values['send_mail'] : null;
+
         switch ($values['action']) {
             case 'add':
                 $announcement_id = SystemAnnouncementManager::add_announcement(
                     $values['title'],
                     $values['content'],
-                    $values['start'],
-                    $values['end'],
+                    $values['range_start'],
+                    $values['range_end'],
                     $values['visible_teacher'],
                     $values['visible_student'],
                     $values['visible_guest'],
                     $values['lang'],
-                    $values['send_mail'],
+                    $sendMail,
                     $values['add_to_calendar'],
                     $values['send_email_test']
                 );
@@ -222,13 +243,13 @@ if ($action_todo) {
                     $values['id'],
                     $values['title'],
                     $values['content'],
-                    $values['start'],
-                    $values['end'],
+                    $values['range_start'],
+                    $values['range_end'],
                     $values['visible_teacher'],
                     $values['visible_student'],
                     $values['visible_guest'],
                     $values['lang'],
-                    $values['send_mail'],
+                    $sendMail,
                     $values['send_email_test']
                 )
                 ) {

+ 25 - 25
main/course_progress/index.php

@@ -296,40 +296,40 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
 
 // Distpacher actions to controller
 switch ($action) {
-	case 'thematic_add'				:
-	case 'thematic_edit'			:
-	case 'thematic_delete'			:
-	case 'thematic_delete_select'	:
-    case 'thematic_copy'            :
-    case 'thematic_import_select'   :
-    case 'thematic_import'          :
-	case 'moveup'					:
-	case 'movedown'					:
+    case 'thematic_add':
+    case 'thematic_edit':
+    case 'thematic_delete':
+    case 'thematic_delete_select':
+    case 'thematic_copy':
+    case 'thematic_import_select':
+    case 'thematic_import':
+    case 'moveup':
+    case 'movedown':
         if (!api_is_allowed_to_edit(null,true)) {
-        	api_not_allowed();
+                api_not_allowed();
         }
-	case 'thematic_list'			:
-    case 'thematic_export'          :
-    case 'thematic_export_pdf'      :
-    case 'thematic_details'         :
+    case 'thematic_list':
+    case 'thematic_export':
+    case 'thematic_export_pdf':
+    case 'thematic_details':
         $thematic_controller->thematic($action);
-		break;
-	case 'thematic_plan_add'		:
-	case 'thematic_plan_edit'		:
-	case 'thematic_plan_delete'		:
+        break;
+    case 'thematic_plan_add':
+    case 'thematic_plan_edit':
+    case 'thematic_plan_delete':
         if (!api_is_allowed_to_edit(null,true)) {
             api_not_allowed();
         }
-    case 'thematic_plan_list'       :
+    case 'thematic_plan_list':
         $thematic_controller->thematic_plan($action);
-        break;
-	case 'thematic_advance_add'		:
-	case 'thematic_advance_edit'	:
-	case 'thematic_advance_delete'	:
+    break;
+    case 'thematic_advance_add':
+    case 'thematic_advance_edit':
+    case 'thematic_advance_delete':
         if (!api_is_allowed_to_edit(null,true)) {
             api_not_allowed();
         }
-    case 'thematic_advance_list'    :
+    case 'thematic_advance_list':
         $thematic_controller->thematic_advance($action);
-        break;
+    break;
 }

+ 1 - 1
main/course_progress/thematic.php

@@ -163,7 +163,7 @@ if ($action == 'thematic_list') {
 					
 					$edit_link = '';
 					if (api_is_allowed_to_edit(null, true)) {
-						$edit_link   = '<a class="thickbox" href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'" >'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array(),ICON_SIZE_SMALL).'</a>';
+						$edit_link   = '<a class="thickbox" href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'&display=no_header" >'.Display::return_icon('edit.png',get_lang('EditThematicAdvance'),array(),ICON_SIZE_SMALL).'</a>';
 						$edit_link  .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic['id'].'&thematic_advance_id='.$thematic_advance['id'].'">'.
                                         Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a></center>';
 						

+ 12 - 6
main/course_progress/thematic_controller.php

@@ -40,7 +40,8 @@ class ThematicController {
 
         $check = Security::check_token('request');
         $thematic_id = isset($_REQUEST['thematic_id']) ? intval($_REQUEST['thematic_id']) : null;
-
+        $displayHeader = (!empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header') ? false : true;
+ 
         if ($check) {
             switch ($action) {
                 case 'thematic_add':
@@ -248,9 +249,11 @@ class ThematicController {
         $data['default_thematic_plan_title'] = $thematic->get_default_thematic_plan_title();
 
         $data['action'] = $action;
+        $layoutName = $displayHeader ? 'layout' : 'layout_no_header';
+       
         // render to the view
         $this->view->set_data($data);
-        $this->view->set_layout('layout');
+        $this->view->set_layout($layoutName);
         $this->view->set_template('thematic');
         $this->view->render();
     }
@@ -357,7 +360,9 @@ class ThematicController {
         $thematic = new Thematic();
         $attendance = new Attendance();
         $data = array();
-
+        
+        $displayHeader = (!empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header') ? false : true;
+  
         // get data for attendance input select		
         $attendance_list = $attendance->get_attendances_list();
         $attendance_select = array();
@@ -365,7 +370,7 @@ class ThematicController {
         foreach ($attendance_list as $attendance_id => $attendance_data) {
             $attendance_select[$attendance_id] = $attendance_data['name'];
         }
-
+       
         $thematic_id = intval($_REQUEST['thematic_id']);
         $thematic_advance_id = intval($_REQUEST['thematic_advance_id']);
 
@@ -459,10 +464,11 @@ class ThematicController {
         $data['attendance_select'] = $attendance_select;
         $data['thematic_advance_data'] = $thematic_advance_data;
         $data['calendar_select'] = $calendar_select;
-
+        $layoutName = $displayHeader ? 'layout' : 'layout_no_header';
+        
         // render to the view
         $this->view->set_data($data);
-        $this->view->set_layout('layout');
+        $this->view->set_layout($layoutName);
         $this->view->set_template('thematic_advance');
         $this->view->render();
     }

+ 1 - 1
main/gradebook/lib/gradebook_functions.inc.php

@@ -242,7 +242,7 @@ function build_edit_icons_cat($cat, $selectcat)
             }
 
             $modify_icons .= '<a href="gradebook_edit_all.php?&selectcat=' . $cat->get_id() . '">' . Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_SMALL) . '</a>';
-            $modify_icons .= '<a href="gradebook_flatview.php?' . api_get_self() . '&selectcat=' . $cat->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_SMALL) . '</a>';
+            $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' . $cat->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_SMALL) . '</a>';
             $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblecat=' . $cat->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=' . $selectcat . ' ">' . Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
 
             //no move ability for root categories

+ 52 - 34
main/inc/lib/formvalidator/Element/DateRangePicker.php

@@ -1,5 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 require_once 'HTML/QuickForm/date.php';
 
 /**
@@ -7,30 +8,34 @@ require_once 'HTML/QuickForm/date.php';
  */
 class DateRangePicker extends HTML_QuickForm_text
 {
-	/**
-	 * Constructor
-	 */
-	public function DateRangePicker($elementName = null, $elementLabel = null, $attributes = null)
-	{
+    /**
+    * Constructor
+    */
+    public function DateRangePicker($elementName = null, $elementLabel = null, $attributes = null)
+    {
         if (!isset($attributes['id'])) {
             $attributes['id'] = $elementName;
         }
         $attributes['class'] = 'span3';
-		HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
-		$this->_appendName = true;
-		$this->_type = 'date_range_picker';
-	}
-
-	/**
-	 * HTML code to display this datepicker
-	 */
-	public function toHtml()
-	{
-		$js = $this->getElementJS();
-		return $js.parent::toHtml();
-	}
-
-    function setValue($value)
+        HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+        $this->_appendName = true;
+        $this->_type = 'date_range_picker';
+    }
+
+    /**
+     * HTML code to display this datepicker
+     */
+    public function toHtml()
+    {
+        $js = $this->getElementJS();
+
+        return $js.parent::toHtml();
+    }
+
+    /**
+     * @param string $value
+     */
+    public function setValue($value)
     {
         $this->updateAttributes(
             array(
@@ -39,14 +44,25 @@ class DateRangePicker extends HTML_QuickForm_text
         );
     }
 
-	/**
-	 * Get the necessary javascript for this datepicker
-	 */
-	private function getElementJS()
-	{
+    /**
+     * Get the necessary javascript for this datepicker
+     * @return string
+     */
+    private function getElementJS()
+    {
         $js = null;
-
         $id = $this->getAttribute('id');
+
+        $dateRange = $this->getAttribute('value');
+
+        $defaultDates = null;
+        if (!empty($dateRange)) {
+            $dates = $this->parseDateRange($dateRange);
+            $defaultDates = "
+                    startDate: '".$dates['start']."',
+                    endDate: '".$dates['end']."', ";
+        }
+
         //timeFormat: 'hh:mm'
         $js .= "<script>
             $(function() {
@@ -55,6 +71,7 @@ class DateRangePicker extends HTML_QuickForm_text
                     timePicker: true,
                     timePickerIncrement: 30,
                     timePicker12Hour: false,
+                    $defaultDates
                     ranges: {
                          '".addslashes(get_lang('Today'))."': [moment(), moment()],
                          '".addslashes(get_lang('ThisWeek'))."': [moment().weekday(1), moment().weekday(5)],
@@ -73,15 +90,15 @@ class DateRangePicker extends HTML_QuickForm_text
             });
         </script>";
 
-		return $js;
-	}
+        return $js;
+    }
 
     /**
      * @param array $dateRange
-
+     *
      * @return array
      */
-    function parseDateRange($dateRange)
+    public function parseDateRange($dateRange)
     {
         $dates = explode('/', $dateRange);
         $dates = array_map('trim', $dates);
@@ -93,10 +110,11 @@ class DateRangePicker extends HTML_QuickForm_text
     }
 
     /**
-     * @param array $dates result of parseDateRange()
-     * @return bool
-     */
-    function validateDates($dates)
+    * @param array $dates result of parseDateRange()
+    *
+    * @return bool
+    */
+    public function validateDates($dates)
     {
         if (empty($dates['start']) || empty($dates['end'])) {
             return false;

+ 35 - 48
main/inc/lib/pear/HTML/QuickForm/text.php

@@ -1,47 +1,44 @@
 <?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
 
-/**
- * HTML class for a text field
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category    HTML
- * @package     HTML_QuickForm
- * @author      Adam Daniel <adaniel1@eesus.jnj.com>
- * @author      Bertrand Mansion <bmansion@mamasam.com>
- * @copyright   2001-2009 The PHP Group
- * @license     http://www.php.net/license/3_01.txt PHP License 3.01
- * @version     CVS: $Id: text.php,v 1.7 2009/04/04 21:34:04 avb Exp $
- * @link        http://pear.php.net/package/HTML_QuickForm
- */
-
-/**
- * Base class for <input /> form elements
- */
-require_once 'HTML/QuickForm/input.php';
+/**
+ * HTML class for a text field
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: This source file is subject to version 3.01 of the PHP license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.php.net/license/3_01.txt If you did not receive a copy of
+ * the PHP License and are unable to obtain it through the web, please
+ * send a note to license@php.net so we can mail you a copy immediately.
+ *
+ * @category    HTML
+ * @package     HTML_QuickForm
+ * @author      Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author      Bertrand Mansion <bmansion@mamasam.com>
+ * @copyright   2001-2009 The PHP Group
+ * @license     http://www.php.net/license/3_01.txt PHP License 3.01
+ * @version     CVS: $Id: text.php,v 1.7 2009/04/04 21:34:04 avb Exp $
+ * @link        http://pear.php.net/package/HTML_QuickForm
+ */
+
+/**
+ * Base class for <input /> form elements
+ */
+require_once 'HTML/QuickForm/input.php';
 
 /**
  * HTML class for a text field
  *
- * @category    HTML
- * @package     HTML_QuickForm
- * @author      Adam Daniel <adaniel1@eesus.jnj.com>
- * @author      Bertrand Mansion <bmansion@mamasam.com>
- * @version     Release: 3.2.11
- * @since       1.0
+ * @category    HTML
+ * @package     HTML_QuickForm
+ * @author      Adam Daniel <adaniel1@eesus.jnj.com>
+ * @author      Bertrand Mansion <bmansion@mamasam.com>
+ * @version     Release: 3.2.11
+ * @since       1.0
  */
 class HTML_QuickForm_text extends HTML_QuickForm_input
 {
-
-    // {{{ constructor
-
     /**
      * Class constructor
      *
@@ -58,10 +55,7 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
         HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
         $this->_persistantFreeze = true;
         $this->setType('text');
-    } //end constructor
-
-    // }}}
-    // {{{ setSize()
+    }
 
     /**
      * Sets size of text field
@@ -74,10 +68,7 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
     function setSize($size)
     {
         $this->updateAttributes(array('size'=>$size));
-    } //end func setSize
-
-    // }}}
-    // {{{ setMaxlength()
+    }
 
     /**
      * Sets maxlength of text field
@@ -91,8 +82,4 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
     {
         $this->updateAttributes(array('maxlength'=>$maxlength));
     } //end func setMaxlength
-
-    // }}}
-
-} //end class HTML_QuickForm_text
-?>
+}

+ 85 - 38
main/inc/lib/system_announcements.lib.php

@@ -1,20 +1,11 @@
 <?php
 /* For licensing terms, see /license.txt */
-/**
- * @package chamilo.library
- */
-/**
- * Code
- */
-
 
 /**
-*	This is the system announcements library for Dokeos.
-*
-*	@package chamilo.library
-*/
-class SystemAnnouncementManager {
-
+ * Class SystemAnnouncementManager
+ */
+class SystemAnnouncementManager
+{
     CONST VISIBLE_GUEST   = 1;
     CONST VISIBLE_STUDENT = 2;
     CONST VISIBLE_TEACHER = 3;
@@ -24,7 +15,8 @@ class SystemAnnouncementManager {
 	 * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
 	 * @param int $id The identifier of the announcement to display
 	 */
-	public static function display_announcements($visible, $id = -1) {
+	public static function display_announcements($visible, $id = -1)
+    {
 		$user_selected_language = api_get_interface_language();
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
@@ -76,9 +68,7 @@ class SystemAnnouncementManager {
 			$query_string = ereg_replace('&$', '', $query_string);
 			$url = api_get_self();
 			echo '<div class="system_announcements">';
-
 			echo '<h3>'.get_lang('SystemAnnouncements').'</h3>';
-
 			echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>';
 
 			while ($announcement = Database::fetch_object($announcements)) {
@@ -107,7 +97,15 @@ class SystemAnnouncementManager {
 		return;
 	}
 
-	public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='') {
+    /**
+     * @param $visible
+     * @param $id
+     * @param int $start
+     * @param string $user_id
+     * @return string
+     */
+    public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='')
+    {
 		$user_selected_language = api_get_interface_language();
 		$start	= intval($start);
 
@@ -200,7 +198,12 @@ class SystemAnnouncementManager {
 		return $content;
 	}
 
-	public static function display_arrow($user_id) {
+    /**
+     * @param int $user_id
+     * @return string
+     */
+    public static function display_arrow($user_id)
+    {
 		$start = (int)$_GET['start'];
 		$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
 		$next = ((int)$_GET['start']+19);
@@ -219,7 +222,13 @@ class SystemAnnouncementManager {
 		return $content;
 	}
 
-	public static function count_nb_announcement($start = 0, $user_id = '') {
+    /**
+     * @param int $start
+     * @param string $user_id
+     * @return int
+     */
+    public static function count_nb_announcement($start = 0, $user_id = '')
+    {
 		$start = intval($start);
 		$visibility = api_is_allowed_to_create_course() ? self::VISIBLE_TEACHER : self::VISIBLE_STUDENT;
 		$user_selected_language = api_get_interface_language();
@@ -261,7 +270,8 @@ class SystemAnnouncementManager {
 	 * @return array An array with all available system announcements (as php
 	 * objects)
 	 */
-	public static function get_all_announcements() {
+	public static function get_all_announcements()
+    {
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
 		$now = api_get_utc_datetime();
 		$sql = "SELECT *, IF( '$now'  >= date_start AND '$now' <= date_end, '1', '0') AS visible FROM $db_table";
@@ -295,8 +305,19 @@ class SystemAnnouncementManager {
 	 * @param int    Whether to send an e-mail to all users (1) or not (0)
 	 * @return mixed  insert_id on success, false on failure
 	 */
-	public static function add_announcement($title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0, $lang = null, $send_mail = 0, $add_to_calendar = false, $sendEmailTest = false) {
-
+    public static function add_announcement(
+        $title,
+        $content,
+        $date_start,
+        $date_end,
+        $visible_teacher = 0,
+        $visible_student = 0,
+        $visible_guest = 0,
+        $lang = null,
+        $send_mail = 0,
+        $add_to_calendar = false,
+        $sendEmailTest = false
+    ) {
 		$original_content = $content;
 		$a_dateS = explode(' ',$date_start);
 		$a_arraySD = explode('-',$a_dateS[0]);
@@ -362,12 +383,14 @@ class SystemAnnouncementManager {
 		}
 		return Database::insert_id();
 	}
+
     /**
    * Makes the announcement id visible only for groups in groups_array
    * @param int announcement id
    * @param array array of group id
    **/
-    public static function announcement_for_groups($announcement_id, $group_array){
+    public static function announcement_for_groups($announcement_id, $group_array)
+    {
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
         //first delete all group associations for this announcement
         $res = Database::query("DELETE FROM $tbl_announcement_group where announcement_id=".intval($announcement_id));
@@ -388,12 +411,14 @@ class SystemAnnouncementManager {
         }
         return true;
     }
-  /**
-   * Gets the groups of this announce
-   * @param int announcement id
-   * @return array array of group id
-   **/
-  public static function get_announcement_groups($announcement_id){
+
+    /**
+    * Gets the groups of this announce
+    * @param int announcement id
+    * @return array array of group id
+    **/
+    public static function get_announcement_groups($announcement_id)
+    {
         $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS);
         $tbl_group = Database :: get_main_table(TABLE_MAIN_GROUP);
         //first delete all group associations for this announcement
@@ -403,7 +428,7 @@ class SystemAnnouncementManager {
                                 ." AND ag.group_id = g.id");
         $groups = Database::fetch_array($res);
         return $groups;
-  }
+    }
 
 	/**
 	 * Updates an announcement to the database
@@ -414,7 +439,19 @@ class SystemAnnouncementManager {
 	 * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
 	 * @return	bool	True on success, false on failure
 	 */
-	public static function update_announcement($id, $title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0,$lang=null, $send_mail=0, $sendEmailTest = false) {
+    public static function update_announcement(
+        $id,
+        $title,
+        $content,
+        $date_start,
+        $date_end,
+        $visible_teacher = 0,
+        $visible_student = 0,
+        $visible_guest = 0,
+        $lang = null,
+        $send_mail = 0,
+        $sendEmailTest = false
+    ) {
 		$a_dateS = explode(' ',$date_start);
 		$a_arraySD = explode('-',$a_dateS[0]);
 		$a_arraySH = explode(':',$a_dateS[1]);
@@ -432,14 +469,17 @@ class SystemAnnouncementManager {
 			Display :: display_normal_message(get_lang('InvalidStartDate'));
 			return false;
 		}
+
 		if (($date_end_to_compare[1] || $date_end_to_compare[2] || $date_end_to_compare[0]) && !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])) {
 			Display :: display_normal_message(get_lang('InvalidEndDate'));
 			return false;
 		}
-		if( strlen(trim($title)) == 0) {
+
+		if (strlen(trim($title)) == 0) {
 			Display::display_normal_message(get_lang('InvalidTitle'));
 			return false;
 		}
+
 	    $start    = api_get_utc_datetime($date_start);
         $end      = api_get_utc_datetime($date_end);
 
@@ -468,12 +508,14 @@ class SystemAnnouncementManager {
 		}
 		return true;
 	}
+
 	/**
 	 * Deletes an announcement
 	 * @param 	int $id The identifier of the announcement that should be
 	 * @return	bool	True on success, false on failure
 	 */
-	public static function delete_announcement($id) {
+	public static function delete_announcement($id)
+    {
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
 		$id = intval($id);
 		$sql = "DELETE FROM ".$db_table." WHERE id =".$id;
@@ -484,25 +526,29 @@ class SystemAnnouncementManager {
 		}
 		return true;
 	}
+
 	/**
 	 * Gets an announcement
 	 * @param 	int		$id The identifier of the announcement that should be
 	 * @return	object	Object of class StdClass or the required class, containing the query result row
 	 */
-	public static function get_announcement($id) {
+	public static function get_announcement($id)
+    {
 		$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
 		$id = intval($id);
 		$sql = "SELECT * FROM ".$db_table." WHERE id = ".$id;
 		$announcement = Database::fetch_object(Database::query($sql));
 		return $announcement;
 	}
+
 	/**
 	 * Change the visibility of an announcement
 	 * @param 	int $announcement_id
 	 * @param 	int $user For who should the visibility be changed (possible values are VISIBLE_TEACHER, VISIBLE_STUDENT, VISIBLE_GUEST)
 	 * @return 	bool	True on success, false on failure
 	 */
-	public static function set_visibility($announcement_id, $user, $visible) {
+	public static function set_visibility($announcement_id, $user, $visible)
+    {
 		$db_table 			= Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
 		$visible			= intval($visible);
 		$announcement_id 	= intval($announcement_id);
@@ -531,7 +577,8 @@ class SystemAnnouncementManager {
 	 * @param	string	Language (optional, considered for all languages if left empty)
      * @return  bool    True if the message was sent or there was no destination matching. False on database or e-mail sending error.
 	 */
-	public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false) {
+	public static function send_system_announcement_by_email($title, $content, $teacher, $student, $language = null, $sendEmailTest = false)
+    {
 		global $charset;
 
         $title = api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset);
@@ -590,13 +637,13 @@ class SystemAnnouncementManager {
 		return $message_sent; //true if at least one e-mail was sent
 	}
 
-
 	/**
 	* Displays announcements as an slideshow
 	* @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER
 	* @param int $id The identifier of the announcement to display
 	*/
-	public static function display_announcements_slider($visible, $id = null) {
+	public static function display_announcements_slider($visible, $id = null)
+    {
 		$user_selected_language = Database::escape_string(api_get_interface_language());
 		$table                  = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
 

+ 47 - 55
main/inc/lib/thematic.lib.php

@@ -541,70 +541,62 @@ class Thematic
 		return $final_return;
 	}
 
-	 /**
+	/**
 	 * get thematic advance list
-	 * @param	int		Thematic advance id (optional), get data by thematic advance list
-	 * @param	string	Course code (optional)
-	 * @return	array	data
+	 * @param int $thematic_advance_id Thematic advance id (optional), get data by thematic advance list
+	 * @param string $course_code Course code (optional)
+         * @param bool $force_session_id Force to have a session id
+	 * @return array $data
 	 */
-	 public function get_thematic_advance_list($thematic_advance_id = null, $course_code = null, $force_session_id = false) {	 	// set current course
-	    $course_info = api_get_course_info($course_code);
-
-        $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
-        $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
+        public function get_thematic_advance_list($thematic_advance_id = null, $course_code = null, $force_session_id = false) { // set current course
+            $course_info = api_get_course_info($course_code);
+            $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
+            $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
 
-        $data = array();
-
-	 	$condition = '';
-	 	if (isset($thematic_advance_id)) {
-	 		$thematic_advance_id = intval($thematic_advance_id);
-	 		$condition = " AND a.id = $thematic_advance_id ";
-	 	}
-
-        $course_id = $course_info['real_id'];
+            $data = array();
 
+            $condition = '';
+            if (isset($thematic_advance_id)) {
+                $thematic_advance_id = intval($thematic_advance_id);
+                $condition = " AND a.id = $thematic_advance_id ";
+            }
 
-	 	/*if ($force_session_id) {
-            $sql = "SELECT a.* FROM $tbl_thematic_advance a INNER JOIN $tbl_thematic t ON t.id = a.thematic_id WHERE 1 $condition AND t.session_id = ".api_get_session_id()." ORDER BY start_date ";
-	 	} else {
-		    $sql = "SELECT * FROM $tbl_thematic_advance a WHERE 1 $condition  ORDER BY start_date ";
-	 	}*/
+            $course_id = $course_info['real_id'];
 
-	 	$sql = "SELECT * FROM $tbl_thematic_advance a WHERE  c_id = $course_id $condition  ORDER BY start_date ";
+            $sql = "SELECT * FROM $tbl_thematic_advance a WHERE  c_id = $course_id $condition  ORDER BY start_date ";
 
-        $elements =  array();
-	 	if ($force_session_id) {
-    	 	$list = api_get_item_property_by_tool('thematic_advance', $course_info['code'], api_get_session_id());
-    	 	foreach($list as $value) {
-    	 	    $elements[$value['ref']]= $value;
-    	 	}
-	 	}
+            $elements = array();
+            if ($force_session_id) {
+                $list = api_get_item_property_by_tool('thematic_advance', $course_info['code'], api_get_session_id());
+                foreach($list as $value) {
+                    $elements[$value['ref']]= $value;
+                }
+            }
 
-        $res = Database::query($sql);
-		if (Database::num_rows($res) > 0) {
-			if (!empty($thematic_advance_id)) {
-				$data = Database::fetch_array($res);
-			} else {
-				// group all data group by thematic id
-				$tmp = array();
-				while ($row = Database::fetch_array($res, 'ASSOC')) {
-
-					$tmp[] = $row['thematic_id'];
-					if (in_array($row['thematic_id'], $tmp)) {
-					    if ($force_session_id) {
-					        if (in_array($row['id'], array_keys($elements))) {
-					            $row['session_id'] = $elements[$row['id']]['id_session'];
-						        $data[$row['thematic_id']][$row['id']] = $row;
-					        }
-					    } else {
-					        $data[$row['thematic_id']][$row['id']] = $row;
-					    }
-					}
+            $res = Database::query($sql);
+            if (Database::num_rows($res) > 0) {
+                if (!empty($thematic_advance_id)) {
+                    $data = Database::fetch_array($res);
+                } else {
+                    // group all data group by thematic id
+                    $tmp = array();
+                    while ($row = Database::fetch_array($res, 'ASSOC')) {
+                        $tmp[] = $row['thematic_id'];
+                        if (in_array($row['thematic_id'], $tmp)) {
+                            if ($force_session_id) {
+                                if (in_array($row['id'], array_keys($elements))) {
+                                    $row['session_id'] = $elements[$row['id']]['id_session'];
+                                    $data[$row['thematic_id']][$row['id']] = $row;
+                                }
+                            } else {
+                                $data[$row['thematic_id']][$row['id']] = $row;
+                            }
+                        }
 
-				}
-			}
-		}
-		return $data;
+                    }
+                }
+            }
+            return $data;
 	 }
 
 	/**

+ 11 - 9
main/install/configuration.dist.php

@@ -6,7 +6,7 @@
  *		Virtual campus configuration
  *
  * This file contains a list of variables that can be modified by the campus
- * site's server administrator. Pay attention when changing these variables, 
+ * site's server administrator. Pay attention when changing these variables,
  * some changes may cause Chamilo to stop working.
  * If you changed some settings and want to restore them, please have a look at
  * configuration.dist.php. That file is an exact copy of the config file at
@@ -15,13 +15,13 @@
 
 /**
  * $_configuration define only the bare essential variables
- * for configuring the platform (paths, database connections, ...). 
+ * for configuring the platform (paths, database connections, ...).
  * Changing a $_configuration variable CAN generally break the installation.
- * Besides the $_configuration, a $_settings array also exists, that 
+ * Besides the $_configuration, a $_settings array also exists, that
  * contains variables that can be changed and will not break the platform.
- * These optional settings are defined in the database, now 
+ * These optional settings are defined in the database, now
  * (table settings_current).
- * example: $_configuration['tracking_enabled'] (assuming that the install 
+ * example: $_configuration['tracking_enabled'] (assuming that the install
  * script creates the necessary tables anyway).
  */
 
@@ -55,6 +55,8 @@ $_configuration['statistics_database']   ='{DATABASE_STATS}';
 // User Personal Database (where all the personal stuff of the user is stored
 // (personal agenda items, course sorting)
 $_configuration['user_personal_database']='{DATABASE_PERSONAL}';
+// Enable access to database management for platform admins.
+$_configuration['db_manager_enabled'] = false;
 
 /**
  * Directory settings
@@ -79,7 +81,7 @@ $_configuration['course_folder']  = "courses/";
 $_configuration['db_admin_path']  = '';
 
 /**
- * 
+ *
  * Login modules settings
  */
 // CAS IMPLEMENTATION
@@ -103,7 +105,7 @@ $extAuthSource["cas"]["newUser"] = $_configuration['root_sys'].$_configuration['
 // $extAuthSource["external_login"]["updateUser"] = $_configuration['root_sys'].$_configuration['code_append']."auth/external_login/updateUser.php";
 
 /**
- * 
+ *
  * Hosting settings - Allows you to set limits to the Chamilo portal when
  * hosting it for a third party. These settings can be overwritten by an
  * optionally-loaded extension file with only the settings (no comments).
@@ -124,7 +126,7 @@ $_configuration[1]['hosting_limit_sessions'] = 0;
 $_configuration[1]['hosting_limit_disk_space'] = 0;
 
 /**
- * Content Delivery Network (CDN) settings. Only use if you need a separate 
+ * Content Delivery Network (CDN) settings. Only use if you need a separate
  * server to serve your static data. If you don't know what a CDN is, you
  * don't need it. These settings are for simple Origin Pull CDNs and are
  * experimental. Enable only if you really know what you're doing.
@@ -191,4 +193,4 @@ $_configuration['system_stable']     = NEW_VERSION_STABLE;
 // Boost query on last connection time
 //$_configuration['save_user_last_login'] = true;
 // Allow course tutors in sessions to add existing students to their session
-//$_configuration['allow_tutors_to_assign_students_to_session'] = 'false'; 
+//$_configuration['allow_tutors_to_assign_students_to_session'] = 'false';

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio