Browse Source

Minor - removing global.inc.php, formatting code, updating docs.

Julio Montoya 11 năm trước cách đây
mục cha
commit
380e7d0866

+ 1 - 24
main/admin/group_add.php

@@ -124,29 +124,6 @@ if ($form->validate()) {
             );
             GroupPortalManager::update($group_id, $name, $description, $url, $status, $picture_uri);
         }
-
-        //@todo send emails
-
-        /*		if (!empty($email) && $send_mail) {
-                    $recipient_name = api_get_person_name($firstname, $lastname, null, PERSON_NAME_EMAIL_ADDRESS);
-                    $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
-
-                    $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
-                    $email_admin = api_get_setting('emailAdministrator');
-
-                    if ($_configuration['multiple_access_urls']) {
-                        $access_url_id = api_get_current_access_url_id();
-                        if ($access_url_id != -1) {
-                            $url = api_get_access_url($access_url_id);
-                            $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $url['url'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
-                        }
-                    }
-                    else {
-                        $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator');
-                    }
-                    api_mail_html($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin);
-                }*/
-
         Security::clear_token();
         $tok = Security::get_token();
         header(
@@ -172,4 +149,4 @@ if (!empty($message)) {
 $form->display();
 
 // Footer
-Display::display_footer();
+Display::display_footer();

+ 1 - 1
main/exercice/feedback.php

@@ -56,7 +56,7 @@ Display::display_header($nameTools, "Exercise");
 
         $form = new FormValidator('feedbackform', 'post', api_get_self()."?".api_get_cidreq(
         )."&modifyQuestion=".$modifyQuestion."&newQuestion=".$newQuestion);
-        $obj_registration_form = new HTML_QuickForm('frmRegistration', 'POST');
+        $obj_registration_form = new FormValidator('frmRegistration', 'POST');
         $renderer =& $obj_registration_form->defaultRenderer();
         $renderer->setElementTemplate(
             '<tr>

+ 2 - 0
main/gradebook/gradebook_result.class.php

@@ -233,6 +233,7 @@ class GradeBookResult
 		echo $data;
 		return true;
 	}
+
 	/**
 	 * Exports the complete report as an XLS file
 	 * @return	boolean		False on error
@@ -275,6 +276,7 @@ class GradeBookResult
 	/**
 	 * Exports the complete report as a DOCX file
 	 * @return	boolean		False on error
+     * @todo use unoconv
 	 */
 	public function exportCompleteReportDOC($data) {
         $_course = api_get_course_info();

+ 0 - 2
main/inc/ajax/admin.ajax.php

@@ -4,8 +4,6 @@
  * Responses to AJAX calls
  */
 
-require_once '../global.inc.php';
-
 api_protect_admin_script();
 
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;

+ 0 - 3
main/inc/ajax/course.ajax.php

@@ -5,10 +5,7 @@
  */
 
 $language_file[] = 'admin';
-require_once '../global.inc.php';
-
 $action = $_REQUEST['a'];
-
 $user_id = api_get_user_id();
 
 switch ($action) {

+ 1 - 14
main/inc/ajax/course_home.ajax.php

@@ -9,7 +9,6 @@ $now    = time();
 
 switch ($action) {
     case 'set_visibility':
-        require_once '../global.inc.php';
         $course_id = api_get_course_int_id();
         $courseInfo = api_get_course_info();
 
@@ -78,7 +77,6 @@ switch ($action) {
         break;
     case 'show_course_information':
         $language_file = array('course_description');
-        require_once '../global.inc.php';
 
         // Get the name of the database course.
         $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
@@ -110,8 +108,6 @@ switch ($action) {
      */
     case 'session_courses_lp_default':
 
-        require_once '../global.inc.php';
-
         $page  = intval($_REQUEST['page']);     //page
         $limit = intval($_REQUEST['rows']);     // quantity of rows
         $sidx  = $_REQUEST['sidx'];    //index to filter
@@ -226,11 +222,7 @@ switch ($action) {
         $response->records = $count;
         echo json_encode($response);
         break;
-
     case 'session_courses_lp_by_week':
-
-        require_once '../global.inc.php';
-
         $page  = intval($_REQUEST['page']);     //page
         $limit = intval($_REQUEST['rows']);     // quantity of rows
         $sidx  = $_REQUEST['sidx'];    //index to filter
@@ -350,12 +342,7 @@ switch ($action) {
         $response->records = $count;
         echo json_encode($response);
         break;
-
-
     case 'session_courses_lp_by_course':
-
-        require_once '../global.inc.php';
-
         $page  = intval($_REQUEST['page']);     //page
         $limit = intval($_REQUEST['rows']);     // quantity of rows
         $sidx  = $_REQUEST['sidx'];    //index to filter
@@ -473,4 +460,4 @@ switch ($action) {
 	default:
 		echo '';
 }
-exit;
+exit;

+ 1 - 3
main/inc/ajax/document.ajax.php

@@ -3,8 +3,6 @@
 /**
  * Responses to AJAX calls for the document upload
  */
-require_once '../global.inc.php';
-
 $action = $_REQUEST['a'];
 switch($action) {
 	case 'upload_file':
@@ -44,4 +42,4 @@ switch($action) {
 		}
 		break;
 }
-exit;
+exit;

+ 1 - 3
main/inc/ajax/events.ajax.php

@@ -1,7 +1,5 @@
 <?php
 
-require_once '../global.inc.php';
-
 $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
 $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
 $event_name = isset($_REQUEST['eventName']) ? $_REQUEST['eventName'] : null;
@@ -22,4 +20,4 @@ switch ($action) {
         print json_encode($users);
         break;
 }
-exit;
+exit;

+ 3 - 4
main/inc/lib/course.lib.php

@@ -1,6 +1,9 @@
 <?php
 /* For licensing terms, see /license.txt*/
+
 /**
+ * Class CourseManager
+ *
  * This is the course library for Chamilo.
  *
  * All main course functions should be placed here.
@@ -12,10 +15,6 @@
  *
  * @package chamilo.library
  */
-/**
- *    CourseManager Class
- *    @package chamilo.library
- */
 class CourseManager
 {
     const MAX_COURSE_LENGTH_CODE = 40;

+ 3 - 0
main/inc/lib/course_home.lib.php

@@ -1,6 +1,9 @@
 <?php
 /* For licensing terms, see /license.txt */
 
+/**
+ * Class CourseHome
+ */
 class CourseHome
 {
     /**

+ 13 - 5
main/inc/lib/display.lib.php

@@ -2,6 +2,8 @@
 /* For licensing terms, see /license.txt */
 
 /**
+ * Class Display
+ *
  * This is a display library for Chamilo.
  *
  * Include/require it in your code to use its public functionality.
@@ -13,17 +15,21 @@
  *
  * @package chamilo.library
  */
-/**
- * Code
- */
 class Display
 {
     /** The main template */
     public static $global_template;
     public static $preview_style = null;
+    public static $urlGenerator = null;
 
     public function __construct()
     {
+
+    }
+
+    public static function setUrlGenerator($urlGenerator)
+    {
+        self::$urlGenerator = $urlGenerator;
     }
 
     /**
@@ -100,7 +106,7 @@ class Display
     }
 
     /**
-     * @param Symfony\Component\Routing\RouterInterface $urlGenerator
+     * @param \Symfony\Component\Routing\RouterInterface $urlGenerator
      * @param string $tool
      * @param array $toolList
      * @return null|string
@@ -783,10 +789,12 @@ class Display
         $show_text = true,
         $return_only_path = false
     ) {
-
         $code_path   = api_get_path(SYS_IMG_PATH);
         $w_code_path = api_get_path(WEB_IMG_PATH);
 
+        //$code_path = self::$urlGenerator->generate('root');
+        //$w_code_path = self::$urlGenerator->generate('root');
+
         $image      = trim($image);
         $theme      = 'css/'.api_get_visual_theme().'/icons/';
         $size_extra = '';

+ 2 - 1
main/inc/lib/events.lib.inc.php

@@ -13,6 +13,7 @@
  */
 use ChamiloLMS\Entity\User;
 use ChamiloLMS\Entity\Role;
+
 /**
  * @author Sebastien Piraux <piraux_seb@hotmail.com> old code
  * @author Julio Montoya 2013
@@ -139,7 +140,7 @@ function event_access_tool($tool, $id_session = 0)
 
     $pos = isset($_SERVER['HTTP_REFERER']) ? strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower(api_get_path(WEB_COURSE_PATH).$_course['path'])) : false;
     // added for "what's new" notification
-    $pos2 = isset($_SERVER['HTTP_REFERER']) ? strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower($_configuration['root_web']."index")) : false;
+    $pos2 = isset($_SERVER['HTTP_REFERER']) ? strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower(api_get_path(WEB_PATH)."index")) : false;
     // end "what's new" notification
     if ($pos !== false || $pos2 !== false) {
         $sql = "INSERT INTO ".$TABLETRACK_ACCESS."

+ 6 - 2
main/inc/lib/usermanager.lib.php

@@ -3287,8 +3287,12 @@ class UserManager
         $user_id = intval($user_id);
 
         // all the information of the field
-        $sql = "SELECT ut.id, tag,count FROM $table_user_tag ut INNER JOIN $table_user_tag_values uv ON (uv.tag_id=ut.ID)
-                WHERE field_id = $field_id AND user_id = $user_id ORDER BY tag";
+        $sql = "SELECT ut.id, tag, count
+                FROM $table_user_tag ut
+                INNER JOIN $table_user_tag_values uv
+                ON (uv.tag_id=ut.ID)
+                WHERE field_id = $field_id AND user_id = $user_id
+                ORDER BY tag";
         $result = Database::query($sql);
         $return = array();
         if (Database::num_rows($result)> 0) {

+ 1 - 1
main/survey/survey.lib.php

@@ -248,7 +248,7 @@ class survey_manager
 							$row['survey_version'] = $row['survey_version'] + 1;
 							$additional['values'] .= ",'".$row['survey_version']."'";
 						} else {
-							$getlast = api_split('\.', $row['survey_version']);
+							$getlast = explode('\.', $row['survey_version']);
 							$lastversion = array_pop($getlast);
 							$lastversion = $lastversion + 1;
 							$add = implode('.', $getlast);

+ 1 - 0
src/ChamiloLMS/Middleware/CourseMiddleware.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace ChamiloLMS\Middleware;
 

+ 5 - 0
src/ChamiloLMS/Provider/ReflectionControllerProvider.php

@@ -1,4 +1,5 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 namespace ChamiloLMS\Provider;
 
@@ -15,6 +16,10 @@ use Sensio\Bundle\FrameworkExtraBundle\Routing\AnnotatedRouteControllerLoader;
 use Doctrine\Common\Annotations\AnnotationReader;
 use ChamiloLMS\Middleware\CourseMiddleware;
 
+/**
+ * Class ReflectionControllerProvider
+ * @package ChamiloLMS\Provider
+ */
 class ReflectionControllerProvider implements ControllerProviderInterface
 {
     private $controllerName;