Commit ed2b052e authored by Open Source Developer's avatar Open Source Developer

commit

parents e1da06ce fd7da3f8
......@@ -7,6 +7,7 @@ drupal/modules/*
!drupal/modules/epal/
!drupal/modules/epalreadydata/
!drupal/modules/oauthost/
!drupal/modules/epaldeploysystem/
# Logs
*.log
......
......@@ -28,3 +28,18 @@ entity.epal_student_sector_field.add_form:
title: 'Add Epal student sector field'
appears_on:
- entity.epal_student_sector_field.collection
entity.epal_criteria.add_form:
route_name: entity.epal_criteria.add_form
title: 'Add Epal criteria'
appears_on:
- entity.epal_criteria.collection
entity.epal_student_moria.add_form:
route_name: entity.epal_student_moria.add_form
title: 'Add Epal student moria'
appears_on:
- entity.epal_student_moria.collection
entity.epal_class_limits.add_form:
route_name: entity.epal_class_limits.add_form
title: 'Add Epal class limits'
appears_on:
- entity.epal_class_limits.collection
......@@ -82,3 +82,45 @@ epal_student_sector_field.admin.structure.settings:
description: 'Configure Epal student sector field entities'
route_name: epal_student_sector_field.settings
parent: system.admin_structure
# Epal criteria menu items definition
entity.epal_criteria.collection:
title: 'Epal criteria list'
route_name: entity.epal_criteria.collection
description: 'List Epal criteria entities'
parent: system.admin_structure
weight: 100
epal_criteria.admin.structure.settings:
title: Epal criteria settings
description: 'Configure Epal criteria entities'
route_name: epal_criteria.settings
parent: system.admin_structure
# Epal student moria menu items definition
entity.epal_student_moria.collection:
title: 'Epal student moria list'
route_name: entity.epal_student_moria.collection
description: 'List Epal student moria entities'
parent: system.admin_structure
weight: 100
epal_student_moria.admin.structure.settings:
title: Epal student moria settings
description: 'Configure Epal student moria entities'
route_name: epal_student_moria.settings
parent: system.admin_structure
# Epal class limits menu items definition
entity.epal_class_limits.collection:
title: 'Epal class limits list'
route_name: entity.epal_class_limits.collection
description: 'List Epal class limits entities'
parent: system.admin_structure
weight: 100
epal_class_limits.admin.structure.settings:
title: Epal class limits settings
description: 'Configure Epal class limits entities'
route_name: epal_class_limits.settings
parent: system.admin_structure
......@@ -130,3 +130,69 @@ entity.epal_student_sector_field.delete_form:
title: Delete
weight: 10
# Epal criteria routing definition
epal_criteria.settings_tab:
route_name: epal_criteria.settings
title: 'Settings'
base_route: epal_criteria.settings
entity.epal_criteria.canonical:
route_name: entity.epal_criteria.canonical
base_route: entity.epal_criteria.canonical
title: 'View'
entity.epal_criteria.edit_form:
route_name: entity.epal_criteria.edit_form
base_route: entity.epal_criteria.canonical
title: 'Edit'
entity.epal_criteria.delete_form:
route_name: entity.epal_criteria.delete_form
base_route: entity.epal_criteria.canonical
title: Delete
weight: 10
# Epal student moria routing definition
epal_student_moria.settings_tab:
route_name: epal_student_moria.settings
title: 'Settings'
base_route: epal_student_moria.settings
entity.epal_student_moria.canonical:
route_name: entity.epal_student_moria.canonical
base_route: entity.epal_student_moria.canonical
title: 'View'
entity.epal_student_moria.edit_form:
route_name: entity.epal_student_moria.edit_form
base_route: entity.epal_student_moria.canonical
title: 'Edit'
entity.epal_student_moria.delete_form:
route_name: entity.epal_student_moria.delete_form
base_route: entity.epal_student_moria.canonical
title: Delete
weight: 10
# Epal class limits routing definition
epal_class_limits.settings_tab:
route_name: epal_class_limits.settings
title: 'Settings'
base_route: epal_class_limits.settings
entity.epal_class_limits.canonical:
route_name: entity.epal_class_limits.canonical
base_route: entity.epal_class_limits.canonical
title: 'View'
entity.epal_class_limits.edit_form:
route_name: entity.epal_class_limits.edit_form
base_route: entity.epal_class_limits.canonical
title: 'Edit'
entity.epal_class_limits.delete_form:
route_name: entity.epal_class_limits.delete_form
base_route: entity.epal_class_limits.canonical
title: Delete
weight: 10
......@@ -130,3 +130,69 @@ view published epal student sector field entities:
view unpublished epal student sector field entities:
title: 'View unpublished Epal student sector field entities'
add epal criteria entities:
title: 'Create new Epal criteria entities'
administer epal criteria entities:
title: 'Administer Epal criteria entities'
description: 'Allow to access the administration form to configure Epal criteria entities.'
restrict access: true
delete epal criteria entities:
title: 'Delete Epal criteria entities'
edit epal criteria entities:
title: 'Edit Epal criteria entities'
access epal criteria overview:
title: 'Access the Epal criteria overview page'
view published epal criteria entities:
title: 'View published Epal criteria entities'
view unpublished epal criteria entities:
title: 'View unpublished Epal criteria entities'
add epal student moria entities:
title: 'Create new Epal student moria entities'
administer epal student moria entities:
title: 'Administer Epal student moria entities'
description: 'Allow to access the administration form to configure Epal student moria entities.'
restrict access: true
delete epal student moria entities:
title: 'Delete Epal student moria entities'
edit epal student moria entities:
title: 'Edit Epal student moria entities'
access epal student moria overview:
title: 'Access the Epal student moria overview page'
view published epal student moria entities:
title: 'View published Epal student moria entities'
view unpublished epal student moria entities:
title: 'View unpublished Epal student moria entities'
add epal class limits entities:
title: 'Create new Epal class limits entities'
administer epal class limits entities:
title: 'Administer Epal class limits entities'
description: 'Allow to access the administration form to configure Epal class limits entities.'
restrict access: true
delete epal class limits entities:
title: 'Delete Epal class limits entities'
edit epal class limits entities:
title: 'Edit Epal class limits entities'
access epal class limits overview:
title: 'Access the Epal class limits overview page'
view published epal class limits entities:
title: 'View published Epal class limits entities'
view unpublished epal class limits entities:
title: 'View unpublished Epal class limits entities'
<?php
/**
* @file
* Contains epal_class_limits.page.inc.
*
* Page callback for Epal class limits entities.
*/
use Drupal\Core\Render\Element;
/**
* Prepares variables for Epal class limits templates.
*
* Default template: epal_class_limits.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_epal_class_limits(array &$variables) {
// Fetch EpalClassLimits Entity Object.
$epal_class_limits = $variables['elements']['#epal_class_limits'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}
<?php
/**
* @file
* Contains epal_criteria.page.inc.
*
* Page callback for Epal criteria entities.
*/
use Drupal\Core\Render\Element;
/**
* Prepares variables for Epal criteria templates.
*
* Default template: epal_criteria.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_epal_criteria(array &$variables) {
// Fetch EpalCriteria Entity Object.
$epal_criteria = $variables['elements']['#epal_criteria'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}
<?php
/**
* @file
* Contains epal_student_moria.page.inc.
*
* Page callback for Epal student moria entities.
*/
use Drupal\Core\Render\Element;
/**
* Prepares variables for Epal student moria templates.
*
* Default template: epal_student_moria.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_epal_student_moria(array &$variables) {
// Fetch EpalStudentMoria Entity Object.
$epal_student_moria = $variables['elements']['#epal_student_moria'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
}
<?php
namespace Drupal\epal\Entity;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
/**
* Defines the Epal class limits entity.
*
* @ingroup epal
*
* @ContentEntityType(
* id = "epal_class_limits",
* label = @Translation("Epal class limits"),
* handlers = {
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\epal\EpalClassLimitsListBuilder",
* "views_data" = "Drupal\epal\Entity\EpalClassLimitsViewsData",
*
* "form" = {
* "default" = "Drupal\epal\Form\EpalClassLimitsForm",
* "add" = "Drupal\epal\Form\EpalClassLimitsForm",
* "edit" = "Drupal\epal\Form\EpalClassLimitsForm",
* "delete" = "Drupal\epal\Form\EpalClassLimitsDeleteForm",
* },
* "access" = "Drupal\epal\EpalClassLimitsAccessControlHandler",
* "route_provider" = {
* "html" = "Drupal\epal\EpalClassLimitsHtmlRouteProvider",
* },
* },
* base_table = "epal_class_limits",
* admin_permission = "administer epal class limits entities",
* entity_keys = {
* "id" = "id",
* "label" = "name",
* "uuid" = "uuid",
* "uid" = "user_id",
* "langcode" = "langcode",
* "status" = "status",
* },
* links = {
* "canonical" = "/admin/structure/epal_class_limits/{epal_class_limits}",
* "add-form" = "/admin/structure/epal_class_limits/add",
* "edit-form" = "/admin/structure/epal_class_limits/{epal_class_limits}/edit",
* "delete-form" = "/admin/structure/epal_class_limits/{epal_class_limits}/delete",
* "collection" = "/admin/structure/epal_class_limits",
* },
* field_ui_base_route = "epal_class_limits.settings"
* )
*/
class EpalClassLimits extends ContentEntityBase implements EpalClassLimitsInterface {
use EntityChangedTrait;
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += array(
'user_id' => \Drupal::currentUser()->id(),
);
}
/**
* {@inheritdoc}
*/
public function getName() {
return $this->get('name')->value;
}
/**
* {@inheritdoc}
*/
public function setName($name) {
$this->set('name', $name);
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreatedTime() {
return $this->get('created')->value;
}
/**
* {@inheritdoc}
*/
public function setCreatedTime($timestamp) {
$this->set('created', $timestamp);
return $this;
}
/**
* {@inheritdoc}
*/
public function getOwner() {
return $this->get('user_id')->entity;
}
/**
* {@inheritdoc}
*/
public function getOwnerId() {
return $this->get('user_id')->target_id;
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this->set('user_id', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this->set('user_id', $account->id());
return $this;
}
/**
* {@inheritdoc}
*/
public function isPublished() {
return (bool) $this->getEntityKey('status');
}
/**
* {@inheritdoc}
*/
public function setPublished($published) {
$this->set('status', $published ? TRUE : FALSE);
return $this;
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by'))
->setDescription(t('The user ID of author of the Epal class limits entity.'))
->setRevisionable(TRUE)
->setSetting('target_type', 'user')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('view', array(
'label' => 'hidden',
'type' => 'author',
'weight' => 0,
))
->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Ονομασία τύπου τμήματος'))
->setDescription(t('Ονομασία τύπου τμήματος.'))
->setSettings(array(
'max_length' => 80,
'text_processing' => 0,
))
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['category'] = BaseFieldDefinition::create('string')
->setLabel(t('Κατηγορία σύμφωνα με την περιοχή μετάθεσης'))
->setDescription(t('Κατηγορία σύμφωνα με την περιοχή μετάθεσης.'))
->setSettings(array(
'max_length' => 80,
'text_processing' => 0,
))
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['limit_down'] = BaseFieldDefinition::create('integer')
->setLabel(t('Κατώτατο όριο μαθητών'))
->setDescription(t('Κατώτατο όριο μαθητών.'))
->setSettings(array(
'max_length' => 2,
'text_processing' => 0,
))
//->setDefaultValue(25)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'integer',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'integer',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['limit_up'] = BaseFieldDefinition::create('integer')
->setLabel(t('Ανώτατο όριο μαθητών'))
->setDescription(t('Ανώτατο όριο μαθητών.'))
->setSettings(array(
'max_length' => 2,
'text_processing' => 0,
))
//->setDefaultValue(30)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'integer',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'integer',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the Epal class limits is published.'))
->setDefaultValue(TRUE);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('The time that the entity was created.'));
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the entity was last edited.'));
return $fields;
}
}
<?php
namespace Drupal\epal\Entity;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\user\EntityOwnerInterface;
/**
* Provides an interface for defining Epal class limits entities.
*
* @ingroup epal
*/
interface EpalClassLimitsInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
// Add get/set methods for your configuration properties here.
/**
* Gets the Epal class limits name.
*
* @return string
* Name of the Epal class limits.
*/
public function getName();
/**
* Sets the Epal class limits name.
*
* @param string $name
* The Epal class limits name.
*
* @return \Drupal\epal\Entity\EpalClassLimitsInterface
* The called Epal class limits entity.
*/
public function setName($name);
/**
* Gets the Epal class limits creation timestamp.
*
* @return int
* Creation timestamp of the Epal class limits.
*/
public function getCreatedTime();
/**
* Sets the Epal class limits creation timestamp.
*
* @param int $timestamp
* The Epal class limits creation timestamp.
*
* @return \Drupal\epal\Entity\EpalClassLimitsInterface
* The called Epal class limits entity.
*/
public function setCreatedTime($timestamp);
/**
* Returns the Epal class limits published status indicator.
*
* Unpublished Epal class limits are only visible to restricted users.
*
* @return bool
* TRUE if the Epal class limits is published.
*/
public function isPublished();
/**
* Sets the published status of a Epal class limits.
*
* @param bool $published
* TRUE to set this Epal class limits to published, FALSE to set it to unpublished.
*
* @return \Drupal\epal\Entity\EpalClassLimitsInterface
* The called Epal class limits entity.
*/
public function setPublished($published);
}
<?php
namespace Drupal\epal\Entity;
use Drupal\views\EntityViewsData;
/**
* Provides Views data for Epal class limits entities.
*/
class EpalClassLimitsViewsData extends EntityViewsData {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = parent::getViewsData();
// Additional information for Views integration, such as table joins, can be
// put here.
return $data;
}
}