insert schooldetails als ze nog niet bestaan
This commit is contained in:
@@ -170,12 +170,25 @@ class Compactsop extends MY_Controller{
|
||||
$target = $savePath.$filename;
|
||||
|
||||
rename($source, $target );
|
||||
chmod($target, '0777');
|
||||
//TODO: unlink eventueel oud logo
|
||||
$logo = $this->Schooldetails_model->getLogo($schoolID);
|
||||
$padNaam = $savePath.$logo;
|
||||
unlink($padNaam);
|
||||
$this->Schooldetails_model->update_record_where(['logo'=>$filename], ['organisatie_id' =>$schoolID]);
|
||||
chmod($target, '0777');
|
||||
|
||||
$details = $this->Schooldetails_model->get_records_where(['organisatie_id' => $schoolID]);
|
||||
if ($details) {
|
||||
$logo = $details['logo'];
|
||||
if ($logo) {
|
||||
$padNaam = $savePath . $logo;
|
||||
unlink($padNaam);
|
||||
}
|
||||
$this->Schooldetails_model->update_record_where(['logo' => $filename], ['organisatie_id' => $schoolID]);
|
||||
} else {
|
||||
|
||||
$org = $this->Organisaties_model->get_record_by_id($schoolID);
|
||||
$this->Schooldetails_model->insert_record([
|
||||
'logo' => $filename,
|
||||
'organisatie_id' => $schoolID,
|
||||
'plaats' => $org->plaats ? $org->plaats : ''
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
function getLogo(){
|
||||
|
||||
Reference in New Issue
Block a user