ソースを参照

Merge with 1.9.x

Julio Montoya 12 年 前
コミット
83e95a5203

+ 37 - 51
main/announcements/announcement_email.class.php

@@ -17,8 +17,7 @@ class AnnouncementEmail
      *
      * @return AnnouncementEmail
      */
-    public static function create($course, $announcement)
-    {
+    public static function create($course, $announcement) {
         return new self($course, $announcement);
     }
 
@@ -26,8 +25,7 @@ class AnnouncementEmail
     protected $announcement = null;
     public $session_id = null;
 
-    function __construct($course, $announcement)
-    {
+    function __construct($course, $announcement) {
         if (empty($course)) {
             $course = api_get_course_int_id();
             $course = CourseManager::get_course_information_by_id($course);
@@ -36,9 +34,9 @@ class AnnouncementEmail
         }
         $this->course = $course;
         $this->session_id = api_get_session_id();
-        
-        if (is_numeric($announcement)) {            
-            $announcement = AnnouncementManager::get_by_id($course['real_id'], $announcement);            
+
+        if (is_numeric($announcement)) {
+            $announcement = AnnouncementManager::get_by_id($course['real_id'], $announcement);
         }
         $this->announcement = $announcement;
     }
@@ -49,8 +47,7 @@ class AnnouncementEmail
      * @param string $key
      * @return array
      */
-    public function course($key = '')
-    {
+    public function course($key = '') {
         $result = $key ? $this->course[$key] : $this->course;
         $result = $key == 'id' ? intval($result) : $result;
         return $result;
@@ -62,8 +59,7 @@ class AnnouncementEmail
      * @param string $key
      * @return array
      */
-    public function announcement($key = '')
-    {
+    public function announcement($key = '') {
         $result = $key ? $this->announcement[$key] : $this->announcement;
         $result = $key == 'id' ? intval($result) : $result;
         return $result;
@@ -75,8 +71,7 @@ class AnnouncementEmail
      *
      * @return array
      */
-    public function all_users()
-    {        
+    public function all_users() {
         $course_code = $this->course('code');
         if (empty($this->session_id)) {
             $group_id = api_get_group_id();
@@ -91,7 +86,7 @@ class AnnouncementEmail
                 $user_list = $new_user_list;
             }
         } else {
-            $user_list = CourseManager::get_user_list_from_course_code($course_code, $this->session_id);            
+            $user_list = CourseManager::get_user_list_from_course_code($course_code, $this->session_id);
         }
         return $user_list;
     }
@@ -101,8 +96,7 @@ class AnnouncementEmail
      *
      * @return array Array of users and groups to whom the element has been sent
      */
-    public function sent_to_info()
-    {
+    public function sent_to_info() {
         $result = array();
         $result['groups'] = array();
         $result['users'] = array();
@@ -139,30 +133,29 @@ class AnnouncementEmail
      *
      * @return array
      */
-    public function sent_to()
-    {
+    public function sent_to() {
         $sent_to = $this->sent_to_info();
         $users = $sent_to['users'];
         $users = $users ? $users : array();
         $groups = $sent_to['groups'];
-        
+
         if ($users) {
             $users = UserManager::get_user_list_by_ids($users, true);
-        }       
+        }
 
         if (!empty($groups)) {
             $group_users = GroupManager::get_groups_users($groups);
             $group_users = UserManager::get_user_list_by_ids($group_users, true);
-            
+
             if (!empty($group_users)) {
-                $users = array_merge($users, $group_users);            
+                $users = array_merge($users, $group_users);
             }
-        }        
-              
+        }
+
         if (empty($users)) {
             $users = self::all_users();
         }
-        
+
         //Clean users just in case
         $new_list_users = array();
         if (!empty($users)) {
@@ -179,8 +172,7 @@ class AnnouncementEmail
      * @param string $key
      * @return array
      */
-    public function sender($key = '')
-    {
+    public function sender($key = '') {
         global $_user;
         return $key ? $_user[$key] : $_user;
     }
@@ -190,9 +182,8 @@ class AnnouncementEmail
      *
      * @return string
      */
-    public function subject()
-    {
-        $result = $this->course('title') . ' - ' . $this->announcement('title');
+    public function subject() {
+        $result = $this->course('title').' - '.$this->announcement('title');
         $result = stripslashes($result);
         return $result;
     }
@@ -202,8 +193,7 @@ class AnnouncementEmail
      *
      * @return string
      */
-    public function message()
-    {
+    public function message() {
         $title = $this->announcement('title');
         $title = stripslashes($title);
 
@@ -211,19 +201,19 @@ class AnnouncementEmail
         $content = stripslashes($content);
         $content = AnnouncementManager::parse_content($content, $this->course('code'));
 
-        $user_email   = $this->sender('mail');
+        $user_email = $this->sender('mail');
         $course_param = api_get_cidreq();
-        $course_name  = $this->course('title');
-        
+        $course_name = $this->course('title');
+
         $result = "<div>$content</div>";
-        
+
         //Adding attachment
-        $attachment = $this->attachement();        
+        $attachment = $this->attachement();
         if (!empty($attachment)) {
-            $result .= '<br />';            
-            $result .= Display::url($attachment['filename'], api_get_path(WEB_CODE_PATH).'announcements/download.php?file='.basename($attachment['path']).'&'.$course_param).'<br />';            
+            $result .= '<br />';
+            $result .= Display::url($attachment['filename'], api_get_path(WEB_CODE_PATH).'announcements/download.php?file='.basename($attachment['path']).'&'.$course_param).'<br />';
         }
-        
+
         $result .= '<hr />';
         $sender_name = api_get_person_name($this->sender('firstName'), $this->sender('lastName'), PERSON_NAME_EMAIL_ADDRESS);
         $result .= '<a href="mailto:'.$user_email.'">'.$sender_name.'</a><br/>';
@@ -236,8 +226,7 @@ class AnnouncementEmail
      *
      * @return array
      */
-    public function attachement()
-    {
+    public function attachement() {
         $result = array();
         $tbl_announcement_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
         $id = $this->announcement('id');
@@ -246,7 +235,7 @@ class AnnouncementEmail
         $rs = Database::query($sql);
         $course_path = $this->course('directory');
         while ($row = Database::fetch_array($rs)) {
-            $path = api_get_path(SYS_COURSE_PATH) . $course_path . '/upload/announcements/' . $row['path'];
+            $path = api_get_path(SYS_COURSE_PATH).$course_path.'/upload/announcements/'.$row['path'];
             $filename = $row['filename'];
             $result[] = array('path' => $path, 'filename' => $filename);
         }
@@ -258,15 +247,14 @@ class AnnouncementEmail
     /**
      * Send emails to users.
      */
-    public function send()
-    {
-        $sender  = $this->sender();                
+    public function send() {
+        $sender = $this->sender();
         $subject = $this->subject();
         $message = $this->message();
-    
+
         // Send email one by one to avoid antispam
         $users = $this->sent_to();
-        
+
         foreach ($users as $user) {
             MessageManager::send_message_simple($user['user_id'], $subject, $message, $sender['user_id']);
         }
@@ -276,8 +264,7 @@ class AnnouncementEmail
     /**
      * Store that emails where sent
      */
-    public function log_mail_sent()
-    {
+    public function log_mail_sent() {
         $id = $this->announcement('id');
         $course_id = $this->course('id');
 
@@ -285,5 +272,4 @@ class AnnouncementEmail
         $sql = "UPDATE $tbl_announcement SET email_sent=1 WHERE c_id = $course_id AND id=$id AND session_id = {$this->session_id} ";
         Database::query($sql);
     }
-
 }

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

@@ -2897,8 +2897,9 @@ class CourseManager {
 
                     $html .= '</div>';
                     $notifications = isset($params['notifications']) ? $params['notifications'] : null;
+                    $param_class = isset($params['class']) ? $params['class'] : null;
 
-                    $html .= '<div class="span6 '.$params['class'].'">';
+                    $html .= '<div class="span6 '.$param_class.'">';
                         $html .='<h3>'.$params['title'].$notifications.'</h3> ';
 
                         if (!empty($params['subtitle'])) {

+ 5 - 9
main/inc/lib/mail.lib.inc.php

@@ -1,7 +1,7 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
- * 
+ *
  * @package chamilo.library
  */
 /**
@@ -56,15 +56,13 @@ function api_mail($recipient_name, $recipient_email, $subject, $message, $sender
  * @see             class.phpmailer.php
  */
 function api_mail_html($recipient_name, $recipient_email, $subject, $message, $sender_name = '', $sender_email = '', $extra_headers = null, $data_file = array(), $embedded_image = false) {
-
-    //global $regexp_rfc3696; // Deprecated, 13-OCT-2010.
     global $platform_email;
 
     $mail = new PHPMailer();
     $mail->Mailer  = $platform_email['SMTP_MAILER'];
     $mail->Host    = $platform_email['SMTP_HOST'];
     $mail->Port    = $platform_email['SMTP_PORT'];
-    $mail->CharSet = $platform_email['SMTP_CHARSET'];    
+    $mail->CharSet = $platform_email['SMTP_CHARSET'];
     $mail->WordWrap = 200; // Stay far below SMTP protocol 980 chars limit.
 
     if ($platform_email['SMTP_AUTH']) {
@@ -75,7 +73,7 @@ function api_mail_html($recipient_name, $recipient_email, $subject, $message, $s
 
     $mail->Priority = 3; // 5 = low, 1 = high
     $mail->AddCustomHeader('Errors-To: '.$platform_email['SMTP_FROM_EMAIL']);
-        
+
     $mail->SMTPKeepAlive = true;
 
     if (($sender_email != '') && ($sender_name != '')) {
@@ -124,7 +122,7 @@ function api_mail_html($recipient_name, $recipient_email, $subject, $message, $s
                 $i++;
 			}
 		}
-		
+
 	    // Replace origin image for new embedded image html.
 	    $x = 0;
 	    if (!empty($m[0])) {
@@ -145,14 +143,12 @@ function api_mail_html($recipient_name, $recipient_email, $subject, $message, $s
     // Only valid addresses are accepted.
     if (is_array($recipient_email)) {
         foreach ($recipient_email as $dest) {
-            //if (eregi($regexp_rfc3696, $dest)) { // Deprecated, 13-OCT-2010.
             if (api_valid_email($dest)) {
                 $mail->AddAddress($dest, $recipient_name);
                 //$mail->AddAddress($dest, ($i > 1 ? '' : $recipient_name));
             }
         }
     } else {
-        //if (eregi($regexp_rfc3696, $recipient_email)) { // Deprecated, 13-OCT-2010.
         if (api_valid_email($recipient_email)) {
             $mail->AddAddress($recipient_email, $recipient_name);
         } else {
@@ -204,4 +200,4 @@ function api_mail_html($recipient_name, $recipient_email, $subject, $message, $s
     // Clear all the addresses.
     $mail->ClearAddresses();
     return 1;
-}
+}

+ 1 - 5
main/inc/lib/tracking.lib.php

@@ -2621,10 +2621,6 @@ class Tracking {
                         $exercise_obj->read($exercices['id']);
                         $visible_return = $exercise_obj->is_visible();
                         
-                        //user can see the exercise results even if the exercise was set to invisible?
-                        /*if ($visible_return['value'] == false) {
-                            continue;
-                        }*/
                         						
 						$score = $weighting = $attempts = 0;
                         
@@ -2709,7 +2705,7 @@ class Tracking {
 				
 				
 				//LP table results				
-				$html .='<table class="data_table" width="100%">';
+                $html .='<table class="data_table">';
 				$html .= Display::tag('th', get_lang('Learnpaths'),         array('class'=>'head', 'style'=>'color:#000'));
 				$html .= Display::tag('th', get_lang('LatencyTimeSpent'),   array('class'=>'head', 'style'=>'color:#000'));
 				$html .= Display::tag('th', get_lang('Progress'),           array('class'=>'head', 'style'=>'color:#000'));