/
admin_index.ctp
148 lines (141 loc) · 6.47 KB
/
admin_index.ctp
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
<?php
/**
* Comment Template.
*
* @todo -c Implement .this needs to be sorted out.
*
* Copyright (c) 2009 Carl Sutton ( dogmatic69 )
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2009 Carl Sutton ( dogmatic69 )
* @link http://www.dogmatic.co.za
* @package sort
* @subpackage sort.comments
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @since 0.5a
*/
echo $this->Form->create( 'Campaign', array( 'url' => array( 'controller' => 'campaigns', 'action' => 'mass', 'admin' => 'true' ) ) );
$massActions = $this->Letter->massActionButtons(
array(
'add',
'copy',
'toggle',
'delete'
)
);
echo $this->Letter->adminIndexHead( $this, $paginator, $filterOptions, $massActions );
?>
<div class="table">
<?php echo $this->Letter->adminTableHeadImages(); ?>
<table class="listing" cellpadding="0" cellspacing="0">
<?php
echo $this->Letter->adminTableHeader(
array(
$this->Form->checkbox( 'all' ) => array(
'class' => 'first',
'style' => 'width:25px;'
),
$paginator->sort( 'name' ),
$paginator->sort( 'description' ),
$paginator->sort( 'Template', 'Template.name' ),
$paginator->sort( __( 'Newsletters', true ), 'newsletter_count' ) => array(
'width' => '50px'
),
$paginator->sort( 'created' ) => array(
'style' => 'width:100px;'
),
$paginator->sort( 'modified' ) => array(
'style' => 'width:100px;'
),
__( 'Status', true ) => array(
'class' => 'actions',
'width' => '50px'
),
__( 'Actions', true ) => array(
'class' => 'last actions'
)
)
);
foreach( $campaigns as $campaign )
{
?>
<tr class="<?php echo $this->Letter->rowClass(); ?>">
<td><?php echo $this->Form->checkbox( $campaign['Campaign']['id'] ); ?> </td>
<td><?php echo $campaign['Campaign']['name']; ?></td>
<td><?php echo $campaign['Campaign']['description']; ?></td>
<td>
<?php
echo $this->Html->link(
$campaign['Template']['name'],
array(
'controller' => 'templates',
'action' => 'view',
$campaign['Template']['id']
)
);
?>
</td>
<td style="text-align:center;"><?php echo $campaign['Campaign']['newsletter_count']; ?></td>
<td><?php echo $this->Time->niceShort( $campaign['Campaign']['created'] ); ?></td>
<td><?php echo $this->Time->niceShort( $campaign['Campaign']['modified'] ); ?></td>
<td>
<?php
$newsletterStatuses = Set::extract( '/Newsletter/sent', $campaign );
$campaignSentStatus = true;
if ( empty( $newsletterStatuses ) )
{
echo $this->Html->link(
$this->Html->image(
'core/icons/actions/16/warning.png',
array(
'alt' => __( 'No Mails', true ),
'title' => __( 'This Campaign has no mails. Click to add some', true )
)
),
array(
'controller' => 'newsletters',
'action' => 'add',
'campaign_id' => $campaign['Campaign']['id']
),
array(
'escape' => false
)
);
}
else
{
foreach( $newsletterStatuses as $newsletterStatus )
{
$campaignSentStatus = $campaignSentStatus && $newsletterStatus;
}
if ( $campaignSentStatus )
{
echo __( 'All Sent', true );
}
else
{
echo $this->Status->toggle( $campaign['Campaign']['active'], $campaign['Campaign']['id'] );
}
}
echo $this->Status->locked( $campaign, 'Campaign' );
?>
</td>
<td>
<?php
echo $this->Html->link( 'edit', array( 'action' => 'edit', $campaign['Campaign']['id'] ) );
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
echo $this->Form->button( __( 'Delete', true ), array( 'value' => 'delete', 'name' => 'action' ) );
echo $this->Form->end();
?>
</div>
<?php echo $this->element( 'pagination/navigation' ); ?>