2014-06-01 18:24:45 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
App::uses('AppController', 'Controller');
|
|
|
|
App::uses('CakeEmail', 'Network/Email');
|
|
|
|
|
|
|
|
class ExtraController extends AppController {
|
|
|
|
|
2015-03-03 16:32:08 +01:00
|
|
|
public $uses = array("DreamjobCompanyPro");
|
|
|
|
|
|
|
|
private static function monthAdd($date,$interval){
|
|
|
|
$date = new DateTime($date);
|
|
|
|
return $date->add(new DateInterval('P'.$interval.'M'))->format("Y-m-d");
|
|
|
|
}
|
2014-06-01 18:24:45 +02:00
|
|
|
|
|
|
|
public function contact() {
|
|
|
|
if ($this->request->is('post')) {
|
|
|
|
$Email = new CakeEmail('dreamjobMain');
|
|
|
|
$Email->to('service@dream-job.eu');
|
|
|
|
$Email->from(array($this->request->data['mail']['adresse'] => $this->request->data['mail']['first_name'] . ' ' . $this->request->data['mail']['last_name']));
|
|
|
|
$Email->subject('[Dreamjob-Kontakt]' . $this->request->data['mail']['subject']);
|
|
|
|
$Email->template('contact');
|
|
|
|
$Email->viewVars(array('text' => $this->request->data, 'strip_tags' => $this->MiconwareSession->strip_tags));
|
|
|
|
if ($Email->send())
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.success'), 'flash', array('alert' => 'success'));
|
2014-06-01 18:24:45 +02:00
|
|
|
else
|
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.error'), 'flash', array('alert' => 'danger'));
|
|
|
|
}
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title', __('dreamjob.contact'));
|
2014-06-01 18:24:45 +02:00
|
|
|
$this->render('/Extra/contact');
|
|
|
|
}
|
|
|
|
public function cooperators(){
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title',__('dreamjob.cooperators'));
|
2014-06-01 18:24:45 +02:00
|
|
|
$this->render('/Extra/cooperators');
|
|
|
|
}
|
|
|
|
public function team(){
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title',__('dreamjob.team'));
|
2014-06-01 18:24:45 +02:00
|
|
|
$this->render('/Extra/team');
|
|
|
|
}
|
2014-06-01 23:04:50 +02:00
|
|
|
public function company(){
|
2014-06-01 19:07:41 +02:00
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title',__('dreamjob.extra.company'));
|
2014-06-01 23:04:50 +02:00
|
|
|
$this->render('/Extra/company');
|
2014-06-01 19:07:41 +02:00
|
|
|
}
|
2014-06-01 23:04:50 +02:00
|
|
|
public function worker(){
|
2014-06-01 19:07:41 +02:00
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title',__('dreamjob.extra.worker'));
|
2014-06-01 23:04:50 +02:00
|
|
|
$this->render('/Extra/worker');
|
2014-06-01 19:07:41 +02:00
|
|
|
}
|
2014-06-01 18:24:45 +02:00
|
|
|
public function premium(){
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title',__('dreamjob.premium'));
|
2015-03-03 16:32:08 +01:00
|
|
|
$a = $this->MiconwareSession->getCompany();
|
|
|
|
if(empty($a)){
|
|
|
|
$this->set('error', array('title'=>__('dreamjob.error.noCompany.title'),'text'=>__('dreamjob.error.noCompany.text')));
|
|
|
|
if(!$this->MiconwareSession->isLoggedin())
|
|
|
|
$this->render('/Home/login');
|
|
|
|
else
|
|
|
|
$this->render('/Home/error');
|
|
|
|
}
|
|
|
|
if ($this->request->is('post')) {
|
|
|
|
$this->request->data['DreamjobCompanyPro']['company_id']=$a['AppUser']['id'];
|
|
|
|
$this->request->data['DreamjobCompanyPro']['order']=date("Y-m-d");
|
|
|
|
$this->request->data['DreamjobCompanyPro']['till']=ExtraController::monthAdd($this->request->data['DreamjobCompanyPro']['order'],1);
|
|
|
|
$this->request->data['DreamjobCompanyPro']['orderstatus']=0;
|
|
|
|
if($this->DreamjobCompanyPro->askPremium($this->request->data))
|
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.success'), 'flash', array('alert' => 'success'));
|
|
|
|
else
|
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.error'), 'flash', array('alert' => 'danger'));
|
|
|
|
}
|
2014-06-01 18:24:45 +02:00
|
|
|
$this->render('/Extra/premium');
|
|
|
|
}
|
|
|
|
public function advertise(){
|
|
|
|
if ($this->request->is('post')) {
|
|
|
|
$Email = new CakeEmail('dreamjobMain');
|
|
|
|
$Email->to('service@dream-job.eu');
|
2014-06-01 19:07:41 +02:00
|
|
|
$Email->from(array($this->request->data['mail']['adresse'] => $this->request->data['mail']['owner'] . ' von ' . $this->request->data['mail']['company']));
|
2014-06-01 18:24:45 +02:00
|
|
|
$Email->subject('[Dreamjob-Kontakt-Advertise]' . $this->request->data['mail']['subject']);
|
|
|
|
$Email->template('contact');
|
|
|
|
$Email->viewVars(array('text' => $this->request->data, 'strip_tags' => $this->MiconwareSession->strip_tags));
|
|
|
|
if ($Email->send())
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.success'), 'flash', array('alert' => 'success'));
|
2014-06-01 18:24:45 +02:00
|
|
|
else
|
|
|
|
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.error'), 'flash', array('alert' => 'danger'));
|
|
|
|
}
|
|
|
|
$this->MiconwareSession->init($this);
|
|
|
|
$this->MiconwareSession->initWeb($this);
|
2014-06-10 18:37:45 +02:00
|
|
|
$this->set('title',__('dreamjob.advertise'));
|
2014-06-01 18:24:45 +02:00
|
|
|
$this->render('/Extra/advertise');
|
|
|
|
}
|
2015-03-03 16:32:08 +01:00
|
|
|
}
|