original_string: public function user_enrolments_and_actions($enrolments) {
          $output = '';
          foreach ($enrolments as $ue) {
              $enrolmentoutput = $ue['text'].' '.$ue['period'];
              if ($ue['dimmed']) {
                  $enrolmentoutput = html_writer::tag('span', $enrolmentoutput, array('class'=>'dimmed_text'));
              } else {
                  $enrolmentoutput = html_writer::tag('span', $enrolmentoutput);
              }
              foreach ($ue['actions'] as $action) {
                  $enrolmentoutput .= $this->render($action);
              }
              $output .= html_writer::tag('div', $enrolmentoutput, array('class'=>'enrolment'));
          }
          return $output;
      }
code: public function user_enrolments_and_actions($enrolments) {
          $output = '';
          foreach ($enrolments as $ue) {
              $enrolmentoutput = $ue['text'].' '.$ue['period'];
              if ($ue['dimmed']) {
                  $enrolmentoutput = html_writer::tag('span', $enrolmentoutput, array('class'=>'dimmed_text'));
              } else {
                  $enrolmentoutput = html_writer::tag('span', $enrolmentoutput);
              }
              foreach ($ue['actions'] as $action) {
                  $enrolmentoutput .= $this->render($action);
              }
              $output .= html_writer::tag('div', $enrolmentoutput, array('class'=>'enrolment'));
          }
          return $output;
      }
code_tokens: public function user_enrolments_and_actions ( $ enrolments ) { $ output = '' ; foreach ( $ enrolments as $ ue ) { $ enrolmentoutput = $ ue [ 'text' ] . ' ' . $ ue [ 'period' ] ; if ( $ ue [ 'dimmed' ] ) { $ enrolmentoutput = html_writer :: tag ( 'span' , $ enrolmentoutput , array ( 'class' => 'dimmed_text' ) ) ; } else { $ enrolmentoutput = html_writer :: tag ( 'span' , $ enrolmentoutput ) ; } foreach ( $ ue [ 'actions' ] as $ action ) { $ enrolmentoutput .= $ this -> render ( $ action ) ; } $ output .= html_writer :: tag ( 'div' , $ enrolmentoutput , array ( 'class' => 'enrolment' ) ) ; } return $ output ; }
docstring: Generates the HTML for the given enrolments + available actions
  
  @param int $userid
  @param array $enrolments
  @param moodle_url $pageurl
  @return string
docstring_tokens: Generates the HTML for the given enrolments + available actions