1
|
|
|
<? |
2
|
|
|
/** |
3
|
|
|
* @param CloudControl\Cms\storage\Document $document |
4
|
|
|
* @param string $cmsPrefix |
5
|
|
|
* @param string $slugPrefix |
6
|
|
|
* @param \CloudControl\Cms\cc\Request $request |
7
|
|
|
*/ |
8
|
|
|
function renderDocument($document, $cmsPrefix, $slugPrefix = '', $request) |
9
|
|
|
{ ?> |
10
|
|
|
<div class="grid-box-10"> |
11
|
|
|
<h3> |
12
|
|
|
<a class="btn documentTitle" href="<?= $request::$subfolders ?><?= $cmsPrefix ?>/documents/edit-document?slug=<?= $slugPrefix . $document->slug ?>" title="Edit"> |
13
|
|
|
<i class="fa fa-file-text-o"></i> |
14
|
|
|
<small class="state <?= strtolower($document->state) ?>"> |
15
|
|
|
<i class="fa <?= $document->state == 'published' ? 'fa-check-circle-o' : 'fa-times-circle-o' ?>"></i></small> |
16
|
|
|
<?= $document->title ?> |
17
|
|
|
</a> |
18
|
|
|
<? if ($document->unpublishedChanges) : ?> |
|
|
|
|
19
|
|
|
<small class="small unpublished-changes">Unpublished Changes</small><? endif ?> |
20
|
|
|
<small class="small documentType"><?= $document->documentType ?></small> |
21
|
|
|
<small class="small lastModified" title="<?= date('r', $document->lastModificationDate) ?>"> |
22
|
|
|
<span class="label">Modified:</span> |
23
|
|
|
<?= \CloudControl\Cms\cc\StringUtil::timeElapsedString($document->lastModificationDate) ?> |
24
|
|
|
</small> |
25
|
|
|
<small class="small lastModifiedBy"> |
26
|
|
|
<span class="label">By:</span> |
27
|
|
|
<?= $document->lastModifiedBy ?> |
28
|
|
|
</small> |
29
|
|
|
</h3> |
30
|
|
|
</div> |
31
|
|
|
<div class="documentActions grid-box-2"> |
32
|
|
View Code Duplication |
<? if ($document->state == 'unpublished' || $document->unpublishedChanges) : ?> |
|
|
|
|
33
|
|
|
<? renderAction('Publish', |
34
|
|
|
'publish', |
35
|
|
|
$request::$subfolders . $cmsPrefix . '/documents/publish-document?slug=' . $slugPrefix . $document->slug, |
36
|
|
|
'check'); ?> |
37
|
|
|
<? endif ?> |
38
|
|
|
<? if ($document->state == 'published') : ?> |
39
|
|
|
<? renderAction('Unpublish', |
40
|
|
|
'unpublish', |
41
|
|
|
$request::$subfolders . $cmsPrefix . '/documents/unpublish-document?slug=' . $slugPrefix . $document->slug, |
42
|
|
|
'times'); ?> |
43
|
|
|
<? endif ?> |
44
|
|
|
<? renderAction('Edit', |
45
|
|
|
'', |
46
|
|
|
$request::$subfolders . $cmsPrefix . '/documents/edit-document?slug=' . $slugPrefix . $document->slug, |
47
|
|
|
'pencil'); ?> |
48
|
|
View Code Duplication |
<? if ($document->state == 'unpublished') : ?> |
|
|
|
|
49
|
|
|
<? renderAction('Delete', |
50
|
|
|
'error', |
51
|
|
|
$request::$subfolders . $cmsPrefix . '/documents/delete-document?slug=' . $slugPrefix . $document->slug, |
52
|
|
|
'trash', |
53
|
|
|
'return confirm(\'Are you sure you want to delete this document?\');'); ?> |
|
|
|
|
54
|
|
|
<? endif ?> |
55
|
|
|
</div> |
56
|
|
|
<? } ?> |
57
|
|
|
|
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.