53 lines
1.3 KiB
PHP
Raw Normal View History

2023-01-24 19:00:39 +01:00
<?php
class thesis extends _publication {
protected $type = 6;
private $thesis_type = "N/A";
public function setThesisType($txt) {
if (strpos ($txt, 'bachelor')!==false) {
$this->thesis_type = 'bachelor';
}
else if (strpos ($txt, 'doctor')!==false) {
$this->thesis_type = 'dissertation';
}
else if (strpos ($txt, 'master')!==false) {
$this->thesis_type = 'thesis';
}
return;
}
// each type has its own master record
// THIS ONLY ADDS article (master of publication)
protected function _addMaster() {
if (!$this->_isPublisher()) {
$this->_addPublisher();
}
try {
$stmt = $this->PDO->prepare("INSERT INTO p_thesis (id_inst, type) VALUES (:id_publisher, :type)");
$stmt->execute(array('id_publisher' => $this->publisher_id,
'type'=>$this->thesis_type));
$master_id = $this->PDO->lastInsertId();
return $master_id;
}
catch (exception $ex) {
common::except ('Err: ' .$ex .' in ' .__DIR__ .'/' .__FILE__ .':' .__LINE__);
}
return false;
}
}