Format code,

pull/2487/head
jmontoyaa 10 years ago
parent 0b9029ef04
commit 3098cd410d
  1. 10
      main/blog/blog.php
  2. 26
      main/course_progress/index.php
  3. 4
      main/inc/lib/api.lib.php
  4. 11
      main/inc/lib/blog.lib.php
  5. 64
      main/inc/lib/statistics.lib.php
  6. 2
      src/Chamilo/CoreBundle/Entity/CourseRequest.php

@ -35,7 +35,7 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
*/
$safe_post_file_comment = isset($_POST['post_file_comment']) ? Security::remove_XSS($_POST['post_file_comment']) : null;
$safe_comment_text = isset($_POST['comment_text']) ? Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['comment_text'])), COURSEMANAGERLOWSECURITY) : null;
$safe_comment_text = isset($_POST['comment_text']) ? Security::remove_XSS($_POST['comment_text']) : null;
$safe_comment_title = isset($_POST['comment_title']) ? Security::remove_XSS($_POST['comment_title']) : null;
$safe_task_name = isset($_POST['task_name']) ? Security::remove_XSS($_POST['task_name']) : null;
$safe_task_description = isset($_POST['task_description']) ? Security::remove_XSS($_POST['task_description']) : null;
@ -311,7 +311,7 @@ Display::display_introduction_section(TOOL_BLOGS);
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><?php echo get_lang('Calendar') ?></div>
<div class="panel-body">
@ -322,7 +322,7 @@ Display::display_introduction_section(TOOL_BLOGS);
?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo get_lang('Search') ?></div>
<div class="panel-body">
@ -336,14 +336,14 @@ Display::display_introduction_section(TOOL_BLOGS);
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><?php echo get_lang('MyTasks') ?></div>
<div class="panel-body">
<?php Blog::get_personal_task_list(); ?>
</div>
</div>
</div>
<div class="col-md-9">
<?php

