Browse Source

Merge branch '1.10.x' of github.com:chamilo/chamilo-lms into 1.10.x

Yannick Warnier 9 years ago
parent
commit
54d61662f4

+ 18 - 17
main/auth/inscription.php

@@ -738,17 +738,21 @@ if ($form->validate()) {
             array('info' => $text_after_registration)
         );
     } else {
-        Display:: display_header($tool_name);
-        echo Display::page_header($tool_name);
-        echo $content;
-        echo $text_after_registration;
 
-        Display:: display_footer();
+        $tpl = new Template($tool_name);
+
+        $tpl->assign('inscription_content', $content);
+        $tpl->assign('text_after_registration', $text_after_registration);
+        $tpl->assign('hide_header', $hideHeaders);
+        $inscription = $tpl->get_template('auth/inscription.tpl');
+        $tpl->display($inscription);
     }
 } else {
     // Custom pages
     if (CustomPages::enabled()) {
-        CustomPages::display(CustomPages::REGISTRATION, array('form' => $form));
+        CustomPages::display(
+            CustomPages::REGISTRATION, array('form' => $form)
+        );
     } else {
 
         if (!api_is_anonymous()) {
@@ -774,17 +778,14 @@ if ($form->validate()) {
             CourseManager::redirectToCourse([]);
         }
 
-        if ($hideHeaders) {
-            Display:: display_no_header();
-        } else {
-            Display:: display_header($tool_name);
-        }
-        echo Display::page_header($tool_name);
-        echo $content;
-        $form->display();
+        $tpl = new Template($tool_name);
 
-        if ($hideHeaders == false) {
-            Display:: display_footer();
-        }
+        $tpl->assign('inscription_header', Display::page_header($tool_name));
+        $tpl->assign('inscription_content', $content);
+        $tpl->assign('form', $form->returnForm());
+        $tpl->assign('hide_header', $hideHeaders);
+
+        $inscription = $tpl->get_template('auth/inscription.tpl');
+        $tpl->display($inscription);
     }
 }

+ 31 - 14
main/auth/lostPassword.php

@@ -14,9 +14,7 @@
 *
 *	@package chamilo.auth
 */
-/**
- * Code
- */
+
 require_once '../inc/global.inc.php';
 
 // Custom pages
@@ -63,20 +61,24 @@ if (CustomPages::enabled()) {
 }
 
 $tool_name = get_lang('LostPassword');
-Display :: display_header($tool_name);
 
-$this_section 	= SECTION_CAMPUS;
-$tool_name 		= get_lang('LostPass');
+$this_section = SECTION_CAMPUS;
+$tool_name = get_lang('LostPass');
 
 // Forbidden to retrieve the lost password
 if (api_get_setting('allow_lostpassword') == 'false') {
-	api_not_allowed();
+	api_not_allowed(true);
 }
 
+$formToString = '';
 if (isset($_GET['reset']) && isset($_GET['id'])) {
-    $message = Display::return_message(Login::reset_password($_GET["reset"], $_GET["id"], true), 'normal', false);
+    $message = Display::return_message(
+        Login::reset_password($_GET["reset"], $_GET["id"], true),
+        'normal',
+        false
+    );
 	$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'auth/lostPassword.php" class="btn btn-back" >'.get_lang('Back').'</a>';
-	echo $message;
+	Display::addFlash($message);
 } else {
 	$form = new FormValidator('lost_password');
     $form->addElement('header', $tool_name);
@@ -96,16 +98,31 @@ if (isset($_GET['reset']) && isset($_GET['id'])) {
             $by_username = true;
             foreach ($users_related_to_username as $user) {
                 if ($_configuration['password_encryption'] != 'none') {
-                    Login::handle_encrypted_password($user, $by_username);
+                    $message = Login::handle_encrypted_password($user, $by_username);
                 } else {
-                    Login::send_password_to_user($user, $by_username);
+                    $message = Login::send_password_to_user($user, $by_username);
                 }
+                Display::addFlash($message);
             }
 		} else {
-			Display::display_warning_message(get_lang('NoUserAccountWithThisEmailAddress'));
+            Display::addFlash(
+                Display::return_message(
+                    get_lang('NoUserAccountWithThisEmailAddress'),
+                    'warning'
+                )
+            );
 		}
 	} else {
-		$form->display();
+		$formToString = $form->returnForm();
 	}
 }
-Display::display_footer();
+
+
+$controller = new IndexManager($tool_name);
+//$tpl = new Template($tool_name);
+$controller->set_login_form();
+$tpl = $controller->tpl;
+$tpl->assign('form', $formToString);
+
+$template = $tpl->get_template('auth/lost_password.tpl');
+$tpl->display($template);

+ 99 - 0
main/cron/course_finished.php

@@ -0,0 +1,99 @@
+<?php
+
+/* For licensing terms, see /license.txt */
+/**
+ * Cron for send a email when the course are finished
+ * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
+ * @package chamilo.cron
+ */
+require_once __DIR__ . '/../inc/global.inc.php';
+
+if (php_sapi_name() != 'cli') {
+    exit; //do not run from browser
+}
+
+$endDate = new DateTime('now', new DateTimeZone('UTC'));
+$endDate = $endDate->format('Y-m-d');
+
+$entityManager = Database::getManager();
+$sessionRepo = $entityManager->getRepository('ChamiloCoreBundle:Session');
+$accessUrlRepo = $entityManager->getRepository('ChamiloCoreBundle:AccessUrl');
+
+$sessions = $sessionRepo->createQueryBuilder('s')
+    ->where('s.accessEndDate LIKE :date')
+    ->setParameter('date', "$endDate%")
+    ->getQuery()
+    ->getResult();
+
+if (empty($sessions)) {
+    echo "No sessions finishing today $endDate" . PHP_EOL;
+    exit;
+}
+
+$administrator = [
+    'complete_name' => api_get_person_name(
+        api_get_setting('administratorName'),
+        api_get_setting('administratorSurname'),
+        null,
+        PERSON_NAME_EMAIL_ADDRESS
+    ),
+    'email' => api_get_setting('emailAdministrator')
+];
+
+foreach ($sessions as $session) {
+    $mailSubject = sprintf(
+        get_lang('MailCronCourseFinishedSubject'),
+        $session->getName()
+    );
+
+    $accessUrls = $accessUrlRepo->createQueryBuilder('au')
+        ->select('au')
+        ->innerJoin(
+            'ChamiloCoreBundle:AccessUrlRelSession',
+            'aus',
+            Doctrine\ORM\Query\Expr\Join::WITH,
+            'au.id = aus.accessUrlId'
+        )
+        ->where('aus.sessionId = :session')
+        ->setParameter('session', $session)
+        ->setMaxResults(1)
+        ->getQuery()
+        ->getResult();
+
+    $accessUrl = current($accessUrls);
+
+    $sessionUsers = $session->getUsers();
+
+    if (empty($sessionUsers)) {
+        echo 'No users to send mail' . PHP_EOL;
+        exit;
+    }
+
+    foreach ($sessionUsers as $sessionUser) {
+        $user = $sessionUser->getUser();
+
+        $mailBody = vsprintf(
+            get_lang('MailCronCourseFinishedBody'),
+            [
+                $user->getCompleteName(),
+                $session->getName(),
+                $accessUrl->getUrl(),
+                api_get_setting("siteName")
+            ]
+        );
+
+        api_mail_html(
+            $user->getCompleteName(),
+            $user->getEmail(),
+            $mailSubject,
+            $mailBody,
+            $administrator['complete_name'],
+            $administrator['email']
+        );
+
+        echo '============' . PHP_EOL;
+        echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})" . PHP_EOL;
+        echo "Session: {$session->getName()}" . PHP_EOL;
+        echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}" . PHP_EOL;
+    }
+}

+ 1 - 1
main/cron/remind_course_expiration.php

