Minor - format code

pull/2468/head
jmontoyaa 8 years ago
parent 353d3541d3
commit 56b3b48034
  1. 16
      main/inc/lib/fileUpload.lib.php
  2. 14
      main/survey/pending.php
  3. 28
      main/survey/surveyUtil.class.php
  4. 31
      plugin/test2pdf/src/test2pdf.lib.php

@ -1247,7 +1247,7 @@ function clean_up_path($path)
* api_get_setting('upload_extensions_exclude') and api_get_setting('upload_extensions_include'). * api_get_setting('upload_extensions_exclude') and api_get_setting('upload_extensions_include').
* *
* @param string $filename passed by reference. The filename will be modified * @param string $filename passed by reference. The filename will be modified
* if filter rules say so! (you can include path but the filename should look like 'abc.html') * if filter rules say so! (you can include path but the filename should look like 'abc.html')
* *
* @return int 0 to skip file, 1 to keep file * @return int 0 to skip file, 1 to keep file
*/ */
@ -1304,17 +1304,17 @@ function filter_extension(&$filename)
/** /**
* Adds a new document to the database. * Adds a new document to the database.
* *
* @param array $courseInfo * @param array $courseInfo
* @param string $path * @param string $path
* @param string $fileType * @param string $fileType
* @param int $fileSize * @param int $fileSize
* @param string $title * @param string $title
* @param string $comment * @param string $comment
* @param int $readonly * @param int $readonly
* @param bool $saveVisibility * @param bool $saveVisibility
* @param int $group_id group.id * @param int $group_id group.id
* @param int $sessionId Session ID, if any * @param int $sessionId Session ID, if any
* @param int $userId creator user id * @param int $userId creator user id
* *
* @return int id if inserted document * @return int id if inserted document
*/ */

@ -1,10 +1,10 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CSurvey;
use Chamilo\CourseBundle\Entity\CSurveyInvitation;
use Chamilo\CoreBundle\Entity\Course; use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CourseBundle\Entity\CSurvey;
use Chamilo\CourseBundle\Entity\CSurveyInvitation;
$cidReset = true; $cidReset = true;
@ -34,17 +34,15 @@ foreach ($pending as $i => $item) {
/** @var Session $session */ /** @var Session $session */
$session = $em->find('ChamiloCoreBundle:Session', $survey->getSessionId()); $session = $em->find('ChamiloCoreBundle:Session', $survey->getSessionId());
$course = $course ? ['id' => $course->getId(), 'title' => $course->getTitle(), 'code' => $course->getCode()] : null;
$session = $session ? ['id' => $session->getId(), 'name' => $session->getName()] : null;
$surveysData[$survey->getSurveyId()] = [ $surveysData[$survey->getSurveyId()] = [
'title' => $survey->getTitle(), 'title' => $survey->getTitle(),
'invitation_code' => $invitation->getInvitationCode(), 'invitation_code' => $invitation->getInvitationCode(),
'avail_from' => $survey->getAvailFrom(), 'avail_from' => $survey->getAvailFrom(),
'avail_till' => $survey->getAvailTill(), 'avail_till' => $survey->getAvailTill(),
'course' => $course 'course' => $course,
? ['id' => $course->getId(), 'title' => $course->getTitle(), 'code' => $course->getCode()] 'session' => $session,
: null,
'session' => $session
? ['id' => $session->getId(), 'name' => $session->getName()]
: null
]; ];
} }

