Minor - format code

pull/2487/head
jmontoyaa 9 years ago
parent 7681724d61
commit 5bfcbfcce0
  1. 21
      main/announcements/announcements.php
  2. 3
      main/calendar/agenda.php
  3. 1
      main/course_info/download.php
  4. 2
      main/cron/user_import/client.php
  5. 15
      main/document/create_document.php
  6. 5
      main/document/downloadfolder.inc.php
  7. 38
      main/inc/lib/AnnouncementManager.php

@ -86,7 +86,6 @@ $searchFormToString = '';
switch ($action) { switch ($action) {
case 'move': case 'move':
/* Move announcement up/down */ /* Move announcement up/down */
if (!empty($_GET['down'])) { if (!empty($_GET['down'])) {
$thisAnnouncementId = intval($_GET['down']); $thisAnnouncementId = intval($_GET['down']);
$sortDirection = "DESC"; $sortDirection = "DESC";
@ -105,15 +104,15 @@ switch ($action) {
$announcementInfo = AnnouncementManager::get_by_id($course_id, $thisAnnouncementId); $announcementInfo = AnnouncementManager::get_by_id($course_id, $thisAnnouncementId);
$sql = "SELECT DISTINCT announcement.id, announcement.display_order $sql = "SELECT DISTINCT announcement.id, announcement.display_order
FROM $tbl_announcement announcement, FROM $tbl_announcement announcement,
$tbl_item_property itemproperty $tbl_item_property itemproperty
WHERE WHERE
announcement.c_id = $course_id AND announcement.c_id = $course_id AND
itemproperty.c_id = $course_id AND itemproperty.c_id = $course_id AND
itemproperty.ref = announcement.id AND itemproperty.ref = announcement.id AND
itemproperty.tool = '".TOOL_ANNOUNCEMENT."' AND itemproperty.tool = '".TOOL_ANNOUNCEMENT."' AND
itemproperty.visibility <> 2 itemproperty.visibility <> 2
ORDER BY display_order $sortDirection"; ORDER BY display_order $sortDirection";
$result = Database::query($sql); $result = Database::query($sql);
$thisAnnouncementOrderFound = false; $thisAnnouncementOrderFound = false;
$thisAnnouncementOrder = null; $thisAnnouncementOrder = null;
@ -549,6 +548,7 @@ switch ($action) {
$sendToUsersInSession $sendToUsersInSession
); );
} }
Display::addFlash( Display::addFlash(
Display::return_message( Display::return_message(
get_lang('AnnouncementAdded'), get_lang('AnnouncementAdded'),
@ -565,7 +565,6 @@ switch ($action) {
} }
header('Location: '.$homeUrl); header('Location: '.$homeUrl);
exit; exit;
} // end condition token } // end condition token
} }
} }

