Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MDL-11511, make logic more clear, merged from MOODLE_19_STABLE
  • Loading branch information
dongsheng committed Apr 17, 2008
1 parent f752e2f commit 4840980
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mod/data/lib.php
Expand Up @@ -955,16 +955,18 @@ function data_print_template($template, $records, $data, $search='',$page=0, $re
$patterns[]='##edit##';
$patterns[]='##delete##';
$isteacher = has_capability('mod/data:manageentries', $context);
$isowner = data_isowner($record->id);
$isowner = data_isowner($record->id);
$canedit = $isteacher or ($isowner && has_capability('mod/data:editownentries', $context));
$candelete = $isteacher or ($isowner && has_capability('mod/data:deleteownentries', $context));

if ($isteacher or ($isowner && has_capability('mod/data:editownentries', $context)) ) {
if ($canedit) {
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/edit.php?d='
.$data->id.'&amp;rid='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/edit.gif" class="iconsmall" alt="'.get_string('edit').'" title="'.get_string('edit').'" /></a>';
}else{
$replacement[] = '';
}

if($isteacher or ($isowner && has_capability('mod/data:deleteownentries', $context)) ) {
if($candelete) {
$replacement[] = '<a href="'.$CFG->wwwroot.'/mod/data/view.php?d='
.$data->id.'&amp;delete='.$record->id.'&amp;sesskey='.sesskey().'"><img src="'.$CFG->pixpath.'/t/delete.gif" class="iconsmall" alt="'.get_string('delete').'" title="'.get_string('delete').'" /></a>';
}else{
Expand Down

0 comments on commit 4840980

Please sign in to comment.