Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
AuthorDAO.inc.php
1 <?php
2 
20 import('classes.monograph.Author');
21 import('classes.monograph.Monograph');
22 import('lib.pkp.classes.submission.PKPAuthorDAO');
23 
24 class AuthorDAO extends PKPAuthorDAO {
28  function AuthorDAO() {
29  parent::PKPAuthorDAO();
30  }
31 
42  function getAuthorsAlphabetizedByPress($pressId = null, $initial = null, $rangeInfo = null) {
43  $authors = array();
44  $params = array(
45  'affiliation', AppLocale::getPrimaryLocale(),
46  'affiliation', AppLocale::getLocale()
47  );
48 
49  if (isset($pressId)) $params[] = $pressId;
50  if (isset($initial)) {
51  $params[] = String::strtolower($initial) . '%';
52  $initialSql = ' AND LOWER(a.last_name) LIKE LOWER(?)';
53  } else {
54  $initialSql = '';
55  }
56 
57  $result = $this->retrieveRange(
58  'SELECT DISTINCT
59  CAST(\'\' AS CHAR) AS url,
60  a.author_id AS author_id,
61  a.submission_id AS submission_id,
62  CAST(\'\' AS CHAR) AS email,
63  0 AS primary_contact,
64  0 AS seq,
65  a.first_name AS first_name,
66  a.middle_name AS middle_name,
67  a.last_name AS last_name,
68  asl.setting_value AS affiliation_l,
69  asl.locale,
70  aspl.setting_value AS affiliation_pl,
71  aspl.locale AS primary_locale,
72  a.suffix AS suffix,
73  a.user_group_id AS user_group_id,
74  a.country
75  FROM authors a
76  LEFT JOIN author_settings aspl ON (a.author_id = aspl.author_id AND aspl.setting_name = ? AND aspl.locale = ?)
77  LEFT JOIN author_settings asl ON (a.author_id = asl.author_id AND asl.setting_name = ? AND asl.locale = ?)
78  JOIN submissions s ON (a.submission_id = s.submission_id)
79  WHERE s.status = ' . STATUS_PUBLISHED . ' ' .
80  (isset($pressId)?'AND s.context_id = ? ':'') . '
81  AND (a.last_name IS NOT NULL AND a.last_name <> \'\')' .
82  $initialSql . '
83  ORDER BY a.last_name, a.first_name',
84  $params,
85  $rangeInfo
86  );
87 
88  return new DAOResultFactory($result, $this, '_fromRow');
89  }
90 
95  function newDataObject() {
96  return new Author();
97  }
98 }
99 
100 ?>
Operations for retrieving and modifying Author objects.
Monograph author metadata class.
Definition: Author.inc.php:20
static getPrimaryLocale()
Operations for retrieving and modifying PKPAuthor objects.
& retrieveRange($sql, $params=false, $dbResultRange=null, $callHooks=true)
Definition: DAO.inc.php:174
static getLocale()
Wrapper around ADORecordSet providing &quot;factory&quot; features for generating objects from DAOs...
static strtolower($string)
Definition: String.inc.php:238
getAuthorsAlphabetizedByPress($pressId=null, $initial=null, $rangeInfo=null)