@ -2829,13 +2829,13 @@ class SurveyUtil
* @param int $survey_id the id of the survey * @param int $survey_id the id of the survey
* @param bool $drh * @param bool $drh
* *
* @return string html code that are the actions that can be performed on any survey
*
* @throws \Doctrine\ORM\ORMException * @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException * @throws \Doctrine\ORM\OptimisticLockException
* @throws \Doctrine\ORM\TransactionRequiredException * @throws \Doctrine\ORM\TransactionRequiredException
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* *
* @return string html code that are the actions that can be performed on any survey
*
* @version January 2007 * @version January 2007
*/ */
public static function modify_filter($survey_id, $drh = false) public static function modify_filter($survey_id, $drh = false)
@ -2893,14 +2893,13 @@ class SurveyUtil
.http_build_query($params + ['action' => 'copy_survey', 'survey_id' => $survey_id]) .http_build_query($params + ['action' => 'copy_survey', 'survey_id' => $survey_id])
); );
$warning = addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES));
$actions[] = Display::url( $actions[] = Display::url(
Display::return_icon('clean.png', get_lang('EmptySurvey')), Display::return_icon('clean.png', get_lang('EmptySurvey')),
$codePath.'survey/survey_list.php' $codePath.'survey/survey_list.php'
.http_build_query($params + ['action' => 'empty', 'survey_id' => $survey_id]), .http_build_query($params + ['action' => 'empty', 'survey_id' => $survey_id]),
[ [
'onclick' => "javascript: if (!confirm('" 'onclick' => "javascript: if (!confirm('".$warning."')) return false;",
.addslashes(api_htmlentities(get_lang("EmptySurvey").'?'))
."')) return false;"
] ]
); );
} }
@ -2917,14 +2916,13 @@ class SurveyUtil
if (api_is_allowed_to_edit() || if (api_is_allowed_to_edit() ||
api_is_element_in_the_session(TOOL_SURVEY, $survey_id) api_is_element_in_the_session(TOOL_SURVEY, $survey_id)
) { ) {
$warning = addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES));
$actions[] = Display::url( $actions[] = Display::url(
Display::return_icon('delete.png', get_lang('Delete')), Display::return_icon('delete.png', get_lang('Delete')),
$codePath.'survey/survey_list.php?' $codePath.'survey/survey_list.php?'
.http_build_query($params + ['action' => 'delete', 'survey_id' => $survey_id]), .http_build_query($params + ['action' => 'delete', 'survey_id' => $survey_id]),
[ [
'onclick' => "javascript: if(!confirm('" 'onclick' => "javascript: if(!confirm('".$warning."')) return false;",
.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES))
."')) return false;"
] ]
); );
} }
@ -2952,14 +2950,13 @@ class SurveyUtil
Display::return_icon('mail_send.png', get_lang('Publish')), Display::return_icon('mail_send.png', get_lang('Publish')),
$codePath.'survey/survey_invite.php?'.http_build_query($params + ['survey_id' => $survey_id]) $codePath.'survey/survey_invite.php?'.http_build_query($params + ['survey_id' => $survey_id])
); );
$warning = addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES));
$actions[] = Display::url( $actions[] = Display::url(
Display::return_icon('clean.png', get_lang('EmptySurvey')), Display::return_icon('clean.png', get_lang('EmptySurvey')),
$codePath.'survey/survey_list.php?' $codePath.'survey/survey_list.php?'
.http_build_query($params + ['action' => 'empty', 'survey_id' => $survey_id]), .http_build_query($params + ['action' => 'empty', 'survey_id' => $survey_id]),
[ [
'onclick' => "javascript: if(!confirm('" 'onclick' => "javascript: if(!confirm('".$warning."')) return false;",
.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES))
."')) return false;"
] ]
); );
@ -3759,7 +3756,7 @@ class SurveyUtil
} }
/** /**
* Get the pending surveys for a user * Get the pending surveys for a user.
* *
* @param int $userId * @param int $userId
* *
@ -3773,8 +3770,11 @@ class SurveyUtil
SELECT s, si FROM ChamiloCourseBundle:CSurvey s SELECT s, si FROM ChamiloCourseBundle:CSurvey s
INNER JOIN ChamiloCourseBundle:CSurveyInvitation si INNER JOIN ChamiloCourseBundle:CSurveyInvitation si
WITH (s.code = si.surveyCode AND s.cId = si.cId AND s.sessionId = si.sessionId ) WITH (s.code = si.surveyCode AND s.cId = si.cId AND s.sessionId = si.sessionId )
WHERE si.user = :user_id AND s.availFrom <= :now AND s.availTill >= :now WHERE
AND si.answered = 0 si.user = :user_id AND
s.availFrom <= :now AND
s.availTill >= :now AND
si.answered = 0
ORDER BY s.availTill ASC ORDER BY s.availTill ASC
"; ";

@ -6,7 +6,34 @@
* @package chamilo.plugin.test2pdf * @package chamilo.plugin.test2pdf
*/ */
$letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; $letters = [
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
];
/** /**
* List exercises. * List exercises.
@ -16,7 +43,7 @@ $letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'
* *
* @throws Exception * @throws Exception
* *
* @return array Results (list of exercice details) * @return array Results (list of exercise details)
*/ */
function showExerciseCourse($courseId, $sessionId = 0) function showExerciseCourse($courseId, $sessionId = 0)

Loading…
Cancel
Save