@ -153,7 +159,9 @@ class SurveyLink extends AbstractLink
WHERE
WHERE
s.c_id = {$this->course_id} AND
s.c_id = {$this->course_id} AND
i.c_id = {$this->course_id} AND
i.c_id = {$this->course_id} AND
s.survey_id = $ref_id AND i.session_id = $session_id";
s.survey_id = $ref_id AND
i.session_id = $session_id
";
if ($get_individual_score) {
if ($get_individual_score) {
$sql .= ' AND i.user = '.intval($stud_id);
$sql .= ' AND i.user = '.intval($stud_id);
@ -199,7 +207,10 @@ class SurveyLink extends AbstractLink
{
{
$session_id = api_get_session_id();
$session_id = api_get_session_id();
$sql = 'SELECT count(survey_id) FROM '.$this->get_survey_table().'
$sql = 'SELECT count(survey_id) FROM '.$this->get_survey_table().'
WHERE c_id = '.$this->course_id.' AND survey_id = '.intval($this->get_ref_id()).' AND session_id='.intval($session_id).'';
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id='.intval($session_id).'';
$result = Database::query($sql);
$result = Database::query($sql);
$number = Database::fetch_row($result);
$number = Database::fetch_row($result);
return ($number[0] != 0);
return ($number[0] != 0);
@ -217,7 +228,10 @@ class SurveyLink extends AbstractLink
$session_id = api_get_session_id();
$session_id = api_get_session_id();
if ($tbl_name != '') {
if ($tbl_name != '') {
$sql = 'SELECT survey_id FROM '.$this->get_survey_table().'
$sql = 'SELECT survey_id FROM '.$this->get_survey_table().'
WHERE c_id = '.$this->course_id.' AND survey_id = '.intval($this->get_ref_id()).' AND session_id = '.intval($session_id).' ';
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id = '.intval($session_id).' ';
$result = Database::query($sql);
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
$row = Database::fetch_array($result, 'ASSOC');
$survey_id = $row['survey_id'];
$survey_id = $row['survey_id'];
@ -234,7 +248,11 @@ class SurveyLink extends AbstractLink
if ($tbl_name == '') {
if ($tbl_name == '') {
return false;
return false;
} elseif (!isset($this->survey_data)) {
} elseif (!isset($this->survey_data)) {
$sql = 'SELECT * FROM '.$tbl_name.' WHERE c_id = '.$this->course_id.' AND survey_id = '.intval($this->get_ref_id()).' AND session_id='.intval($session_id).'';
@ -1025,6 +1033,7 @@ function api_get_person_name($first_name, $last_name, $title = null, $format = n
if (empty($encoding)) {
if (empty($encoding)) {
$encoding = _api_mb_internal_encoding();
$encoding = _api_mb_internal_encoding();
}
}
if (!isset($valid[$format][$language])) {
if (!isset($valid[$format][$language])) {
if (is_int($format)) {
if (is_int($format)) {
switch ($format) {
switch ($format) {
@ -1078,7 +1087,7 @@ function api_get_person_name($first_name, $last_name, $title = null, $format = n
/**
/**
* Checks whether a given format represents person name in Western order (for which first name is first).
* Checks whether a given format represents person name in Western order (for which first name is first).
* @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param string $language (optional) The language indentificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @param string $language (optional) The language identificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @return bool The result TRUE means that the order is first_name last_name, FALSE means last_name first_name.
* @return bool The result TRUE means that the order is first_name last_name, FALSE means last_name first_name.
* Note: You may use this function for determing the order of the fields or columns "First name" and "Last name" in forms, tables and reports.
* Note: You may use this function for determing the order of the fields or columns "First name" and "Last name" in forms, tables and reports.
// Some experimental settings for Spanish language:
//'spanish' => array( 'format' => 'title first_name LAST_NAME', 'sort_by' => 'first_name'), // Western order, last name is uppercase when a full name is assembled
//'spanish' => array( 'format' => 'title first_name LAST_NAME', 'sort_by' => 'last_name'), // Western order, last name is uppercase when a full name is assembled
//'spanish' => array( 'format' => 'title LAST_NAME, first_name', 'sort_by' => 'last_name'), // Library order, last name is uppercase when a full name is assembled