mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
- use function getAktOrNextSemester
- restructure single libs to isolate typeId of data - refactor Job: use params, details output - use functions insert, update, delete - use timeperiode for getAllTags and checkIfExistingTag - controller: rebuild function: change to POST - updated insertVon Batchuser
This commit is contained in:
@@ -39,13 +39,16 @@ class TagJob extends JOB_Controller
|
||||
$automatedTagsRes = $this->NotiztypModel->loadWhere(array('automatisiert' => true, 'taglib IS NOT NULL' => null));
|
||||
$automatedTags = hasData($automatedTagsRes) ? getData($automatedTagsRes) : [];
|
||||
|
||||
$result = $this->StudiensemesterModel->getLastOrAktSemester();
|
||||
$result = $this->StudiensemesterModel->getAktOrNextSemester();
|
||||
if (isError($result))
|
||||
return error ('Error occurred during retrieving studiensemester');
|
||||
if (empty($result->retval) || !isset($result->retval[0])) {
|
||||
return error('No studiensemester found');
|
||||
}
|
||||
$studiensemester_kurzbz = $result->retval[0]->studiensemester_kurzbz ?? null;
|
||||
$params = array(
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
);
|
||||
|
||||
foreach($automatedTags as $autoTag)
|
||||
{
|
||||
@@ -56,7 +59,7 @@ class TagJob extends JOB_Controller
|
||||
require_once($filePath);
|
||||
} else {
|
||||
echo "File not found: " . $filePath . PHP_EOL;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
$kurz_bz = $autoTag->typ_kurzbz;
|
||||
@@ -65,25 +68,69 @@ class TagJob extends JOB_Controller
|
||||
|
||||
$obj = new $className();
|
||||
|
||||
$outputArray = $obj->getZuordnungIds(['studiensemester_kurzbz' => $studiensemester_kurzbz]);
|
||||
$data = $outputArray->data;
|
||||
$outputArray = $obj->getZuordnungIds($params);
|
||||
$typeId = $outputArray->typeId;
|
||||
|
||||
print_r($kurz_bz . " " . $autoTag->taglib);
|
||||
$paramsTag = array(
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'kurzbz' => $kurz_bz,
|
||||
'data' => $outputArray->data,
|
||||
'typeId' => $typeId
|
||||
);
|
||||
|
||||
$result = $this->taglib->updateAutomatedTags($kurz_bz, $data);
|
||||
$result = $this->taglib->updateAutomatedTags($paramsTag);
|
||||
|
||||
$data = $result->retval;
|
||||
if (isError($result))
|
||||
return error ('Error occurred during updateAutomatedTags');
|
||||
if (isError($result)) {
|
||||
return error('Error occurred during updateAutomatedTags');
|
||||
}
|
||||
|
||||
$data = is_array($result) ? $result['retval'] : $result->retval;
|
||||
|
||||
//PRINT OUTPUT CONSOLE
|
||||
//SUMMARY
|
||||
print_r(PHP_EOL . "-- TAG " . $result->retval['input']['tag'] . " | TYPE_ID " . $typeId . " --");
|
||||
|
||||
//Output with Summary and Details
|
||||
print_r(PHP_EOL . "-- TAG " . $result->retval['input']['tag'] . " --");
|
||||
print_r( PHP_EOL . "Count Recycled: " . $result->retval['summary']['recycled']);
|
||||
print_r(PHP_EOL . "Count Added: ". $result->retval['summary']['added']);
|
||||
print_r(PHP_EOL . "Count Deleted: ". $result->retval['summary']['deleted']);
|
||||
|
||||
//DETAILS
|
||||
//print_r(PHP_EOL . "New tag(s) [". $typeId . "]: " . implode(', ', $result->retval['results']['newTags']));
|
||||
//print_r(PHP_EOL . "Deleted tags(s) [". $typeId . "]: " . implode(', ', $result->retval['results']['deletedTagsIds']));
|
||||
//print_r(PHP_EOL . "Recycled tag(s) [". $typeId . "]: " . implode(', ', $result->retval['results']['retaggedIds']));
|
||||
print_r(PHP_EOL);
|
||||
}
|
||||
print_r( PHP_EOL . "End Job rebuild" . PHP_EOL);
|
||||
|
||||
}
|
||||
|
||||
public function deleteAllAutomatedTags()
|
||||
{
|
||||
print_r( PHP_EOL . "Start Job delete ALL Automated Tags" . PHP_EOL);
|
||||
|
||||
$resultToDelete = $this->NotizModel->loadWhere(array('insertvon' => 'BatchJobTagAdd'));
|
||||
|
||||
$data = $resultToDelete->retval;
|
||||
$notiz_ids = array_map(function($item) {
|
||||
return $item->notiz_id;
|
||||
}, $data);
|
||||
|
||||
print_r($notiz_ids);
|
||||
|
||||
foreach ($notiz_ids as $notiz_id)
|
||||
{
|
||||
$result = $this->NotizzuordnungModel->delete([
|
||||
'notiz_id' => $notiz_id
|
||||
]);
|
||||
if (isError($result))
|
||||
return error ('Error occurred delete Notizzuordnung' . $notiz_id);
|
||||
|
||||
$result = $this->NotizModel->delete([
|
||||
'notiz_id' => $notiz_id
|
||||
]);
|
||||
if (isError($result))
|
||||
return error ('Error occurred delete Notiz' . $notiz_id);
|
||||
}
|
||||
print_r( PHP_EOL . "End Job delete Automated Tags" . PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user