source: extensions/title/initadmin.php @ 16859

Last change on this file since 16859 was 14975, checked in by ddtddt, 12 years ago

[extensions] - title - update 2.4

File size: 3.6 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4
5//Add link menu
6add_event_handler('get_admin_plugin_menu_links', 'title_admin_menu');
7function title_admin_menu($menu)
8{
9  array_push($menu, array(
10        'NAME' => 'Title',
11    'URL' => get_admin_plugin_menu_link(TITLE_PATH . 'admin/admin.php')));
12  return $menu;
13}
14
15
16//add prefiltre photo
17add_event_handler('loc_begin_admin', 'titlePadminf',60);
18add_event_handler('loc_begin_admin_page', 'titlePadminA',60);
19
20function titlePadminf()
21        {
22        global $template;
23        $template->set_prefilter('picture_modify', 'titlePadminfT');
24        }
25
26function titlePadminfT($content, &$smarty)
27        {
28  $search = '#</form>#';
29 
30  $replacement = '
31        <div>
32                <fieldset>
33                  <br>
34                        <legend>{\'Title - Plugin title\'|@translate}</legend>
35                                {\'title_photo\'|@translate}&nbsp;:&nbsp;<input type="text" name="insertitleP" value="{$titleCONTENT}" size="110" maxlenght="110">
36                        <br>   
37                        <br>
38                                <div style="text-align:center;">
39                                <input class="submit" name="subtitlephoto" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} />
40                                </div>
41                </fieldset>
42        </div> 
43</form>';
44
45  return preg_replace($search, $replacement, $content);
46        }
47 
48function titlePadminA()
49        {
50                load_language('plugin.lang', TITLE_PATH);
51if (isset($_GET['image_id']))
52 {
53        global $template, $prefixeTable;
54$query = '
55select id,title
56  FROM ' . TITLE_PHOTO_TABLE . '
57  WHERE id = '.$_GET['image_id'].'
58  ;';
59$result = pwg_query($query);
60$row = mysql_fetch_array($result);
61$titleP=$row['title'];
62  $template->assign(
63    array(
64      'titleCONTENT' => $titleP,
65      ));
66 }
67 
68if (isset($_POST['subtitlephoto']))
69 {
70        $query = '
71DELETE
72  FROM ' . TITLE_PHOTO_TABLE . '
73  WHERE id = '.$_GET['image_id'].'
74  ;';
75$result = pwg_query($query);
76        $q = '
77INSERT INTO ' . $prefixeTable . 'title_photo(id,title)VALUES ('.$_GET['image_id'].',"'.$_POST['insertitleP'].'");';
78    pwg_query($q);
79 
80  $template->assign(
81    array(
82      'titleCONTENT' => $_POST['insertitleP'],
83      ));
84  }
85        }
86       
87//add prefiltre album
88add_event_handler('loc_end_cat_modify', 'titleAadminf', 60);
89add_event_handler('loc_end_cat_modify', 'titleAadminA', 60);
90
91function titleAadminf()
92 {
93        global $template;
94        $template->set_prefilter('album_properties', 'titleAadminfT');
95 }
96
97function titleAadminfT($content, &$smarty)
98 {
99  $search = '#</form>#';
100 
101  $replacement = '
102        <div>
103                <fieldset>
104                  <br>
105                        <legend>{\'Title - Plugin title\'|@translate}</legend>
106                                {\'title_album\'|@translate}&nbsp;:&nbsp;<input type="text" name="insertitleA" value="{$titleCONTENT}" size="110" maxlenght="110">
107                        <br>   
108                        <br>
109                                <div style="text-align:center;">
110                                <input class="submit" name="subtitlealbum" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} />
111                                </div>
112                </fieldset>
113        </div>
114</form>';
115
116  return preg_replace($search, $replacement, $content);
117 }
118
119 function titleAadminA()
120        { 
121                load_language('plugin.lang', TITLE_PATH);
122if (isset($_GET['cat_id']))
123 {
124        global $template, $prefixeTable;
125$query = '
126select id,title
127  FROM ' . TITLE_ALBUM_TABLE . '
128  WHERE id = '.$_GET['cat_id'].'
129  ;';
130$result = pwg_query($query);
131$row = mysql_fetch_array($result);
132$titleA=$row['title'];
133
134  $template->assign(
135    array(
136      'titleCONTENT' => $titleA,
137      ));
138 }
139 
140if (isset($_POST['subtitlealbum']))
141 {
142        $query = '
143DELETE
144  FROM ' . TITLE_ALBUM_TABLE . '
145  WHERE id = '.$_GET['cat_id'].'
146  ;';
147$result = pwg_query($query);
148        $q = '
149INSERT INTO ' . $prefixeTable . 'title_album(id,title)VALUES ('.$_GET['cat_id'].',"'.$_POST['insertitleA'].'");';
150    pwg_query($q);
151               
152  $template->assign(
153    array(
154      'titleCONTENT' => $_POST['insertitleA'],
155      ));
156  }
157        }
158
159?>
Note: See TracBrowser for help on using the repository browser.