id); $inactive = NULL; $row = array(); $row[] = new tabobject('list', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id, get_string('list','data'), '', true); if (isset($record)) { $row[] = new tabobject('single', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&rid='.$record->id, get_string('single','data'), '', true); } else { $row[] = new tabobject('single', $CFG->wwwroot.'/mod/data/view.php?d='.$data->id.'&mode=single', get_string('single','data'), '', true); } //if (isloggedin() and !isguest()) { if (isloggedin()) { if (has_capability('mod/data:writeentry', $context->id)) { // 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, '', true); } if (has_capability('mod/data:managetemplates', $context->id)) { if ($currenttab == 'list') { $defaultemplate = 'listtemplate'; } else if ($currenttab == 'add') { $defaultemplate = 'addtemplate'; } 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'), '', true); } } $tabs[] = $row; /***************************** * stolen code from quiz report *****************************/ if ($currenttab == 'templates' and isset($mode)) { $inactive[] = 'templates'; $templatelist = array ('listtemplate', 'singletemplate', 'addtemplate', 'rsstemplate', 'csstemplate'); $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; } } $tabs[] = $row; } /// Print out the tabs and continue! print_tabs($tabs, $currenttab, $inactive); ?>