source: extensions/title/initadmin.php @ 11661

Last change on this file since 11661 was 9794, checked in by ddtddt, 13 years ago

[extensions] - title - add lv_LV (Latvian) thanks to Aivars Baldone

File size: 3.7 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', '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 id="associations"#';
29 
30  $replacement = '
31        <div>
32                <form method="post" >
33                        <fieldset>
34                          <br>
35                                <legend>{\'Title - Plugin title\'|@translate}</legend>
36                                        {\'title_photo\'|@translate}&nbsp;:&nbsp;<input type="text" name="inser" value="{$titleCONTENT}" size="110" maxlenght="110">
37                                <br>   
38                                <br>
39                                        <div style="text-align:center;">
40                                        <input class="submit" name="subtitlephoto" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} />
41                                        </div>
42                        </fieldset>
43                </form>
44        </div> 
45  <form id="associations"';
46
47  return preg_replace($search, $replacement, $content);
48        }
49 
50function titlePadminA()
51        { 
52                load_language('plugin.lang', TITLE_PATH);
53if (isset($_GET['image_id']))
54 {
55        global $template, $prefixeTable;
56$query = '
57select id,title
58  FROM ' . TITLE_PHOTO_TABLE . '
59  WHERE id = '.$_GET['image_id'].'
60  ;';
61$result = pwg_query($query);
62$row = mysql_fetch_array($result);
63$titleP=$row['title'];
64
65  $template->assign(
66    array(
67      'titleCONTENT' => $titleP,
68      ));
69 }
70 
71if (isset($_POST['subtitlephoto']))
72 {
73        $query = '
74DELETE
75  FROM ' . TITLE_PHOTO_TABLE . '
76  WHERE id = '.$_GET['image_id'].'
77  ;';
78$result = pwg_query($query);
79        $q = '
80INSERT INTO ' . $prefixeTable . 'title_photo(id,title)VALUES ('.$_GET['image_id'].',"'.$_POST['inser'].'");';
81    pwg_query($q);
82 
83  $template->assign(
84    array(
85      'titleCONTENT' => $_POST['inser'],
86      ));
87  }
88        }
89       
90//add prefiltre album
91add_event_handler('loc_end_cat_modify', 'titleAadminf', 60);
92add_event_handler('loc_end_cat_modify', 'titleAadminA', 60);
93
94function titleAadminf()
95 {
96        global $template;
97        $template->set_prefilter('categories', 'titleAadminfT');
98 }
99
100function titleAadminfT($content, &$smarty)
101 {
102  $search = '#name="reset">
103</p>#';
104 
105  $replacement = 'name="reset">
106</p>
107
108        <div>
109                <form method="post" >
110                        <fieldset>
111                          <br>
112                                <legend>{\'Title - Plugin title\'|@translate}</legend>
113                                        {\'title_album\'|@translate}&nbsp;:&nbsp;<input type="text" name="inser" value="{$titleCONTENT}" size="110" maxlenght="110">
114                                <br>   
115                                <br>
116                                        <div style="text-align:center;">
117                                        <input class="submit" name="subtitlealbum" type="submit" value="{\'title_insbase\'|@translate}" {$TAG_INPUT_ENABLED} />
118                                        </div>
119                        </fieldset>
120                </form>
121        </div>
122  ';
123
124  return preg_replace($search, $replacement, $content);
125 }
126
127 function titleAadminA()
128        { 
129                load_language('plugin.lang', TITLE_PATH);
130if (isset($_GET['cat_id']))
131 {
132        global $template, $prefixeTable;
133$query = '
134select id,title
135  FROM ' . TITLE_ALBUM_TABLE . '
136  WHERE id = '.$_GET['cat_id'].'
137  ;';
138$result = pwg_query($query);
139$row = mysql_fetch_array($result);
140$titleA=$row['title'];
141
142  $template->assign(
143    array(
144      'titleCONTENT' => $titleA,
145      ));
146 }
147 
148if (isset($_POST['subtitlealbum']))
149 {
150        $query = '
151DELETE
152  FROM ' . TITLE_ALBUM_TABLE . '
153  WHERE id = '.$_GET['cat_id'].'
154  ;';
155$result = pwg_query($query);
156        $q = '
157INSERT INTO ' . $prefixeTable . 'title_album(id,title)VALUES ('.$_GET['cat_id'].',"'.$_POST['inser'].'");';
158    pwg_query($q);
159               
160  $template->assign(
161    array(
162      'titleCONTENT' => $_POST['inser'],
163      ));
164  }
165        }
166
167?>
Note: See TracBrowser for help on using the repository browser.