EpalStudentListBuilder.php 2.29 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php

namespace Drupal\epal;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Routing\LinkGeneratorTrait;
use Drupal\Core\Url;

/**
 * Defines a class to build a listing of EPAL Student entities.
 *
 * @ingroup epal
 */
class EpalStudentListBuilder extends EntityListBuilder {

  use LinkGeneratorTrait;

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
23 24 25 26 27 28 29 30
    $header['id'] = $this->t('ID');
	$header['epaluser_id'] = $this->t('ID χρήστη ΕΠΑΛ');
    $header['name'] = $this->t('Όνομα');
    $header['studentsurname'] = $this->t('Επώνυμο');
    //$header['guardianfirstname'] = $this->t('Όνομα κηδεμόνα');
	//$header['guardiansurname'] = $this->t('Επώνυμο κηδεμόνα');
    $header['studentamka'] = $this->t('AMKA μαθητή');
  
31 32 33 34 35 36 37 38 39
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    /* @var $entity \Drupal\epal\Entity\EpalStudent */
    $row['id'] = $entity->id();
40 41 42 43 44 45 46 47 48 49
	
	$row['epaluser_id'] = $this->l(
      $entity->getEpaluser_id(),
      new Url(
        'entity.epal_student.edit_form', array(
          'epal_student' => $entity->id(),
        )
      )
    );
    
50
    $row['name'] = $this->l(
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
      $entity->getName(),
      new Url(
        'entity.epal_student.edit_form', array(
          'epal_student' => $entity->id(),
        )
      )
    );

    $row['studentsurname'] = $this->l(
      $entity->getStudentSurname(),
      new Url(
        'entity.epal_student.edit_form', array(
          'epal_student' => $entity->id(),
        )
      )
    );

	/*
    $row['guardianfirstname'] = $this->l(
      $entity->getGuardianFirstname(),
      new Url(
        'entity.epal_student.edit_form', array(
          'epal_student' => $entity->id(),
        )
      )
    );
	
	$row['guardiansurname'] = $this->l(
      $entity->getGuardianSurname(),
80 81 82 83 84 85
      new Url(
        'entity.epal_student.edit_form', array(
          'epal_student' => $entity->id(),
        )
      )
    );
86 87 88 89 90 91 92 93 94 95 96
	*/

   $row['studentAmka'] = $this->l(
      $entity->getStudentAmka(),
      new Url(
        'entity.epal_student.edit_form', array(
          'epal_student' => $entity->id(),
        )
      )
    );

97 98 99 100
    return $row + parent::buildRow($entity);
  }

}