From 896add496425e1f07f563b72d5ffecd377f04bba Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 29 Apr 2014 11:55:57 +0200 Subject: [PATCH] Minor - format code. --- index.php | 2 +- .../announcement_email.class.php | 22 +++++++++---- main/announcements/announcements.inc.php | 28 ++++++++-------- tests/main/inc/lib/message.lib.test.php | 33 ------------------- .../Doctrine/Common/Cache/MemcachedCache.php | 3 +- 5 files changed, 32 insertions(+), 56 deletions(-) diff --git a/index.php b/index.php index 3c6601230b..b3340499f4 100644 --- a/index.php +++ b/index.php @@ -143,7 +143,7 @@ $controller->set_login_form(); //@todo move this inside the IndexManager if (!api_is_anonymous()) { $controller->tpl->assign('profile_block', $controller->return_profile_block()); - $controller->tpl->assign('user_image_block', $controller->return_user_image_block()); + $controller->tpl->assign('user_image_block', $controller->return_user_image_block()); if (api_is_platform_admin()) { $controller->tpl->assign('course_block', $controller->return_course_block()); diff --git a/main/announcements/announcement_email.class.php b/main/announcements/announcement_email.class.php index 20a91a61f6..77284a4999 100644 --- a/main/announcements/announcement_email.class.php +++ b/main/announcements/announcement_email.class.php @@ -49,6 +49,7 @@ class AnnouncementEmail * Course info * * @param string $key + * * @return array */ public function course($key = '') @@ -176,6 +177,7 @@ class AnnouncementEmail //Clean users just in case $new_list_users = array(); + if (!empty($users)) { foreach ($users as $user) { $new_list_users[$user['user_id']] = array('user_id' => $user['user_id']); @@ -188,9 +190,11 @@ class AnnouncementEmail * Sender info * * @param string $key + * * @return array */ - public function sender($key = '') { + public function sender($key = '') + { global $_user; return $key ? $_user[$key] : $_user; } @@ -204,19 +208,19 @@ class AnnouncementEmail { $result = $this->course('title').' - '.$this->announcement('title'); $result = stripslashes($result); + return $result; } /** * Email message * @param int $receiverUserId + * * @return string */ public function message($receiverUserId) { - $title = $this->announcement('title'); - $title = stripslashes($title); - + //$title = $this->announcement('title'); $content = $this->announcement('content'); $content = stripslashes($content); $content = AnnouncementManager::parse_content($receiverUserId, $content, $this->course('code')); @@ -231,13 +235,17 @@ class AnnouncementEmail $attachment = $this->attachement(); if (!empty($attachment)) { $result .= '
'; - $result .= Display::url($attachment['filename'], api_get_path(WEB_CODE_PATH).'announcements/download.php?file='.basename($attachment['path']).'&'.$course_param).'
'; + $result .= Display::url( + $attachment['filename'], + api_get_path(WEB_CODE_PATH).'announcements/download.php?file='.basename($attachment['path']).'&'.$course_param + ).'
'; } $result .= '
'; $sender_name = api_get_person_name($this->sender('firstName'), $this->sender('lastName'), PERSON_NAME_EMAIL_ADDRESS); $result .= ''.$sender_name.'
'; $result .= ''.$course_name.'
'; + return $result; } @@ -262,6 +270,7 @@ class AnnouncementEmail } $result = $result ? reset($result) : array(); + return $result; } @@ -297,7 +306,8 @@ class AnnouncementEmail $course_id = $this->course('id'); $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); - $sql = "UPDATE $tbl_announcement SET email_sent=1 WHERE c_id = $course_id AND id=$id AND session_id = {$this->session_id} "; + $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); } } diff --git a/main/announcements/announcements.inc.php b/main/announcements/announcements.inc.php index f25257989f..88d572bf19 100644 --- a/main/announcements/announcements.inc.php +++ b/main/announcements/announcements.inc.php @@ -1,13 +1,14 @@ 0) { $list = array(); while ($row = Database::fetch_array($rs)) { @@ -119,13 +122,14 @@ class AnnouncementManager } else { api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, 'visible', api_get_user_id()); } + return true; } /** * Deletes an announcement - * @param array the course array - * @param int the announcement id + * @param array $_course the course array + * @param int $id the announcement id */ public static function delete_announcement($_course, $id) { @@ -134,7 +138,7 @@ class AnnouncementManager /** * Deletes all announcements by course - * @param array the course array + * @param array $_course the course array */ public static function delete_all_announcements($_course) { @@ -746,10 +750,6 @@ class AnnouncementManager echo ""; } - /* - DATA FUNCTIONS - */ - /** * Returns announcement info from its id * @@ -782,7 +782,7 @@ class AnnouncementManager /** * this function gets all the users of the course, * including users from linked courses - * @todo deprecate this function, use CourseManager class + * @deprecate use CourseManager class */ public static function get_course_users() { diff --git a/tests/main/inc/lib/message.lib.test.php b/tests/main/inc/lib/message.lib.test.php index bb48452962..2a817f6173 100755 --- a/tests/main/inc/lib/message.lib.test.php +++ b/tests/main/inc/lib/message.lib.test.php @@ -7,39 +7,6 @@ class TestMessage extends UnitTestCase { $this->UnitTestCase('Messages library - main/inc/lib/message.lib.test.php'); } - function testGetNumberOfMessagesMask() { - $res=get_number_of_messages_mask(); - $this->assertTrue(is_string($res)); - //var_dump($res); - } - - function testGetMessageDataMask() { - $from=''; - $number_of_items=get_number_of_messages_mask(); - $column='3'; - $direction=''; - $res=get_message_data_mask($from, $number_of_items, $column, $direction); - $this->assertTrue(is_array($res)); - //var_dump($res); - } - - function testGetMessageDataSendMask() { - $from=''; - $number_of_items=get_number_of_messages_send_mask(); - $column= '3'; - $direction=''; - $res=get_message_data_send_mask($from, $number_of_items, $column, $direction); - $this->assertTrue(is_array($res)); - //var_dump($res); - } - - function testGetNumberOfMessagesSendMask() { - $res=get_number_of_messages_send_mask(); - $this->assertTrue(is_string($res)); - //var_dump($res); - - } - function testInboxDisplay() { global $charset; ob_start(); diff --git a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php index f7e5500a1c..eb4defe086 100644 --- a/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php +++ b/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php @@ -24,8 +24,7 @@ use \Memcached; /** * Memcached cache provider. * - * @link www.doctrine-project.org - * @since 2.2 + * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan Wage