@@ -93,7 +93,7 @@ if ($usersToBeReminded) {
         );
         foreach ($sessions as $sessionId => $session) {
             $daysRemaining = date_diff($today, date_create($session['access_end_date']));
-            $join = " INNER JOIN ".Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION)."ON id = access_url_id";
+            $join = " INNER JOIN ".Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION)." ON id = access_url_id";
             $result = Database::select(
                 'url',
                 Database::get_main_table(TABLE_MAIN_ACCESS_URL).$join,

+ 12 - 1
main/document/edit_document.php

@@ -60,6 +60,7 @@ $lib_path = api_get_path(LIBRARY_PATH);
 
 $course_info = api_get_course_info();
 $group_id = api_get_group_id();
+$sessionId = api_get_session_id();
 
 if (api_is_in_group()) {
 	$group_properties = GroupManager::get_group_properties($group_id);
@@ -73,9 +74,19 @@ if (isset($_GET['id'])) {
     $document_data = DocumentManager::get_document_data_by_id(
         $_GET['id'],
         api_get_course_id(),
-        true
+        true,
+		0
     );
 
+    if (!empty($sessionId) && empty($document_data)) {
+        $document_data = DocumentManager::get_document_data_by_id(
+            $_REQUEST['id'],
+            api_get_course_id(),
+            true,
+            $sessionId
+        );
+    }
+
 	$document_id = $document_data['id'];
 	$file = $document_data['path'];
 	$parent_id = DocumentManager::get_document_id($course_info, dirname($file));

+ 5 - 4
main/exercice/exercise_history.php

@@ -25,9 +25,9 @@ if (!$is_allowedToEdit){
     exit;
 }
 
-$interbreadcrumb[]= array ('url' => 'exercise_report.php','name' => get_lang('Exercises'));
-$interbreadcrumb[]= array ('url' => 'exercise_report.php'.'?filter=2','name' => get_lang('StudentScore'));
-$interbreadcrumb[]= array ('url' => 'exercise_history.php'.'?exe_id='.intval($_GET['exe_id']), 'name' => get_lang('Details'));
+$interbreadcrumb[]= array ('url' => 'exercise_report.php?'.api_get_cidreq(),'name' => get_lang('Exercises'));
+$interbreadcrumb[]= array ('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(),'name' => get_lang('StudentScore'));
+$interbreadcrumb[]= array ('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details'));
 
 $TBL_USER          	    = Database::get_main_table(TABLE_MAIN_USER);
 $TBL_EXERCISES			= Database::get_course_table(TABLE_QUIZ_TEST);
@@ -43,7 +43,8 @@ if (isset($_GET['message'])) {
 }
 
 echo '<div class="actions">';
-echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' . Display :: return_icon('back.png', get_lang('BackToResultList'),'',ICON_SIZE_MEDIUM).'</a>';
+echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' .
+    Display :: return_icon('back.png', get_lang('BackToResultList'),'',ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 
 ?>

+ 2 - 2
main/exercice/exercise_report.php

@@ -289,7 +289,7 @@ if (($is_allowedToEdit || $is_tutor || api_is_coach()) &&
         Database::query($sql);
         $sql = 'DELETE FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.$exe_id;
         Database::query($sql);
-        header('Location: exercise_report.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&exerciseId='.$exercise_id);
+        header('Location: exercise_report.php?'.api_get_cidreq().'&exerciseId='.$exercise_id);
         exit;
     }
 }
@@ -623,7 +623,7 @@ $extra_params['height'] = 'auto';
             });
         });
 </script>
-<form id="export_report_form" method="post" action="exercise_report.php">
+<form id="export_report_form" method="post" action="exercise_report.php?<?php echo api_get_cidreq(); ?>">
     <input type="hidden" name="csvBuffer" id="csvBuffer" value="" />
     <input type="hidden" name="export_report" id="export_report" value="1" />
     <input type="hidden" name="exerciseId" id="exerciseId" value="<?php echo $exercise_id ?>" />

+ 2 - 1
main/exercice/live_stats.php