@ -219,6 +219,7 @@ if (api_is_allowed_to_edit(false, true) ||
exit; exit;
} }
$usersToSend = isset($values['users_to_send']) ? $values['users_to_send'] : '';
// Editing normal event. // Editing normal event.
$agenda->editEvent( $agenda->editEvent(
$eventId, $eventId,
@ -227,7 +228,7 @@ if (api_is_allowed_to_edit(false, true) ||
$allDay, $allDay,
$values['title'], $values['title'],
$values['content'], $values['content'],
$values['users_to_send'], $usersToSend,
$attachmentList, $attachmentList,
$attachmentCommentList, $attachmentCommentList,
$comment, $comment,

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver; use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
/** /**

@ -27,7 +27,7 @@ $response = $client->call(
'import_users', 'import_users',
array( array(
'filepath' => api_get_path(SYS_UPLOAD_PATH)."users_import.csv", 'filepath' => api_get_path(SYS_UPLOAD_PATH)."users_import.csv",
'security_key' => $_configuration['security_key'], 'security_key' => api_get_configuration_value('security_key'),
) )
); );
echo $response; echo $response;

@ -502,21 +502,6 @@ if ($form->validate()) {
fclose($fp); fclose($fp);
chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files()); chmod($filepath.$filename.'.'.$extension, api_get_permissions_for_new_files());
/*
if (!is_dir($filepath.'css')) {
mkdir($filepath.'css', api_get_permissions_for_new_directories());
$doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css');
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', $userId, null, null, null, null, $current_session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, null, null, null, null, $current_session_id);
}
if (!is_file($filepath.'css/frames.css')) {
// Make a copy of the current css for the new document
copy(api_get_path(SYS_CODE_PATH).'css/'.api_get_setting('stylesheets').'/frames.css', $filepath.'css/frames.css');
$doc_id = add_document($_course, $dir.'css/frames.css', 'file', filesize($filepath.'css/frames.css'), 'frames.css');
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $userId, null, null, null, null, $current_session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, null, null, null, null, $current_session_id);
}*/
$file_size = filesize($filepath.$filename.'.'.$extension); $file_size = filesize($filepath.$filename.'.'.$extension);
$save_file_path = $dir.$filename.'.'.$extension; $save_file_path = $dir.$filename.'.'.$extension;

@ -1,13 +1,14 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/** /**
* Functions and main code for the download folder feature * Functions and main code for the download folder feature
* *
* @package chamilo.document * @package chamilo.document
*/ */
use ChamiloSession as Session;
set_time_limit(0); set_time_limit(0);
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';

@ -153,11 +153,17 @@ class AnnouncementManager
/** /**
* Deletes an announcement * Deletes an announcement
* @param array $_course the course array * @param array $_course the course array
* @param int $id the announcement id * @param int $id the announcement id
*/ */
public static function delete_announcement($_course, $id) public static function delete_announcement($_course, $id)
{ {
api_item_property_update($_course, TOOL_ANNOUNCEMENT, $id, 'delete', api_get_user_id()); api_item_property_update(
$_course,
TOOL_ANNOUNCEMENT,
$id,
'delete',
api_get_user_id()
);
} }
/** /**
@ -387,13 +393,13 @@ class AnnouncementManager
/** /**
* Store an announcement in the database (including its attached file if any) * Store an announcement in the database (including its attached file if any)
* @param string Announcement title (pure text) * @param string $emailTitle Announcement title (pure text)
* @param string Content of the announcement (can be HTML) * @param string $newContent Content of the announcement (can be HTML)
* @param int Display order in the list of announcements * @param array $sentTo Array of users and groups to send the announcement to
* @param array Array of users and groups to send the announcement to * @param array $file uploaded file $_FILES
* @param array uploaded file $_FILES * @param string $file_comment Comment describing the attachment
* @param string Comment describing the attachment * @param string $end_date
* @param bool $sendToUsersInSession * @param bool $sendToUsersInSession
* @return int false on failure, ID of the announcement on success * @return int false on failure, ID of the announcement on success
*/ */
public static function add_announcement( public static function add_announcement(
@ -1206,8 +1212,11 @@ class AnnouncementManager
* @param bool $sendToUsersInSession * @param bool $sendToUsersInSession
* @param bool $sendToDrhUsers * @param bool $sendToDrhUsers
*/ */
public static function send_email($id, $sendToUsersInSession = false, $sendToDrhUsers = false) public static function send_email(
{ $id,
$sendToUsersInSession = false,
$sendToDrhUsers = false
) {
$email = AnnouncementEmail::create(null, $id); $email = AnnouncementEmail::create(null, $id);
$email->send($sendToUsersInSession, $sendToDrhUsers); $email->send($sendToUsersInSession, $sendToDrhUsers);
} }
@ -1278,7 +1287,7 @@ class AnnouncementManager
//if (!empty($user_id)) { //if (!empty($user_id)) {
if (0) { if (0) {
if (is_array($group_memberships) && count($group_memberships) > 0 ) { if (is_array($group_memberships) && count($group_memberships) > 0) {
$sql = "SELECT $select $sql = "SELECT $select
FROM $tbl_announcement announcement, $tbl_item_property ip FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE WHERE
@ -1325,7 +1334,6 @@ class AnnouncementManager
ORDER BY display_order DESC"; ORDER BY display_order DESC";
//GROUP BY ip.ref //GROUP BY ip.ref
} else { } else {
// A.3 you are a course admin without any group or user filter // A.3 you are a course admin without any group or user filter
// A.3.a you are a course admin without user or group filter but WITH studentview // A.3.a you are a course admin without user or group filter but WITH studentview
// => see all the messages of all the users and groups without editing possibilities // => see all the messages of all the users and groups without editing possibilities
@ -1402,7 +1410,6 @@ class AnnouncementManager
AND ip.visibility='1' AND ip.visibility='1'
ORDER BY display_order DESC"; ORDER BY display_order DESC";
} else { } else {
if ($user_id) { if ($user_id) {
if ($allowUserEditSetting && !api_is_anonymous()) { if ($allowUserEditSetting && !api_is_anonymous()) {
$cond_user_id = " AND ( $cond_user_id = " AND (
@ -1426,7 +1433,6 @@ class AnnouncementManager
AND ip.visibility='1' AND ip.visibility='1'
AND announcement.session_id IN(0, ".$session_id.") AND announcement.session_id IN(0, ".$session_id.")
ORDER BY display_order DESC"; ORDER BY display_order DESC";
} else { } else {
if (($allowUserEditSetting && !api_is_anonymous())) { if (($allowUserEditSetting && !api_is_anonymous())) {
$cond_user_id = " AND ( $cond_user_id = " AND (
@ -1691,7 +1697,7 @@ class AnnouncementManager
} }
// the user is not identiefied => show only the general announcements // the user is not identiefied => show only the general announcements
$sql="SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id
FROM $tbl_announcement announcement, $tbl_item_property ip FROM $tbl_announcement announcement, $tbl_item_property ip
WHERE WHERE
announcement.c_id = $course_id AND announcement.c_id = $course_id AND

Loading…
Cancel
Save