This commit is contained in:
Martin Müller 2014-05-07 10:51:24 +02:00
parent ec7ae4f599
commit f684517432
2 changed files with 359 additions and 354 deletions

View File

@ -9,8 +9,7 @@ class JobController extends AppController {
* *
* @var array * @var array
*/ */
public $uses = array('DreamjobJobOpening', 'DreamjobJobFavority', 'DreamjobJobApplication', 'DreamjobPageText', 'DreamjobPageImage', 'DreamjobJobMsg', 'DreamjobCvEntry', 'DreamjobListCvCategory', 'DreamjobListBranch', 'DreamjobListCity');
public $uses = array('DreamjobJobOpening','DreamjobJobFavority','DreamjobJobApplication','DreamjobPageText','DreamjobPageImage','DreamjobJobMsg','DreamjobCvEntry','DreamjobListCvCategory','DreamjobListBranch','DreamjobListCity');
/** /**
* Displays a view * Displays a view
@ -20,30 +19,27 @@ class JobController 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 openingList() { public function openingList() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$self = $this->MiconwareSession->getCompany(); $self = $this->MiconwareSession->getCompany();
if(!is_array($self) or count($self) <= 0){ if (!is_array($self) or count($self) <= 0) {
$this->set('error', 'dreamjob.error.noPermision'); $this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
if(!empty($this->request->query['del'])){ if (!empty($this->request->query['del'])) {
$o =$this->DreamjobJobOpening->findById($this->request->query['del']); $o = $this->DreamjobJobOpening->findById($this->request->query['del']);
if($o['AppUser']['id']== $self['AppUser']['id']){ if ($o['AppUser']['id'] == $self['AppUser']['id']) {
$this->DreamjobJobOpening->delete($this->request->query['del'],false); $this->DreamjobJobOpening->delete($this->request->query['del'], false);
$this->MiconwareSession->setFlash(__('dreamjob.opening.delete'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.opening.delete'), 'flash', array('alert' => 'success'));
}else{ } else {
$this->MiconwareSession->setFlash(__('dreamjob.opening.delete.error'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.opening.delete.error'), 'flash', array('alert' => 'danger'));
} }
} }
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => array('DreamjobJobOpening.company_id' => $self['AppUser']['id']))); $openings = $this->DreamjobJobOpening->find('all', array('conditions' => array('DreamjobJobOpening.company_id' => $self['AppUser']['id'])));
$this->set('openings',$openings); $this->set('openings', $openings);
$this->render('/Job/opening_list'); $this->render('/Job/opening_list');
} }
} }
@ -52,37 +48,41 @@ class JobController extends AppController {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$c = $this->MiconwareSession->getCompany(); $c = $this->MiconwareSession->getCompany();
if(!empty($c)){ if (!empty($c)) {
if ($this->request->is('post')) { if ($this->request->is('post')) {
$this->DreamjobJobOpening->create($this->request->data); $this->DreamjobJobOpening->create($this->request->data);
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $c['AppUser']['id']; $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $c['AppUser']['id'];
if ($this->DreamjobJobOpening->save()) { if ($this->DreamjobJobOpening->save()) {
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.add'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.opening.save.add'), 'flash', array('alert' => 'success'));
}else{ return $this->redirect(array('action' => 'openingByOpening','id'=>$this->DreamjobJobOpening->id));
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'),'flash',array('alert'=>'danger')); } else {
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger'));
} }
}else{
$this->request->data['DreamjobJobOpening']['active']=true;
} }
$this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list'));
$this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list')); $this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list'));
$this->set('branches',$this->DreamjobListBranch->find('list')); $this->set('branches', $this->DreamjobListBranch->find('list'));
$this->set('cities',$this->DreamjobListCity->find('list')); $this->set('cities', $this->DreamjobListCity->find('list'));
$this->render('/Job/opening_edit'); $this->render('/Job/opening_edit');
}else{ } else {
$this->set('error', 'dreamjob.error.noCompany'); $this->set('error', 'dreamjob.error.noCompany');
$this->render('/Home/error'); $this->render('/Home/error');
} }
} }
public function openingEdit() { public function openingEdit() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$a = $this->MiconwareSession->getCompany(); $a = $this->MiconwareSession->getCompany();
if(empty($a)){ if (empty($a)) {
$this->set('error', 'dreamjob.error.noCompany'); $this->set('error', 'dreamjob.error.noCompany');
$this->render('/Home/error'); $this->render('/Home/error');
return null; return null;
} }
if(!empty($this->request->params['id'])){ if (!empty($this->request->params['id'])) {
$load = $this->DreamjobJobOpening->findById($this->request->params['id']); $load = $this->DreamjobJobOpening->findById($this->request->params['id']);
$cid = $a['AppUser']['id']; $cid = $a['AppUser']['id'];
if (!empty($load) and $load['DreamjobJobOpening']['company_id'] == $cid) { if (!empty($load) and $load['DreamjobJobOpening']['company_id'] == $cid) {
@ -91,26 +91,26 @@ class JobController extends AppController {
$this->DreamjobJobOpening->data['DreamjobJobOpening']['id'] = $this->request->params['id']; $this->DreamjobJobOpening->data['DreamjobJobOpening']['id'] = $this->request->params['id'];
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid; $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid;
if ($this->DreamjobJobOpening->save($this->DreamjobJobOpening->data)) { if ($this->DreamjobJobOpening->save($this->DreamjobJobOpening->data)) {
$this->MiconwareSession->setFlash(__('dreamjob.opening.save'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.opening.save'), 'flash', array('alert' => 'success'));
return $this->redirect(array('action' => 'openingByOpening','id'=>$this->request->params['id']));
}else } else
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger'));
} }
} }
$this->request->data=$load; $this->request->data = $load;
$this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list'));
$this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list')); $this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list'));
$this->set('branches',$this->DreamjobListBranch->find('list')); $this->set('branches', $this->DreamjobListBranch->find('list'));
$this->set('cities',$this->DreamjobListCity->find('list')); $this->set('cities', $this->DreamjobListCity->find('list'));
} }
if(empty($this->request->data['DreamjobJobOpening'])){ if (empty($this->request->data['DreamjobJobOpening'])) {
$this->set('error', 'dreamjob.error.opening.notFound'); $this->set('error', 'dreamjob.error.opening.notFound');
$this->render('/Home/error'); $this->render('/Home/error');
}elseif( $this->request->data['DreamjobJobOpening']['company_id'] != $a['AppUser']['id']){ } elseif ($this->request->data['DreamjobJobOpening']['company_id'] != $a['AppUser']['id']) {
$this->set('error', 'dreamjob.error.noPermision'); $this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
$this->render('/Job/opening_edit'); $this->render('/Job/opening_edit');
} }
} }
@ -121,39 +121,40 @@ class JobController extends AppController {
$opening = false; $opening = false;
if(!empty($this->request->params['id'])){ if (!empty($this->request->params['id'])) {
if(!empty($this->request->params['favorite']) and count($this->request->params['favorite'])>0){ if (!empty($this->request->params['favorite']) and count($this->request->params['favorite']) > 0) {
$WORKER = $this->MiconwareSession->getWorker(); $WORKER = $this->MiconwareSession->getWorker();
$fav=false; $fav = false;
foreach($WORKER['Favority'] as $val){ foreach ($WORKER['Favority'] as $val) {
if($val['id'] == $this->request->params['id']) if ($val['id'] == $this->request->params['id'])
$fav=true; $fav = true;
} }
$data = array('DreamjobJobFavority' => array('opening_id' => $this->request->params['id'], 'worker_id' => $WORKER['AppUser']['id']),'modified' => false); $data = array('DreamjobJobFavority' => array('opening_id' => $this->request->params['id'], 'worker_id' => $WORKER['AppUser']['id']), 'modified' => false);
$data2 = array('DreamjobJobFavority.opening_id' => $this->request->params['id'], 'DreamjobJobFavority.worker_id' => $WORKER['AppUser']['id']); $data2 = array('DreamjobJobFavority.opening_id' => $this->request->params['id'], 'DreamjobJobFavority.worker_id' => $WORKER['AppUser']['id']);
if($fav){ if ($fav) {
$this->MiconwareSession->setFlash(__('dreamjob.opening.fav.delete'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.opening.fav.delete'), 'flash', array('alert' => 'success'));
$this->DreamjobJobFavority->deleteAll($data2,false); $this->DreamjobJobFavority->deleteAll($data2, false);
}else{ } else {
$this->DreamjobJobFavority->create(); $this->DreamjobJobFavority->create();
$this->DreamjobJobFavority->save($data); $this->DreamjobJobFavority->save($data);
$this->MiconwareSession->setFlash(__('dreamjob.opening.fav.add'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.opening.fav.add'), 'flash', array('alert' => 'success'));
} }
} }
$con = $this->MiconwareSession->getOpeningCondition(); $con = $this->MiconwareSession->getOpeningCondition();
$con['DreamjobJobOpening.id'] = $this->request->params['id']; $con['DreamjobJobOpening.id'] = $this->request->params['id'];
$opening = $this->DreamjobJobOpening->find('first',array('conditions' => $con)); var_dump($con);
$opening = $this->DreamjobJobOpening->find('first', array('conditions' => $con));
} }
$this->MiconwareSession->refreshCache(); $this->MiconwareSession->refreshCache();
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
if(!is_array($opening) or count($opening) <= 0 ){ if (!is_array($opening) or count($opening) <= 0) {
$this->set('error', 'dreamjob.error.opening.notFound'); $this->set('error', 'dreamjob.error.opening.notFound');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
$this->set('opening',$opening); $this->set('opening', $opening);
$this->render('/Job/opening'); $this->render('/Job/opening');
} }
} }
@ -163,37 +164,39 @@ class JobController extends AppController {
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$self = $this->MiconwareSession->getWorker(); $self = $this->MiconwareSession->getWorker();
if(!is_array($self) or count($self) <= 0){ if (!is_array($self) or count($self) <= 0) {
$this->set('error', 'dreamjob.error.noPermision'); $this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
$fav_id = array(); $fav_id = array();
foreach($self['Favority'] as $fav) foreach ($self['Favority'] as $fav)
$fav_id[]=$fav['id']; $fav_id[] = $fav['id'];
$con = $this->MiconwareSession->getOpeningCondition(); $con = $this->MiconwareSession->getOpeningCondition();
$con['DreamjobJobOpening.id'] =$fav_id; $con['DreamjobJobOpening.id'] = $fav_id;
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => $con)); $openings = $this->DreamjobJobOpening->find('all', array('conditions' => $con));
$this->set('openings',$openings); $this->set('openings', $openings);
$this->set('opening_MINI',true); $this->set('opening_MINI', true);
$this->render('/Job/favorite'); $this->render('/Job/favorite');
} }
} }
public function applicationList() { public function applicationList() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$self = $this->MiconwareSession->getWorker(); $self = $this->MiconwareSession->getWorker();
if(!is_array($self) or count($self) <= 0){ if (!is_array($self) or count($self) <= 0) {
$this->set('error', 'dreamjob.error.noPermision'); $this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
$applications = $this->DreamjobJobApplication->find('all',array('conditions' => array('DreamjobJobApplication.worker_id' => $self['AppUser']['id']))); $applications = $this->DreamjobJobApplication->find('all', array('conditions' => array('DreamjobJobApplication.worker_id' => $self['AppUser']['id'])));
$this->set('applications',$applications); $this->set('applications', $applications);
$this->set('opening_MINI',true); $this->set('opening_MINI', true);
$this->render('/Job/applicationWorker_list'); $this->render('/Job/applicationWorker_list');
} }
} }
public function applicationGet() { public function applicationGet() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
@ -201,165 +204,167 @@ class JobController extends AppController {
$WORKER = $this->MiconwareSession->getWorker(); $WORKER = $this->MiconwareSession->getWorker();
$COMPANY = $self = $this->MiconwareSession->getCompany(); $COMPANY = $self = $this->MiconwareSession->getCompany();
$application = null; $application = null;
if(isset($this->request->params['id'])){ if (isset($this->request->params['id'])) {
if(is_array($WORKER) and count($WORKER) > 0) if (is_array($WORKER) and count($WORKER) > 0)
$application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.worker_id' => $WORKER['AppUser']['id'],'DreamjobJobApplication.id'=> $this->request->params['id'] ))); $application = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.worker_id' => $WORKER['AppUser']['id'], 'DreamjobJobApplication.id' => $this->request->params['id'])));
if(is_array($COMPANY) and count($COMPANY) > 0) if (is_array($COMPANY) and count($COMPANY) > 0)
$application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'],'DreamjobJobApplication.id'=> $this->request->params['id'] ))); $application = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'], 'DreamjobJobApplication.id' => $this->request->params['id'])));
} }
if(!is_array($application) or count($application) <= 0){ if (!is_array($application) or count($application) <= 0) {
$this->set('error', 'dreamjob.error.noPermision'); $this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
$this->set('page',null); $this->set('page', null);
$this->set("edit",false); $this->set("edit", false);
if(!empty($this->request->params['hiv'])){ if (!empty($this->request->params['hiv'])) {
$this->DreamjobJobApplication->id = $application['DreamjobJobApplication']['id']; $this->DreamjobJobApplication->id = $application['DreamjobJobApplication']['id'];
if ($this->DreamjobJobApplication->saveField('closed',!$application['DreamjobJobApplication']['closed'])) { if ($this->DreamjobJobApplication->saveField('closed', !$application['DreamjobJobApplication']['closed'])) {
$application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.id'=> $this->request->params['id'] ))); $application = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $this->request->params['id'])));
$this->MiconwareSession->setFlash(__('dreamjob.application.archiv'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.application.archiv'), 'flash', array('alert' => 'success'));
}else{ } else {
$this->MiconwareSession->setFlash(__('dreamjob.application.archiv.error'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.application.archiv.error'), 'flash', array('alert' => 'danger'));
} }
} }
if(!empty($this->request->params['ages'])){ if (!empty($this->request->params['ages'])) {
$this->set('msg',true); $this->set('msg', true);
if ($this->request->is('post')) { if ($this->request->is('post')) {
$this->DreamjobJobMsg->create($this->request->data); $this->DreamjobJobMsg->create($this->request->data);
$this->DreamjobJobMsg->data['DreamjobJobMsg']['saw'] = false; $this->DreamjobJobMsg->data['DreamjobJobMsg']['saw'] = false;
$this->DreamjobJobMsg->data['DreamjobJobMsg']['application_id'] = $application['DreamjobJobApplication']['id']; $this->DreamjobJobMsg->data['DreamjobJobMsg']['application_id'] = $application['DreamjobJobApplication']['id'];
$this->DreamjobJobMsg->data['DreamjobJobMsg']['fromcompany'] = is_array($COMPANY) and count($COMPANY) > 0; $this->DreamjobJobMsg->data['DreamjobJobMsg']['fromcompany'] = is_array($COMPANY) and count($COMPANY) > 0;
if($this->DreamjobJobMsg->sendMessage()) { if ($this->DreamjobJobMsg->sendMessage()) {
$application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.id'=> $this->request->params['id'] ))); $application = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $this->request->params['id'])));
$this->MiconwareSession->setFlash(__('dreamjob.application.msg.add'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.application.msg.add'), 'flash', array('alert' => 'success'));
}else{ } else {
$this->MiconwareSession->setFlash(__('dreamjob.application.msg.error'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.application.msg.error'), 'flash', array('alert' => 'danger'));
} }
} }
if(is_array($WORKER) and count($WORKER) > 0) if (is_array($WORKER) and count($WORKER) > 0)
$this->DreamjobJobMsg->updateAll(array("saw"=>true),array("DreamjobJobMsg.fromcompany"=>true,"DreamjobJobMsg.application_id"=>$this->request->params['id'])); $this->DreamjobJobMsg->updateAll(array("saw" => true), array("DreamjobJobMsg.fromcompany" => true, "DreamjobJobMsg.application_id" => $this->request->params['id']));
if(is_array($COMPANY) and count($COMPANY) > 0) if (is_array($COMPANY) and count($COMPANY) > 0)
$this->DreamjobJobMsg->updateAll(array("saw"=>true),array("DreamjobJobMsg.fromcompany"=>false,"DreamjobJobMsg.application_id"=>$this->request->params['id'])); $this->DreamjobJobMsg->updateAll(array("saw" => true), array("DreamjobJobMsg.fromcompany" => false, "DreamjobJobMsg.application_id" => $this->request->params['id']));
}else {
}else{ $this->set('msg', false);
$this->set('msg',false);
// CV // CV
if(!empty($this->request->params['vitea'])){ if (!empty($this->request->params['vitea'])) {
$cv = $this->DreamjobCvEntry->find('all',array('conditions' => array('worker_id'=> $application['DreamjobJobApplication']['worker_id']))); $cv = $this->DreamjobCvEntry->find('all', array('conditions' => array('worker_id' => $application['DreamjobJobApplication']['worker_id'])));
$this->set("cv",$cv); $this->set("cv", $cv);
$cvp0 = $this->DreamjobListCvCategory->find('first',array('conditions' => array('DreamjobListCvCategory.position' => 0))); $cvp0 = $this->DreamjobListCvCategory->find('first', array('conditions' => array('DreamjobListCvCategory.position' => 0)));
$this->set('cvp0', $cvp0); $this->set('cvp0', $cvp0);
}else{ } else {
if(!empty($this->request->params['page'])){ if (!empty($this->request->params['page'])) {
/*$this->set('pageInh',$this->DreamjobJobApplication->Page->find('first', /* $this->set('pageInh',$this->DreamjobJobApplication->Page->find('first',
array('conditions' => array("Page.id" => $this->request->params['page'])) array('conditions' => array("Page.id" => $this->request->params['page']))
));*/ )); */
$page = $this->DreamjobJobApplication->PageText->find('first', $page = $this->DreamjobJobApplication->PageText->find('first', array('conditions' => array("PageText.page_ptr_id" => $this->request->params['page']))
array('conditions' => array("PageText.page_ptr_id" => $this->request->params['page']))
); );
if(!is_array($page) or count($page)<= 0) if (!is_array($page) or count($page) <= 0)
$page = $this->DreamjobJobApplication->PageImage->find('first', $page = $this->DreamjobJobApplication->PageImage->find('first', array('conditions' => array("PageImage.page_ptr_id" => $this->request->params['page']))
array('conditions' => array("PageImage.page_ptr_id" => $this->request->params['page']))
); );
$this->set('page',$page); $this->set('page', $page);
} }
} }
} }
$this->set('application',$application); $this->set('application', $application);
$this->render('/Job/application'); $this->render('/Job/application');
} }
} }
public function applicationByOpening(){
public function applicationByOpening() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$COMPANY = $self = $this->MiconwareSession->getCompany(); $COMPANY = $self = $this->MiconwareSession->getCompany();
$applications = null; $applications = null;
$opening = null; $opening = null;
if(isset($this->request->params['id'])){ if (isset($this->request->params['id'])) {
if(is_array($COMPANY) and count($COMPANY) > 0) if (is_array($COMPANY) and count($COMPANY) > 0)
$opening = $this->DreamjobJobOpening->find('first',array('conditions' => array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'],'DreamjobJobOpening.id'=> $this->request->params['id'] ))); $opening = $this->DreamjobJobOpening->find('first', array('conditions' => array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'], 'DreamjobJobOpening.id' => $this->request->params['id'])));
if(!empty($this->request->query['archiv']) and count($opening)>0){ if (!empty($this->request->query['archiv']) and count($opening) > 0) {
$application = $this->DreamjobJobApplication->find('first',array('conditions' =>array('DreamjobJobApplication.id'=>$this->request->query['archiv'], 'DreamjobJobApplication.opening_id'=> $this->request->params['id']))); $application = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $this->request->query['archiv'], 'DreamjobJobApplication.opening_id' => $this->request->params['id'])));
$this->DreamjobJobApplication->id = $this->request->query['archiv']; $this->DreamjobJobApplication->id = $this->request->query['archiv'];
if ($this->DreamjobJobApplication->saveField('closed',!$application['DreamjobJobApplication']['closed'])) { if ($this->DreamjobJobApplication->saveField('closed', !$application['DreamjobJobApplication']['closed'])) {
$application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.id'=> $this->request->params['id'] ))); $application = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $this->request->params['id'])));
$this->MiconwareSession->setFlash(__('dreamjob.application.archiv'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.application.archiv'), 'flash', array('alert' => 'success'));
}else{ } else {
$this->MiconwareSession->setFlash(__('dreamjob.application.archiv.error'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.application.archiv.error'), 'flash', array('alert' => 'danger'));
} }
} }
$filter_current = false; $filter_current = false;
$filter_archiv = false; $filter_archiv = false;
$condition = array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'],'DreamjobJobApplication.opening_id'=> $this->request->params['id']); $condition = array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'], 'DreamjobJobApplication.opening_id' => $this->request->params['id']);
if(isset($this->request->query['filter']) and $this->request->query['filter'] =='all'){ if (isset($this->request->query['filter']) and $this->request->query['filter'] == 'all') {
}elseif(isset($this->request->query['filter']) and $this->request->query['filter'] =='archiv'){
} elseif (isset($this->request->query['filter']) and $this->request->query['filter'] == 'archiv') {
$condition['closed'] = true; $condition['closed'] = true;
$filter_archiv = true; $filter_archiv = true;
}else{ } else {
$condition['closed'] = false; $condition['closed'] = false;
$filter_current = true; $filter_current = true;
} }
$applications = $this->DreamjobJobApplication->find('all',array('conditions' =>$condition)); $applications = $this->DreamjobJobApplication->find('all', array('conditions' => $condition));
$this->set("filter_archiv",$filter_archiv); $this->set("filter_archiv", $filter_archiv);
$this->set("filter_current",$filter_current); $this->set("filter_current", $filter_current);
} }
if(!is_array($opening) or count($opening) <= 0){ if (!is_array($opening) or count($opening) <= 0) {
$this->set('error', 'dreamjob.error.noPermision'); $this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
$this->set('opening',$opening); $this->set('opening', $opening);
$this->set('applications',$applications); $this->set('applications', $applications);
$this->render('/Job/applicationCompany_list'); $this->render('/Job/applicationCompany_list');
} }
} }
public function applicationSend() { public function applicationSend() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$w = $this->MiconwareSession->getWorker(); $w = $this->MiconwareSession->getWorker();
if(!empty($w)){ if (!empty($w)) {
$opening = null; $opening = null;
if(!empty($this->request->params['id'])){ if (!empty($this->request->params['id'])) {
$con = $this->MiconwareSession->getOpeningCondition(); $con = $this->MiconwareSession->getOpeningCondition();
$con['DreamjobJobOpening.id'] = $this->request->params['id']; $con['DreamjobJobOpening.id'] = $this->request->params['id'];
$opening = $this->DreamjobJobOpening->find('first',array('conditions' => $con)); $opening = $this->DreamjobJobOpening->find('first', array('conditions' => $con));
} }
if(!is_array($opening) or count($opening) <= 0 ){ if (!is_array($opening) or count($opening) <= 0) {
$this->set('error', 'dreamjob.error.opening.notFound'); $this->set('error', 'dreamjob.error.opening.notFound');
$this->render('/Home/error'); $this->render('/Home/error');
}else{ } else {
if ($this->request->is('post')){ if ($this->request->is('post')) {
if($this->request->data['DreamjobJobApplication']['agb']) { if ($this->request->data['DreamjobJobApplication']['agb']) {
unset($this->request->data['DreamjobJobApplication']['agb']); unset($this->request->data['DreamjobJobApplication']['agb']);
$this->request->data['DreamjobJobApplication']['worker_id'] = $w['AppUser']['id']; $this->request->data['DreamjobJobApplication']['worker_id'] = $w['AppUser']['id'];
$this->request->data['DreamjobJobApplication']['opening_id'] = $this->request->params['id']; $this->request->data['DreamjobJobApplication']['opening_id'] = $this->request->params['id'];
$pages = $this->request->data['DreamjobJobApplicationPage']['page_id']; $pages = $this->request->data['DreamjobJobApplicationPage']['page_id'];
unset($this->request->data['DreamjobJobApplicationPage']['page_id']); unset($this->request->data['DreamjobJobApplicationPage']['page_id']);
foreach($pages as $id) foreach ($pages as $id)
$this->request->data['DreamjobJobApplicationPage'][]=array('page_id'=> $id); $this->request->data['DreamjobJobApplicationPage'][] = array('page_id' => $id);
$result = $this->DreamjobJobApplication->sendApplication($this->request->data); $result = $this->DreamjobJobApplication->sendApplication($this->request->data);
if ($result) { if ($result) {
$this->MiconwareSession->setFlash(__('dreamjob.application.send.success'),'flash',array('alert'=>'success')); $this->MiconwareSession->setFlash(__('dreamjob.application.send.success'), 'flash', array('alert' => 'success'));
}else{ } else {
$this->MiconwareSession->setFlash(__('dreamjob.application.send.error'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.application.send.error'), 'flash', array('alert' => 'danger'));
} }
}else{ } else {
$this->MiconwareSession->setFlash(__('dreamjob.agb.error.notAccept'),'flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash(__('dreamjob.agb.error.notAccept'), 'flash', array('alert' => 'danger'));
} }
} }
$this->set('pages', $w['DreamjobPageInh']); $this->set('pages', $w['DreamjobPageInh']);
$this->set('opening', $opening); $this->set('opening', $opening);
$this->render('/Job/application_send'); $this->render('/Job/application_send');
} }
}else{ } else {
$this->set('error', 'dreamjob.error.noWorker'); $this->set('error', 'dreamjob.error.noWorker');
$this->render('/Home/error'); $this->render('/Home/error');
} }
} }
} }
?> ?>

View File

@ -21,7 +21,7 @@ echo $this->Form->create('DreamjobJobOpening',$default_Form);
</c:choose> </c:choose>
*/ */
echo $this->Form->hidden("DreamjobJobOpening.company_id"); echo $this->Form->hidden("DreamjobJobOpening.company_id");
if(!empty($this->request->data['DreamjobJobOpening'])) if(!empty($this->request->data['DreamjobJobOpening']['title']))
echo $this->request->data['DreamjobJobOpening']['title']; echo $this->request->data['DreamjobJobOpening']['title'];
else else
echo __("dreamjob.opening.addForm"); echo __("dreamjob.opening.addForm");