XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
permissions.php
Go to the documentation of this file.
1 <?php
20 include 'admin_header.php';
23 echo $indexAdmin->addNavigation('permissions.php');
24 
25 $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "edit";
26 
28 switch ($op ) {
29 case "visibility":
30  //redirect_header("visibility.php", 0, _PROFILE_AM_PROF_VISIBLE);
31  header("Location: visibility.php");
32  break;
33 
34 case "edit":
35  $title_of_form = _PROFILE_AM_PROF_EDITABLE;
36  $perm_name = "profile_edit";
37  $restriction = "field_edit";
38  $anonymous = false;
39  break;
40 
41 case "search":
42  $title_of_form = _PROFILE_AM_PROF_SEARCH;
43  $perm_name = "profile_search";
44  $restriction = "";
45  $anonymous = true;
46  break;
47 
48 case "access":
49  $title_of_form = _PROFILE_AM_PROF_ACCESS;
50  $perm_name = "profile_access";
52  $restriction = "";
53  $anonymous = true;
54  break;
55 }
56 
57 include_once $GLOBALS['xoops']->path( "/class/xoopsformloader.php" );
58 $opform = new XoopsSimpleForm('', 'opform', 'permissions.php', "get");
59 $op_select = new XoopsFormSelect("", 'op', $op);
60 $op_select->setExtra('onchange="document.forms.opform.submit()"');
61 $op_select->addOption('visibility', _PROFILE_AM_PROF_VISIBLE);
62 $op_select->addOption('edit', _PROFILE_AM_PROF_EDITABLE);
63 $op_select->addOption('search', _PROFILE_AM_PROF_SEARCH);
64 $op_select->addOption('access', _PROFILE_AM_PROF_ACCESS);
65 $opform->addElement($op_select);
66 $opform->display();
67 
68 $module_id = $GLOBALS['xoopsModule']->getVar('mid');
69 include_once $GLOBALS['xoops']->path( '/class/xoopsform/grouppermform.php' );
70 $form = new XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc, 'admin/permissions.php', $anonymous);
71 
72 if ( $op == "access" ) {
73  $member_handler =& xoops_gethandler('member');
74  $glist = $member_handler->getGroupList();
75  foreach (array_keys($glist) as $i ) {
76  if ( $i != XOOPS_GROUP_ANONYMOUS ) {
77  $form->addItem($i, $glist[$i]);
78  }
79  }
80 
81 } else {
83  $fields = $profile_handler->loadFields();
84 
85  if ( $op != "search" ) {
86  foreach (array_keys($fields) as $i ) {
87  if ( $restriction == "" || $fields[$i]->getVar($restriction) ) {
88  $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25) );
89  }
90  }
91  } else {
92  $searchable_types = array('textbox',
93  'select',
94  'radio',
95  'yesno',
96  'date',
97  'datetime',
98  'timezone',
99  'language');
100  foreach (array_keys($fields) as $i ) {
101  if ( in_array($fields[$i]->getVar('field_type'), $searchable_types) ) {
102  $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25) );
103  }
104  }
105  }
106 }
107 $form->display();
108 include 'admin_footer.php';
109 //xoops_cp_footer();