root/modules/branches/2.1/featurecodeadmin/functions.inc.php

Revision 1792, 0.9 kB (checked in by diego_iastrubni, 7 years ago)

removed executable properties from these modules

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
Line 
1 <?php
2
3 function featurecodeadmin_update($req) {
4   foreach ($req as $key => $item) {
5     // Split up...
6     // 0 - action
7     // 1 - modulename
8     // 2 - featurename
9     $arr = explode("#", $key);
10     if (count($arr) == 3) {
11       $action = $arr[0];
12       $modulename = $arr[1];
13       $featurename = $arr[2];
14       $fieldvalue = $item;
15       
16       // Is there a more efficient way of doing this?
17       switch ($action)
18       {
19         case "ena":
20           $fcc = new featurecode($modulename, $featurename);
21           if ($fieldvalue == 1) {
22             $fcc->setEnabled(true);
23           } else {
24             $fcc->setEnabled(false);
25           }
26           $fcc->update();
27           break;
28         case "custom":
29           $fcc = new featurecode($modulename, $featurename);
30           if ($fieldvalue == $fcc->getDefault()) {
31             $fcc->setCode(''); // using default
32           } else {
33             $fcc->setCode($fieldvalue);
34           }
35           $fcc->update();
36           break;
37       }
38     }
39   }
40
41   needreload();
42 }
43 ?>
Note: See TracBrowser for help on using the browser.