Minor - format code update from master

pull/3240/head
Julio Montoya 5 years ago
parent c1c33d5f55
commit c44978554a
  1. 2
      main/admin/career_diagram.php
  2. 10
      main/calendar/agenda.php
  3. 7
      main/calendar/agenda_js.php
  4. 2
      main/extra/create_school_calendar.php
  5. 18
      main/extra/group_space_tracking.php
  6. 8
      main/extra/myStudents.php
  7. 2
      main/gamification/my_progress.php
  8. 5
      main/glossary/glossary.js.php
  9. 3
      main/glossary/glossary_ajax_request.php
  10. 3
      main/glossary/index.php
  11. 3
      main/group/group_category.php
  12. 4
      main/group/group_creation.php
  13. 4
      main/group/group_overview.php
  14. 3
      main/group/group_space.php
  15. 1
      main/group/import.php
  16. 3
      main/group/settings.php
  17. 3
      main/group/tutor_settings.php
  18. 2
      main/inc/lib/SortableTableFromArray.php
  19. 4
      main/inc/lib/SortableTableFromArrayConfig.php
  20. 2
      main/inc/lib/TeacherTimeReport.php
  21. 6
      main/inc/lib/api.lib.php
  22. 4
      main/inc/lib/array.lib.php
  23. 8
      main/inc/lib/attendance.lib.php
  24. 5
      main/messages/index.php
  25. 6
      main/messages/new_message.php
  26. 4
      main/messages/outbox.php
  27. 2
      main/mySpace/access_details.php
  28. 3
      main/mySpace/admin.php
  29. 6
      main/mySpace/admin_view.php
  30. 2
      main/mySpace/company_reports_resumed.php
  31. 2
      main/mySpace/course.php
  32. 2
      main/mySpace/current_courses.php
  33. 4
      main/mySpace/lp_tracking.php
  34. 12
      main/mySpace/myStudents.php
  35. 2
      main/mySpace/my_career.php
  36. 3
      main/mySpace/progression.php
  37. 6
      main/mySpace/session.php
  38. 4
      main/mySpace/student.php
  39. 2
      main/mySpace/teachers.php
  40. 1
      main/mySpace/user_import.php
  41. 6
      main/mySpace/users.php
  42. 2
      main/mySpace/works_in_session_report.php
  43. 2
      main/notebook/index.php
  44. 2
      main/plagiarism/compilatio/download.php
  45. 6
      main/plagiarism/compilatio/upload.php
  46. 2
      main/survey/ch_multipleresponse.php
  47. 2
      main/survey/ch_yesno.php
  48. 5
      main/survey/copy_survey.php
  49. 4
      main/survey/create_new_survey.php
  50. 2
      main/survey/edit_meeting.php
  51. 24
      main/survey/fillsurvey.php
  52. 8
      main/survey/preview.php
  53. 4
      main/survey/question.php
  54. 4
      main/survey/reporting.php
  55. 2
      main/survey/survey.download.inc.php
  56. 33
      main/survey/survey.lib.php
  57. 10
      main/survey/survey.php
  58. 60
      main/survey/surveyUtil.class.php
  59. 2
      main/survey/survey_invitation.php
  60. 4
      main/survey/survey_list.php
  61. 2
      main/survey/survey_question.php
  62. 7
      main/template/default/agenda/month.tpl
  63. 3
      main/ticket/assign_tickets.php

