source: extensions/MyPiwiShop/include/admin_events.inc.php @ 27781

Last change on this file since 27781 was 27781, checked in by Miklfe, 10 years ago
File size: 2.1 KB
Line 
1<?php
2defined('MPS_PATH') or die('Hacking attempt!');
3
4
5// admin plugins menu link
6function mps_admin_plugin_menu_links($menu) 
7{
8  $menu[] = array(
9    'NAME' => l10n('MyPiwiShop'),
10    'URL' => MPS_ADMIN,
11    );
12
13  return $menu;
14}
15
16//add an action to the Batch Manager unit
17function mps_loc_end_element_set_unit()
18{
19  include_once(MPS_PATH.'admin/MyPiwiShopBatchUnit.php');
20 
21  global $template;
22  $template->set_filename('mps_batch_unit', realpath(MPS_PATH.'admin/template/MyPiwiShopBatchUnit.tpl'));
23  $template->assign_var_from_handle('MPS_BATCH_UNIT', 'mps_batch_unit');
24  $template->set_prefilter('batch_manager_unit', 'batch_unit_form');
25}
26
27function batch_unit_form($content)
28{
29  $search = '#</table>(\s*)</fieldset>#s';
30  $replace ='</table>$1<div class="MyPiwiShopBatchUnit" style="text-align:left">{combine_script id="batchmanagerunit" load="footer" path="'.MPS_PATH.'/admin/template/js/batchmanagerunit.js"}
31  {include file="'.realpath(MPS_PATH).'/admin/template/MyPiwiShopBatchUnit.tpl" imgid=$element.id}</div>$1</fieldset>';
32
33  return preg_replace($search, $replace, $content);
34}
35
36//add an action to the Batch Manager
37function mps_loc_end_element_set_global()
38{
39  include_once(MPS_PATH.'admin/MyPiwiShopBatch.php');
40
41  global $template;
42  $template->set_filename('mps_batch_global', (MPS_PATH.'admin/template/MyPiwiShopBatch.tpl'));
43  $template->append('element_set_global_plugins_actions', array(
44   'ID' => 'mps', 
45   'NAME' => l10n('MyPiwiShop'), 
46   'CONTENT' => $template->parse('mps_batch_global', true)
47  ));
48}
49
50// perform added action
51function mps_element_set_global_action($action, $collection)
52{
53  if ($action == 'mps') {
54   global $page;
55       
56   if (empty($_POST['productcheck'])) {
57        $page['errors'][] = l10n('Select at least one product');
58   } else if ($_POST['thisprod']=='del') {
59        $product_id = $_POST['productcheck'];
60        deletAll_product_image($product_id, $collection);
61        $page['infos'][] = l10n('Products have been removed for these pictures');       
62   } else {
63    $product_id = $_POST['productcheck'];
64    add_product_image($product_id, $collection);
65        $page['infos'][] = l10n('products have been added to these images');   
66   }
67   
68  } 
69}
70
Note: See TracBrowser for help on using the repository browser.