Minor - fix php code

pull/3064/head
Julio 5 years ago
parent 7b9cad463e
commit 84f40622e7
  1. 20
      public/main/ticket/assign_tickets.php
  2. 28
      public/main/ticket/categories.php
  3. 4
      public/main/ticket/categories_add_user.php
  4. 3
      public/main/ticket/download.php
  5. 3
      public/main/ticket/index.php
  6. 26
      public/main/ticket/new_ticket.php
  7. 24
      public/main/ticket/priorities.php
  8. 22
      public/main/ticket/projects.php
  9. 1
      public/main/ticket/settings.php
  10. 22
      public/main/ticket/status.php
  11. 2
      public/main/ticket/ticket_assign_log.php
  12. 13
      public/main/ticket/ticket_details.php
  13. 18
      public/main/ticket/tickets.php
  14. 43
      public/main/ticket/tutor_report.lib.php

@ -1,9 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.plugin.ticket
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
@ -19,8 +17,8 @@ echo '<div id="confirmation"></div>';
$id = (int) $_GET['id'];
$tblWeeklyReport = Database::get_main_table('rp_reporte_semanas');
$sql = "SELECT * FROM $tblWeeklyReport WHERE id = $id";
$sql_tasks = "SELECT id AS colid, title as coltitle
FROM ".Database::get_course_table(TABLE_STUDENT_PUBLICATION)."
$sql_tasks = 'SELECT id AS colid, title as coltitle
FROM '.Database::get_course_table(TABLE_STUDENT_PUBLICATION)."
WHERE parent_id = 0
AND id NOT IN (
SELECT work_id
@ -29,8 +27,8 @@ $sql_tasks = "SELECT id AS colid, title as coltitle
course_code = '$course_code' AND
id != $id
)";
$sql_forum = "SELECT thread_id AS colid, thread_title AS coltitle
FROM ".Database::get_course_table(TABLE_FORUM_THREAD)."
$sql_forum = 'SELECT thread_id AS colid, thread_title AS coltitle
FROM '.Database::get_course_table(TABLE_FORUM_THREAD)."
WHERE thread_id NOT IN (
SELECT forum_id
FROM $tblWeeklyReport
@ -47,9 +45,9 @@ echo '<div class="row">
<div class="formw">'.get_lang('Please select tasks').'</div>
</div>';
echo '<div class="row"><div class="formw"><select name ="work_id" id="work_id">';
echo '<option value="0"'.(($row['colid'] == $rs->work_id) ? "selected" : "").'>'.get_lang('Please select').'</option>';
echo '<option value="0"'.($row['colid'] == $rs->work_id ? 'selected' : '').'>'.get_lang('Please select').'</option>';
while ($row = Database::fetch_assoc($result_tasks)) {
echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->work_id) ? "selected" : "").'>'.
echo '<option value="'.$row['colid'].'"'.($row['colid'] == $rs->work_id ? 'selected' : '').'>'.
$row['coltitle'].'</option>';
}
echo '</select></div><div>';
@ -57,9 +55,9 @@ echo '<div class="row">
<div class="formw">'.get_lang('Please selectThread').'</div>
</div>';
echo '<div class="row"><div class="formw"><select name ="forum_id" id="forum_id">';
echo '<option value="0"'.(($row['colid'] == $rs->work_id) ? "forum_id" : "").'>'.get_lang('Please select').'</option>';
echo '<option value="0"'.($row['colid'] == $rs->work_id ? 'forum_id' : '').'>'.get_lang('Please select').'</option>';
while ($row = Database::fetch_assoc($result_forum)) {
echo '<option value="'.$row['colid'].'"'.(($row['colid'] == $rs->forum_id) ? "selected" : "").'>'.
echo '<option value="'.$row['colid'].'"'.($row['colid'] == $rs->forum_id ? 'selected' : '').'>'.
$row['coltitle'].'</option>';
}
echo '</select></div><div>';

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This script is the Tickets plugin main entry point.
*
* @package chamilo.plugin.ticket
*/
// needed in order to load the plugin lang variables
@ -32,7 +31,7 @@ $table = new SortableTable(
1
);
if ($table->per_page == 0) {
if (0 == $table->per_page) {
$table->per_page = 20;
}
@ -77,8 +76,9 @@ switch ($action) {
} else {
Display::addFlash(Display::return_message(get_lang('This item is related to other tickets.')));
}
header("Location: ".api_get_self().'?project_id='.$projectId);
header('Location: '.api_get_self().'?project_id='.$projectId);
exit;
break;
case 'add':
$toolName = get_lang('Add');
@ -105,12 +105,13 @@ switch ($action) {
Display::addFlash(Display::return_message(get_lang('Added')));
header("Location: ".api_get_self().'?project_id='.$projectId);
header('Location: '.api_get_self().'?project_id='.$projectId);
exit;
}
break;
case 'edit':
if (api_get_setting('ticket_allow_category_edition') !== 'true') {
if ('true' !== api_get_setting('ticket_allow_category_edition')) {
api_not_allowed();
}
@ -136,9 +137,10 @@ switch ($action) {
];
$cat = TicketManager::updateCategory($_GET['id'], $params);
Display::addFlash(Display::return_message(get_lang('Update successful')));
header("Location: ".api_get_self().'?project_id='.$projectId);
header('Location: '.api_get_self().'?project_id='.$projectId);
exit;
}
break;
default:
break;
@ -147,9 +149,9 @@ switch ($action) {
/**
* Build the modify-column of the table.
*
* @param int The user id
* @param string URL params to add to table links
* @param array Row of elements to alter
* @param int $id The user id
* @param string $params URL params to add to table links
* @param array $row Row of elements to alter
*
* @return string Some HTML-code with modify-buttons
*/
@ -157,7 +159,7 @@ function modify_filter($id, $params, $row)
{
$projectId = Session::read('project_id');
$result = '';
if (api_get_setting('ticket_allow_category_edition') === 'true') {
if ('true' === api_get_setting('ticket_allow_category_edition')) {
$result .= Display::url(
Display::return_icon('edit.png', get_lang('Edit')),
"categories.php?action=edit&id={$row['id']}&project_id=".$projectId
@ -169,7 +171,7 @@ function modify_filter($id, $params, $row)
"categories_add_user.php?id={$row['id']}&project_id=".$projectId
);
if (api_get_setting('ticket_allow_category_edition') === 'true') {
if ('true' === api_get_setting('ticket_allow_category_edition')) {
$result .= Display::url(
Display::return_icon('delete.png', get_lang('Delete')),
"categories.php?action=delete&id={$row['id']}&project_id=".$projectId
@ -181,7 +183,7 @@ function modify_filter($id, $params, $row)
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Title'), false);
$table->set_header(2, get_lang('Description'), true, ["style" => "width:200px"]);
$table->set_header(2, get_lang('Description'), true, ['style' => 'width:200px']);
$table->set_header(3, get_lang('Total tickets'), false);
$table->set_header(4, get_lang('Detail'), true);
$table->set_column_filter(4, 'modify_filter');

@ -1,9 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.plugin.ticket
*/
require_once __DIR__.'/../inc/global.inc.php';
api_protect_admin_script(true);

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';
@ -34,7 +35,7 @@ if (!api_is_platform_admin()) {
$rs = Database::query($sql);
$row_users = Database::fetch_array($rs, 'ASSOC');
$user_request_id = $row_users['request_user'];
if (intval($user_request_id) != $user_id) {
if ((int) $user_request_id != $user_id) {
api_not_allowed(true);
}
}

@ -1,10 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Redirects to "myticket.php".
*
* @package chamilo.plugin.ticket
*/
require_once __DIR__.'/../inc/global.inc.php';
header('Location:'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');

@ -1,12 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.ticket
*/
require_once __DIR__.'/../inc/global.inc.php';
if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') !== 'true') {
if (!api_is_platform_admin() && 'true' !== api_get_setting('ticket_allow_student_add')) {
header('Location:'.api_get_path(WEB_CODE_PATH).'ticket/tickets.php');
exit;
}
@ -17,7 +15,7 @@ $courseId = api_get_course_int_id();
$htmlHeadXtra[] = '<script>
function updateCourseList(sessionId) {
$selectCourse = $("select#course_id");
$selectCourse.empty();
$selectCourse.empty();
$.get("'.api_get_path(WEB_AJAX_PATH).'session.ajax.php", {
a: "get_courses_inside_session",
session_id : sessionId
@ -26,8 +24,8 @@ function updateCourseList(sessionId) {
value: 0,
text: "'.get_lang('Select').'"
}).appendTo($selectCourse);
if (courseList.length > 0) {
if (courseList.length > 0) {
$.each(courseList, function (index, course) {
$("<option>", {
value: course.id,
@ -36,16 +34,16 @@ function updateCourseList(sessionId) {
});
$("select#course_id option[value=\''.$courseId.'\']").attr("selected",true);
$("select#course_id").selectpicker("refresh");
}
}, "json");
}
}, "json");
}
$(function() {
$("select#session_id").on("change", function () {
$(function() {
$("select#session_id").on("change", function () {
var sessionId = parseInt(this.value, 10);
updateCourseList(sessionId);
});
});
var sessionId = $("select#session_id").val();
updateCourseList(sessionId);
});
@ -122,7 +120,7 @@ $htmlHeadXtra[] = '<script>
*/
function js_array($array, $name, $key)
{
$return = "new Array(); ";
$return = 'new Array(); ';
foreach ($array as $value) {
$return .= $name."['".$value['category_id']."'] ='".$value[$key]."'; ";
}

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This script is the Tickets plugin main entry point.
*
* @package chamilo.plugin.ticket
*/
$cidReset = true;
@ -27,12 +26,12 @@ $table = new SortableTable(
1
);
if ($table->per_page == 0) {
if (0 == $table->per_page) {
$table->per_page = 20;
}
$formToString = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$id = isset($_GET['id']) ? (int) ($_GET['id']) : 0;
$action = isset($_GET['action']) ? $_GET['action'] : '';
$interbreadcrumb[] = [
@ -54,8 +53,9 @@ switch ($action) {
} else {
Display::addFlash(Display::return_message(get_lang('This item is related to other tickets.'), 'warning'));
}
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
break;
case 'add':
$toolName = get_lang('Add');
@ -76,9 +76,10 @@ switch ($action) {
TicketManager::addPriority($params);
Display::addFlash(Display::return_message(get_lang('Added')));
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
}
break;
case 'edit':
$toolName = get_lang('Edit');
@ -104,9 +105,10 @@ switch ($action) {
];
$cat = TicketManager::updatePriority($_GET['id'], $params);
Display::addFlash(Display::return_message(get_lang('Update successful')));
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
}
break;
default:
break;
@ -118,9 +120,9 @@ $isAdmin = api_is_platform_admin();
/**
* Build the modify-column of the table.
*
* @param int The user id
* @param string URL params to add to table links
* @param array Row of elements to alter
* @param int $id The user id
* @param string $params URL params to add to table links
* @param array $row Row of elements to alter
*
* @return string Some HTML-code with modify-buttons
*/
@ -145,7 +147,7 @@ function modify_filter($id, $params, $row)
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Title'), false);
$table->set_header(2, get_lang('Description'), true, ["style" => "width:200px"]);
$table->set_header(2, get_lang('Description'), true, ['style' => 'width:200px']);
$table->set_header(3, get_lang('Detail'), true);
$table->set_column_filter('3', 'modify_filter');

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This script is the Tickets plugin main entry point.
*
* @package chamilo.plugin.ticket
*/
$cidReset = true;
@ -25,7 +24,7 @@ $table = new SortableTable(
1
);
if ($table->per_page == 0) {
if (0 == $table->per_page) {
$table->per_page = 20;
}
@ -57,8 +56,9 @@ switch ($action) {
} else {
Display::addFlash(Display::return_message(get_lang('This item is related to other tickets.')));
}
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
break;
case 'add':
$toolName = get_lang('Add');
@ -77,9 +77,10 @@ switch ($action) {
Display::addFlash(Display::return_message(get_lang('Added')));
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
}
break;
case 'edit':
$item = TicketManager::getProject($id);
@ -107,9 +108,10 @@ switch ($action) {
];
TicketManager::updateProject($id, $params);
Display::addFlash(Display::return_message(get_lang('Update successful')));
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
}
break;
default:
break;
@ -121,9 +123,9 @@ $isAdmin = api_is_platform_admin();
/**
* Build the modify-column of the table.
*
* @param int The user id
* @param string URL params to add to table links
* @param array Row of elements to alter
* @param int $id The user id
* @param string $params URL params to add to table links
* @param array $row Row of elements to alter
*
* @return string Some HTML-code with modify-buttons
*/
@ -156,7 +158,7 @@ function modify_filter($id, $params, $row)
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Title'), false);
$table->set_header(2, get_lang('Description'), true, ["style" => "width:200px"]);
$table->set_header(2, get_lang('Description'), true, ['style' => 'width:200px']);
$table->set_header(3, get_lang('Detail'), true);
$table->set_column_filter('3', 'modify_filter');

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
$cidReset = true;

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This script is the Tickets plugin main entry point.
*
* @package chamilo.plugin.ticket
*/
$cidReset = true;
@ -27,7 +26,7 @@ $table = new SortableTable(
1
);
if ($table->per_page == 0) {
if (0 == $table->per_page) {
$table->per_page = 20;
}
@ -54,8 +53,9 @@ switch ($action) {
Display::addFlash(Display::return_message(get_lang('This item is related to other tickets.'), 'warning'));
}
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
break;
case 'add':
$toolName = get_lang('Add');
@ -76,9 +76,10 @@ switch ($action) {
TicketManager::addStatus($params);
Display::addFlash(Display::return_message(get_lang('Added')));
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
}
break;
case 'edit':
$toolName = get_lang('Edit');
@ -104,9 +105,10 @@ switch ($action) {
];
$cat = TicketManager::updateStatus($id, $params);
Display::addFlash(Display::return_message(get_lang('Update successful')));
header("Location: ".api_get_self());
header('Location: '.api_get_self());
exit;
}
break;
default:
break;
@ -118,9 +120,9 @@ $isAdmin = api_is_platform_admin();
/**
* Build the modify-column of the table.
*
* @param int The user id
* @param string URL params to add to table links
* @param array Row of elements to alter
* @param int $id The user id
* @param string $params URL params to add to table links
* @param array $row Row of elements to alter
*
* @return string Some HTML-code with modify-buttons
*/
@ -146,7 +148,7 @@ function modify_filter($id, $params, $row)
$table->set_header(0, '', false);
$table->set_header(1, get_lang('Title'), false);
$table->set_header(2, get_lang('Description'), true, ["style" => "width:200px"]);
$table->set_header(2, get_lang('Description'), true, ['style' => 'width:200px']);
$table->set_header(3, get_lang('Detail'), true);
$table->set_column_filter('3', 'modify_filter');

@ -14,7 +14,7 @@ $history = TicketManager::get_assign_log($ticket_id);
?>
<table width="200px" border="0" cellspacing="2" cellpadding="2">
<?php
if (count($history) == 0) {
if (0 == count($history)) {
?>
<tr>
<td colspan="2"><?php echo api_ucfirst(get_lang('No history')); ?></td>

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
$cidReset = true;
@ -205,13 +206,13 @@ foreach ($messages as $message) {
['class' => 'well']
);
}
$counter++;
++$counter;
}
$subject = get_lang('Re:').': '.Security::remove_XSS($ticket['ticket']['subject']);
if ($ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED &&
$ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE
if (TicketManager::STATUS_FORWARDED != $ticket['ticket']['status_id'] &&
TicketManager::STATUS_CLOSE != $ticket['ticket']['status_id']
) {
if ($ticket['ticket']['assigned_last_user'] == $user_id ||
$ticket['ticket']['sys_insert_user_id'] == $user_id ||
@ -330,7 +331,7 @@ if ($ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED &&
);
Display::addFlash(Display::return_message(get_lang('Saved.')));
header("Location:".api_get_self()."?ticket_id=".$ticket_id);
header('Location:'.api_get_self().'?ticket_id='.$ticket_id);
exit;
}
}
@ -344,7 +345,7 @@ echo Display::url(
);
echo '</div>';
$bold = '';
if ($ticket['ticket']['status_id'] == TicketManager::STATUS_CLOSE) {
if (TicketManager::STATUS_CLOSE == $ticket['ticket']['status_id']) {
$bold = 'style = "font-weight: bold;"';
}
$senderData = get_lang('added by').' '.$ticket['usuario']['complete_name_with_message_link'];
@ -391,7 +392,7 @@ if (!empty($ticket['ticket']['assigned_last_user'])) {
<td><p><b>'.get_lang('Assigned to').': </b>-<p></td>
</tr>';
}
if ($ticket['ticket']['course_url'] != null) {
if (null != $ticket['ticket']['course_url']) {
if (!empty($ticket['ticket']['session_id'])) {
$sessionInfo = api_get_session_info($ticket['ticket']['session_id']);
echo '<tr>

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This script is the Tickets plugin main entry point.
*
* @package chamilo.plugin.ticket
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -68,7 +67,7 @@ $table = new SortableTable(
$table->set_additional_parameters(['project_id' => $projectId]);
if ($table->per_page == 0) {
if (0 == $table->per_page) {
$table->per_page = 20;
}
@ -77,6 +76,7 @@ switch ($action) {
if (!$isAdmin && isset($_GET['ticket_id'])) {
TicketManager::send_alert($_GET['ticket_id'], $user_id);
}
break;
case 'export':
$data = [
@ -109,9 +109,11 @@ switch ($action) {
}
Export::arrayToXls($data, get_lang('Tickets'));
exit;
break;
case 'close_tickets':
TicketManager::close_old_tickets();
break;
default:
break;
@ -167,10 +169,10 @@ if (!empty($projectId)) {
}
if (isset($_GET['submit_advanced'])) {
$get_parameter .= "&submit_advanced=";
$get_parameter .= '&submit_advanced=';
}
if (isset($_GET['submit_simple'])) {
$get_parameter .= "&submit_simple=";
$get_parameter .= '&submit_simple=';
}
// Select categories
@ -228,7 +230,7 @@ if (!empty($projectId)) {
);
// Add link
if (api_get_setting('ticket_allow_student_add') == 'true' || api_is_platform_admin()) {
if ('true' == api_get_setting('ticket_allow_student_add') || api_is_platform_admin()) {
$actionRight = Display::url(
Display::return_icon(
'add.png',
@ -355,7 +357,7 @@ if (!empty($projectId)) {
$advancedSearchForm->addButtonSearch(get_lang('Advanced search'), 'submit_advanced');
$advancedSearchForm->display();
} else {
if (api_get_setting('ticket_allow_student_add') === 'true') {
if ('true' === api_get_setting('ticket_allow_student_add')) {
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'ticket/new_ticket.php?project_id='.$projectId.'">'.
Display::return_icon('add.png', get_lang('Add'), '', '32').
@ -374,7 +376,7 @@ if ($isAdmin) {
$table->set_header(6, get_lang('Assigned to'), true);
$table->set_header(7, get_lang('Message'), true);
} else {
if ($isAllow == false) {
if (false == $isAllow) {
echo Display::page_subheader(get_lang('My tickets'));
echo Display::return_message(get_lang('Welcome to YOUR tickets section. Here, you\'ll be able to track the state of all the tickets you created in the main tickets section.'));
}

@ -1,10 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Helper library for weekly reports.
*
* @package chamilo.plugin.ticket
*/
/**
@ -28,16 +27,16 @@ function initializeReport($course_code)
$resWeeks = Database::query($sqlWeeks);
$weeks = Database::fetch_object($resWeeks);
$obj = Database::fetch_object($res);
$weeksCount = (!isset($_POST['weeksNumber'])) ? (($weeks->semanas == 0) ? 7 : $weeks->semanas) : (int) $_POST['weeksNumber'];
$weeksCount = !isset($_POST['weeksNumber']) ? (0 == $weeks->semanas ? 7 : $weeks->semanas) : (int) $_POST['weeksNumber'];
$weeksCount = Database::escape_string($weeksCount);
Database::query("REPLACE INTO $table_semanas_curso (course_code , semanas) VALUES ('$course_code','$weeksCount')");
if (intval($obj->cant) != $weeksCount) {
if (intval($obj->cant) > $weeksCount) {
if ((int) ($obj->cant) != $weeksCount) {
if ((int) ($obj->cant) > $weeksCount) {
$sql = "DELETE FROM $table_reporte_semanas
WHERE week_id > $weeksCount AND course_code = '$course_code'";
Database::query($sql);
} else {
for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
for ($i = $obj->cant + 1; $i <= $weeksCount; ++$i) {
if (!Database::query("INSERT INTO $table_reporte_semanas (week_id, course_code, forum_id, work_id, quiz_id, pc_id)
VALUES ($i, '$course_code', '0', '0', '0', '0' )")) {
return false;
@ -57,7 +56,7 @@ function initializeReport($course_code)
if (!Database::query($sql)) {
return false;
} else {
$page = (!isset($_GET['page'])) ? 1 : (int) $_GET['page'];
$page = !isset($_GET['page']) ? 1 : (int) $_GET['page'];
Database::query("UPDATE $table_students_report sr SET sr.work_ok = 1
WHERE CONCAT (sr.user_id,',',sr.week_report_id)
@ -82,8 +81,8 @@ function initializeReport($course_code)
function showResults($courseInfo, $weeksCount, $page)
{
$course_code = $courseInfo['code'];
$page = intval($page);
$weeksCount = intval($weeksCount);
$page = (int) $page;
$weeksCount = (int) $weeksCount;
$tableWeeklyReport = Database::get_main_table('rp_reporte_semanas');
$tableStudentsReport = Database::get_main_table('rp_students_report');
@ -116,7 +115,7 @@ function showResults($courseInfo, $weeksCount, $page)
//$fila_export_encabezado2[] = utf8_decode($rowe['eval_title']);
//$fila_export_encabezado2[] = utf8_decode($rowe['pc_title']);
$fila_export = ['Work'.$rowe['week_id'], 'Forum'.$rowe['week_id'], 'Eval'.$rowe['week_id'], 'PC'.$rowe['week_id']];
if ($rowe['week_id'] > (($page - 1) * 7) && $rowe['week_id'] <= (7 * $page)) {
if ($rowe['week_id'] > (($page - 1) * 7) && $rowe['week_id'] <= 7 * $page) {
$ids[$rowe['week_id']] = $rowe['id'];
$line .= '<th>
<a href="#" onClick="showContent('."'tarea".$rowe['week_id']."'".');">Work'.$rowe['week_id'].'
@ -137,12 +136,12 @@ function showResults($courseInfo, $weeksCount, $page)
<div class="row">
'.get_lang('Select the timespan in weeks').'
<select name="weeksNumber" id="weeksNumber" onChange="submit();">
<option value="7" '.(($weeksCount == 7) ? 'selected="selected"' : "").'>7 weeks</option>
<option value="14" '.(($weeksCount == 14) ? 'selected="selected"' : "").'>14 weeks</option>
<option value="7" '.(7 == $weeksCount ? 'selected="selected"' : '').'>7 weeks</option>
<option value="14" '.(14 == $weeksCount ? 'selected="selected"' : '').'>14 weeks</option>
</select>';
if ($weeksCount == 14) {
$html .= '<span style="float:right;"><a href="tutor.php?page='.(($page == 1) ? 2 : 1).'">'.(($page == 1) ? "Siguiente" : "Anterior").'</a></span>';
if (14 == $weeksCount) {
$html .= '<span style="float:right;"><a href="tutor.php?page='.(1 == $page ? 2 : 1).'">'.(1 == $page ? 'Siguiente' : 'Anterior').'</a></span>';
}
$html .= '<span style="float:right;"><a href="'.api_get_self().'?action=export'.$get_parameter.$get_parameter2.'">'.Display::return_icon('export_excel.png', get_lang('Export'), '', '32').'</a></span>';
@ -150,7 +149,7 @@ function showResults($courseInfo, $weeksCount, $page)
$html .= '<table class="reports">';
$html .= '<tr>
<th ></th>';
for ($i = (7 * $page - 6); $i <= $page * 7; $i++) {
for ($i = 7 * $page - 6; $i <= $page * 7; ++$i) {
$html .= '<th colspan="2">Week '.$i.'<a href="assign_tickets.php?id='.$ids[$i].'" class="ajax">'.Display::return_icon('edit.png', get_lang('Edit'), ['width' => '16', 'height' => '16'], 22).'</a></th>';
}
$html .= '</tr>';
@ -165,9 +164,9 @@ function showResults($courseInfo, $weeksCount, $page)
$result = Database::query($sql);
while ($row = Database::fetch_assoc($result)) {
$resultadose[$row['username']][$row['week_id']] = $row;
if ($row['week_id'] > (($page - 1) * 7) && $row['week_id'] <= (7 * $page)) {
if ($row['week_id'] > (($page - 1) * 7) && $row['week_id'] <= 7 * $page) {
$results[$row['username']][$row['week_id']] = $row;
if (count($results[$row['username']]) == 7) {
if (7 == count($results[$row['username']])) {
$html .= showStudentResult($results[$row['username']], $page);
}
}
@ -189,13 +188,13 @@ function showResults($courseInfo, $weeksCount, $page)
*/
function showStudentResult($datos, $pagina)
{
$inicio = (7 * $pagina - 6);
$inicio = 7 * $pagina - 6;
$fila = '<tr>';
$fila .= '<td><a href="'.api_get_path(WEB_CODE_PATH).'user/userInfo.php?'.api_get_cidreq().'&uInfo='.$datos[$inicio]['user_id'].'">'.$datos[$inicio]['username'].'</a></td>';
foreach ($datos as $dato) {
$fila .= '<td align="center">'.(($dato['work_ok'] == 1) ? Display::return_icon('check.png') : Display::return_icon('aspa.png')).'</td>';
$fila .= '<td align="center">'.(($dato['thread_ok'] == 1) ? Display::return_icon('check.png') : Display::return_icon('aspa.png')).'</td>';
$fila .= '<td align="center">'.(1 == $dato['work_ok'] ? Display::return_icon('check.png') : Display::return_icon('aspa.png')).'</td>';
$fila .= '<td align="center">'.(1 == $dato['thread_ok'] ? Display::return_icon('check.png') : Display::return_icon('aspa.png')).'</td>';
}
$fila .= '</tr>';
@ -214,8 +213,8 @@ function showStudentResultExport($data, $numero_semanas)
$fila[] = utf8_decode($data[1]['username']);
$fila[] = utf8_decode($data[1]['fullname']);
foreach ($data as $line) {
$fila[] = ($line['work_ok'] == 1) ? get_lang('Yes') : get_lang('No');
$fila[] = ($line['thread_ok'] == 1) ? get_lang('Yes') : get_lang('No');
$fila[] = 1 == $line['work_ok'] ? get_lang('Yes') : get_lang('No');
$fila[] = 1 == $line['thread_ok'] ? get_lang('Yes') : get_lang('No');
}
return $fila;

Loading…
Cancel
Save