forked from hubzero/hubzero-cms
/
publication.php
2318 lines (2050 loc) · 51 KB
/
publication.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* HUBzero CMS
*
* Copyright 2005-2015 HUBzero Foundation, LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* HUBzero is a registered trademark of Purdue University.
*
* @package hubzero-cms
* @author Alissa Nedossekina <aliasa@purdue.edu>
* @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
* @license http://opensource.org/licenses/MIT MIT
*/
namespace Components\Publications\Models;
use Hubzero\Base\Object;
use Components\Publications\Helpers;
use Components\Publications\Tables;
use Hubzero\Base\ItemList;
// Include table classes
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'publication.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'version.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'access.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'audience.level.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'audience.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'author.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'license.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'category.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'master.type.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'screenshot.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'attachment.php');
require_once(dirname(__DIR__) . DS . 'tables' . DS . 'logs.php');
// Projects
require_once(PATH_CORE . DS . 'components'.DS .'com_projects' . DS . 'models' . DS . 'project.php');
require_once(PATH_CORE . DS . 'components'.DS .'com_projects' . DS . 'models' . DS . 'repo.php');
// Common models
require_once(__DIR__ . DS . 'curation.php');
require_once(__DIR__ . DS . 'doi.php');
// Helpers
require_once(dirname(__DIR__) . DS . 'helpers' . DS . 'html.php');
require_once(dirname(__DIR__) . DS . 'helpers' . DS . 'utilities.php');
require_once(dirname(__DIR__) . DS . 'helpers' . DS . 'tags.php');
/**
* Information retrieval for items/info linked to a publication
*/
class Publication extends Object
{
/**
* Authorized
*
* @var mixed
*/
private $_authorized = false;
/**
* Database
*
* @var object
*/
private $_db = null;
/**
* Container for properties
*
* @var array
*/
private $_data = array();
/**
* Constructor
*
* @param integer $oid Publication ID or alias
* @param string $version Publication version number or alias (dev/default)
* @param integer $vid Publication version ID
* @return void
*/
public function __construct($oid = null, $version = 'default', $vid = null)
{
$this->_db = \App::get('db');
if (is_object($oid))
{
// This mapping is used in item listings
$this->version = new Tables\Version($this->_db);
$this->version->bind($oid);
$this->publication = new Tables\Publication($this->_db);
$this->publication->bind($oid);
// Map values
foreach ($oid as $field => $value)
{
$this->$field = $value;
}
// Some adjustments
$this->version->id = $this->get('version_id');
$this->params = Component::params('com_publications');
$this->params->merge(new \Hubzero\Config\Registry($this->version->params));
if (isset($this->version->type_params))
{
$this->params->merge($this->version->type_params);
}
}
else
{
$this->version = new Tables\Version($this->_db);
$this->publication = new Tables\Publication($this->_db);
// Load version & master record
if (intval($vid))
{
$this->version->load($vid);
$oid = $this->version->publication_id;
$this->publication->loadPublication($oid);
}
elseif ($oid)
{
$this->publication->loadPublication($oid);
$this->version->loadVersion($this->publication->id, $version);
}
// Get what we need
$this->masterType();
$this->category();
// Map values for easy access
foreach ($this->version as $field => $value)
{
$this->$field = $value;
}
$this->version_id = $this->version->id;
$this->id = $this->publication->id;
$this->base = $this->_type->alias;
$this->curatorgroup = $this->_type->curatorgroup;
// Map master values
foreach ($this->publication as $field => $value)
{
if (isset($this->$field))
{
$masterField = 'master_' . $field;
$this->$masterField = $value;
}
else
{
$this->$field = $value;
}
}
// Collect params
$this->params = Component::params('com_publications');
$this->params->merge(new \Hubzero\Config\Registry($this->version->params));
$this->params->merge($this->_type->_params);
}
// Set version alias
$this->versionAlias($version);
}
/**
* Returns a reference to an article model
*
* @param mixed $oid ID or alias
* @return object
*/
static function &getInstance($oid=null)
{
static $instances;
if (!isset($instances))
{
$instances = array();
}
if (is_object($oid))
{
$key = $oid->id;
}
else if (is_array($oid))
{
$key = $oid['id'];
}
else
{
$key = $oid;
}
if (!isset($instances[$key]))
{
$instances[$key] = new self($oid);
}
return $instances[$key];
}
/**
* Check if a property is set
*
* @param string $property Name of property to set
* @return boolean True if set
*/
public function __isset($property)
{
return isset($this->_data[$property]);
}
/**
* Set a property
*
* @param string $property Name of property to set
* @param mixed $value Value to set property to
* @return void
*/
public function __set($property, $value)
{
$this->_data[$property] = $value;
}
/**
* Get a property
*
* @param string $property Name of property to retrieve
* @return mixed
*/
public function __get($property)
{
if (isset($this->_data[$property]))
{
return $this->_data[$property];
}
}
/**
* Get a configuration value
* If no key is passed, it returns the configuration object
*
* @param string $key Config property to retrieve
* @param mixed $default
* @return mixed
*/
public function config($key=null, $default=null)
{
if (!isset($this->_config))
{
$this->_config = Component::params('com_publications');
}
if ($key)
{
return $this->_config->get($key, $default);
}
return $this->_config;
}
/**
* Check if the publication exists
*
* @return bool
*/
public function masterExists()
{
if (empty($this->publication) || !$this->publication->id)
{
return false;
}
return true;
}
/**
* Check if the version exists
*
* @return bool
*/
public function exists()
{
if (empty($this->version) || !$this->get('version_id'))
{
return false;
}
return true;
}
/**
* Set/get version alternative label if applicable (dev/default)
*
* @param string $name
* @return mixed
*/
public function versionAlias($name = 'default')
{
if (!$this->exists())
{
return false;
}
if (!isset($this->versionAlias))
{
$this->versionAlias = $this->isMain() && !$this->isUnpublished() ? 'default' : $name;
$this->versionAlias = $this->isDev() ? 'dev' : $name;
}
return $this->versionAlias;
}
/**
* Check if the publication belongs to project
*
* @param int $projectId
* @return bool
*/
public function belongsToProject($projectId = null)
{
if (!$projectId)
{
return false;
}
if (!$this->masterExists())
{
return false;
}
if ($this->get('project_id') != $projectId)
{
return false;
}
return true;
}
/**
* Get version property
*
* @param string $property
* @param string $versionAlias dev/default
* @return mixed
*/
public function versionProperty($property = '', $versionAlias = 'default')
{
if (!$property || ($versionAlias != 'dev' && $versionAlias != 'default'))
{
return false;
}
$val = $versionAlias . '_' . $property;
if (!isset($this->$val))
{
$this->$val = $this->version->getAttribute(
$this->get('id'),
$versionAlias,
$property
);
}
return $this->$val;
}
/**
* Return a formatted created timestamp
*
* @param string $as What data to return
* @return string
*/
public function created($as='')
{
return $this->_date('created', $as);
}
/**
* Return a formatted modified timestamp
*
* @param string $as What data to return
* @return string
*/
public function modified($as='')
{
return $this->_date('modified', $as);
}
/**
* Return a formatted modified timestamp
*
* @param string $as What data to return
* @return string
*/
public function published($as='')
{
if ($this->get('accepted')
&& $this->get('accepted') != '0000-00-00 00:00:00'
&& $this->get('accepted') > $this->get('published_up'))
{
return $this->_date('accepted', $as);
}
return $this->_date('published_up', $as);
}
/**
* Return a formatted modified timestamp
*
* @param string $as What data to return
* @return string
*/
public function unpublished($as='')
{
return $this->_date('published_down', $as);
}
/**
* Return a formatted modified timestamp
*
* @param string $as What data to return
* @return string
*/
public function submitted($as='')
{
return $this->_date('submitted', $as);
}
/**
* Return a formatted modified timestamp
*
* @param string $as What data to return
* @return string
*/
public function accepted($as='')
{
return $this->_date('accepted', $as);
}
/**
* Return a formatted modified timestamp
*
* @param string $as What data to return
* @return string
*/
public function archived($as='')
{
return $this->_date('archived', $as);
}
/**
* Return a formatted modified timestamp
*
* @param string $as What data to return
* @return string
*/
public function released($as='')
{
return $this->_date('released', $as);
}
/**
* Does publication have future release date?
*
* @return boolean
*/
public function isEmbargoed()
{
if (!$this->get('published_up') || $this->get('published_up') == $this->_db->getNullDate())
{
return false;
}
if (Date::of($this->get('published_up'))->toUnix() > Date::toUnix())
{
return true;
}
return false;
}
/**
* Determine future archive date
*
* @return mixed
*/
public function futureArchivalDate()
{
if ($this->accepted())
{
$archDate = Date::of($this->get('accepted') . '+1 month')->toSql();
if (Date::of($archDate)->toUnix() > Date::toUnix())
{
return $archDate;
}
}
return null;
}
/**
* Return a formatted timestamp
*
* @param string $key Field to return
* @param string $as What data to return
* @return string
*/
protected function _date($key, $as='')
{
if ($this->get($key) == $this->_db->getNullDate())
{
return null;
}
switch (strtolower($as))
{
case 'date':
return Date::of($this->get($key))->toLocal(Lang::txt('DATE_FORMAT_HZ1'));
break;
case 'time':
return Date::of($this->get($key))->toLocal(Lang::txt('TIME_FORMAT_HZ1'));
break;
case 'datetime':
return $this->_date($key, 'date') . ' @ ' . $this->_date($key, 'time');
break;
case 'timeago':
return \Components\Projects\Helpers\Html::timeAgo($this->get($key));
break;
default:
return $this->get($key);
break;
}
}
/**
* Get the home project of this entry
*
* @return object Models\Project
*/
public function project()
{
if (empty($this->_project))
{
$this->_project = new \Components\Projects\Models\Project($this->publication->project_id);
$this->_project->_params = new \Hubzero\Config\Registry($this->_project->params);
}
return $this->_project;
}
/**
* Get last public release
*
* @return mixed
*/
public function lastPublicRelease()
{
if (!isset($this->_lastPublicRelease))
{
$pid = empty($this->publication->id) ? $this->version->publication_id : $this->publication->id;
$this->_lastPublicRelease = $this->version->getLastPubRelease($pid);
}
return $this->_lastPublicRelease;
}
/**
* Get the master type of this entry
*
* @return mixed
*/
public function masterType()
{
if (empty($this->_type))
{
$this->_type = new Tables\MasterType($this->_db);
$this->_type->load($this->publication->master_type);
$this->_type->_params = new \Hubzero\Config\Registry($this->_type->params);
}
return $this->_type;
}
/**
* Set curation
* Get & apply manifest from saved record or master type)
*
* @param boolean $setProgress Get status of each section
* @return mixed
*/
public function setCuration($setProgress = true)
{
if (!$this->exists())
{
return null;
}
$this->masterType();
$this->project();
if (!isset($this->_curationModel))
{
// Get manifest from either version record (published) or master type
$manifest = $this->version->curation
? $this->version->curation
: $this->_type->curation;
// Get curation model
$this->_curationModel = new Curation($manifest, $this->_type->curation);
// Set pub assoc and load curation
$this->_curationModel->setPubAssoc($this, $setProgress);
}
return $this->_curationModel;
}
/**
* Get curation model or its properties
*
* @param string $property
* @param int $blockId
* @param string $blockProperty
* @param int $elementId
* @return mixed
*/
public function curation($property = null, $blockId = null, $blockProperty = null, $elementId = null)
{
if (!isset($this->_curationModel))
{
$this->setCuration();
}
switch ($property)
{
case 'progress':
return $this->_curationModel->_progress;
break;
case 'blocks':
if ($blockId && isset($this->_curationModel->_progress->blocks->$blockId))
{
if ($blockProperty)
{
switch ($blockProperty)
{
case 'complete':
return $this->_curationModel->_progress->blocks->$blockId->status->status;
break;
case 'elementStatus':
if ($elementId && isset($this->_curationModel->_progress->blocks->$blockId->status->elements->$elementId))
{
return $this->_curationModel->_progress->blocks->$blockId->status->elements->$elementId->status;
}
break;
case 'elements':
if ($elementId)
{
if (isset($this->_curationModel->_progress->blocks->$blockId->manifest->elements->$elementId))
{
return $this->_curationModel->_progress->blocks->$blockId->manifest->elements->$elementId;
}
else
{
$first = $this->curation('blocks', $blockId, 'firstElement');
return $this->_curationModel->_progress->blocks->$blockId->manifest->elements->$first;
}
}
return $this->_curationModel->_progress->blocks->$blockId->manifest->elements;
break;
case 'props':
return $this->_curationModel->_progress->blocks->$blockId->name . '-' . $blockId;
break;
case 'required':
return isset($this->_curationModel->_progress->blocks->$blockId->manifest->params->required) ? $this->_curationModel->_progress->blocks->$blockId->manifest->params->required : 0;
break;
case 'hasElements':
return empty($this->_curationModel->_progress->blocks->$blockId->manifest->elements) ? false : true;
break;
default:
if (isset($this->_curationModel->_progress->blocks->$blockId->$blockProperty))
{
return $this->_curationModel->_progress->blocks->$blockId->$blockProperty;
}
else
{
return null;
}
break;
}
}
return $this->_curationModel->_progress->blocks->$blockId;
}
elseif ($blockId)
{
// Block does not exist or is inactive
return false;
}
return $this->_curationModel->_progress->blocks;
break;
case 'complete':
return $this->_curationModel->_progress->complete;
break;
case 'lastBlock':
return $this->_curationModel->_progress->lastBlock;
break;
case 'firstBlock':
return $this->_curationModel->_progress->firstBlock;
break;
case 'params':
return $this->_curationModel->_manifest->params;
break;
default:
return $this->_curationModel;
break;
}
}
/**
* Get the category of this entry
*
* @return mixed
*/
public function category()
{
if (empty($this->_category))
{
$this->_category = new Tables\Category($this->_db);
$this->_category->load($this->publication->category);
$this->_category->_params = new \Hubzero\Config\Registry($this->_category->params);
}
return $this->_category;
}
/**
* Get the authors of this entry
*
* @return mixed
*/
public function authors()
{
if (!isset($this->_tblAuthors))
{
$this->_tblAuthors = new Tables\Author($this->_db);
}
if (!$this->exists())
{
return array();
}
if (!isset($this->_authors))
{
$this->_authors = $this->_tblAuthors->getAuthors($this->version->id);
$this->_submitter = $this->_tblAuthors->getSubmitter($this->version->id, $this->version->created_by);
}
return $this->_authors;
}
/**
* Get publication table
*
* @param string $name
* @return object
*/
public function table($name = null)
{
if ($name == 'Author')
{
if (!isset($this->_tblAuthor))
{
$this->_tblAuthor = new Tables\Author($this->_db);
}
return $this->_tblAuthor;
}
if ($name == 'Content')
{
if (!isset($this->_tblContent))
{
$this->_tblContent = new Tables\Attachment($this->_db);
}
return $this->_tblContent;
}
if ($name == 'License')
{
if (!isset($this->_tblLicense))
{
$this->_tblLicense = new Tables\License($this->_db);
}
return $this->_tblLicense;
}
return $this->publication;
}
/**
* Get unlinked contributors
*
* @param boolean $incSubmitter
* @return string
*/
public function getUnlinkedContributors($incSubmitter = false)
{
if (!$this->exists())
{
return array();
}
$contributors = $this->authors();
$html = '';
if (!empty($contributors))
{
$names = array();
foreach ($contributors as $contributor)
{
if ($incSubmitter == false && $contributor->role == 'submitter')
{
continue;
}
if ($contributor->lastName || $contributor->firstName)
{
$name = stripslashes($contributor->lastName);
if (strstr($contributor->firstName, ' '))
{
$parts = explode(' ', $contributor->firstName);
$contributor->firstName = array_shift($parts);
$contributor->middleName = implode(' ', $parts);
}
$name .= ', ' . substr(stripslashes($contributor->firstName), 0, 1) . '.';
if ($contributor->middleName)
{
$name .= ' ' . substr(stripslashes($contributor->middleName), 0, 1) . '.';
}
}
else
{
$name = $contributor->name;
}
$name = str_replace('"', '"', $name);
$names[] = $name;
}
if (count($names) > 0)
{
$html = implode('; ', $names);
}
}
return $html;
}
/**
* Get submitter of this entry
*
* @return mixed
*/
public function submitter()
{
if (!$this->exists())
{
return array();
}
if (!isset($this->_submitter))
{
$this->authors();
}
return $this->_submitter;
}
/**
* Get project owner
*
* @return mixed
*/
public function owner()
{
if (!$this->exists())
{
return array();
}
if (!isset($this->_owner))
{
$objO = new \Components\Projects\Tables\Owner($this->_db);
$this->_owner = $objO->isOwner(User::get('id'), $this->publication->project_id);
}
return $this->_owner;
}
/**
* Get curator group names
*
* @return mixed
*/
public function curatorGroups()
{
if (!$this->exists() || !$this->masterType())
{
return array();
}
if (!isset($this->_curatorGroups))
{
$groups = array();
if ($this->_type->curatorgroup)
{
$groups[] = $this->_type->curatorgroup;
}
if ($this->params->get('curatorgroup'))
{
$groups[] = $this->params->get('curatorgroup');
}
$this->_curatorGroups = $groups;
}
return $this->_curatorGroups;
}
/**
* Get access group names
*
* @return mixed
*/
public function getAccessGroups()
{
if (!$this->exists() || !$this->masterType())
{
return array();
}
if (!isset($this->_accessGroups))
{
$paccess = new Tables\Access($this->_db);
$aGroups = $paccess->getGroups($this->version->id, $this->publication->id);
$this->_accessGroups = $this->getGroupProperty($aGroups);
}
return $this->_accessGroups;
}
/**
* Get group property
*
* @param object $groups
* @param string $get
* @return array
*/
public function getGroupProperty($groups, $get = 'cn')
{
$arr = array();
if (!empty($groups))
{
foreach ($groups as $group)
{
if ($group->regconfirmed)
{
$arr[] = $get == 'cn' ? $group->cn : $group->gidNumber;
}
}
}
return $arr;
}
/**
* Get publication content
*
* @param bool $reload
* @return mixed
*/
public function attachments($reload = false)
{
if (!$this->exists())
{
return array();
}
if (!isset($this->_tblContent))
{
$this->_tblContent = new Tables\Attachment($this->_db);
}
if (!isset($this->_attachments) || $reload == true)
{
$this->_attachments = $this->_tblContent->sortAttachments ($this->version->id);
}