mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
plausicheck issues: enabled generic passing of different parameters, not just core plausicheck specific. moved studiensemester param to specific PlausiIssueProducer controller
This commit is contained in:
@@ -5,14 +5,37 @@
|
||||
*/
|
||||
class PlausiIssueProducer extends PlausiIssueProducer_Controller
|
||||
{
|
||||
private $_currentStudiensemester;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library('issues/PlausicheckDefinitionLib');
|
||||
|
||||
// load models
|
||||
$this->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
// get current Studiensemester
|
||||
$studiensemesterRes = $this->StudiensemesterModel->getAkt();
|
||||
if (hasData($studiensemesterRes)) $this->_currentStudiensemester = getData($studiensemesterRes)[0]->studiensemester_kurzbz;
|
||||
|
||||
// set fehler which can be produced by the job
|
||||
// structure: fehler_kurzbz => class (library) name for resolving
|
||||
$this->_fehlerLibMappings = $this->plausicheckdefinitionlib->getFehlerLibMappings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs issue production job.
|
||||
* @param studiensemester_kurzbz string job is run for students of a certain semester.
|
||||
* @param studiengang_kz int job is run for students of certain Studiengang.
|
||||
*/
|
||||
public function run($studiensemester_kurzbz = null, $studiengang_kz = null)
|
||||
{
|
||||
// get Studiensemester
|
||||
if (isEmptyString($studiensemester_kurzbz)) $studiensemester_kurzbz = $this->_currentStudiensemester;
|
||||
|
||||
// producing issues for semester and optionally Studiengang
|
||||
$this->producePlausicheckIssues(array('studiensemester_kurzbz' => $studiensemester_kurzbz, 'studiengang_kz' => $studiengang_kz));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,16 +14,12 @@ abstract class PlausiIssueProducer_Controller extends JOB_Controller
|
||||
// pass extension name if calling from extension
|
||||
$extensionName = isset($this->_extensionName) ? $this->_extensionName : null;
|
||||
|
||||
// load libraries
|
||||
$this->load->library('issues/PlausicheckProducerLib', array('extensionName' => $extensionName));
|
||||
$this->load->library('IssuesLib');
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs issue production job.
|
||||
* @param studiensemester_kurzbz string job is run for students of a certain semester.
|
||||
* @param studiengang_kz int job is run for students of certain Studiengang.
|
||||
*/
|
||||
public function run($studiensemester_kurzbz = null, $studiengang_kz = null)
|
||||
protected function producePlausicheckIssues($params)
|
||||
{
|
||||
$this->logInfo("Plausicheck issue producer job started");
|
||||
|
||||
@@ -34,8 +30,7 @@ abstract class PlausiIssueProducer_Controller extends JOB_Controller
|
||||
$this->logInfo("Checking " . $fehler_kurzbz . "...");
|
||||
$plausicheckRes = $this->plausicheckproducerlib->producePlausicheckIssue(
|
||||
$libName,
|
||||
$studiensemester_kurzbz,
|
||||
$studiengang_kz
|
||||
$params
|
||||
);
|
||||
|
||||
if (isError($plausicheckRes)) $this->logError(getError($plausicheckRes));
|
||||
|
||||
@@ -11,7 +11,6 @@ class PlausicheckProducerLib
|
||||
const EXECUTE_PLAUSI_CHECK_METHOD_NAME = 'executePlausiCheck';
|
||||
|
||||
private $_ci; // ci instance
|
||||
private $_currentStudiensemester; // current Studiensemester
|
||||
private $_extensionName;
|
||||
|
||||
public function __construct($params = null)
|
||||
@@ -20,13 +19,6 @@ class PlausicheckProducerLib
|
||||
if (isset($params['extensionName'])) $this->_extensionName = $params['extensionName'];
|
||||
|
||||
$this->_ci =& get_instance(); // get ci instance
|
||||
|
||||
// load models
|
||||
$this->_ci->load->model('organisation/studiensemester_model', 'StudiensemesterModel');
|
||||
|
||||
// get current Studiensemester
|
||||
$studiensemesterRes = $this->_ci->StudiensemesterModel->getAkt();
|
||||
if (hasData($studiensemesterRes)) $this->_currentStudiensemester = getData($studiensemesterRes)[0]->studiensemester_kurzbz;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,11 +27,8 @@ class PlausicheckProducerLib
|
||||
* @param $studiensemester_kurzbz string optionally needed for issue production
|
||||
* @param $studiengang_kz int optionally needed for issue production
|
||||
*/
|
||||
public function producePlausicheckIssue($libName, $studiensemester_kurzbz = null, $studiengang_kz = null)
|
||||
public function producePlausicheckIssue($libName, $params)
|
||||
{
|
||||
// get Studiensemester
|
||||
if (isEmptyString($studiensemester_kurzbz)) $studiensemester_kurzbz = $this->_currentStudiensemester;
|
||||
|
||||
// if called from extension (extension name set), path includes extension names
|
||||
$libRootPath = isset($this->_extensionName) ? self::EXTENSIONS_FOLDER . '/' . $this->_extensionName . '/' : '';
|
||||
|
||||
@@ -50,16 +39,10 @@ class PlausicheckProducerLib
|
||||
$issuesLibFilePath = DOC_ROOT . self::CI_PATH
|
||||
. '/' . $libRootPath . self::CI_LIBRARY_FOLDER . '/' . self::PLAUSI_ISSUES_FOLDER . '/' . $libName . '.php';
|
||||
|
||||
// get path of library for issue to be produced
|
||||
|
||||
//~ $issuesLibPath = DOC_ROOT . self::CI_LIBRARY_PATH . '/' . self::PLAUSI_ISSUES_FOLDER . '/';
|
||||
//~ $issuesLibFilePath = $issuesLibPath . $libName . '.php';
|
||||
|
||||
// check if library file exists
|
||||
if (!file_exists($issuesLibFilePath)) return error("Issue library file " . $issuesLibFilePath . " does not exist");
|
||||
|
||||
// load library connected to fehlercode
|
||||
//$this->_ci->load->library(self::PLAUSI_ISSUES_FOLDER . '/'.$libName);
|
||||
$this->_ci->load->library($issuesLibPath . $libName);
|
||||
|
||||
$lowercaseLibName = mb_strtolower($libName);
|
||||
@@ -68,13 +51,7 @@ class PlausicheckProducerLib
|
||||
if (!is_callable(array($this->_ci->{$lowercaseLibName}, self::EXECUTE_PLAUSI_CHECK_METHOD_NAME)))
|
||||
return error("Method " . self::EXECUTE_PLAUSI_CHECK_METHOD_NAME . " is not defined in library $lowercaseLibName");
|
||||
|
||||
// pass the data needed for issue check
|
||||
$paramsForCheck = array(
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'studiengang_kz' => $studiengang_kz
|
||||
);
|
||||
|
||||
// call the function for checking for issue production
|
||||
return $this->_ci->{$lowercaseLibName}->{self::EXECUTE_PLAUSI_CHECK_METHOD_NAME}($paramsForCheck);
|
||||
return $this->_ci->{$lowercaseLibName}->{self::EXECUTE_PLAUSI_CHECK_METHOD_NAME}($params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user