-
Notifications
You must be signed in to change notification settings - Fork 452
/
Composer.php
79 lines (71 loc) · 2 KB
/
Composer.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
<?php
namespace Concrete\Core\Application\Service;
use Concrete\Core\Page\Page;
use Concrete\Core\Page\Type\Type;
use Concrete\Core\Permission\Key\Key;
use Concrete\Core\Page\Type\Composer\Control\Control as PageTypeComposerControl;
use View;
class Composer
{
/**
* @param Type $pagetype
* @param bool|\Page $page
*/
public function display(Type $pagetype, $page = false)
{
$pagetype->renderComposerOutputForm($page);
}
/**
* @param Type $pagetype
* @param bool|\Page $page
*/
public function displayButtons(Type $pagetype, $page = false)
{
View::element('page_types/composer/form/output/buttons', array(
'pagetype' => $pagetype,
'page' => $page,
));
}
/**
* @param Type $pt
* @param \Controller $cnt
*/
public function addAssetsToRequest(Type $pt, \Controller $cnt)
{
$list = PageTypeComposerControl::getList($pt);
foreach ($list as $l) {
$l->addAssetsToRequest($cnt);
}
}
public function getPublishButtonTitle(Page $c)
{
if ($c->isPageDraft()) {
$publishTitle = t('Publish Page');
} else {
$publishTitle = t('Publish Changes');
}
$pk = Key::getByHandle('approve_page_versions');
$pk->setPermissionObject($c);
$pa = $pk->getPermissionAccessObject();
$workflows = array();
$canApproveWorkflow = true;
if (is_object($pa)) {
$workflows = $pa->getWorkflows();
}
foreach ($workflows as $wf) {
if (!$wf->canApproveWorkflow()) {
$canApproveWorkflow = false;
}
}
if (count($workflows) > 0 && !$canApproveWorkflow) {
$publishTitle = t('Submit to Workflow');
}
return $publishTitle;
}
public function displayPublishScheduleSettings(Page $c = null)
{
View::element('pages/schedule', array(
'page' => $c,
));
}
}