@ -1,6 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/* For licensing terms, see /license.txt */
/*
*

@ -83,7 +83,7 @@ $nameTools = get_lang('Agenda');
Event::event_access_tool(TOOL_CALENDAR_EVENT);
if ($type === 'fromjs') {
if ('fromjs' === $type) {
// split the "id" parameter only if string and there are _ separators
if (preg_match('/_/', $eventId)) {
$id_list = explode('_', $eventId);
@ -92,18 +92,18 @@ if ($type === 'fromjs') {
}
$eventId = $id_list[1];
$event_type = $id_list[0];
$event_type = $event_type === 'platform' ? 'admin' : $event_type;
$event_type = 'platform' === $event_type ? 'admin' : $event_type;
}
$agenda = new Agenda($event_type);
$allowToEdit = $agenda->getIsAllowedToEdit();
$actions = $agenda->displayActions('calendar');
if (!$allowToEdit && $event_type === 'course') {
if (!$allowToEdit && 'course' === $event_type) {
api_not_allowed(true);
}
if ($event_type === 'course') {
if ('course' === $event_type) {
$agendaUrl = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?'.api_get_cidreq().'&type=course';
} else {
$agendaUrl = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?&type='.$event_type;
@ -287,7 +287,7 @@ if ($allowToEdit) {
}
$content = $form->returnForm();
break;
case "delete":
case 'delete':
if (!(api_is_session_general_coach() &&
!api_is_element_in_the_session(TOOL_AGENDA, $eventId))
) {

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
// use anonymous mode when accessing this course tool
@ -8,7 +9,7 @@ $typeList = ['personal', 'course', 'admin', 'platform'];
$type = isset($_REQUEST['type']) && in_array($_REQUEST['type'], $typeList) ? $_REQUEST['type'] : 'personal';
$userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null;
if ($type == 'personal' || $type == 'admin') {
if ('personal' == $type || 'admin' == $type) {
$cidReset = true; // fixes #5162
}
require_once __DIR__.'/../inc/global.inc.php';
@ -111,7 +112,7 @@ switch ($type) {
$tpl->assign('js_format_date', 'll');
$region_value = api_get_language_isocode();
if ($region_value == 'en') {
if ('en' == $region_value) {
$region_value = 'en-GB';
}
$tpl->assign('region_value', $region_value);
@ -221,7 +222,7 @@ if (!empty($userId)) {
$agenda_ajax_url = api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?type='.$type;
}
if ($type == 'course' && !empty($courseId)) {
if ('course' === $type && !empty($courseId)) {
$agenda_ajax_url .= '&'.api_get_cidreq();
}

@ -57,7 +57,7 @@ if (empty($title)) {
$nbcol = 2;
echo "<table border='1'><tr>";
if ($i % $nbcol == 0) {
if (0 == $i % $nbcol) {
for ($i = 0; $i <= $nbjour; $i++) {
echo "<td><input type='text' NAME='date_case' size='8' value=".date('Y-m-d', $date1)."> ";
$date1 += 60 * 60 * 24; //On additionne d'un jour (en seconde)

@ -38,19 +38,19 @@ $forums_of_groups = get_forums_of_group($current_group['id']);
$forum_state_public = 0;
if (is_array($forums_of_groups)) {
foreach ($forums_of_groups as $key => $value) {
if ($value['forum_group_public_private'] == 'public') {
if ('public' == $value['forum_group_public_private']) {
$forum_state_public = 1;
}
}
}
if ($current_group['doc_state'] != 1 &&
$current_group['calendar_state'] != 1 &&
$current_group['work_state'] != 1 &&
$current_group['announcements_state'] != 1 &&
$current_group['wiki_state'] != 1 &&
$current_group['chat_state'] != 1 &&
$forum_state_public != 1
if (1 != $current_group['doc_state'] &&
1 != $current_group['calendar_state'] &&
1 != $current_group['work_state'] &&
1 != $current_group['announcements_state'] &&
1 != $current_group['wiki_state'] &&
1 != $current_group['chat_state'] &&
1 != $forum_state_public
) {
if (!api_is_allowed_to_edit(null, true) &&
!GroupManager::is_user_in_group($user_id, $group_id)) {
@ -421,6 +421,6 @@ function user_name_filter($name, $url_params, $row)
// Footer
$orig = isset($origin) ? $origin : '';
if ($orig != 'learnpath') {
if ('learnpath' != $orig) {
Display::display_footer();
}

@ -9,7 +9,7 @@ if (empty($allow)) {
}
api_block_anonymous_users();
$export_csv = isset($_GET['export']) && $_GET['export'] === 'csv' ? true : false;
$export_csv = isset($_GET['export']) && 'csv' === $_GET['export'] ? true : false;
$course_code = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
$_course = api_get_course_info();
$coment = '';
@ -57,7 +57,7 @@ if ($export) {
$csv_content = [];
$from_myspace = false;
if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
if (isset($_GET['from']) && 'myspace' == $_GET['from']) {
$from_myspace = true;
$this_section = SECTION_TRACKING;
} else {
@ -68,7 +68,7 @@ $nameTools = get_lang('StudentDetails');
$em = Database::getManager();
if (isset($_GET['details'])) {
if ($origin === 'user_course') {
if ('user_course' === $origin) {
if (empty($cidReq)) {
$interbreadcrumb[] = [
"url" => api_get_path(WEB_COURSE_PATH).$courseInfo['directory'],
@ -80,7 +80,7 @@ if (isset($_GET['details'])) {
"name" => get_lang('Users'),
];
} else {
if ($origin === 'tracking_course') {
if ('tracking_course' === $origin) {
$interbreadcrumb[] = [
"url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session='.api_get_session_id(),
"name" => get_lang('Tracking'),

@ -7,8 +7,6 @@ use Chamilo\CoreBundle\Entity\Repository\TrackECourseAccessRepository;
* See the progress for a user when the gamification mode is active.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.gamification
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';
@ -11,7 +12,7 @@ $tpl = new Template('', false, false, false, true, false, false);
$glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
if ($origin == 'learnpath') {
if ('learnpath' == $origin) {
$showGlossary = in_array($glossaryExtraTools, ['lp', 'exercise_and_lp']);
} else {
$showGlossary = in_array($glossaryExtraTools, ['true', 'lp', 'exercise_and_lp']);
@ -19,7 +20,7 @@ if ($origin == 'learnpath') {
if ($showGlossary) {
$templateName = 'glossary/glossary_auto.js.tpl';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
if ('ismanual' == api_get_setting('show_glossary_in_documents')) {
$templateName = 'glossary/glossary_manual.js.tpl';
}

@ -1,11 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/* @todo move this file in the inc/ajax/ folder */
/**
* Glossary ajax request code.
*
* @package chamilo.glossary
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -1,11 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* @package chamilo.glossary
*
* @author Christian Fasanando, initial version
* @author Bas Wijnen import/export to CSV
*/

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.group
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP;

@ -1,9 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.group
*/
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP;

