id); $inactive = NULL; $activetwo = NULL; $tabs = array(); $row = array(); $row[] = new tabobject('list', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id, get_string('list','data')); if (isset($record)) { $row[] = new tabobject('single', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id, get_string('single','data')); } else { $row[] = new tabobject('single', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&mode=single', get_string('single','data')); } // Add an advanced search tab. $row[] = new tabobject('asearch', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&mode=asearch', get_string('search', 'data')); if (isloggedin()) { // just a perf shortcut if (data_user_can_add_entry($data, $currentgroup, $groupmode, $context)) { // took out participation list here! $addstring = empty($editentry) ? get_string('add', 'data') : get_string('editentry', 'data'); $row[] = new tabobject('add', $CFG->wwwroot.'/mod/data/edit.php?d='.$data->id, $addstring); } if (has_capability(DATA_CAP_EXPORT, $context)) { // The capability required to Export database records is centrally defined in 'lib.php' // and should be weaker than those required to edit Templates, Fields and Presets. $row[] = new tabobject('export', $CFG->wwwroot.'/mod/data/export.php?d='.$data->id, get_string('export', 'data')); } if (has_capability('mod/data:managetemplates', $context)) { if ($currenttab == 'list') { $defaultemplate = 'listtemplate'; } else if ($currenttab == 'add') { $defaultemplate = 'addtemplate'; } else if ($currenttab == 'asearch') { $defaultemplate = 'asearchtemplate'; } else { $defaultemplate = 'singletemplate'; } $row[] = new tabobject('templates', $CFG->wwwroot.'/mod/data/templates.php?d='.$data->id.'&mode='.$defaultemplate, get_string('templates','data')); $row[] = new tabobject('fields', $CFG->wwwroot.'/mod/data/field.php?d='.$data->id, get_string('fields','data')); $row[] = new tabobject('presets', $CFG->wwwroot.'/mod/data/preset.php?d='.$data->id, get_string('presets', 'data')); } } $tabs[] = $row; if ($currenttab == 'templates' and isset($mode)) { $inactive = array(); $inactive[] = 'templates'; $templatelist = array ('listtemplate', 'singletemplate', 'asearchtemplate', 'addtemplate', 'rsstemplate', 'csstemplate', 'jstemplate'); $row = array(); $currenttab =''; foreach ($templatelist as $template) { $row[] = new tabobject($template, "templates.php?d=$data->id&mode=$template", get_string($template, 'data')); if ($template == $mode) { $currenttab = $template; } } if ($currenttab == '') { $currenttab = $mode = 'singletemplate'; } $tabs[] = $row; $activetwo = array('templates'); } // Print out the tabs and continue! print_tabs($tabs, $currenttab, $inactive, $activetwo);