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,
44 if (isset($journalId)) $params[] = $journalId;
46 $supportedLocales = array();
47 if ($journalId !==
null) {
49 $journal = $journalDao->getById($journalId);
50 $supportedLocales = $journal->getSupportedLocales();
53 $supportedLocales = $site->getSupportedLocales();
55 $supportedLocalesCount = count($supportedLocales);
56 $sqlJoinAuthorSettings = $sqlColumnsAuthorSettings = $initialSql =
'';
57 if (isset($initial)) {
58 $initialSql =
' AND (';
61 foreach ($supportedLocales as $locale) {
62 $localeStr = str_replace(
'@',
'_', $locale);
63 $sqlColumnsAuthorSettings .=
",
64 COALESCE(asg$index.setting_value, ''), ' ',
65 COALESCE(asf$index.setting_value, ''), ' ',
66 COALESCE(SUBSTRING(asa$index.setting_value FROM 1 FOR 255), ''), ' '
68 $sqlJoinAuthorSettings .=
"
69 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')
70 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')
71 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')
73 if (isset($initial)) {
74 if ($initial ==
'-') {
75 $initialSql .=
"(asf$index.setting_value IS NULL OR asf$index.setting_value = '')";
76 if ($index < $supportedLocalesCount - 1) {
77 $initialSql .=
' AND ';
81 $initialSql .=
"LOWER(asf$index.setting_value) LIKE LOWER(?)";
82 if ($index < $supportedLocalesCount - 1) {
83 $initialSql .=
' OR ';
89 if (isset($initial)) {
94 'SELECT a.*, ug.show_title, p.locale,
95 COALESCE(agl.setting_value, agpl.setting_value) AS author_given,
96 CASE WHEN agl.setting_value <> \'\' THEN afl.setting_value ELSE afpl.setting_value END AS author_family
98 JOIN user_groups ug ON (a.user_group_id = ug.user_group_id)
99 JOIN publications p ON (p.publication_id = a.publication_id)
100 JOIN submissions s ON (s.current_publication_id = p.publication_id)
101 LEFT JOIN author_settings agl ON (a.author_id = agl.author_id AND agl.setting_name = ? AND agl.locale = ?)
102 LEFT JOIN author_settings agpl ON (a.author_id = agpl.author_id AND agpl.setting_name = ? AND agpl.locale = p.locale)
103 LEFT JOIN author_settings afl ON (a.author_id = afl.author_id AND afl.setting_name = ? AND afl.locale = ?)
104 LEFT JOIN author_settings afpl ON (a.author_id = afpl.author_id AND afpl.setting_name = ? AND afpl.locale = p.locale)
107 MIN(aa.author_id) as author_id,
109 ' . ($includeEmail ?
'aa.email,' :
'CAST(\'\' AS CHAR),') .
'
113 ' . $sqlColumnsAuthorSettings .
'
116 JOIN publications pp ON (pp.publication_id = aa.publication_id)
117 LEFT JOIN publication_settings ppss ON (ppss.publication_id = pp.publication_id)
118 JOIN submissions ss ON (ss.submission_id = pp.submission_id AND ss.current_publication_id = pp.publication_id AND ss.status = ' . STATUS_PUBLISHED .
')
119 JOIN journals j ON (ss.context_id = j.journal_id)
120 JOIN issues i ON (ppss.setting_name = ? AND ppss.setting_value = CAST(i.issue_id AS CHAR) AND i.published = 1)
121 LEFT JOIN author_settings ac ON (ac.author_id = aa.author_id AND ac.setting_name = \'country\')
122 ' . $sqlJoinAuthorSettings .
'
124 ' . (isset($journalId) ?
' AND j.journal_id = ?' :
'')
127 ) as t1 ON (t1.author_id = a.author_id)
128 ORDER BY author_family, author_given',