@ -17,14 +17,11 @@ require_once 'thematic_controller.php';
// current section
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_COURSE_PROGRESS;
$current_course_tool = TOOL_COURSE_PROGRESS;
// protect a course script
api_protect_course_script(true);
// defining constants
define('ADD_THEMATIC_PLAN', 6);
// get actions
$actions = array(
'thematic_details',
@ -92,7 +89,7 @@ $default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
// Only when I see the 3 columns. Avoids double or triple click binding for onclick event
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(".thematic_advance_actions, .thematic_tools ").hide();
$(".thematic_content").mouseover(function() {
@ -117,7 +114,7 @@ $(document).ready(function() {
});
</script>';
$htmlHeadXtra[] = '<script type="text/javascript">
$htmlHeadXtra[] = '<script>
function datetime_by_attendance(attendance_id, thematic_advance_id) {
$.ajax({
@ -190,18 +187,27 @@ if ($action == 'thematic_list') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
}
if ($action == 'thematic_add') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));
$interbreadcrumb[] = array(
'url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl,
'name' => get_lang('ThematicControl')
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewThematicSection'));
}
if ($action == 'thematic_edit') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array(
'url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl,
'name' => get_lang('ThematicControl')
);
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));
}
if ($action == 'thematic_details') {
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
}
if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl'));
$interbreadcrumb[] = array(
'url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl,
'name' => get_lang('ThematicControl')
);
if (!empty($thematic_data)) {
$interbreadcrumb[] = array(
'url' => '#',

@ -424,7 +424,6 @@ define('GROUP_IMAGE_SIZE_ORIGINAL', 1);
define('GROUP_IMAGE_SIZE_BIG', 2);
define('GROUP_IMAGE_SIZE_MEDIUM', 3);
define('GROUP_IMAGE_SIZE_SMALL', 4);
define('GROUP_TITLE_LENGTH', 50);
// Exercise
@ -603,6 +602,7 @@ define('RESOURCE_WORK', 'work');
define('RESOURCE_SESSION_COURSE', 'session_course');
define('RESOURCE_GRADEBOOK', 'gradebook');
define('ADD_THEMATIC_PLAN', 6);
// Make sure the CHAMILO_LOAD_WYSIWYG constant is defined
// To remove CKeditor libs from HTML, set this constant to true before loading
@ -7860,7 +7860,7 @@ function api_mail_html(
// Attachment ...
if (!empty($data_file)) {
$o = 0;
foreach ($data_file as $file_attach) {
foreach ($data_file as $file_attach) {
if (!empty($file_attach['path']) && !empty($file_attach['filename'])) {
$mail->AddAttachment($file_attach['path'], $file_attach['filename']);
}

@ -412,8 +412,15 @@ class Blog
* @param Integer $post_id
* @param Integer $parent_id
*/
public static function create_comment($title, $full_text, $file_comment, $blog_id, $post_id, $parent_id, $task_id = 'NULL')
{
public static function create_comment(
$title,
$full_text,
$file_comment,
$blog_id,
$post_id,
$parent_id,
$task_id = 'NULL'
) {
$_user = api_get_user_info();
$_course = api_get_course_info();
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);

@ -116,7 +116,7 @@ class Statistics
u.user_id = url.user_id AND
access_url_id = '".$current_url_id."'
$status_filter $active_filter";
if (isset ($categoryCode)) {
if (isset($categoryCode)) {
$sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number
FROM $course_user_table cu, $course_table c, $access_url_rel_user_table as url
WHERE
@ -130,7 +130,7 @@ class Statistics
$sql = "SELECT COUNT(DISTINCT(user_id)) AS number
FROM $user_table
WHERE 1=1 $status_filter $active_filter";
if (isset ($categoryCode)) {
if (isset($categoryCode)) {
$status_filter = isset($status)?' AND status = '.intval($status):'';
$sql = "SELECT COUNT(DISTINCT(cu.user_id)) AS number
FROM $course_user_table cu, $course_table c
@ -198,7 +198,11 @@ class Statistics
if (isset($_GET['keyword'])) {
$keyword = Database::escape_string(trim($_GET['keyword']));
$sql .= " AND (user.username LIKE '%".$keyword."%' OR default_event_type LIKE '%".$keyword."%' OR default_value_type LIKE '%".$keyword."%' OR default_value LIKE '%".$keyword."%') ";
$sql .= " AND (
user.username LIKE '%".$keyword."%' OR
default_event_type LIKE '%".$keyword."%' OR
default_value_type LIKE '%".$keyword."%' OR
default_value LIKE '%".$keyword."%') ";
}
$res = Database::query($sql);
@ -453,14 +457,26 @@ class Statistics
switch ($type) {
case 'hour':
$period = get_lang('PeriodHour');
$sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date ";
$sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date ";
$sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins
FROM $table.$table_url $where_url
GROUP BY stat_date
ORDER BY stat_date ";
$sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins
FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')."
GROUP BY stat_date
ORDER BY stat_date ";
break;
case 'day':
$periodCollection = api_get_week_days_long();
$period = get_lang('PeriodDay');
$sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
$sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
$sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins
FROM ".$table.$table_url.$where_url."
GROUP BY stat_date
ORDER BY DATE_FORMAT( login_date, '%w' ) ";
$sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date, count( login_id ) AS number_of_logins
FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')."
GROUP BY stat_date
ORDER BY DATE_FORMAT( login_date, '%w' ) ";
break;
}
if ($sql_last_x) {
@ -516,10 +532,10 @@ class Statistics
if ($distinct) {
$field = 'DISTINCT(login_user_id)';
}
$sql[get_lang('ThisDay')] = "SELECT count($field) AS number FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= '$now' $where_url";
$sql[get_lang('Last7days')] = "SELECT count($field) AS number FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= '$now' $where_url";
$sql[get_lang('ThisDay')] = "SELECT count($field) AS number FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 1 DAY) >= '$now' $where_url";
$sql[get_lang('Last7days')] = "SELECT count($field) AS number FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 7 DAY) >= '$now' $where_url";
$sql[get_lang('Last31days')] = "SELECT count($field) AS number FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 31 DAY) >= '$now' $where_url";
$sql[get_lang('Total')] = "SELECT count($field) AS number FROM $table $table_url WHERE 1=1 $where_url";
$sql[get_lang('Total')] = "SELECT count($field) AS number FROM $table $table_url WHERE 1=1 $where_url";
foreach ($sql as $index => $query) {
$res = Database::query($query);
$obj = Database::fetch_object($res);
@ -558,7 +574,7 @@ class Statistics
$sql = "SELECT count($field) AS number, date(login_date) as login_date FROM $table $table_url WHERE DATE_ADD(login_date, INTERVAL 15 DAY) >= '$now' $where_url GROUP BY date(login_date)";
$res = Database::query($sql);
while($row = Database::fetch_array($res,'ASSOC')){
while ($row = Database::fetch_array($res,'ASSOC')){
$totalLogin[$row['login_date']] = $row['number'];
}
@ -744,7 +760,6 @@ class Statistics
$page_nr = isset($_GET['page_nr'])?intval($_GET['page_nr']) : 1;
$column = isset($_GET['column'])?intval($_GET['column']) : 0;
$date_diff = isset($_GET['date_diff'])?intval($_GET['date_diff']) : 60;
$direction = isset($_GET['direction']) ? $_GET['direction'] : SORT_ASC;
if (!in_array($direction, array(SORT_ASC, SORT_DESC))) {
@ -813,7 +828,7 @@ class Statistics
/**
* Displays the statistics of the messages sent and received by each user in the social network
* @param string Type of message: 'sent' or 'received'
* @param string $messageType Type of message: 'sent' or 'received'
* @return array Message list
*/
public static function getMessages($messageType)
@ -833,16 +848,16 @@ class Statistics
break;
}
if (api_is_multiple_url_enabled()) {
$sql = "SELECT lastname, firstname, username, COUNT($field) AS count_message ".
"FROM ".$access_url_rel_user_table." as url, ".$message_table." m ".
"LEFT JOIN ".$user_table." u ON m.$field = u.user_id ".
"WHERE url.user_id = m.$field AND access_url_id='".$current_url_id."' ".
"GROUP BY m.$field ORDER BY count_message DESC ";
$sql = "SELECT lastname, firstname, username, COUNT($field) AS count_message
FROM ".$access_url_rel_user_table." as url, ".$message_table." m
LEFT JOIN ".$user_table." u ON m.$field = u.user_id
WHERE url.user_id = m.$field AND access_url_id='".$current_url_id."'
GROUP BY m.$field ORDER BY count_message DESC ";
} else {
$sql = "SELECT lastname, firstname, username, COUNT($field) AS count_message ".
"FROM ".$message_table." m ".
"LEFT JOIN ".$user_table." u ON m.$field = u.user_id ".
"GROUP BY m.$field ORDER BY count_message DESC ";
$sql = "SELECT lastname, firstname, username, COUNT($field) AS count_message
FROM ".$message_table." m
LEFT JOIN ".$user_table." u ON m.$field = u.user_id
GROUP BY m.$field ORDER BY count_message DESC ";
}
$res = Database::query($sql);
$messages_sent = array();
@ -850,7 +865,10 @@ class Statistics
if (empty($messages['username'])) {
$messages['username'] = get_lang('Unknown');
}
$users = api_get_person_name($messages['firstname'], $messages['lastname']).'<br />('.$messages['username'].')';
$users = api_get_person_name(
$messages['firstname'],
$messages['lastname']
).'<br />('.$messages['username'].')';
$messages_sent[$users] = $messages['count_message'];
}
return $messages_sent;

@ -7,6 +7,8 @@ use Doctrine\ORM\Mapping as ORM;
/**
* CourseRequest
*
* @todo fix objetives variable
*
* @ORM\Table(name="course_request", uniqueConstraints={@ORM\UniqueConstraint(name="code", columns={"code"})})
* @ORM\Entity
*/

Loading…
Cancel
Save