17 import(
'classes.article.Author');
18 import(
'classes.submission.Submission');
19 import(
'lib.pkp.classes.submission.PKPAuthorDAO');
38 IDENTITY_SETTING_GIVENNAME, $locale,
39 IDENTITY_SETTING_GIVENNAME,
40 IDENTITY_SETTING_FAMILYNAME, $locale,
41 IDENTITY_SETTING_FAMILYNAME,
43 if (isset($journalId)) $params[] = $journalId;
45 $supportedLocales = array();
46 if ($journalId !==
null) {
48 $journal = $journalDao->getById($journalId);
49 $supportedLocales = $journal->getSupportedLocales();
52 $supportedLocales = $site->getSupportedLocales();
54 $supportedLocalesCount = count($supportedLocales);
55 $sqlJoinAuthorSettings = $sqlColumnsAuthorSettings = $initialSql =
'';
56 if (isset($initial)) {
57 $initialSql =
' AND (';
60 foreach ($supportedLocales as $locale) {
61 $localeStr = str_replace(
'@',
'_', $locale);
62 $sqlColumnsAuthorSettings .=
",
63 COALESCE(asg$index.setting_value, ''), ' ',
64 COALESCE(asf$index.setting_value, ''), ' ',
65 COALESCE(SUBSTRING(asa$index.setting_value FROM 1 FOR 255), ''), ' '
67 $sqlJoinAuthorSettings .=
"
68 LEFT JOIN author_settings asg$index ON (asg$index.author_id = aa.author_id AND asg$index.setting_name = '" . IDENTITY_SETTING_GIVENNAME .
"' AND asg$index.locale = '$locale')
69 LEFT JOIN author_settings asf$index ON (asf$index.author_id = aa.author_id AND asf$index.setting_name = '" . IDENTITY_SETTING_FAMILYNAME .
"' AND asf$index.locale = '$locale')
70 LEFT JOIN author_settings asa$index ON (asa$index.author_id = aa.author_id AND asa$index.setting_name = 'affiliation' AND asa$index.locale = '$locale')
72 if (isset($initial)) {
73 if ($initial ==
'-') {
74 $initialSql .=
"(asf$index.setting_value IS NULL OR asf$index.setting_value = '')";
75 if ($index < $supportedLocalesCount - 1) {
76 $initialSql .=
' AND ';
80 $initialSql .=
"LOWER(asf$index.setting_value) LIKE LOWER(?)";
81 if ($index < $supportedLocalesCount - 1) {
82 $initialSql .=
' OR ';
88 if (isset($initial)) {
93 'SELECT a.*, ug.show_title, p.locale,
94 COALESCE(agl.setting_value, agpl.setting_value) AS author_given,
95 CASE WHEN agl.setting_value <> \'\' THEN afl.setting_value ELSE afpl.setting_value END AS author_family
97 JOIN user_groups ug ON (a.user_group_id = ug.user_group_id)
98 JOIN publications p ON (p.publication_id = a.publication_id)
99 JOIN submissions s ON (s.current_publication_id = p.publication_id)
100 LEFT JOIN author_settings agl ON (a.author_id = agl.author_id AND agl.setting_name = ? AND agl.locale = ?)
101 LEFT JOIN author_settings agpl ON (a.author_id = agpl.author_id AND agpl.setting_name = ? AND agpl.locale = p.locale)
102 LEFT JOIN author_settings afl ON (a.author_id = afl.author_id AND afl.setting_name = ? AND afl.locale = ?)
103 LEFT JOIN author_settings afpl ON (a.author_id = afpl.author_id AND afpl.setting_name = ? AND afpl.locale = p.locale)
106 MIN(aa.author_id) as author_id,
108 ' . ($includeEmail ?
'aa.email,' :
'CAST(\'\' AS CHAR),') .
'
112 ' . $sqlColumnsAuthorSettings .
'
115 JOIN publications pp ON (pp.publication_id = aa.publication_id)
116 LEFT JOIN publication_settings ppss ON (ppss.publication_id = pp.publication_id)
117 JOIN submissions ss ON (ss.submission_id = pp.submission_id AND ss.current_publication_id = pp.publication_id AND ss.status = ' . STATUS_PUBLISHED .
')
118 JOIN journals j ON (ss.context_id = j.journal_id)
119 LEFT JOIN author_settings ac ON (ac.author_id = aa.author_id AND ac.setting_name = \'country\')
120 ' . $sqlJoinAuthorSettings .
'
122 ' . (isset($journalId) ?
' AND j.journal_id = ?' :
'')
125 ) as t1 ON (t1.author_id = a.author_id)
126 ORDER BY author_family, author_given',