/
FEUChecklist.module.php
executable file
·167 lines (140 loc) · 3.29 KB
/
FEUChecklist.module.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php // -*- mode:php; tab-width:4; indent-tabs-mode:t; c-basic-offset:4; -*-
# FEUChecklist - A CMS Made Simple Module
# Created By: Ted Kulp <ted@shiftrefresh.net>
# Copyright (c) 2011
#
# CMS - CMS Made Simple
# (c)2004 by Ted Kulp (ted@cmsmadesimple.org)
# This project's homepage is: http://www.cmsmadesimple.org
$cgextensions = cms_join_path($gCms->config['root_path'],'modules', 'CGExtensions','CGExtensions.module.php');
if (!is_readable($cgextensions))
{
echo '<h1><font color="red">ERROR: The CGExtensions module could not be found.</font></h1>';
return;
}
require_once($cgextensions);
class FEUChecklist extends CGExtensions
{
function GetName()
{
return 'FEUChecklist';
}
function GetChangeLog()
{
return $this->Lang('changelog');
}
function GetFriendlyName()
{
return $this->Lang('friendlyname');
}
function GetVersion()
{
return '0.2';
}
function GetHelp()
{
return $this->Lang('help');
}
function GetAuthor()
{
return 'Ted Kulp';
}
function GetAuthorEmail()
{
return 'ted@shiftrefresh.net';
}
function IsPluginModule()
{
return true;
}
function HasAdmin()
{
return true;
}
function IsAdminOnly()
{
return false;
}
function GetAdminSection()
{
return 'content';
}
function GetAdminDescription()
{
return $this->Lang('moddescription');
}
function MinimumCMSVersion()
{
return "1.9.2";
}
function GetDependencies()
{
return array('CGExtensions' => '1.19.4', 'CGSimpleSmarty' => '1.4.4', 'FrontEndUsers' => '1.12.8');
}
function VisibleToAdminUser()
{
return true;
//$this->CheckPermission('Modify Site Preferences');
}
function SetParameters()
{
$this->RegisterModulePlugin();
}
function RegisterEvents()
{
$this->AddEventHandler('FrontEndUsers', 'OnCreateUser', false);
$this->AddEventHandler('FrontEndUsers', 'OnUpdateUser', false);
$this->AddEventHandler('FrontEndUsers', 'OnDeleteUser', false);
}
function DoEvent($originator, $eventname, &$params)
{
if ($originator == 'FrontEndUsers')
{
switch ($eventname)
{
case 'OnCreateUser':
//$params['name']
//$params['id']
$this->AddUser($params['id']);
break;
case 'OnDeleteUser':
//$params['username']
//$params['id']
//$params['props'] = array()
$this->DeleteUser($params['id']);
break;
}
}
}
function AddUser($user_id)
{
}
function DeleteUser($user_id)
{
$gCms = cmsms();
$db = $gCms->GetDb();
$db->Execute("DELETE FROM " . cms_db_prefix() . "module_feuchecklist_checked_items WHERE user_id = ?", array($user_id));
}
function GetItemUploadPath($item_id = '')
{
$gCms = cmsms();
$config = $gCms->GetConfig();
if ($item_id == '')
$item_id = 'tmp';
return $config['uploads_url'] . '/feu_checklist_files/item_' . $item_id;
}
function GetItemUploadDirectory($item_id = '')
{
$gCms = cmsms();
$config = $gCms->GetConfig();
if ($item_id == '')
$item_id = 'tmp';
return cms_join_path($config['uploads_path'], 'feu_checklist_files', 'item_' . $item_id);
}
function ItemUploadDirectoryExists($item_id = '')
{
$path = $this->GetItemUploadDirectory($item_id);
return is_dir($path);
}
}
# vim:ts=4 sw=4 noet