Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart markers created and developed #10

Merged
merged 10 commits into from
Oct 11, 2022
105 changes: 1 addition & 104 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,7 @@
* Special method entity roles
*/
Configure::write('Admin.special_method_entity_roles', [
'index,add,edit' => [
'Users' => [
'userRoles',
],
],

]);

/*
Expand All @@ -352,105 +348,6 @@
],
]);

$defaultClasses = [
'test1' => [
'name' => 'Test1',
'img' => 'webroot/img/advanced-configuration/test1.png',
// 'order' => 0,
],
'test2' => [
'name' => 'Test2',
'img' => 'webroot/img/advanced-configuration/test2.png',
// 'order' => 0,
]
];

$defaultClasses['wrapped']['from'] = [];
$defaultClasses['wrapped']['to'] = [];
for ($i = 1; $i <= 13; $i++) {
if ($i < 10) {
$num = str_pad($i, 2, 0, STR_PAD_LEFT);
} else {
$num = $i;
}

if ($i >= 1 && $i <= 12) {
$class = [
'wrapped-from-' . $i => [
'img' => 'webroot/img/advanced-configuration/wrapped-' . $i . '.png',
]
];
$defaultClasses['wrapped']['from'] += $class;
}
if ($i >= 2 && $i <= 13) {
$class = [
'wrapped-to-' . $i => [
'img' => 'webroot/img/advanced-configuration/wrapped-' . $i . '.png',
]
];

$defaultClasses['wrapped']['to'] += $class;
}
}

$defaultClasses_formatted = [];
foreach ($defaultClasses as $class => $value) {
$name = isset($value['name']) ? $value['name'] : $class;
$defaultClasses_formatted[$class] = $name;

if (isset($value['img'])) {
$defaultClasses[$class]['img'] = Configure::read('Config.base_url') . $value['img'];
}
}

/*
* Configure the generic parameters
*/
Configure::write('Admin.parameters', [
'entities' => 'all',
'defaultClasses' => $defaultClasses,
'config' => [
'classes' => [
'type' => 'form-control',
'config' => [
'label' => 'Clases',
'type' => 'select',
'class' => 'keywords',
'multiple' => true,
'options' => $defaultClasses_formatted
]
],
// 'variables' => [
// 'type' => 'variables',
// 'config' => [
// 'name' => 'Variables',
// ]
// ],
'wrapped' => [
'type' => 'wrapped',
'config' => [
'name' => 'Clases Wrapped',
]
],
'decoration-images' => [
'type' => 'decoration-images',
'config' => [
'name' => 'Imágenes decorativas',
]
]
],
]);

/*
* Set API key of TinyPNG to reduce jpg and png images
*/
Configure::write("tinypng.api_key", "XHWMjj1DlYRCz0lzBW7R4fWQPvg0W9FV");
Configure::write("tinypng.available_extensions", [
'jpg',
'jpeg',
'png'
]);

/*
* Configure the entities that can be queried using the API
*/
Expand Down
28 changes: 0 additions & 28 deletions config/bootstrap_cli.php

This file was deleted.

121 changes: 0 additions & 121 deletions config/seo.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AcademicalYearsController extends AppController
'Editar' => [
'icon' => '<i class="fas fa-edit"></i>',
'url' => [
'controller' => 'AcademicalYear',
'controller' => 'AcademicalYears',
'action' => 'edit',
'plugin' => 'Colmena/AcademicalManager'
],
Expand All @@ -37,7 +37,7 @@ class AcademicalYearsController extends AppController
'Borrar' => [
'icon' => '<i class="fas fa-trash-alt"></i>',
'url' => [
'controller' => 'AcademicalYear',
'controller' => 'AcademicalYears',
'action' => 'delete',
'plugin' => 'Colmena/AcademicalManager'
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,18 @@ class SessionsController extends AppController
'class' => 'red-icon',
'escape' => false
]
]
],
'Markers' => [
'icon' => '<i class="fas fa-bug"></i>',
'url' => [
'controller' => 'Markers',
'action' => 'sessions-markers',
'plugin' => 'Colmena/ErrorsManager'
],
'options' => [
'escape' => false
]
],
];

protected $header_actions = [
Expand Down Expand Up @@ -129,6 +140,7 @@ public function add($subjectID)
{
$entity = $this->{$this->getName()}->newEmptyEntity();
$subject = $this->{$this->getName()}->Subjects->get($subjectID);
$programmingLanguages = $this->{$this->getName()}->Languages->find('list')->order(['name' => 'ASC'])->toArray();

if ($this->request->is('post')) {
$data = $this->request->getData();
Expand All @@ -143,7 +155,7 @@ public function add($subjectID)
$this->showErrors($entity);
}

$this->set(compact('entity', 'subject'));
$this->set(compact('entity', 'subject', 'programmingLanguages'));
}

/**
Expand All @@ -159,10 +171,10 @@ public function edit($entityID = null, $subjectID, $locale = null)
$entity = $this->{$this->getName()}->get($entityID);
$subject = $this->{$this->getName()}->Subjects->get($subjectID);
$programmingLanguages = $this->{$this->getName()}->Languages->find('list')->order(['name' => 'ASC'])->toArray();

if ($this->request->is(['patch', 'post', 'put'])) {
$entity = $this->{$this->getName()}->patchEntity($entity, $this->request->getData());

if ($this->{$this->getName()}->save($entity)) {
$this->Flash->success('La sesión se ha guardado correctamente.');
return $this->redirect(['action' => 'edit', $entity->id, $subjectID, $locale]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public function initialize(array $config): void

$this->belongsTo('PracticeGroups', [
'className' => 'Colmena/UsersManager.PracticeGroups'
]);
])->setForeignKey('practice_group_id');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,9 @@ public function initialize(array $config): void
'className' => 'Colmena/AcademicalManager.SessionSchedules'
]);

$this->belongsToMany(
$this->belongsTo(
'Languages',
[
'foreignKey' => 'session_id',
'targetForeignKey' => 'language_id',
'joinTable' => 'acm_languages_sessions',
'sort' => ['Languages.name' => 'ASC'],
'className' => 'Colmena/ErrorsManager.Languages',
]
);
Expand Down
Loading