Add area field to 'advanced subscription' plugin - refs BT#9462

1.10.x
Imanol Losada 10 years ago
parent 9d48a6bd1f
commit ede15f6b4f
  1. 1
      plugin/advanced_subscription/lang/english.php
  2. 1
      plugin/advanced_subscription/lang/spanish.php
  3. 35
      plugin/advanced_subscription/src/AdvancedSubscriptionPlugin.php
  4. 4
      plugin/advanced_subscription/src/admin_view.php
  5. 2
      plugin/advanced_subscription/views/admin_view.tpl

@ -62,6 +62,7 @@ $strings['RecommendedNumberOfParticipants'] = 'Recommended number of participant
$strings['PublicationEndDate'] = 'Publication end date';
$strings['Mode'] = 'Mode';
$strings['Postulant'] = 'Postulant';
$strings['Area'] = 'Area';
$strings['InscriptionDate'] = 'Inscription date';
$strings['BossValidation'] = 'Boss validation';
$strings['Decision'] = 'Decision';

@ -62,6 +62,7 @@ $strings['RecommendedNumberOfParticipants'] = 'Número recomendado de participan
$strings['PublicationEndDate'] = 'Fecha fin de publicación';
$strings['Mode'] = 'Modalidad';
$strings['Postulant'] = 'Postulante';
$strings['Area'] = 'Área';
$strings['InscriptionDate'] = 'Fecha de inscripción';
$strings['BossValidation'] = 'Validación del superior';
$strings['Decision'] = 'Decisión';

@ -50,6 +50,7 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
public function install()
{
$this->installDatabase();
$this->addAreaField();
$this->installHook();
}
@ -60,9 +61,43 @@ class AdvancedSubscriptionPlugin extends Plugin implements HookPluginInterface
public function uninstall()
{
$this->uninstallHook();
// Note: Keeping area field data is intended so it will not be removed
$this->uninstallDatabase();
}
/**
* addAreaField() (adds an area field if it is not already created)
* @return void
*/
private function addAreaField()
{
$result = Database::select(
'field_variable',
'user_field',
array(
'where'=> array(
'field_variable = ? ' => array(
'area'
)
)
)
);
if (empty($result)) {
require_once api_get_path(LIBRARY_PATH).'extra_field.lib.php';
$extraField = new Extrafield('user');
$extraField->save(array(
'field_type' => 1,
'field_variable' => 'area',
'field_display_text' => get_plugin_lang('Area', 'AdvancedSubscriptionPlugin'),
'field_default_value' => null,
'field_order' => null,
'field_visible' => 1,
'field_changeable' => 1,
'field_filter' => null
));
}
}
/**
* Create the database tables for the plugin
* @return void

@ -59,7 +59,9 @@ if (!empty($sessionId)) {
$isWesternNameOrder = api_is_western_name_order();
foreach ($studentList['students'] as &$student) {
$data['studentUserId'] = intval($student['user_id']);
$studentId = intval($student['user_id']);
$data['studentUserId'] = $studentId;
$student['area'] = UserManager::get_user_info_by_id($studentId)['extra']['area'];
$data['queueId'] = intval($student['queue_id']);
$data['newStatus'] = ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED;
$student['acceptUrl'] = $plugin->getQueueUrl($data);

@ -39,6 +39,7 @@
<th style="width: 118px;"><img src="{{ _p.web_plugin }}advanced_subscription/views/img/icon-avatar.png"/> </th>
<th>{{ "Postulant" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
<th>{{ "InscriptionDate" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
<th>{{ "Area" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
<th>{{ "BossValidation" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
<th>{{ "Decision" | get_plugin_lang('AdvancedSubscriptionPlugin') }}</th>
</tr>
@ -48,6 +49,7 @@
<td style="width: 118px;"><img src="{{ student.picture.file }}" class="img-circle"> </td>
<td class="name">{{ student.complete_name }}</td>
<td>{{ student.created_at }}</td>
<td>{{ student.area }}</td>
<td>{{ student.validation }}</td>
<td>
<a

Loading…
Cancel
Save