forked from mapasculturais/mapasculturais
-
Notifications
You must be signed in to change notification settings - Fork 0
/
editable-entity.php
39 lines (35 loc) · 1.44 KB
/
editable-entity.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
<?php
if (!$this->isEditable() && !$entity->canUser('modify')){
?><div id="editable-entity" class="clearfix sombra js-not-editable" style='display:none; min-height:0; height:42px;'></div><?php
return;
}
$can_edit_roles = $this->controller->id == 'agent' && $entity->user->id != $app->user->id && $entity->id == $entity->user->profile->id && $entity->user->canUser('addRole');
if($this->isEditable()){
$classes = 'editable-entity-edit';
if($can_edit_roles)
$classes .= ' can-edit-roles';
}else{
$classes = 'editable-entity-single';
}
$class = $entity->getClassName();
$params = [
'entity' => $entity,
'status_draft' => $class::STATUS_DRAFT,
'status_enabled' => $class::STATUS_ENABLED,
'status_trash' => $class::STATUS_TRASH,
'status_archived' => $class::STATUS_ARCHIVED
];
?>
<div id="editable-entity" class="clearfix sombra <?php echo $classes ?>" data-action="<?php echo $action; ?>" data-entity="<?php echo $this->controller->id ?>" data-id="<?php echo $entity->id ?>">
<?php $this->part('editable-entity-logo') ?>
<div class="controles">
<?php if ($this->isEditable()): ?>
<?php if ($can_edit_roles): ?>
<?php $this->part('singles/control--roles', $params) ?>
<?php endif; ?>
<?php $this->part('singles/control--edit-buttons', $params) ?>
<?php else: ?>
<?php $this->part('singles/control--view-buttons', $params) ?>
<?php endif; ?>
</div>
</div>