Changeset 9148 for extensions/AddInfo/main.inc.php
- Timestamp:
- Feb 10, 2011, 2:49:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AddInfo/main.inc.php
r8986 r9148 17 17 define('ADDINFO_TABLE' , $prefixeTable . 'AddInfo_images'); 18 18 19 //Ajout du menu admin 20 add_event_handler('get_admin_plugin_menu_links', 'addinfo_admin_menu'); 21 function addinfo_admin_menu($menu) 22 { 23 array_push($menu, array( 24 'NAME' => 'AddInfo', 25 'URL' => get_admin_plugin_menu_link(ADDINFO_PATH . 'admin/admin.php'))); 26 return $menu; 27 } 28 29 //Ajout du prefiltre 30 31 add_event_handler('loc_begin_picture', 'adddinfoI', 55 ); 32 33 function adddinfoI() 34 { 35 global $template; 36 $template->set_prefilter('picture', 'adddinfoIT'); 37 } 38 39 function adddinfoIT($content, &$smarty) 40 { 41 $search = '#<tr id="datecreate">#'; 42 43 $replacement = ' 44 <tr id="info1"> 45 <td class="label">{\'addinfo_info1\'|@translate}</td> 46 <td class="value">{$INFO1}</td> 47 </tr> 48 <tr id="info2"> 49 <td class="label">{\'addinfo_info2\'|@translate}</td> 50 <td class="value">{$INFO2}</td> 51 </tr> 52 <tr id="info3"> 53 <td class="label">{\'addinfo_info3\'|@translate}</td> 54 <td class="value">{$INFO3}</td> 55 </tr> 56 <tr id="datecreate">'; 57 58 return preg_replace($search, $replacement, $content); 59 } 60 61 add_event_handler('loc_begin_picture', 'addInfoT'); 62 63 function addInfoT() 64 { 65 global $conf, $page, $template, $tab, $cit, $nbr ; 66 load_language('plugin.lang', ADDINFO_PATH); 67 load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) ); 68 69 // Affichage du bloc uniquement sur les page des photos 70 if ( !empty($page['image_id']) ) 71 { 72 73 $query = ' 74 select id,info1,info2,info3 75 FROM ' . ADDINFO_TABLE . ' 76 WHERE id = \''.$page['image_id'].'\' 77 ;'; 78 $result = pwg_query($query); 79 $row = mysql_fetch_array($result); 80 $idaddinfo=$row['id']; 81 $info1=$row['info1']; 82 $info2=$row['info2']; 83 $info3=$row['info3']; 84 85 // Envoi des données au template 86 $template->assign ( 87 array ( 88 'INFO1' => $info1, 89 'INFO2' => $info2, 90 'INFO3' => $info3 91 ) ); 92 } 19 // Plugin on picture page 20 if (script_basename() == 'picture') 21 { 22 include_once(dirname(__FILE__).'/initpicture.php'); 93 23 } 94 24 95 25 26 // Plugin for admin 27 if (script_basename() == 'admin') 28 { 29 include_once(dirname(__FILE__).'/initadmin.php'); 30 } 31 96 32 ?>
Note: See TracChangeset
for help on using the changeset viewer.