@ -108,7 +108,7 @@ if (isset($_GET['action'])) {
/* Header */
$interbreadcrumb[] = ['url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')];
$origin = api_get_origin();
if ($origin !== 'learnpath') {
if ('learnpath' != $origin) {
// So we are not in learnpath tool
if (!api_is_allowed_in_course()) {
api_not_allowed(true);
@ -155,6 +155,6 @@ Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICO
echo Display::toolbarAction('actions', [$actions, GroupManager::getSearchForm()]);
echo GroupManager::getOverview($courseId, $keyword);
if ($origin !== 'learnpath') {
if ('learnpath' != $origin) {
Display::display_footer();
}

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This script shows the group space for one specific group, possibly displaying
* a list of users in the group, subscribe or unsubscribe option, tutors...
*
* @package chamilo.group
*
* @todo Display error message if no group ID specified
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -7,8 +8,6 @@
* @author various contributors
* @author Roan Embrechts (VUB), partial code cleanup, initial virtual course support
*
* @package chamilo.group
*
* @todo course admin functionality to create groups based on who is in which course (or class).
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -8,8 +9,6 @@
* @author various contributors
* @author Roan Embrechts (VUB), partial code cleanup, initial virtual course support
*
* @package chamilo.group
*
* @todo course admin functionality to create groups based on who is in which course (or class).
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -60,7 +60,7 @@ class SortableTableFromArray extends SortableTable
$content = TableSort::sort_table(
$this->table_data,
$this->column,
$this->direction === 'ASC' ? SORT_ASC : SORT_DESC
'ASC' === $this->direction ? SORT_ASC : SORT_DESC
);
} else {
$content = $this->table_data;

@ -9,8 +9,6 @@
* $column_order is an array that lets us decide the ordering of the columns
* i.e: $column_header=array('a','b','c','d','e'); $column_order=array(1,2,5,4,5);
* These means that the 3th column (letter "c") will be sort like the order we use in the 5th column
*
* @package chamilo.library
*/
class SortableTableFromArrayConfig extends SortableTable
{
@ -81,7 +79,7 @@ class SortableTableFromArrayConfig extends SortableTable
$table = TableSort::sort_table_config(
$this->table_data,
$this->column,
$this->direction === 'ASC' ? SORT_ASC : SORT_DESC,
'ASC' === $this->direction ? SORT_ASC : SORT_DESC,
$this->column_show,
$this->column_order,
SORT_REGULAR,

@ -5,8 +5,6 @@
* Library for generate a teacher time report.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.admin
*/
class TeacherTimeReport
{

@ -2705,7 +2705,7 @@ function api_get_session_visibility(
// If there is a session duration but there is no previous
// access by the user, then the session is still available
if (count($courseAccess) == 0) {
if (0 == count($courseAccess)) {
return SESSION_AVAILABLE;
}
@ -3614,7 +3614,7 @@ function api_is_allowed_to_session_edit($tutor = false, $coach = false)
} else {
$sessionId = api_get_session_id();
if ($sessionId == 0) {
if (0 == $sessionId) {
// I'm not in a session so i will return true to not affect the normal behaviour of Chamilo tools.
return true;
} else {
@ -5553,7 +5553,7 @@ function copy_folder_course_session(
$rs1 = Database::query($sql);
$num_rows = Database::num_rows($rs1);
if ($num_rows == 0) {
if (0 == $num_rows) {
mkdir($new_pathname, api_get_permissions_for_new_directories());
// Insert new folder with destination session_id.

@ -3,8 +3,6 @@
/**
* This is the array library for Chamilo.
* Include/require it in your code to use its functionality.
*
* @package chamilo.library
*/
/**
@ -53,7 +51,7 @@ function msort($array, $id = 'id', $order = 'desc')
$lowest_id = 0;
$index = 0;
foreach ($array as $item) {
if ($order == 'desc') {
if ('desc' == $order) {
if ($item[$id] < $array[$lowest_id][$id]) {
$lowest_id = $index;
}

@ -60,8 +60,8 @@ class Attendance
$sql = "SELECT COUNT(att.id) AS total_number_of_items
FROM $tbl_attendance att
WHERE
c_id = $course_id AND
WHERE
c_id = $course_id AND
active <> 2 $active_plus $condition_session ";
/*$active = (int) $active;
if ($active === 1 || $active === 0) {
@ -172,8 +172,8 @@ class Attendance
while ($attendance = Database::fetch_row($res)) {
$session_star = '';
if (api_get_session_id() == $attendance[6]) {
$session_star = api_get_session_image(api_get_session_id(), $user_info['status']);
if ($session_id == $attendance[6]) {
$session_star = api_get_session_image($session_id, $user_info['status']);
}
if ($attendance[5] == 1) {

@ -1,8 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
require_once __DIR__.'/../inc/global.inc.php';
if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
header('Location:inbox.php?f=social');

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
/**
* This script shows a compose area (wysiwyg editor if supported, otherwise
@ -65,9 +62,8 @@ $tpl = new Template(get_lang('ComposeMessage'));
function show_compose_to_any($tpl)
{
$default['user_list'] = 0;
$html = manageForm($default, null, null, $tpl);
return $html;
return manageForm($default, null, null, $tpl);
}
function show_compose_reply_to_message($message_id, $receiver_id, $tpl)

@ -1,9 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.messages
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -5,8 +5,6 @@
/**
* This is the tracking library for Chamilo.
*
* Calculates the time spent on the course
*
* @param int $user_id the user id
* @param string $course_code the course code
*

@ -1,9 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Special reporting page for admins.
*
* @package chamilo.reporting
*/
ob_start();
$cidReset = true;

@ -26,13 +26,13 @@ if (!$allowToTrack) {
}
if ($exportCSV) {
if ($display === 'user') {
if ('user' === $display) {
MySpace::export_tracking_user_overview();
exit;
} elseif ($display === 'session') {
} elseif ('session' === $display) {
MySpace::export_tracking_session_overview();
exit;
} elseif ($display === 'course') {
} elseif ('course' === $display) {
MySpace::export_tracking_course_overview();
exit;
}

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Special report for corporate users.
*
* @package chamilo.reporting
*/
$cidReset = true;

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Courses reporting.
*
* @package chamilo.reporting
*/
ob_start();
$cidReset = true;

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Report for current courses followed by the user.
*
* @package chamilo.reporting
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -7,15 +7,13 @@ use Chamilo\CourseBundle\Entity\CLpItemView;
/**
* Learning paths reporting.
*
* @package chamilo.reporting
*/
require_once __DIR__.'/../inc/global.inc.php';
$cidReset = true;
$from_myspace = false;
$from_link = '';
if (isset($_GET['from']) && $_GET['from'] === 'myspace') {
if (isset($_GET['from']) && 'myspace' == $_GET['from']) {
$from_link = '&from=myspace';
$this_section = SECTION_TRACKING;
} else {

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CLpCategory;
@ -8,11 +9,6 @@ if (!isset($_GET['course'])) {
$cidReset = true;
}
/**
* Implements the tracking of students in the Reporting pages.
*
* @package chamilo.reporting
*/
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();
@ -124,13 +120,13 @@ if (!empty($details)) {
'name' => get_lang('Users'),
];
} else {
if ($origin === 'tracking_course') {
if ('tracking_course' === $origin) {
$interbreadcrumb[] = [
'url' => '../tracking/courseLog.php?cidReq='.$courseCode.'&id_session='.api_get_session_id(),
'name' => get_lang('Tracking'),
];
} else {
if ($origin === 'resume_session') {
if ('resume_session' === $origin) {
$interbreadcrumb[] = [
'url' => "../session/session_list.php",
'name' => get_lang('SessionList'),
@ -1347,7 +1343,7 @@ if (empty($details)) {
$timeCourse = Tracking::getCalculateTime($student_id, $courseInfo['real_id'], $sessionId);
}
if ($user_info['status'] != INVITEE) {
if (INVITEE != $user_info['status']) {
$csv_content[] = [];
$csv_content[] = [str_replace('&nbsp;', '', strip_tags($userInfo['complete_name']))];
$trackingColumns = api_get_configuration_value('tracking_columns');

@ -5,7 +5,7 @@ use Fhaculty\Graph\Graph;
require_once __DIR__.'/../inc/global.inc.php';
if (api_get_configuration_value('allow_career_diagram') == false) {
if (false == api_get_configuration_value('allow_career_diagram')) {
api_not_allowed(true);
}

@ -1,10 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Progress report.
*
* @package chamilo.reporting
*
* @deprecated seems there's no link to this page
* Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com
*/

@ -1,11 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Sessions reporting.
*
* @package chamilo.reporting
*/
ob_start();
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -3,8 +3,6 @@
/**
* Report on students subscribed to courses I am teaching.
*
* @package chamilo.reporting
*/
$cidReset = true;
@ -107,7 +105,7 @@ function get_users($from, $limit, $column, $direction)
}
}
if ($drhLoaded === false) {
if (false === $drhLoaded) {
$students = UserManager::getUsersFollowedByUser(
api_get_user_id(),
api_is_student_boss() ? null : STUDENT,

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Teacher report.
*
* @package chamilo.reporting
*/
$cidReset = true;

@ -4,7 +4,6 @@
* This tool allows platform admins to add users by uploading a CSV or XML file
* This code is inherited from admin/user_import.php.
*
* @package chamilo.reporting
* Created on 26 julio 2008 by Julio Montoya gugli100@gmail.com
*/
$cidReset = true;

@ -3,8 +3,6 @@
/**
* Report on users followed (filtered by status given in URL).
*
* @package chamilo.reporting
*/
$cidReset = true;
@ -21,7 +19,7 @@ if (!$allowToTrack) {
}
$nameTools = get_lang('Users');
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$export_csv = isset($_GET['export']) && 'csv' == $_GET['export'] ? true : false;
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$active = isset($_GET['active']) ? intval($_GET['active']) : 1;
$sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null;
@ -106,7 +104,7 @@ function get_users($from, $limit, $column, $direction)
}
}
if ($drhLoaded === false) {
if (false === $drhLoaded) {
$students = UserManager::getUsersFollowedByUser(
api_get_user_id(),
$status,

@ -7,8 +7,6 @@ use Chamilo\UserBundle\Entity\User;
/**
* Courses reporting.
*
* @package chamilo.reporting
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -4,8 +4,6 @@
use ChamiloSession as Session;
/**
* @package chamilo.notebook
*
* @author Christian Fasanando, initial version
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium,
* refactoring and tighter integration

@ -8,8 +8,6 @@ exit;
* Html files are parsed to fix a few problems with URLs,
* but this code will hopefully be replaced soon by an Apache URL
* rewrite mechanism.
*
* @package chamilo.work
*/
session_cache_limiter('public');
require_once '../../inc/global.inc.php';

@ -14,7 +14,7 @@ $courseInfo = api_get_course_info();
$compilatio = new Compilatio();
/* if we have to upload severals documents*/
if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'multi') {
if (isset($_REQUEST['type']) && 'multi' === $_REQUEST['type']) {
$docs = explode('a', $_REQUEST['doc']);
for ($k = 0; $k < count($docs) - 1; $k++) {
$documentId = 0;
@ -41,7 +41,7 @@ if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'multi') {
$WrkUrl = $currentCourseRepositoryWeb.$doc->url;
$LocalWrkUrl = $courseInfo['course_sys_path'].$doc->url;
$mime = DocumentManager::file_get_mime_type($doc->title);
if ($compilatio->getTransportMode() === 'wget') {
if ('wget' === $compilatio->getTransportMode()) {
/*Compilatio's server recover tjre file throught wget like this:
username:password@http://somedomain.com/reg/remotefilename.tar.gz */
if (strlen($compilatio->getWgetUri()) > 2) {
@ -102,7 +102,7 @@ function sendDocument($documentId, $courseInfo)
$mime = DocumentManager::file_get_mime_type($doc->title);
$compilatio = new Compilatio();
if ($compilatio->getTransportMode() === 'wget') {
if ('wget' === $compilatio->getTransportMode()) {
if (strlen($compilatio->getWgetUri()) > 2) {
$filename = preg_replace('/$', '', $compilatio->getWgetUri()).'/'.$courseInfo['path'].'/'.$doc->title;
} else {

@ -55,7 +55,7 @@ class ch_multipleresponse extends survey_question
) {
$class = 'checkbox-inline';
$labelClass = 'checkbox-inline';
if ($questionData['display'] === 'vertical') {
if ('vertical' == $questionData['display']) {
$class = 'checkbox-vertical';
}

@ -62,7 +62,7 @@ class ch_yesno extends survey_question
if (is_array($questionData['options'])) {
$class = 'radio-inline';
$labelClass = 'radio-inline';
if ($questionData['display'] === 'vertical') {
if ('vertical' == $questionData['display']) {
$class = 'radio-vertical';
}

@ -1,8 +1,7 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.backup
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_COURSE_MAINTENANCE;

@ -122,7 +122,7 @@ $form = new FormValidator(
$form->addElement('header', $tool_name);
// Setting the form elements
if ($action == 'edit' && isset($survey_id) && is_numeric($survey_id)) {
if ('edit' == $action && isset($survey_id) && is_numeric($survey_id)) {
$form->addElement('hidden', 'survey_id');
}
@ -133,7 +133,7 @@ $survey_code = $form->addElement(
['size' => '20', 'maxlength' => '20', 'autofocus' => 'autofocus']
);
if ($action == 'edit') {
if ('edit' == $action) {
$survey_code->freeze();
$form->applyFilter('survey_code', 'api_strtoupper');
}

@ -169,7 +169,7 @@ if ($form->validate()) {
$date = $values[$name];
if ($date === 'delete' && !empty($id)) {
if ('delete' === $date && !empty($id)) {
$deleteItems[] = $id;
}

@ -91,7 +91,7 @@ if ((!isset($_GET['course']) || !isset($_GET['invitationcode'])) && !isset($_GET
$invitationcode = $_GET['invitationcode'];
// Start auto-invitation feature FS#3403 (all-users-can-do-the-survey-URL handling)
if ($invitationcode === 'auto' && isset($_GET['scode'])) {
if ('auto' == $invitationcode && isset($_GET['scode'])) {
$userid = api_get_user_id();
// Survey_code of the survey
$surveyCode = $_GET['scode'];
@ -131,7 +131,7 @@ if ($invitationcode === 'auto' && isset($_GET['scode'])) {
invitation_code = '".Database::escape_string($autoInvitationcode)."'";
$result = Database::query($sql);
$now = api_get_utc_datetime();
if (Database :: num_rows($result) == 0) {
if (0 == Database :: num_rows($result)) {
$params = [
'c_id' => $course_id,
'survey_code' => $surveyCode,
@ -285,7 +285,7 @@ if (count($_POST) > 0) {
);
foreach ($value as $answer_key => &$answer_value) {
if ($types[$survey_question_id] === 'score') {
if ('score' == $types[$survey_question_id]) {
$option_id = $answer_key;
$option_value = $answer_value;
} else {
@ -305,7 +305,7 @@ if (count($_POST) > 0) {
} else {
// All the other question types (open question, multiple choice, percentage, ...)
if (isset($types[$survey_question_id]) &&
$types[$survey_question_id] === 'percentage') {
'percentage' == $types[$survey_question_id]) {
$sql = "SELECT * FROM $table_survey_question_option
WHERE
c_id = $course_id AND
@ -316,7 +316,7 @@ if (count($_POST) > 0) {
} else {
$option_value = 0;
if (isset($types[$survey_question_id]) &&
$types[$survey_question_id] === 'open'
'open' == $types[$survey_question_id]
) {
$option_value = $value;
}
@ -363,7 +363,7 @@ if (count($_POST) > 0) {
// Looping through all the post values
foreach ($_POST as $key => &$value) {
// If the post value key contains the string 'question' then it is an answer to a question
if (strpos($key, 'question') !== false) {
if (false !== strpos($key, 'question')) {
// Finding the question id by removing 'question'
$survey_question_id = str_replace('question', '', $key);
// If not question ID was defined, we're on the start
@ -674,7 +674,7 @@ if (isset($_POST['finish_survey'])) {
// Sets the random questions
$shuffle = '';
if ($survey_data['shuffle'] == 1) {
if (1 == $survey_data['shuffle']) {
$shuffle = ' BY RAND() ';
}
@ -813,13 +813,13 @@ if ((isset($_GET['show']) && $_GET['show'] != '') ||
$counter++;
}
}
} elseif ($survey_data['survey_type'] === '1') {
} elseif ('1' === $survey_data['survey_type']) {
$my_survey_id = (int) $survey_invitation['survey_id'];
$current_user = Database::escape_string($survey_invitation['user']);
if (isset($_POST['personality'])) {
// Compute the results to get the 3 groups nearest to the user's personality
if ($shuffle == '') {
if ('' == $shuffle) {
$order = 'BY sort ASC ';
} else {
$order = $shuffle;
@ -1079,7 +1079,7 @@ if ((isset($_GET['show']) && $_GET['show'] != '') ||
$questions = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
// If the type is not a pagebreak we store it in the $questions array
if ($row['type'] != 'pagebreak') {
if ('pagebreak' != $row['type']) {
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
@ -1193,7 +1193,7 @@ if ((isset($_GET['show']) && $_GET['show'] != '') ||
$questions = [];
while ($row = Database :: fetch_array($result, 'ASSOC')) {
// If the type is not a pagebreak we store it in the $questions array
if ($row['type'] !== 'pagebreak') {
if ('pagebreak' != $row['type']) {
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
@ -1319,13 +1319,11 @@ if (isset($questions) && is_array($questions)) {
$finalAnswer = [];
foreach ($userAnswer as $userChoice) {
list($choiceId, $choiceValue) = explode('*', $userChoice);
$finalAnswer[$choiceId] = $choiceValue;
}
break;
case 'percentage':
list($choiceId, $choiceValue) = explode('*', current($userAnswer));
$finalAnswer = $choiceId;
break;
default:

@ -92,14 +92,14 @@ if (isset($_GET['show'])) {
$questions_exists = true;
if (Database::num_rows($result)) {
while ($row = Database::fetch_array($result)) {
if ($survey_data['one_question_per_page'] == 1) {
if ($row['type'] !== 'pagebreak') {
if (1 == $survey_data['one_question_per_page']) {
if ('pagebreak' != $row['type']) {
$paged_questions[$counter][] = $row['question_id'];
$counter++;
continue;
}
} else {
if ($row['type'] === 'pagebreak') {
if ('pagebreak' == $row['type']) {
$counter++;
} else {
$paged_questions[$counter][] = $row['question_id'];
@ -143,7 +143,7 @@ if (isset($_GET['show'])) {
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
// If the type is not a pagebreak we store it in the $questions array
if ($row['type'] !== 'pagebreak') {
if ('pagebreak' != $row['type']) {
$sort = $row['sort'];
$questions[$sort]['question_id'] = $row['question_id'];
$questions[$sort]['survey_id'] = $row['survey_id'];

@ -46,13 +46,13 @@ if (api_strlen(strip_tags($surveyData['title'])) > 40) {
$urlname .= '...';
}
if ($surveyData['survey_type'] == 1) {
if (1 == $surveyData['survey_type']) {
$sql = 'SELECT id FROM '.Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP).'
WHERE
c_id = '.$course_id.' AND
survey_id = '.$surveyId.' LIMIT 1';
$rs = Database::query($sql);
if (Database::num_rows($rs) === 0) {
if (0 === Database::num_rows($rs)) {
Display::addFlash(
Display::return_message(get_lang('YouNeedToCreateGroups'))
);

@ -21,7 +21,7 @@ if (empty($survey_data)) {
api_not_allowed(true);
}
if ($survey_data['anonymous'] == 0) {
if (0 == $survey_data['anonymous']) {
$people_filled_full_data = true;
} else {
$people_filled_full_data = false;
@ -42,7 +42,7 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!api_is_allowed_to_edit(false, true) || $isDrhOfCourse) {
// Show error message if the survey can be seen only by tutors
if ($survey_data['visible_results'] == SURVEY_VISIBLE_TUTOR) {
if (SURVEY_VISIBLE_TUTOR == $survey_data['visible_results']) {
api_not_allowed(true);
}

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* @package chamilo.survey
*
* @author Arnaud Ligot <arnaud@cblue.be>
*
* A small peace of code to enable user to access images included into survey

@ -147,7 +147,7 @@ class SurveyManager
$survey_id = (int) $survey_id;
$table_survey = Database::get_course_table(TABLE_SURVEY);
if ($shared != 0) {
if (0 != $shared) {
$table_survey = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
$sql = "SELECT * FROM $table_survey
WHERE survey_id='".$survey_id."' ";
@ -581,7 +581,7 @@ class SurveyManager
if (!$values['survey_id'] ||
!is_numeric($values['survey_id']) ||
$values['survey_share']['survey_share'] == 'true'
'true' == $values['survey_share']['survey_share']
) {
$sql = "INSERT INTO $table_survey (code, title, subtitle, author, lang, template, intro, surveythanks, creation_date, course_code) VALUES (
'".Database::escape_string($values['survey_code'])."',
@ -846,7 +846,7 @@ class SurveyManager
$datas = self::get_survey($surveyId);
$session_where = '';
if (api_get_session_id() != 0) {
if (0 != api_get_session_id()) {
$session_where = ' AND session_id = "'.api_get_session_id().'" ';
}
@ -966,9 +966,9 @@ class SurveyManager
if (in_array($type, $possible_types)) {
return $icon_question[$type];
} else {
return false;
}
return false;
}
/**
@ -1034,7 +1034,7 @@ class SurveyManager
? $row['is_required']
: false;
if ($row['survey_group_pri'] != 0) {
if (0 != $row['survey_group_pri']) {
$return['assigned'] = $row['survey_group_pri'];
$return['choose'] = 1;
} else {
@ -1156,7 +1156,7 @@ class SurveyManager
}
}
if ($form_content['type'] === 'score') {
if ('score' == $form_content['type']) {
if (strlen($form_content['maximum_score']) < 1) {
$empty_answer = true;
}
@ -1246,11 +1246,11 @@ class SurveyManager
// Updating an existing question
$extraParams = [];
if (isset($_POST['choose'])) {
if ($_POST['choose'] == 1) {
if (1 == $_POST['choose']) {
$extraParams['survey_group_pri'] = $_POST['assigned'];
$extraParams['survey_group_sec1'] = 0;
$extraParams['survey_group_sec2'] = 0;
} elseif ($_POST['choose'] == 2) {
} elseif (2 == $_POST['choose']) {
$extraParams['survey_group_pri'] = 0;
$extraParams['survey_group_sec1'] = $_POST['assigned1'];
$extraParams['survey_group_sec2'] = $_POST['assigned2'];
@ -1351,7 +1351,7 @@ class SurveyManager
$tbl_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
// Storing a new question
if ($form_content['shared_question_id'] == '' ||
if ('' == $form_content['shared_question_id'] ||
!is_numeric($form_content['shared_question_id'])
) {
// Finding the max sort order of the questions in the given survey
@ -1410,10 +1410,10 @@ class SurveyManager
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$course_id = api_get_course_int_id();
if ($direction == 'moveup') {
if ('moveup' == $direction) {
$sort = 'DESC';
}
if ($direction == 'movedown') {
if ('movedown' == $direction) {
$sort = 'ASC';
}
@ -1580,7 +1580,7 @@ class SurveyManager
}
}
if (is_numeric($survey_data['survey_share']) && $survey_data['survey_share'] != 0) {
if (is_numeric($survey_data['survey_share']) && 0 != $survey_data['survey_share']) {
self::save_shared_question_options($form_content, $survey_data);
}
@ -2009,7 +2009,7 @@ class SurveyManager
*/
public static function protectByMandatory()
{
if (strpos($_SERVER['SCRIPT_NAME'], 'fillsurvey.php') !== false) {
if (false !== strpos($_SERVER['SCRIPT_NAME'], 'fillsurvey.php')) {
return;
}
@ -2354,7 +2354,7 @@ class SurveyManager
foreach ($newQuestionList as $question) {
$text = $question['question'];
if (strpos($text, $classTag) !== false) {
if (false !== strpos($text, $classTag)) {
$replacedText = str_replace($classTag, $className, $text);
$values = [
'c_id' => $courseId,
@ -2375,7 +2375,8 @@ class SurveyManager
foreach ($users as $userId) {
$userInfo = api_get_user_info($userId);
if (strpos($text, $studentTag) !== false) {
if (false !== strpos($text, $studentTag)) {
$replacedText = str_replace($studentTag, $userInfo['complete_name'], $text);
$values = [
'c_id' => $courseId,

@ -56,7 +56,7 @@ Session::erase('answer_list');
// Getting the survey information
if (!empty($_GET['survey_id'])) {
$course_code = api_get_course_id();
if ($course_code != -1) {
if (-1 != $course_code) {
$survey_data = SurveyManager::get_survey($survey_id);
} else {
api_not_allowed(true);
@ -66,7 +66,7 @@ if (!empty($_GET['survey_id'])) {
}
$tool_name = strip_tags($survey_data['title'], '<span>');
$is_survey_type_1 = $survey_data['survey_type'] == 1;
$is_survey_type_1 = 1 == $survey_data['survey_type'];
if (api_strlen(strip_tags($survey_data['title'])) > 40) {
$tool_name .= '...';
@ -74,7 +74,7 @@ if (api_strlen(strip_tags($survey_data['title'])) > 40) {
if ($is_survey_type_1 && ($action === 'addgroup' || $action === 'deletegroup')) {
$_POST['name'] = trim($_POST['name']);
if ($action === 'addgroup') {
if ('addgroup' == $action) {
if (!empty($_POST['group_id'])) {
Database::query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\'
WHERE c_id = '.$course_id.' AND id = \''.Database::escape_string($_POST['group_id']).'\'');
@ -87,7 +87,7 @@ if ($is_survey_type_1 && ($action === 'addgroup' || $action === 'deletegroup'))
}
}
if ($action === 'deletegroup') {
if ('deletegroup' == $action) {
$sql = 'DELETE FROM '.$table_survey_question_group.'
WHERE c_id = '.$course_id.' AND id = '.intval($_GET['gid']).' AND survey_id = '.$survey_id;
Database::query($sql);
@ -355,7 +355,7 @@ if ($is_survey_type_1) {
}
echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
echo '<form action="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
if ($_GET['action'] == 'editgroup') {
if ('editgroup' == $_GET['action']) {
$sql = 'SELECT name,description FROM '.$table_survey_question_group.'
WHERE id = '.intval($_GET['gid']).' AND survey_id = '.intval($survey_id).' limit 1';
$rs = Database::query($sql);

@ -112,7 +112,7 @@ class SurveyUtil
$table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
// Make the survey anonymous
if ($survey_data['anonymous'] == 1) {
if (1 == $survey_data['anonymous']) {
$surveyUser = Session::read('surveyuser');
if (empty($surveyUser)) {
$user = md5($user.time());
@ -640,7 +640,7 @@ class SurveyUtil
echo strip_tags(isset($question['survey_question']) ? $question['survey_question'] : null);
echo '</div>';
if ($question['type'] === 'score') {
if ('score' == $question['type']) {
/** @todo This function should return the options as this is needed further in the code */
$options = self::display_question_report_score($survey_data, $question, $offset);
} elseif ($question['type'] === 'open' || $question['type'] === 'comment') {
@ -1077,9 +1077,9 @@ class SurveyUtil
in_array($row['question_id'], $_POST['questions_filter']))
) {
// We do not show comment and pagebreak question types
if ($row['type'] != 'pagebreak') {
if ('pagebreak' != $row['type']) {
$content .= ' <th';
if ($row['number_of_options'] > 0 && $row['type'] != 'percentage') {
if ($row['number_of_options'] > 0 && 'percentage' != $row['type']) {
$content .= ' colspan="'.$row['number_of_options'].'"';
}
$content .= '>';
@ -1146,7 +1146,7 @@ class SurveyUtil
(is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter']))
) {
// we do not show comment and pagebreak question types
if ($row['type'] === 'open' || $row['type'] === 'comment') {
if ('open' == $row['type'] || 'comment' == $row['type']) {
$content .= '<th>&nbsp;-&nbsp;</th>';
$possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id'];
$display_percentage_header = 1;
@ -1203,8 +1203,8 @@ class SurveyUtil
$answers_of_user = [];
}
if (isset($questions[$row['question_id']]) &&
$questions[$row['question_id']]['type'] !== 'open' &&
$questions[$row['question_id']]['type'] !== 'comment'
'open' != $questions[$row['question_id']]['type'] &&
'comment' != $questions[$row['question_id']]['type']
) {
$answers_of_user[$row['question_id']][$row['option_id']] = $row;
} else {
@ -1214,7 +1214,7 @@ class SurveyUtil
}
$userParam = $old_user;
if ($survey_data['anonymous'] != 0) {
if (0 != $survey_data['anonymous']) {
$userParam = $i;
$i++;
}
@ -1328,7 +1328,7 @@ class SurveyUtil
} else {
$content .= '<td align="center">';
if (!empty($answers_of_user[$question_id][$option_id])) {
if ($answers_of_user[$question_id][$option_id]['value'] != 0) {
if (0 != $answers_of_user[$question_id][$option_id]['value']) {
$content .= $answers_of_user[$question_id][$option_id]['value'];
} else {
$content .= 'v';
@ -1551,8 +1551,8 @@ class SurveyUtil
$answers_of_user = [];
}
if ($possible_answers_type[$row['question_id']] == 'open' ||
$possible_answers_type[$row['question_id']] == 'comment'
if ('open' == $possible_answers_type[$row['question_id']] ||
'comment' == $possible_answers_type[$row['question_id']]
) {
$temp_id = 'open'.$open_question_iterator;
$answers_of_user[$row['question_id']][$temp_id] = $row;
@ -1601,8 +1601,8 @@ class SurveyUtil
$compact = false
) {
$return = '';
if ($survey_data['anonymous'] == 0) {
if (intval($user) !== 0) {
if (0 == $survey_data['anonymous']) {
if (0 !== intval($user)) {
$userInfo = api_get_user_info($user);
if (!empty($userInfo)) {
$user_displayed = $userInfo['complete_name_with_username'];
@ -2413,7 +2413,7 @@ class SurveyUtil
// Remind unanswered is a special version of remind all reminder
$exclude_users = [];
if ($remindUnAnswered == 1) {
if (1 == $remindUnAnswered) {
// Remind only unanswered users
$reminder = 1;
$exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']);
@ -2423,7 +2423,7 @@ class SurveyUtil
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
if ($isAdditionalEmail == false) {
if (false == $isAdditionalEmail) {
$result = CourseManager::separateUsersGroups($users_array);
$groupList = $result['groups'];
$users_array = $result['users'];
@ -2454,7 +2454,7 @@ class SurveyUtil
$users_array = array_unique($users_array);
foreach ($users_array as $key => $value) {
if (!isset($value) || $value == '') {
if (!isset($value) || '' == $value) {
continue;
}
@ -3062,7 +3062,7 @@ class SurveyUtil
if (api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id)) {
$editUrl = $codePath.'survey/create_new_survey.php?'.
http_build_query($params + ['action' => 'edit', 'survey_id' => $survey_id]);
if ($survey->getSurveyType() == 3) {
if (3 == $survey->getSurveyType()) {
$editUrl = $codePath.'survey/edit_meeting.php?'.
http_build_query($params + ['action' => 'edit', 'survey_id' => $survey_id]);
}
@ -3115,7 +3115,7 @@ class SurveyUtil
}
}
if ($type != 3) {
if (3 != $type) {
$actions[] = Display::url(
Display::return_icon('preview_view.png', get_lang('Preview')),
$codePath.'survey/preview.php?'.http_build_query($params + ['survey_id' => $survey_id])
@ -3136,7 +3136,7 @@ class SurveyUtil
);
}
if ($type != 3) {
if (3 != $type) {
$actions[] = $hideReportingButton ? null : $reportingLink;
}
@ -3228,7 +3228,7 @@ class SurveyUtil
*/
public static function anonymous_filter($anonymous)
{
if ($anonymous == 1) {
if (1 == $anonymous) {
return get_lang('Yes');
} else {
return get_lang('No');
@ -3391,7 +3391,7 @@ class SurveyUtil
$array[1] = $survey[1];
} else {
// Doodle
if ($survey['survey_type'] == 3) {
if (3 == $survey['survey_type']) {
$array[1] = Display::url(
$survey[1],
api_get_path(WEB_CODE_PATH).'survey/meeting.php?survey_id='.$survey[0].'&'.api_get_cidreq()
@ -3748,13 +3748,13 @@ class SurveyUtil
$extra = UserManager::get_extra_fields(0, 50, 5, 'ASC');
foreach ($extra as $id => $field_details) {
if ($field_details[6] == 0) {
if (0 == $field_details[6]) {
continue;
}
switch ($field_details[2]) {
case UserManager::USER_FIELD_TYPE_TEXT:
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
@ -3762,7 +3762,7 @@ class SurveyUtil
break;
case UserManager::USER_FIELD_TYPE_TEXTAREA:
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
@ -3770,7 +3770,7 @@ class SurveyUtil
break;
case UserManager::USER_FIELD_TYPE_RADIO:
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
@ -3792,7 +3792,7 @@ class SurveyUtil
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
}
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
@ -3800,7 +3800,7 @@ class SurveyUtil
break;
case UserManager::USER_FIELD_TYPE_SELECT_MULTIPLE:
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
@ -3808,7 +3808,7 @@ class SurveyUtil
break;
case UserManager::USER_FIELD_TYPE_DATE:
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
@ -3816,7 +3816,7 @@ class SurveyUtil
break;
case UserManager::USER_FIELD_TYPE_DATETIME:
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;
@ -3824,7 +3824,7 @@ class SurveyUtil
break;
case UserManager::USER_FIELD_TYPE_DOUBLE_SELECT:
$field_list_array['extra_'.$field_details[1]]['name'] = $field_details[3];
if ($field_details[7] == 0) {
if (0 == $field_details[7]) {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 0;
} else {
$field_list_array['extra_'.$field_details[1]]['visibility'] = 1;

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* @package chamilo.survey
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
*
* @version $Id: survey_invite.php 10680 2007-01-11 21:26:23Z pcool $

@ -248,7 +248,7 @@ switch ($action) {
break;
case 'empty':
$mysession = api_get_session_id();
if ($mysession != 0) {
if (0 != $mysession) {
if (!((api_is_session_general_coach() || api_is_platform_admin()) &&
api_is_element_in_the_session(TOOL_SURVEY, $surveyId))) {
// The coach can't empty a survey not belonging to his session
@ -274,7 +274,7 @@ Display::display_header($tool_name, 'Survey');
Display::display_introduction_section('survey', 'left');
// Action handling: searching
if (isset($_GET['search']) && $_GET['search'] === 'advanced') {
if (isset($_GET['search']) && 'advanced' == $_GET['search']) {
SurveyUtil::display_survey_search_form();
}

@ -239,7 +239,7 @@ class survey_question
$this->addParentMenu($formData, $form, $surveyData);
}
if ($surveyData['survey_type'] == 1) {
if (1 == $surveyData['survey_type']) {
$table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
$sql = 'SELECT id, name FROM '.$table_survey_question_group.'
WHERE survey_id = '.$surveyId.'

@ -17,15 +17,11 @@ function checkLength( o, n, min, max ) {
function clean_user_select() {
//Cleans the selected attr
$("#users_to_send").val('').trigger("chosen:updated");
/*$('#users_to_send')
.find('option')
.removeAttr('selected')
.end();*/
}
var region_value = '{{ region_value }}';
$(document).ready(function() {
$(function() {
var cookieData = Cookies.getJSON('agenda_cookies');
var defaultView = (cookieData && cookieData.view) || '{{ default_view }}';
var defaultStartDate = (cookieData && cookieData.start) || moment.now();
@ -470,7 +466,6 @@ $(document).ready(function() {
if (calEvent.editable) {
$('#visible_to_input').hide();
$('#add_as_announcement_div').hide();
{% if type != 'admin' %}
$('#visible_to_read_only').show();
$("#visible_to_read_only_users").html(calEvent.sent_to);

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.plugin.ticket
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

Loading…
Cancel
Save