This commit is contained in:
@@ -9,6 +9,8 @@ if (!isset($_SESSION['user'])) {
|
|||||||
}
|
}
|
||||||
$user = unserialize($_SESSION['user']);
|
$user = unserialize($_SESSION['user']);
|
||||||
|
|
||||||
|
$facultad_id = $user->facultad["facultad_id"];
|
||||||
|
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
|
||||||
@@ -16,7 +18,7 @@ use PhpOffice\PhpSpreadsheet\IOFactory;
|
|||||||
$spreadsheet = new Spreadsheet();
|
$spreadsheet = new Spreadsheet();
|
||||||
|
|
||||||
// Get data for each 'puesto'
|
// Get data for each 'puesto'
|
||||||
$puestos = $db->orderBy('nombre')->where('facultad_id', $user->facultad['facultad_id'])->get('puesto', columns: ['nombre', 'puesto_id']);
|
$puestos = $db->orderBy('nombre')->where('facultad_id', $facultad_id)->get('puesto', columns: ['nombre', 'puesto_id']);
|
||||||
|
|
||||||
$sheetIndex = 0; // To track and switch between sheets
|
$sheetIndex = 0; // To track and switch between sheets
|
||||||
|
|
||||||
@@ -25,10 +27,10 @@ foreach ($puestos as $puesto) {
|
|||||||
if ($sheetIndex == 0) {
|
if ($sheetIndex == 0) {
|
||||||
// Use the first default sheet
|
// Use the first default sheet
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
$sheet->setTitle($puesto['nombre']); // Name the first sheet
|
$sheet->setTitle(substr($puesto['nombre'], 0, 31)); // Name the first sheet
|
||||||
} else {
|
} else {
|
||||||
$sheet = $spreadsheet->createSheet(); // Create new sheet
|
$sheet = $spreadsheet->createSheet(); // Create new sheet
|
||||||
$sheet->setTitle($puesto['nombre']); // Set sheet title to puesto name
|
$sheet->setTitle(substr($puesto['nombre'], 0, 31)); // Set sheet title to puesto name
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get associated materias for current puesto
|
// Get associated materias for current puesto
|
||||||
|
|||||||
Reference in New Issue
Block a user