@@ -76,7 +76,8 @@ $(function() {
 </script>
 <?php
 
-$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'">' . Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
+$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' .
+    Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
 echo $actions = Display::div($actions, array('class'=> 'actions'));
 
 //echo Display::page_header($objExercise->name);

+ 3 - 3
main/exercice/stats.php

@@ -276,8 +276,8 @@ foreach ($data as $row_table) {
 $content .= $table->toHtml();
 
 
-$interbreadcrumb[] = array ("url" => "exercise.php?gradebook=$gradebook", "name" => get_lang('Exercises'));
-$interbreadcrumb[] = array ("url" => "admin.php?exerciseId=$exercise_id","name" => $objExercise->name);
+$interbreadcrumb[] = array("url" => "exercise.php?gradebook=$gradebook&".api_get_cidreq(), "name" => get_lang('Exercises'));
+$interbreadcrumb[] = array("url" => "admin.php?exerciseId=$exercise_id&".api_get_cidreq(), "name" => $objExercise->name);
 
 $tpl = new Template(get_lang('ReportByQuestion'));
 
@@ -285,7 +285,7 @@ $tpl = new Template(get_lang('ReportByQuestion'));
 //$actions[]= array(get_lang('Back'), Display::return_icon('back.png', get_lang('Back'), 'exercise_report.php?'.$exercise_id));
 //$tpl->set_actions($actions);
 
-$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'">' .
+$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' .
     Display :: return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
 $actions = Display::div($actions, array('class'=> 'actions'));
 $content = $actions.$content;

+ 6 - 1
main/inc/lib/api.lib.php

@@ -7846,7 +7846,12 @@ function api_mail_html(
         }
     }
     $message = str_replace(array("\n\r", "\n", "\r"), '<br />', $message);
-    $mail->Body = '<html><head></head><body>'.$message.'</body></html>';
+
+    $mailView = new Template(null, false, false, false, false, false);
+    $mailView->assign('content', $message);
+    $layout = $mailView->get_template('mail/mail.tpl');
+
+    $mail->Body = $mailView->fetch($layout);
 
     // Attachment ...
     if (!empty($data_file)) {

+ 1 - 1
main/inc/lib/document.lib.php

@@ -2740,7 +2740,7 @@ class DocumentManager
         $course_data = api_get_course_info($course_code);
         $document_data = self::get_document_data_by_id($document_id, $course_code);
         $file_path = api_get_path(SYS_COURSE_PATH) . $course_data['path'] . '/document' . $document_data['path'];
-        $pdf = new PDF();
+        $pdf = new PDF('A4-L', 'L');
         $pdf->html_to_pdf($file_path, $document_data['title'], $course_code);
     }
 

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

@@ -124,7 +124,8 @@ class Login
      *
      * @author Olivier Cauberghe <olivier.cauberghe@UGent.be>, Ghent University
      */
-    public static function handle_encrypted_password($user, $by_username = false) {
+    public static function handle_encrypted_password($user, $by_username = false)
+    {
         $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT
 
         if ($by_username) { // Show only for lost password
@@ -147,7 +148,7 @@ class Login
             if (CustomPages::enabled()) {
                 return get_lang('YourPasswordHasBeenEmailed');
             } else {
-                Display::display_confirmation_message(get_lang('YourPasswordHasBeenEmailed'));
+                return Display::return_message(get_lang('YourPasswordHasBeenEmailed'));
             }
         } else {
             $admin_email = Display :: encrypted_mailto_link(api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname')));
@@ -156,7 +157,7 @@ class Login
             if (CustomPages::enabled()) {
                 return $message;
             } else {
-                Display::display_error_message($message, false);
+                return Display::return_message($message, 'error');
             }
         }
     }

+ 171 - 14
main/inc/lib/template.lib.php

@@ -60,10 +60,10 @@ class Template
         $load_plugins = true
     ) {
         // Page title
-        $this->title            = $title;
-        $this->show_learnpath   = $show_learnpath;
+        $this->title = $title;
+        $this->show_learnpath = $show_learnpath;
         $this->hide_global_chat = $hide_global_chat;
-        $this->load_plugins     = $load_plugins;
+        $this->load_plugins = $load_plugins;
 
         $template_paths = array(
             api_get_path(SYS_CODE_PATH) . 'template/overrides', // user defined templates
@@ -83,20 +83,25 @@ class Template
         if (api_get_setting('server_type') == 'test') {
             $options = array(
                 //'cache' => api_get_path(SYS_ARCHIVE_PATH), //path to the cache folder
-                'autoescape'       => false,
-                'debug'            => true,
-                'auto_reload'      => true,
-                'optimizations'    => 0, // turn on optimizations with -1
-                'strict_variables' => false, //If set to false, Twig will silently ignore invalid variables
+                'autoescape' => false,
+                'debug' => true,
+                'auto_reload' => true,
+                'optimizations' => 0,
+                // turn on optimizations with -1
+                'strict_variables' => false,
+                //If set to false, Twig will silently ignore invalid variables
             );
         } else {
             $options = array(
-                'cache'            => $cache_folder, //path to the cache folder
-                'autoescape'       => false,
-                'debug'            => false,
-                'auto_reload'      => false,
-                'optimizations'    => -1, // turn on optimizations with -1
-                'strict_variables' => false //If set to false, Twig will silently ignore invalid variables
+                'cache' => $cache_folder,
+                //path to the cache folder
+                'autoescape' => false,
+                'debug' => false,
+                'auto_reload' => false,
+                'optimizations' => -1,
+                // turn on optimizations with -1
+                'strict_variables' => false
+                //If set to false, Twig will silently ignore invalid variables
             );
         }
 
@@ -153,6 +158,8 @@ class Template
         $this->assign('css_styles', $this->theme);
         $this->assign('login_class', null);
 
+        $this->setLoginForm();
+
         // Chamilo plugins
         if ($this->show_header) {
             if ($this->load_plugins) {
@@ -1099,4 +1106,154 @@ class Template
         }
         return $theme;
     }
+
+    /**
+     * @param bool|true $setLoginForm
+     */
+    public function setLoginForm($setLoginForm = true)
+    {
+        global $loginFailed;
+        $userId = api_get_user_id();
+        if (!($userId) || api_is_anonymous($userId)) {
+
+            // Only display if the user isn't logged in.
+            $this->assign(
+                'login_language_form',
+                api_display_language_form(true)
+            );
+            if ($setLoginForm) {
+                $this->assign('login_form', $this->displayLoginForm());
+
+                if ($loginFailed) {
+                    $this->assign('login_failed', $this::handleLoginFailed());
+                }
+            }
+        }
+    }
+
+    /**
+     * @return string
+     */
+    public function handleLoginFailed()
+    {
+        $message = get_lang('InvalidId');
+
+        if (!isset($_GET['error'])) {
+            if (api_is_self_registration_allowed()) {
+                $message = get_lang('InvalidForSelfRegistration');
+            }
+        } else {
+            switch ($_GET['error']) {
+                case '':
+                    if (api_is_self_registration_allowed()) {
+                        $message = get_lang('InvalidForSelfRegistration');
+                    }
+                    break;
+                case 'account_expired':
+                    $message = get_lang('AccountExpired');
+                    break;
+                case 'account_inactive':
+                    $message = get_lang('AccountInactive');
+                    break;
+                case 'user_password_incorrect':
+                    $message = get_lang('InvalidId');
+                    break;
+                case 'access_url_inactive':
+                    $message = get_lang('AccountURLInactive');
+                    break;
+                case 'wrong_captcha':
+                    $message = get_lang('TheTextYouEnteredDoesNotMatchThePicture');
+                    break;
+                case 'blocked_by_captcha':
+                    $message = get_lang('AccountBlockedByCaptcha');
+                    break;
+                case 'multiple_connection_not_allowed':
+                    $message = get_lang('MultipleConnectionsAreNotAllow');
+                    break;
+                case 'unrecognize_sso_origin':
+                    //$message = get_lang('SSOError');
+                    break;
+            }
+        }
+        return Display::return_message($message, 'error');
+    }
+
+    /**
+     * @return string
+     */
+    public function displayLoginForm()
+    {
+        $form = new FormValidator(
+            'formLogin',
+            'POST',
+            null,
+            null,
+            null,
+            FormValidator::LAYOUT_BOX_NO_LABEL
+        );
+
+        $form->addText(
+            'login',
+            get_lang('UserName'),
+            true,
+            array('id' => 'login', 'autofocus' => 'autofocus', 'icon' => 'user')
+        );
+
+        $form->addElement(
+            'password',
+            'password',
+            get_lang('Pass'),
+            array('id' => 'password', 'icon' => 'lock')
+        );
+
+        // Captcha
+        $captcha = api_get_setting('allow_captcha');
+        $allowCaptcha = $captcha == 'true';
+
+        if ($allowCaptcha) {
+            $useCaptcha = isset($_SESSION['loginFailed']) ? $_SESSION['loginFailed'] : null;
+            if ($useCaptcha) {
+                $ajax = api_get_path(WEB_AJAX_PATH).'form.ajax.php?a=get_captcha';
+                $options = array(
+                    'width' => 250,
+                    'height' => 90,
+                    'callback'     => $ajax.'&var='.basename(__FILE__, '.php'),
+                    'sessionVar'   => basename(__FILE__, '.php'),
+                    'imageOptions' => array(
+                        'font_size' => 20,
+                        'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
+                        'font_file' => 'OpenSans-Regular.ttf',
+                        //'output' => 'gif'
+                    )
+                );
+
+                // Minimum options using all defaults (including defaults for Image_Text):
+                //$options = array('callback' => 'qfcaptcha_image.php');
+
+                $captcha_question = $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
+                $form->addHtml(get_lang('ClickOnTheImageForANewOne'));
+
+                $form->addElement('text', 'captcha', get_lang('EnterTheLettersYouSee'));
+                $form->addRule('captcha', get_lang('EnterTheCharactersYouReadInTheImage'), 'required', null, 'client');
+                $form->addRule('captcha', get_lang('TheTextYouEnteredDoesNotMatchThePicture'), 'CAPTCHA', $captcha_question);
+            }
+        }
+
+        $form->addButton('submitAuth', get_lang('LoginEnter'), null, 'primary', null, 'btn-block');
+
+        $html = $form->returnForm();
+        // The validation is located in the local.inc
+        /*if ($form->validate()) {
+            // Prevent re-use of the same CAPTCHA phrase
+            $captcha_question->destroy();
+        }*/
+
+        if (api_get_setting('openid_authentication') == 'true') {
+            include_once 'main/auth/openid/login.php';
+            $html .= '<div>'.openid_form().'</div>';
+        }
+
+        return $html;
+    }
+
 }

+ 17 - 9
main/inc/lib/tracking.lib.php

@@ -6160,8 +6160,8 @@ class TrackingCourseLog
     	$sql .= " ORDER BY col$column $direction ";
     	$sql .= " LIMIT $from,$number_of_items";
 
-    	$res      = Database::query($sql);
-    	$users    = array();
+        $res = Database::query($sql);
+        $users = array();
 
         $course_info = api_get_course_info($course_code);
         $total_surveys = 0;
@@ -6196,11 +6196,18 @@ class TrackingCourseLog
             $courseInfo = api_get_course_info($course_code);
             $courseId = $courseInfo['real_id'];
 
-    		$user['official_code']  = $user['col0'];
-            $user['lastname']       = $user['col1'];
-            $user['firstname']      = $user['col2'];
-    		$user['username']       = $user['col3'];
-    		$user['time'] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user['user_id'], $courseId, $session_id));
+            $user['official_code'] = $user['col0'];
+            $user['lastname'] = $user['col1'];
+            $user['firstname'] = $user['col2'];
+            $user['username'] = $user['col3'];
+
+            $user['time'] = api_time_to_hms(
+                Tracking::get_time_spent_on_the_course(
+                    $user['user_id'],
+                    $courseId,
+                    $session_id
+                )
+            );
 
             $avg_student_score = Tracking::get_avg_student_score(
                 $user['user_id'],
@@ -6215,10 +6222,11 @@ class TrackingCourseLog
                 array(),
                 $session_id
             );
+
     		if (empty($avg_student_progress)) {
     			$avg_student_progress=0;
     		}
-    		$user['average_progress']   = $avg_student_progress.'%';
+    		$user['average_progress'] = $avg_student_progress.'%';
 
             $total_user_exercise = Tracking::get_exercise_student_progress(
                 $total_exercises,
@@ -6227,7 +6235,7 @@ class TrackingCourseLog
                 $session_id
             );
 
-            $user['exercise_progress']  = $total_user_exercise;
+            $user['exercise_progress'] = $total_user_exercise;
 
             $total_user_exercise = Tracking::get_exercise_student_average_best_attempt(
                 $total_exercises,

+ 5 - 124
main/inc/lib/userportal.lib.php

@@ -34,18 +34,7 @@ class IndexManager
     function set_login_form($setLoginForm = true)
     {
         global $loginFailed;
-        if (!($this->user_id) || api_is_anonymous($this->user_id)) {
-
-            // Only display if the user isn't logged in.
-            $this->tpl->assign('login_language_form', api_display_language_form(true));
-            if ($setLoginForm) {
-                $this->tpl->assign('login_form',  self::display_login_form());
-
-                if ($loginFailed) {
-                    $this->tpl->assign('login_failed',  self::handle_login_failed());
-                }
-            }
-        }
+        $this->tpl->setLoginForm($setLoginForm);
     }
 
     function return_exercise_block($personal_course_list)
@@ -367,47 +356,9 @@ class IndexManager
      *
      * @version 1.0.1
      */
-    function handle_login_failed() {
-        $message = get_lang('InvalidId');
-
-        if (!isset($_GET['error'])) {
-            if (api_is_self_registration_allowed()) {
-                $message = get_lang('InvalidForSelfRegistration');
-            }
-        } else {
-            switch ($_GET['error']) {
-                case '':
-                    if (api_is_self_registration_allowed()) {
-                        $message = get_lang('InvalidForSelfRegistration');
-                    }
-                    break;
-                case 'account_expired':
-                    $message = get_lang('AccountExpired');
-                    break;
-                case 'account_inactive':
-                    $message = get_lang('AccountInactive');
-                    break;
-                case 'user_password_incorrect':
-                    $message = get_lang('InvalidId');
-                    break;
-                case 'access_url_inactive':
-                    $message = get_lang('AccountURLInactive');
-                    break;
-                case 'wrong_captcha':
-                    $message = get_lang('TheTextYouEnteredDoesNotMatchThePicture');
-                    break;
-                case 'blocked_by_captcha':
-                    $message = get_lang('AccountBlockedByCaptcha');
-                    break;
-                case 'multiple_connection_not_allowed':
-                    $message = get_lang('MultipleConnectionsAreNotAllow');
-                    break;
-                case 'unrecognize_sso_origin':
-                    //$message = get_lang('SSOError');
-                    break;
-            }
-        }
-        return Display::return_message($message, 'error');
+    function handle_login_failed()
+    {
+        return $this->tpl->handleLoginFailed();
     }
 
     /**
@@ -746,77 +697,7 @@ class IndexManager
      */
     public function display_login_form()
     {
-        $form = new FormValidator(
-            'formLogin',
-            'POST',
-            null,
-            null,
-            null,
-            FormValidator::LAYOUT_BOX_NO_LABEL
-        );
-
-        $form->addText(
-            'login',
-            get_lang('UserName'),
-            true,
-            array('id' => 'login', 'autofocus' => 'autofocus', 'icon' => 'user')
-        );
-
-        $form->addElement(
-            'password',
-            'password',
-            get_lang('Pass'),
-            array('id' => 'password', 'icon' => 'lock')
-        );
-
-        // Captcha
-        $captcha = api_get_setting('allow_captcha');
-        $allowCaptcha = $captcha == 'true';
-
-        if ($allowCaptcha) {
-            $useCaptcha = isset($_SESSION['loginFailed']) ? $_SESSION['loginFailed'] : null;
-            if ($useCaptcha) {
-                $ajax = api_get_path(WEB_AJAX_PATH).'form.ajax.php?a=get_captcha';
-                $options = array(
-                    'width' => 250,
-                    'height' => 90,
-                    'callback'     => $ajax.'&var='.basename(__FILE__, '.php'),
-                    'sessionVar'   => basename(__FILE__, '.php'),
-                    'imageOptions' => array(
-                        'font_size' => 20,
-                        'font_path' => api_get_path(SYS_FONTS_PATH) . 'opensans/',
-                        'font_file' => 'OpenSans-Regular.ttf',
-                        //'output' => 'gif'
-                    )
-                );
-
-                // Minimum options using all defaults (including defaults for Image_Text):
-                //$options = array('callback' => 'qfcaptcha_image.php');
-
-                $captcha_question = $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
-                $form->addHtml(get_lang('ClickOnTheImageForANewOne'));
-
-                $form->addElement('text', 'captcha', get_lang('EnterTheLettersYouSee'));
-                $form->addRule('captcha', get_lang('EnterTheCharactersYouReadInTheImage'), 'required', null, 'client');
-                $form->addRule('captcha', get_lang('TheTextYouEnteredDoesNotMatchThePicture'), 'CAPTCHA', $captcha_question);
-            }
-        }
-
-        $form->addButton('submitAuth', get_lang('LoginEnter'), null, 'primary', null, 'btn-block');
-
-        $html = $form->returnForm();
-        // The validation is located in the local.inc
-        /*if ($form->validate()) {
-            // Prevent re-use of the same CAPTCHA phrase
-            $captcha_question->destroy();
-        }*/
-
-        if (api_get_setting('openid_authentication') == 'true') {
-            include_once 'main/auth/openid/login.php';
-            $html .= '<div>'.openid_form().'</div>';
-        }
-
-        return $html;
+        return $this->tpl->displayLoginForm();
     }
 
     /**

+ 1 - 0
main/install/data.sql

@@ -309,6 +309,7 @@ VALUES
 ('meta_description', NULL, 'textfield', 'Tracking', '', 'MetaDescriptionTitle', 'MetaDescriptionComment', NULL, NULL, 1),
 ('meta_image_path', NULL, 'textfield', 'Tracking', '', 'MetaImagePathTitle', 'MetaImagePathComment', NULL, NULL, 1),
 ('allow_teachers_to_create_sessions', NULL, 'radio', 'Session', 'false', 'AllowTeachersToCreateSessionsTitle', 'AllowTeachersToCreateSessionsComment', NULL, NULL, 0),
+('institution_address',NULL,'textfield','Platform','','InstitutionAddressTitle','InstitutionAddressComment',NULL,NULL, 1),
 ('chamilo_database_version', NULL, 'textfield', NULL, '0', 'DatabaseVersion', '', NULL, NULL, 0);
 
 INSERT INTO settings_options (variable, value, display_text)

+ 63 - 55
main/lang/english/trad4all.inc.php

@@ -325,18 +325,18 @@ $DeleteUsersNotInList = "Unsubscribe students which are not in the imported list
 $IfSessionExistsUpdate = "If a session exists, update it";
 $CreatedByXYOnZ = "Create by <a href=\"%s\">%s</a> on %s";
 $LoginWithExternalAccount = "Login without an institutional account";
-$ImportAikenQuizExplanationExample = "This is the text for question 1
-A. Answer 1
-B. Answer 2
-C. Answer 3
-ANSWER: B
-
-This is the text for question 2
-A. Answer 1
-B. Answer 2
-C. Answer 3
-D. Answer 4
-ANSWER: D
+$ImportAikenQuizExplanationExample = "This is the text for question 1
+A. Answer 1
+B. Answer 2
+C. Answer 3
+ANSWER: B
+
+This is the text for question 2
+A. Answer 1
+B. Answer 2
+C. Answer 3
+D. Answer 4
+ANSWER: D
 ANSWER_EXPLANATION: this is an optional feedback comment that will appear next to the correct answer.";
 $ImportAikenQuizExplanation = "The Aiken format comes in a simple text (.txt) file, with several question blocks, each separated by a blank line. The first line is the question, the answer lines are prefixed by a letter and a dot, and the correct answer comes next with the ANSWER: prefix. See example below.";
 $ExerciseAikenErrorNoAnswerOptionGiven = "The imported file has at least one question without any answer (or the answers do not include the required prefix letter). Please make sure each question has at least one answer and that it is prefixed by a letter and a dot or a parenthesis, like this: A. answer one";
@@ -425,18 +425,18 @@ $VersionUpToDate = "Your version is up-to-date";
 $LatestVersionIs = "The latest version is";
 $YourVersionNotUpToDate = "Your version is not up-to-date";
 $Hotpotatoes = "Hotpotatoes";
-$ZeroMeansNoQuestionWillBeSelectedMinusOneMeansThatAllQuestionsWillBeSelected = "-1 = All questions will be selected.
+$ZeroMeansNoQuestionWillBeSelectedMinusOneMeansThatAllQuestionsWillBeSelected = "-1 = All questions will be selected.
  0 = No questions will be selected.";
-$EmailNotificationTemplateDescription = "You can customize the email sent to users when they finished the exercise. You can use tags like these:
-
-1. {{ student.username }}
-2. {{ student.firstname }}
-3. {{ student.lastname }}
-4. {{ student.official_code }}
-5. {{ exercise.title }}
-6. {{ exercise.start_time }}
-7. {{ exercise.end_time }}
-8. {{ course.title }}
+$EmailNotificationTemplateDescription = "You can customize the email sent to users when they finished the exercise. You can use tags like these:
+
+1. {{ student.username }}
+2. {{ student.firstname }}
+3. {{ student.lastname }}
+4. {{ student.official_code }}
+5. {{ exercise.title }}
+6. {{ exercise.start_time }}
+7. {{ exercise.end_time }}
+8. {{ course.title }}
 9. {{ course.code }}";
 $EmailNotificationTemplate = "Email notification template";
 $ExerciseEndButtonDisconnect = "Logout";
@@ -844,10 +844,10 @@ $AllowVisitors = "Allow visitors";
 $EnableIframeInclusionComment = "Allowing arbitrary iframes in the HTML Editor will enhance the edition capabilities of the users, but it can represent a security risk. Please make sure you can rely on your users (i.e. you know who they are) before enabling this feature.";
 $AddedToLPCannotBeAccessed = "This exercise has been included in a learning path, so it cannot be accessed by students directly from here. If you want to put the same exercise available through the exercises tool, please make a copy of the current exercise using the copy icon.";
 $EnableIframeInclusionTitle = "Allow iframes in HTML Editor";
-$MailTemplateRegistrationMessage = "Dear ((firstname)) ((lastname)),\n\nYou are registered on
-((sitename)) with the following settings:\n\nUsername :
-((username))\nPass : ((password))\n\nThe address of ((sitename)) is :
-((url))\n\nIn case of trouble, contact us.\n\nYours sincerely
+$MailTemplateRegistrationMessage = "Dear ((firstname)) ((lastname)),\n\nYou are registered on
+((sitename)) with the following settings:\n\nUsername :
+((username))\nPass : ((password))\n\nThe address of ((sitename)) is :
+((url))\n\nIn case of trouble, contact us.\n\nYours sincerely
 \n((admin_name)) ((admin_surname)).";
 $Explanation = "Once you click on \"Create a course\", a course is created with a section for Tests, Project based learning, Assessments, Courses, Dropbox, Agenda and much more. Logging in as teacher provides you with editing privileges for this course.";
 $CodeTaken = "This training code is already in use.  <br>Use the <b>Back</b> button on your browser and try again";
@@ -2640,16 +2640,16 @@ $NoPosts = "No posts";
 $WithoutAchievedSkills = "Without achieved skills";
 $TypeMessage = "Please type your message!";
 $ConfirmReset = "Do you really want to delete all messages?";
-$MailCronCourseExpirationReminderBody = "Dear %s,
-
-It has come to our attention that you have not completed the course %s although its expiration date had been set on %s, remaining %s days to finish it.
-
-We remind you that you have only the possibility to follow this course once a year, that is why we invite you insistently to complete your course on time.
-
-You can return to the course connecting to the platform through this address: %s
-
-Best Regards,
-
+$MailCronCourseExpirationReminderBody = "Dear %s,
+
+It has come to our attention that you have not completed the course %s although its expiration date had been set on %s, remaining %s days to finish it.
+
+We remind you that you have only the possibility to follow this course once a year, that is why we invite you insistently to complete your course on time.
+
+You can return to the course connecting to the platform through this address: %s
+
+Best Regards,
+
 %s Team";
 $MailCronCourseExpirationReminderSubject = "Urgent: %s course expiration reminder";
 $ExerciseAndLearningPath = "Exercise and learning path";
@@ -5778,8 +5778,8 @@ $CheckThatYouHaveEnoughQuestionsInYourCategories = "Make sure you have enough qu
 $PortalCoursesLimitReached = "Sorry, this installation has a courses limit, which has now been reached. To increase the number of courses allowed on this Chamilo installation, please contact your hosting provider or, if available, upgrade to a superior hosting plan.";
 $PortalTeachersLimitReached = "Sorry, this installation has a teachers limit, which has now been reached. To increase the number of teachers allowed on this Chamilo installation, please contact your hosting provider or, if available, upgrade to a superior hosting plan.";
 $PortalUsersLimitReached = "Sorry, this installation has a users limit, which has now been reached. To increase the number of users allowed on this Chamilo installation, please contact your hosting provider or, if available, upgrade to a superior hosting plan.";
-$GenerateSurveyAccessLinkExplanation = "By copying the link below and pasting it in an e-mail or on a website, you will allow any anonymous person to enter and answer this survey.
-You can test this feature by clicking the link above and answering the survey.
+$GenerateSurveyAccessLinkExplanation = "By copying the link below and pasting it in an e-mail or on a website, you will allow any anonymous person to enter and answer this survey.
+You can test this feature by clicking the link above and answering the survey.
 This is particularly useful if you want to allow anyone on a forum to answer you survey and you don't know their e-mail addresses.";
 $LinkOpenSelf = "Open self";
 $LinkOpenBlank = "Open blank";
@@ -5832,8 +5832,8 @@ $Item = "Item";
 $ConfigureDashboardPlugin = "Configure Dashboard Plugin";
 $EditBlocks = "Edit blocks";
 $Never = "Never";
-$YourAccountIsActiveYouCanLoginAndCheckYourCourses = "Dear user, 
-
+$YourAccountIsActiveYouCanLoginAndCheckYourCourses = "Dear user, 
+
 Your account has now been activated on the platform. Please login and enjoy your courses.";
 $SessionFields = "Session fields";
 $CopyLabelSuffix = "Copy";
@@ -5895,7 +5895,7 @@ $CourseSettingsRegisterDirectLink = "If your course is public or open, you can u
 $DirectLink = "Direct link";
 $here = "here";
 $GoAheadAndBrowseOurCourseCatalogXOnceRegisteredYouWillSeeTheCourseHereX = "<p>Go ahead and browse our course catalog %s to register to any course you like. Once registered, you will see the course appear right %s, instead of this message.</p>";
-$HelloXAsYouCanSeeYourCourseListIsEmpty = "<p>Hello <strong>%s</strong> and welcome,</p>
+$HelloXAsYouCanSeeYourCourseListIsEmpty = "<p>Hello <strong>%s</strong> and welcome,</p>
 <p>As you can see, your courses list is still empty. That's because you are not registered to any course yet! </p>";
 $UnsubscribeUsersAlreadyAddedInCourse = "Unsubscribe users already added";
 $ImportUsers = "Import users";
@@ -6159,7 +6159,7 @@ $AverageScore = "Average score";
 $LastConnexionDate = "Last connexion date";
 $ToolVideoconference = "Videoconference";
 $BigBlueButtonEnableTitle = "BigBlueButton videoconference tool";
-$BigBlueButtonEnableComment = "Choose whether you want to enable the BigBlueButton videoconference tool. Once enabled, it will show as an additional course tool in all courses' homepage, and teachers will be able to launch a conference at any time. Learners will not be able to launch a conference, only join one. If you don't have a BigBlueButton server, please <a href=\"http://bigbluebutton.org/\" target=\"_blank\">set one up</a> or ask the <a href=\"http://www.chamilo.org/en/providers\" target=\"_blank\">Chamilo official providers</a> for a quote.
+$BigBlueButtonEnableComment = "Choose whether you want to enable the BigBlueButton videoconference tool. Once enabled, it will show as an additional course tool in all courses' homepage, and teachers will be able to launch a conference at any time. Learners will not be able to launch a conference, only join one. If you don't have a BigBlueButton server, please <a href=\"http://bigbluebutton.org/\" target=\"_blank\">set one up</a> or ask the <a href=\"http://www.chamilo.org/en/providers\" target=\"_blank\">Chamilo official providers</a> for a quote.
 BigBlueButton is a free (as in freedom *and* beer), but its installation requires a set of technical skills that might not be immediately available to all. You can install it on your own or seek professional help to assist you or do it for you. This help, however, will generate a certain cost. In the pure logic of the free software, we offer you the tools to make your work easier and recommend professionals (the Chamilo Official Providers) that will be able to help you if this were too difficult.";
 $BigBlueButtonHostTitle = "BigBlueButton server host";
 $BigBlueButtonHostComment = "This is the name of the server where your BigBlueButton server is running. Might be <i>localhost</i>, an IP address (e.g. 192.168.13.54) or a domain name (e.g. my.video.com).";
@@ -6170,14 +6170,14 @@ $OnlyAccessFromYourGroup = "Only accessible from your group";
 $CreateAssignmentPage = "This will create a special wiki page in which the teacher can describe the task and which will be automatically linked to the wiki pages where learners perform the task. Both the teacher's and the learners' pages are created automatically. In these tasks, learners can only edit and view theirs pages, but this can be changed easily if you need to.";
 $UserFolders = "Folders of users";
 $UserFolder = "User folder";
-$HelpUsersFolder = "INFORMATION VISIBLE TO THE TEACHER ONLY:\nThe users folder contains a folder for each user who has accessed it through the documents tool, or when any file has been sent in the course through the online editor. If neither circumstances has occurred, then no user folder will have been created. In the case of groups, files that are sent through the editor will be added in the folder of each group, which is only accessible by students from this group.
-<br /><br />
-The users folder and each of the included folders will be hidden by default in for all students, but each student can see the contents of his/her directory through the online editor. However, if a student knows the address of a file or folder of another student, he may be able to access it.
-<br /><br />
-If the folder of a student is visible, other students can see what it contains. In this case, the student that owns the folder can also (from the documents tool and only in his/her folder): create and edit web documents, convert a document into a template for personal use, create and edit drawings in SVG and PNG formats, record audio files in WAV format, make audio files in MP3 from a text, make snapshops from a webcam, send documents, create folders, move folders and files, delete folders and files, and download backup of his/her folder.
-<br /><br />
-Moreover, the documents tool is synchronized with the file manager of the online editor, so changes in the documents triggered in any one of these will affect both.
-<br /><br />
+$HelpUsersFolder = "INFORMATION VISIBLE TO THE TEACHER ONLY:\nThe users folder contains a folder for each user who has accessed it through the documents tool, or when any file has been sent in the course through the online editor. If neither circumstances has occurred, then no user folder will have been created. In the case of groups, files that are sent through the editor will be added in the folder of each group, which is only accessible by students from this group.
+<br /><br />
+The users folder and each of the included folders will be hidden by default in for all students, but each student can see the contents of his/her directory through the online editor. However, if a student knows the address of a file or folder of another student, he may be able to access it.
+<br /><br />
+If the folder of a student is visible, other students can see what it contains. In this case, the student that owns the folder can also (from the documents tool and only in his/her folder): create and edit web documents, convert a document into a template for personal use, create and edit drawings in SVG and PNG formats, record audio files in WAV format, make audio files in MP3 from a text, make snapshops from a webcam, send documents, create folders, move folders and files, delete folders and files, and download backup of his/her folder.
+<br /><br />
+Moreover, the documents tool is synchronized with the file manager of the online editor, so changes in the documents triggered in any one of these will affect both.
+<br /><br />
 As such, the user folder is not only a place to deposit files, it becomes a complete manager of the documents students use during the course. Also, remember that any user can copy a file that is visible from any folder in the documents tool (whether or not he is the owner) to his/her portfolios or personal documents area of social network, which will be available to him/her for use in other courses.";
 $HelpFolderChat = "INFORMATION VISIBLE TO THE TEACHER ONLY:\nThis folder contains all sessions that have been opened in the chat. Although the chat sessions can often be trivial, others can be really interesting and worthy of being incorporated as an additional work document. To do this without changing the visibility of this folder, make the file visible and link it from where you deem appropriate. It is not recommended to make this folder visible to all.";
 $HelpFolderCertificates = "INFORMATION VISIBLE TO THE TEACHER ONLY:\nThis folder contains the various certificates templates that have been created for the rating tool. It is not recommended to make this folder visible to all.";
@@ -6227,8 +6227,8 @@ $Pediaphon = "Use Pediaphon audio services";
 $HelpPediaphon = "Supports text with several thousands characters, in various types of male and female voices (depending on the language). Audio files will be generated and automatically saved to the Chamilo directory in which you are.";
 $FirstSelectALanguage = "Please select a language";
 $MoveUserStats = "Move users results from/to a session";
-$CompareUserResultsBetweenCoursesAndCoursesInASession = "This advanced tool allows you to manually improve the tracking of users results when moving from courses methodology to sessions methodology. In most cases, you won't need to use it.<br />
-On this screen, you can compare results of users between the context of a standalone course, and the context of the same course inside a session.<br />
+$CompareUserResultsBetweenCoursesAndCoursesInASession = "This advanced tool allows you to manually improve the tracking of users results when moving from courses methodology to sessions methodology. In most cases, you won't need to use it.<br />
+On this screen, you can compare results of users between the context of a standalone course, and the context of the same course inside a session.<br />
 Once you are sure about what to do, you can choose to move the tracking data of the students (exercises results and learning paths tracking) from a course to a session.";
 $PDFExportWatermarkEnableTitle = "Enable watermark in PDF export";
 $PDFExportWatermarkEnableComment = "By enabling this option, you can upload an image or a text that will be automatically added as watermark to all PDF exports of documents on the system.";
@@ -6363,8 +6363,8 @@ $MailNotifyInvitation = "Notify by mail on new invitation received";
 $MailNotifyMessage = "Notify by mail on new personal message received";
 $MailNotifyGroupMessage = "Notify by mail on new message received in group";
 $SearchEnabledTitle = "Fulltext search";
-$SearchEnabledComment = "This feature allows you to index most of the documents uploaded to your portal, then provide a search feature for users.<br />
-This feature will not index documents that have already been uploaded, so it is important to enable (if wanted) at the beginning of your implementation.<br />
+$SearchEnabledComment = "This feature allows you to index most of the documents uploaded to your portal, then provide a search feature for users.<br />
+This feature will not index documents that have already been uploaded, so it is important to enable (if wanted) at the beginning of your implementation.<br />
 Once enabled, a search box will appear in the courses list of every user. Searching for a specific term will bring a list of corresponding documents, exercises or forum topics, filtered depending on the availability of these contents to the user.";
 $SpecificSearchFieldsAvailable = "Available custom search fields";
 $XapianModuleInstalled = "Xapian module installed";
@@ -7418,4 +7418,12 @@ $HtmlPurifierWikiComment = "Enable HTML purifier in the wiki tool (will increase
 $ClickOrDropFilesHere = "Click or drop files";
 $RemoveTutorStatus = "Remove tutor status";
 $ImportGradebookInCourse = "Import gradebook from base course";
+$InstitutionAddressTitle = "Institution address";
+$InstitutionAddressComment = "Address";
+$LatestLoginInCourse = "Latest access in course";
+$LatestLoginInPlatform = "Latest login in platform";
+$FirstLoginInPlatform = "First login in platform";
+$FirstLoginInCourse = "First access in in course";
+$QuotingToXUser = "Quoting to %s";
+$LoadMoreComments = "Load more comments";
 ?>

File diff suppressed because it is too large
+ 56 - 56
main/lang/spanish/trad4all.inc.php


+ 20 - 16
main/mySpace/myStudents.php

@@ -115,11 +115,6 @@ if (isset($_GET['details'])) {
     $nameTools = get_lang("DetailsStudentInCourse");
 } else {
     if (!empty ($_GET['origin']) && $_GET['origin'] == 'resume_session') {
-        /*$interbreadcrumb[] = array (
-            'url' => '../admin/index.php',
-            "name" => get_lang('PlatformAdmin')
-        );*/
-
         $interbreadcrumb[] = array (
             'url' => "../session/session_list.php",
             "name" => get_lang('SessionList')
@@ -316,7 +311,6 @@ if (isset($message)) {
 
 $token = Security::get_token();
 if (!empty($student_id)) {
-
     // Actions bar
     echo '<div class="actions">';
     echo '<a href="javascript: window.back();" ">'.
@@ -328,7 +322,7 @@ if (!empty($student_id)) {
             Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
     if (!empty ($user_info['email'])) {
         $send_mail = '<a href="mailto:'.$user_info['email'].'">'.
-                Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'</a>';
+            Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'</a>';
     } else {
         $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM);
     }
@@ -426,8 +420,8 @@ if (!empty($student_id)) {
         get_lang('Tracking', '')
     );
     $csv_content[] = array(
-        get_lang('FirstLogin', ''),
-        get_lang('LatestLogin', ''),
+        get_lang('FirstLoginInPlatform', ''),
+        get_lang('LatestLoginInPlatform', ''),
         get_lang('TimeSpentInTheCourse', ''),
         get_lang('Progress', ''),
         get_lang('Score', '')
@@ -544,11 +538,11 @@ if (!empty($student_id)) {
             <tr>
                 <th colspan="2"><?php echo get_lang('Tracking'); ?></th>
             </tr>
-            <tr><td align="right"><?php echo get_lang('FirstLogin') ?></td>
+            <tr><td align="right"><?php echo get_lang('FirstLoginInPlatform') ?></td>
                 <td align="left"><?php echo $first_connection_date ?></td>
             </tr>
             <tr>
-                <td align="right"><?php echo get_lang('LatestLogin') ?></td>
+                <td align="right"><?php echo get_lang('LatestLoginInPlatform') ?></td>
                 <td align="left"><?php echo $last_connection_date ?></td>
             </tr>
             <?php if (isset($_GET['details']) && $_GET['details'] == 'true') {?>
@@ -762,11 +756,21 @@ if (!empty($student_id)) {
                 <table class="data_table">
                 <tr>
                     <th><?php echo get_lang('Learnpaths');?></th>
-                    <th><?php echo get_lang('Time').' '; Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
-                    <th><?php echo get_lang('AverageScore').' '; Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
-                    <th><?php echo get_lang('LatestAttemptAverageScore').' '; Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
-                    <th><?php echo get_lang('Progress').' '; Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
-                    <th><?php echo get_lang('LastConnexion').' '; Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
+                    <th><?php
+                        echo get_lang('Time').' ';
+                        Display :: display_icon('info3.gif', get_lang('TotalTimeByCourse'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?></th>
+                    <th><?php
+                        echo get_lang('AverageScore').' ';
+                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInAllAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
+                    <th><?php
+                        echo get_lang('LatestAttemptAverageScore').' ';
+                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?></th>
+                    <th><?php
+                        echo get_lang('Progress').' ';
+                        Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
+                    <th><?php
+                        echo get_lang('LastConnexion').' ';
+                        Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?></th>
                     <?php
                     echo '<th>'.get_lang('Details').'</th>';
                     if (api_is_allowed_to_edit()) {

+ 17 - 7
main/session/about.php

@@ -8,6 +8,7 @@
  */
 use Chamilo\CoreBundle\Entity\ExtraField;
 use Chamilo\CourseBundle\Entity\CCourseDescription;
+use \Chamilo\CoreBundle\Entity\SequenceResource;
 
 $cidReset = true;
 
@@ -115,9 +116,18 @@ $sessionDates = SessionManager::parseSessionDates([
 
 $sessionRequirements = $sequenceResourceRepo->getRequirements(
     $session->getId(),
-    \Chamilo\CoreBundle\Entity\SequenceResource::SESSION_TYPE
+    SequenceResource::SESSION_TYPE
 );
 
+$hasRequirements = false;
+
+foreach ($sessionRequirements as $sequence) {
+    if (!empty($sequence['requirements'])) {
+        $hasRequirements = true;
+        break;
+    }
+}
+
 $courseController = new CoursesController();
 
 /* View */
@@ -138,7 +148,7 @@ $template->assign(
     $courseController->getRegisteredInSessionButton(
         $session->getId(),
         $session->getName(),
-        !empty($sessionRequirements)
+        $hasRequirements
     )
 );
 
@@ -148,14 +158,14 @@ $template->assign(
     'session_extra_fields',
     $sessionValues->getAllValuesForAnItem($session->getId(), true)
 );
+$template->assign('has_requirements', $hasRequirements);
+$template->assign('sequences', $sessionRequirements);
 
 $templateFolder = api_get_configuration_value('default_template');
 
-if (!empty($templateFolder)) {
-    $content = $template->fetch($templateFolder.'/session/about.tpl');
-} else {
-    $content = $template->fetch('default/session/about.tpl');
-}
+$layout = $template->get_template('session/about.tpl');
+
+$content = $template->fetch($layout);
 
 $template->assign('header', $session->getName());
 $template->assign('content', $content);

+ 14 - 0
main/template/default/auth/inscription.tpl

@@ -0,0 +1,14 @@
+{%
+    extends hide_header == true
+    ? template ~ "/layout/blank.tpl"
+    : template ~ "/layout/layout_1_col.tpl"
+%}
+
+{% block content %}
+
+{{ inscription_header }}
+{{ inscription_content }}
+{{ form }}
+{{ text_after_registration }}
+
+{% endblock %}

+ 7 - 0
main/template/default/auth/lost_password.tpl

@@ -0,0 +1,7 @@
+{% extends template ~ "/layout/layout_1_col.tpl" %}
+
+{% block content %}
+
+{{ form }}
+
+{% endblock %}

+ 3 - 1
main/template/default/layout/blank.tpl

@@ -1 +1,3 @@
-{{ content }}
+{% block content %}
+{{ content }}
+{% endblock %}

+ 1 - 1
main/template/default/layout/login_form.tpl

@@ -16,7 +16,7 @@
         {% if "allow_lostpassword" | get_setting == 'true' and "allow_registration" | get_setting == 'true' %}
             <ul class="nav nav-pills nav-stacked">
                 {% if "allow_registration" | get_setting != 'false' %}
-                    <li><a href="main/auth/inscription.php?hide_headers=1"> {{ 'SignUp' | get_lang }} </a></li>
+                    <li><a href="main/auth/inscription.php"> {{ 'SignUp' | get_lang }} </a></li>
                 {% endif %}
 
                 {% if "allow_lostpassword" | get_setting == 'true' %}

+ 7 - 0
main/template/default/mail/footer.tpl

@@ -0,0 +1,7 @@
+<table border="0" cellpadding="10" cellspacing="0" width="100%">
+    <tr>
+        <td style="background-color: #2C3E50; border-bottom: 1px solid #2C3E50; box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.1);">
+            &nbsp;
+        </td>
+    </tr>
+</table>

+ 12 - 0
main/template/default/mail/header.tpl

@@ -0,0 +1,12 @@
+<table border="0" cellpadding="10" cellspacing="0" width="100%">
+    <tr>
+        <td width="245">
+            <a href="{{ _p.web }}">
+                <img src="{{ _p.web_css_theme ~ 'images/header-logo.png' }}" alt="{{ _s.site_name }}">
+            </a>
+        </td>
+        <td width="100%">
+            &nbsp;
+        </td>
+    </tr>
+</table>

+ 33 - 0
main/template/default/mail/mail.tpl

@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+        <title>{{ _s.institution }}</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    </head>
+    <body style="margin: 0; padding: 0;">
+        <table border="0" cellpadding="0" cellspacing="0" width="100%">
+            <tr>
+                <td>
+                    <table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;">
+                        <tr>
+                            <td>
+                                {% include template ~ '/mail/header.tpl' %}
+                            </td>
+                        </tr>
+                        <tr>
+                            <td cellpadding="0" cellspacing="0" style="padding: 40px 10px">
+                                {{ content }}
+                            </td>
+                        </tr>
+                        <tr>
+                            <td>
+                                {% include template ~ '/mail/footer.tpl' %}
+                            </td>
+                        </tr>
+                    </table>
+                </td>
+            </tr>
+        </table>
+    </body>
+</html>

+ 63 - 25
main/template/default/session/about.tpl

@@ -1,13 +1,48 @@
 <div id="about-session">
-    <p><i class="fa fa-clock-o"></i> <em>{{ session_date.display }}</em></p>
+    <div class="row">
+        <div class="col-xs-12">
+            <p><i class="fa fa-clock-o"></i> <em>{{ session_date.display }}</em></p>
+
+            {% if show_tutor %}
+                <p>
+                    <i class="fa fa-user"></i> {{ 'SessionGeneralCoach'|get_lang }}: <em>{{ session.generalCoach.getCompleteName() }}</em>
+                </p>
+            {% endif %}
 
-    {% if show_tutor %}
-        <p><i class="fa fa-user"></i> {{ 'SessionGeneralCoach'|get_lang }}: <em>{{ session.generalCoach.getCompleteName() }}</em></p>
-    {% endif %}
+            {% if session.getShowDescription() %}
+                <div class="lead">
+                    {{ session.getDescription() }}
+                </div>
+            {% endif %}
+        </div>
+    </div>
 
-    {% if session.getShowDescription() %}
-        <div class="lead">
-            {{ session.getDescription() }}
+    {% if has_requirements %}
+        <div class="row">
+            <div class="col-xs-12">
+                <div class="panel panel-default">
+                    <div class="panel-heading">{{ 'RequiredSessions'|get_lang }}</div>
+                    <div class="panel-body">
+                        <div class="row">
+                            {% for sequence in sequences %}
+                                <div class="col-md-4">
+                                    <dl class="dl-horizontal">
+                                        {% if sequence.requirements %}
+                                            <dt>{{ sequence.name }}</dt>
+
+                                            {% for requirement in sequence.requirements %}
+                                                <dd>
+                                                    <a href="{{ _p.web ~ 'session/' ~ requirement.getId ~ '/about/' }}">{{ requirement.getName }}</a>
+                                                </dd>
+                                            {% endfor %}
+                                        {% endif %}
+                                    </dl>
+                                </div>
+                            {% endfor %}
+                        </div>
+                    </div>
+                </div>
+            </div>
         </div>
     {% endif %}
 
@@ -26,15 +61,13 @@
             {% endif %}
         {% endfor %}
 
-        {% if courses|length > 1 %}
-            <div class="row">
+        <div class="row">
+            {% if courses|length > 1 %}
                 <div class="col-xs-12">
-                    <h2 class="text-uppercase">{{ course_data.course.getTitle }}</h2>
+                    <h3 class="text-uppercase">{{ course_data.course.getTitle }}</h3>
                 </div>
-            </div>
-        {% endif %}
+            {% endif %}
 
-        <div class="row">
             {% if course_video %}
                 <div class="col-sm-6 col-md-7">
                     <div class="embed-responsive embed-responsive-16by9">
@@ -47,14 +80,6 @@
                 <div class="description-course">
                     {{ course_data.description.getContent }}
                 </div>
-                {% if course_data.tags %}
-                    <div class="tags-course">
-                        <i class="fa fa-tags"></i>
-                        {% for tag in course_data.tags %}
-                            <a href="#">{{ tag.getTag }}</a>
-                        {% endfor %}
-                    </div>
-                {% endif %}
 
                 {% if courses|length == 1 and not is_subscribed %}
                     <div class="subscribe">
@@ -64,8 +89,6 @@
             </div>
         </div>
 
-
-
         <div class="row info-course">
             <div class="col-xs-12 col-md-7">
                 <div class="panel panel-default">
@@ -79,16 +102,15 @@
                                 <div class="content-info">
                                     {{ course_data.objectives.getContent }}
                                 </div>
-
                             </div>
                         {% endif %}
+
                         {% if course_data.topics %}
                             <div class="topics">
                                 <h4 class="title-info"><i class="fa fa-book"></i> {{ "Topics"|get_lang }}</h4>
                                 <div class="content-info">
                                     {{ course_data.topics.getContent }}
                                 </div>
-
                             </div>
                         {% endif %}
                     </div>
@@ -124,6 +146,22 @@
                         </div>
                     </div>
                 {% endif %}
+
+                {% if course_data.tags %}
+                    <div class="panel panel-default">
+                        <div class="panel-heading">{{ 'Tags'|get_lang }}</div>
+                        <div class="panel-body">
+                            <ul class="list-inline">
+                                {% for tag in course_data.tags %}
+                                    <li>
+                                        <span class="label label-info">{{ tag.getTag }}</span>
+                                    </li>
+                                {% endfor %}
+                            </ul>
+                        </div>
+                    </div>
+                {% endif %}
+
                 <div class="panel panel-default social-share">
                     <div class="panel-heading">{{ "ShareWithYourFriends"|get_lang }}</div>
                     <div class="panel-body">

+ 28 - 19
main/tracking/courseLog.php

@@ -335,7 +335,11 @@ echo Display::page_subheader2(get_lang('StudentList'));
 $is_western_name_order = api_is_western_name_order();
 
 if (count($a_students) > 0) {
-    $form = new FormValidator('reminder_form', 'get', api_get_path(REL_CODE_PATH).'announcements/announcements.php');
+    $form = new FormValidator(
+        'reminder_form',
+        'get',
+        api_get_path(REL_CODE_PATH).'announcements/announcements.php'
+    );
     $renderer = $form->defaultRenderer();
     $renderer->setElementTemplate(
         '<span>{label} {element}</span>&nbsp;<button class="save" type="submit">'.get_lang('SendNotification').'</button>',
@@ -390,9 +394,9 @@ if (count($a_students) > 0) {
         array('TrackingCourseLog', 'get_user_data'),
         (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
 
-    $parameters['cidReq'] 		= Security::remove_XSS($_GET['cidReq']);
-    $parameters['id_session'] 	= $session_id;
-    $parameters['from'] 		= isset($_GET['myspace']) ? Security::remove_XSS($_GET['myspace']) : null;
+    $parameters['cidReq'] = Security::remove_XSS($_GET['cidReq']);
+    $parameters['id_session'] = $session_id;
+    $parameters['from'] = isset($_GET['myspace']) ? Security::remove_XSS($_GET['myspace']) : null;
 
     $table->set_additional_parameters($parameters);
     $headers = array();
@@ -413,16 +417,21 @@ if (count($a_students) > 0) {
     $table->set_header(3, get_lang('Login'), false);
     $headers['login'] = get_lang('Login');
 
-    $table->set_header(4, get_lang('TrainingTime').'&nbsp;'.Display::return_icon('info3.gif', get_lang('TrainingTimeInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
+    $table->set_header(4, get_lang('TrainingTime').'&nbsp;'.
+        Display::return_icon('info3.gif', get_lang('TrainingTimeInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
     $headers['training_time'] = get_lang('TrainingTime');
-    $table->set_header(5, get_lang('CourseProgress').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
+    $table->set_header(5, get_lang('CourseProgress').'&nbsp;'.
+        Display::return_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
     $headers['course_progress'] = get_lang('CourseProgress');
 
-    $table->set_header(6, get_lang('ExerciseProgress').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ExerciseProgressInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
+    $table->set_header(6, get_lang('ExerciseProgress').'&nbsp;'.
+        Display::return_icon('info3.gif', get_lang('ExerciseProgressInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
     $headers['exercise_progress'] = get_lang('ExerciseProgress');
-    $table->set_header(7, get_lang('ExerciseAverage').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ExerciseAverageInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
+    $table->set_header(7, get_lang('ExerciseAverage').'&nbsp;'.
+        Display::return_icon('info3.gif', get_lang('ExerciseAverageInfo'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
     $headers['exercise_average'] = get_lang('ExerciseAverage');
-    $table->set_header(8, get_lang('Score').'&nbsp;'.Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
+    $table->set_header(8, get_lang('Score').'&nbsp;'.
+        Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')), false, array('style' => 'width:110px;'));
     $headers['score'] = get_lang('Score');
     $table->set_header(9, get_lang('Student_publication'), false);
     $headers['student_publication'] = get_lang('Student_publication');
@@ -432,10 +441,10 @@ if (count($a_students) > 0) {
     if (empty($session_id)) {
         $table->set_header(11, get_lang('Survey'), false);
         $headers['survey'] = get_lang('Survey');
-        $table->set_header(12, get_lang('FirstLogin'), false);
-        $headers['first_login'] = get_lang('FirstLogin');
-        $table->set_header(13, get_lang('LatestLogin'), false);
-        $headers['latest_login'] = get_lang('LatestLogin');
+        $table->set_header(12, get_lang('FirstLoginInCourse'), false);
+        $headers['first_login'] = get_lang('FirstLoginInCourse');
+        $table->set_header(13, get_lang('LatestLoginInCourse'), false);
+        $headers['latest_login'] = get_lang('LatestLoginInCourse');
         if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) {
             $table->set_header(14, $extra_info['display_text'], false);
             $headers['display_text'] = $extra_info['display_text'];
@@ -446,10 +455,10 @@ if (count($a_students) > 0) {
             $headers['details'] = get_lang('Details');
         }
     } else {
-        $table->set_header(11, get_lang('FirstLogin'), false);
-        $headers['first_login'] = get_lang('FirstLogin');
-        $table->set_header(12, get_lang('LatestLogin'), false);
-        $headers['latest_login'] = get_lang('LatestLogin');
+        $table->set_header(11, get_lang('FirstLoginInCourse'), false);
+        $headers['first_login'] = get_lang('FirstLoginInCourse');
+        $table->set_header(12, get_lang('LatestLoginInCourse'), false);
+        $headers['latest_login'] = get_lang('LatestLoginInCourse');
 
         if (isset($_GET['additional_profile_field']) and is_numeric($_GET['additional_profile_field'])) {
             $table->set_header(13, $extra_info['display_text'], false);
@@ -508,8 +517,8 @@ if ($export_csv) {
         $csv_headers[] = get_lang('Survey');
     }
 
-    $csv_headers[] = get_lang('FirstLogin', '');
-    $csv_headers[] = get_lang('LatestLogin', '');
+    $csv_headers[] = get_lang('FirstLoginInCourse', '');
+    $csv_headers[] = get_lang('LatestLoginInCourse', '');
 
     if (isset($_GET['additional_profile_field']) AND is_numeric($_GET['additional_profile_field'])) {
         $csv_headers[] = $extra_info['display_text'];

+ 1 - 0
src/Chamilo/CoreBundle/Migrations/Schema/V110/Version110.php

@@ -446,6 +446,7 @@ class Version110 extends AbstractMigrationChamilo
         $this->addSql("DELETE FROM settings_current WHERE variable = 'advanced_filemanager'");
         $this->addSql("DELETE FROM settings_options WHERE variable = 'advanced_filemanager'");
 
+        $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('institution_address', NULL, 'textfield', 'Platform', '', 'InstitutionAddressTitle', 'InstitutionAddressComment', NULL, NULL, 1)");
         $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('prevent_session_admins_to_manage_all_users', NULL, 'radio', 'Session', 'false', 'PreventSessionAdminsToManageAllUsersTitle', 'PreventSessionAdminsToManageAllUsersComment', NULL, NULL, 1)");
         $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('prevent_session_admins_to_manage_all_users', 'true', 'Yes'), ('prevent_session_admins_to_manage_all_users', 'false', 'No')");
         $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('show_glossary_in_extra_tools', 'none', 'None')");

Some files were not shown because too many files changed in this diff