This commit is contained in:
Martin Müller 2014-04-16 15:34:02 +02:00
parent f82ce2957c
commit 9a359b265c
3 changed files with 24 additions and 8 deletions

View File

@ -22,6 +22,10 @@ class SearchController extends AppController {
* @throws NotFoundException When the view file could not be found * @throws NotFoundException When the view file could not be found
* or MissingViewException in debug mode. * or MissingViewException in debug mode.
*/ */
public function beforeFilter(){
$this->Security->unlockedActions[]="openings";
parent::beforeFilter();
}
public function openings() { public function openings() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);

View File

@ -159,7 +159,7 @@ class UserController extends AppController {
$this->render('/Home/error'); $this->render('/Home/error');
} }
} }
/*
public function savePageDeleteJson(){ public function savePageDeleteJson(){
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
@ -182,7 +182,7 @@ class UserController extends AppController {
$this->set('error', true); $this->set('error', true);
} }
$this->set('_serialize', array('error')); $this->set('_serialize', array('error'));
} }*/
public function savePageOrder(){ public function savePageOrder(){
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
@ -371,16 +371,12 @@ class UserController extends AppController {
if(!empty($page) and count($page)> 0){ if(!empty($page) and count($page)> 0){
$path = null; $path = null;
if($image){ if($image){
$path = WWW_ROOT.$page['DreamjobPageImage']['image']; $result = $this->DreamjobPageImage->delete($page,false);
$result = $this->DreamjobPageImage->delete($page['DreamjobPageInh']['id'],false);
}else }else
$result = $this->DreamjobPageText->delete($page['DreamjobPageInh']['id'],false); $result = $this->DreamjobPageText->delete($page['DreamjobPageInh']['id'],false);
if($result){ if($result){
$result = $this->DreamjobPageInh->delete($page['DreamjobPageInh']['id'],false); $result = $this->DreamjobPageInh->delete($page['DreamjobPageInh']['id'],false);
} }
if($path!=null and $result){
$result = unlink($path);
}
if($result){ if($result){
$this->MiconwareSession->refreshCache(); $this->MiconwareSession->refreshCache();
$profil = $this->MiconwareSession->getWorker(); $profil = $this->MiconwareSession->getWorker();

View File

@ -124,7 +124,23 @@ public function processUpload($check=array()) {
return TRUE; return TRUE;
} }
public function delete($id = NULL, $cascade = true){
$dataSource = $this->getDataSource();
$dataSource->begin();
$result = $this->delete($id['DreamjobPageInh']['id'],false);
if($result){
$filename = WWW_ROOT . $this->uploadDir . DS .$id['DreamjobPageImage']['image'];
chmod($filename,0755);
$result = unlink($filename);
}
if ($result) {
$dataSource->commit();
return true;
} else {
$dataSource->rollback();
}
return false;
}
public function saveAndUpload($data){ public function saveAndUpload($data){
$dataSource = $this->getDataSource(); $dataSource = $this->getDataSource();
$dataSource->begin(); $dataSource->begin();