function renderOrganisation($type, $organisation = '', $organisation_owner = '', $target = '', $show_buttons = true) { if (!$organisation) { $organisation = Groups::getGroup($type, '', $organisation_owner); } $key_name = Groups::keyField($type); $id = $organisation->{$key_name}; if ($organisation) { $s = ''; if ($show_buttons && user_access('vals admin register')) { $pPath = request_path(); $edit_action = "onclick='ajaxCall(\"administration\", \"edit\", {type: \"{$type}\", id: {$id}, path: \"{$pPath}\", target: \"{$target}\"}, " . ($type == _STUDENT_GROUP ? "\"{$target}\");'" : "\"formResult\", \"html\", \"{$target}\");'"); $s .= "<div class='totheright'>"; $s .= "\t<input type='button' value='" . t('edit') . "' {$edit_action}/>"; // has the org signup period ended if so user cant add/delete entries, only edit if (vals_soc_access_check("dashboard/{$type}/administer/add_or_delete")) { $delete_action = "onclick='if(confirm(\"" . tt('Are you sure you want to delete this %1$s?', t_type($type)) . "\")){ajaxCall(\"administration\", \"delete\", {type: \"{$type}\", id: {$id}, path: \"{$pPath}\", target: \"{$target}\"}, \"refreshTabs\", \"json\", [\"{$type}\", \"{$target}\", \"administration\"]);}'"; $s .= "\t<input type='button' value='" . t('delete') . "' {$delete_action}/>"; } $s .= "</div>"; //$sub_type_user = ''; } $s .= formatMemberRecordNice($organisation, $type, $target); if ($type == _STUDENT_GROUP) { $s .= "<h2>" . t('Members') . "</h2>"; $students = Users::getStudents($id); $s .= renderStudents('', $students); } return $s; } else { return tt('You have no %1$s registered yet', $type); } }
// 'form' => $form, // '#attached' => $form['submit']['#attached'], // This will attach all needed JS behaviors onto the page // ); // Print $form renderForm($form, $target); // print drupal_render($form); // print valssoc_form_get_js($form);// Print JS //print drupal_get_js(); break; case 'showmembers': if ($_POST['type'] == _STUDENT_GROUP) { echo renderUsers(_STUDENT_TYPE, '', $_POST['id'], $_POST['type']); } elseif ($_POST['type'] == _INSTITUTE_GROUP) { $subtype = altSubValue($_GET, 'subtype', 'all'); if ($subtype == _STUDENT_TYPE) { echo renderStudents($_POST['id']); } elseif ($subtype == _SUPERVISOR_TYPE) { echo renderSupervisors($_POST['id']); } elseif ($subtype == _INSTADMIN_TYPE) { echo renderUsers(_INSTADMIN_TYPE, '', $_POST['id'], _INSTITUTE_GROUP); } elseif ($subtype == 'staff') { $inst_id = $_POST['id']; echo renderUsers(_INSTADMIN_TYPE, '', $inst_id, _INSTITUTE_GROUP, TRUE); echo renderUsers(_SUPERVISOR_TYPE, '', $inst_id, _INSTITUTE_GROUP, TRUE); } else { echo tt('No such type %1$s', $subtype); } } elseif ($_POST['type'] == _ORGANISATION_GROUP) { $organisation_id = altSubValue($_POST, 'id', ''); if ($organisation_id == 0) { $organisation_id = 'all';