-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.php
120 lines (96 loc) · 2.38 KB
/
admin.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
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* Wordcloud Module - Manage your words in a cloud
*
* @author Steve Williamson
* @package CMS
* @subpackage Wordcloud Module
* @category Modules
*/
class Admin extends Admin_Controller
{
// Set the section
protected $section = 'wordcloud';
public function __construct()
{
parent::__construct();
// Load all the required classes
$this->lang->load('wordcloud');
$this->load->driver('streams');
}
public function index()
{
// Set the title
$this->template->title(lang('wordcloud:list_title'));
// Set some extras
$extra = array(
'title' => lang('wordcloud:list_title'),
'buttons' => array(
array(
'label' => lang('global:edit'),
'url' => 'admin/wordcloud/edit/-entry_id-',
),
array(
'label' => lang('global:delete'),
'url' => 'admin/wordcloud/delete/-entry_id-',
'confirm' => true,
),
),
'filters' => array(),
);
$this->streams->cp->entries_table('wordcloud', 'wordcloud', $this->settings->get('records_per_page'), 'admin/wordcloud/index', true, $extra);
}
/**
* Add a new word
*
* @access public
* @return void
*/
public function create()
{
// Set the title
$this->template->title(lang('wordcloud:add_title'));
/* Start normal Streams_Core stuff
-----------------------------------*/
// Set some shit
$extra = array(
'return' => 'admin/wordcloud',
'title' => lang('wordcloud:add_title'),
);
// Build it
$this->streams->cp->entry_form('wordcloud', 'wordcloud', $mode = 'new', null, true, $extra);
}
// --------------------------------------------------------------------------
/**
* Edit a location
*
* @access public
* @return void
*/
public function edit($id)
{
// Set the title
$this->template->title(lang('wordcloud:edit_title'));
/* Start normal Streams_Core stuff
-----------------------------------*/
// Set some shit
$extra = array(
'return' => 'admin/wordcloud',
'title' => lang('wordcloud:edit_title'),
);
// Build it
$this->streams->cp->entry_form('wordcloud', 'wordcloud', $mode = 'edit', $id, true, $extra);
}
/**
* Delete an existing word
*
* @access public
* @return void
*/
public function delete($id)
{
$this->streams->entries->delete_entry($id, 'wordcloud','wordcloud');
redirect($_SERVER['HTTP_REFERER']);
}
}