Premium Account #134

This commit is contained in:
Martin Müller 2015-03-03 16:32:08 +01:00
parent 8a3672111e
commit 471dde66b7
7 changed files with 87 additions and 109 deletions

View File

@ -5,7 +5,12 @@ App::uses('CakeEmail', 'Network/Email');
class ExtraController extends AppController {
public $uses = array();
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");
}
public function contact() {
if ($this->request->is('post')) {
@ -50,21 +55,27 @@ class ExtraController extends AppController {
$this->render('/Extra/worker');
}
public function premium(){
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']['owner'] . ' von ' . $this->request->data['mail']['company']));
$Email->subject('[Dreamjob-Kontakt-Premium]');
$Email->template('contact');
$Email->viewVars(array('text' => $this->request->data, 'strip_tags' => $this->MiconwareSession->strip_tags));
if ($Email->send())
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.success'), 'flash', array('alert' => 'success'));
else
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.error'), 'flash', array('alert' => 'danger'));
}
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$this->set('title',__('dreamjob.premium'));
$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'));
}
$this->render('/Extra/premium');
}
public function advertise(){
@ -85,4 +96,4 @@ class ExtraController extends AppController {
$this->set('title',__('dreamjob.advertise'));
$this->render('/Extra/advertise');
}
}
}

View File

@ -1,5 +1,6 @@
<?php
App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');
/**
*/
class DreamjobCompanyPro extends AppModel {
@ -31,8 +32,36 @@ class DreamjobCompanyPro extends AppModel {
*/
public $validate = array(
);
public static function sendMail($mail,$data,$id){
$Email = new CakeEmail('dreamjobMain');
$Email->to($mail);
$Email->bcc('service@dream-job.eu');
$Email->subject('Bestellung des Premium Pakets');
$Email->template('extra_premium');
$Email->viewVars(array('id'=>$id,'data'=>$data));
$Email->attachments(array('dak.jpg' => WWW_ROOT.DS.'mail'.DS.'dak.jpg'));
return $Email->send();
}
public function askPremium($data){
$dataSource = $this->getDataSource();
$dataSource->begin();
$result=$this->saveAssociated($data);
if($result){
$open = $this->DreamjobCompany->find('first', array('conditions' => array('DreamjobCompany.djaccount_ptr_id' => $data['DreamjobCompanyPro']['company_id'])));
$result = self::sendMail($open['User']['mail'],array('DreamjobCompany'=>$open['DreamjobCompany']),$this->id);
}
if ($result) {
$dataSource->commit();
return true;
} else {
$dataSource->rollback();
}
return false;
}
public $hasOne = array(
'DreamjobCompany' => array(
'className' => 'DreamjobCompany',

View File

@ -44,16 +44,16 @@ class DreamjobJobApplication extends AppModel {
$Email->attachments(array('dak.jpg' => WWW_ROOT.DS.'mail'.DS.'dak.jpg'));
return $Email->send();
}
public function sendApplication($data){
$dataSource = $this->getDataSource();
$dataSource->begin();
$result=$this->saveAssociated($data);
if($result){
$open = $this->DreamjobJobOpening->find('first', array('conditions' => array('DreamjobJobOpening.id' => $data['DreamjobJobApplication']['opening_id'])));
$result = self::sendMail($open['User']['mail'],array('DreamjobCompany'=>$open['DreamjobCompany']),$this->id);
}
if ($result) {
$dataSource->commit();
@ -171,8 +171,8 @@ class DreamjobJobApplication extends AppModel {
'foreignKey' => 'opening_id'
)
);
public $hasOne = array(
'Mannerofaddress' => array(
'className' => 'Mannerofaddress',
@ -198,9 +198,9 @@ class DreamjobJobApplication extends AppModel {
'conditions' => array('DreamjobUserWorker.city_id = DreamjobWorkerListCity.id'),
'limit' => 1
),
//achtung
'DreamjobCompany' => array(
'className' => 'DreamjobCompany',
@ -238,9 +238,9 @@ class DreamjobJobApplication extends AppModel {
'conditions' => array('DreamjobUser.city_id = DreamjobCompanyListCity.id'),
'limit' => 1
),
'DreamjobListGraducation' => array(
'className' => 'DreamjobListGraducation',
'foreignKey' => false,
@ -259,7 +259,7 @@ class DreamjobJobApplication extends AppModel {
'conditions' => array('DreamjobJobOpening.branch_id = DreamjobListBranch.id'),
'limit' => 1
)
);
public $hasAndBelongsToMany = array(
'PageText' =>
@ -284,7 +284,7 @@ class DreamjobJobApplication extends AppModel {
'associationForeignKey' => 'page_id'
)
);
public $hasMany = array(
'DreamjobJobMsg' => array(
'className' => 'DreamjobJobMsg',

View File

@ -0,0 +1,2 @@
Sie haben:<br/>
<?=var_dump($data);?>

View File

@ -0,0 +1,2 @@
Sie haben:\n
<?=var_dump($data);?>

View File

@ -1,87 +1,21 @@
<?php
/*
*
* <h1><?=__('dreamjob.premium');?></h1><br/>
*/
?>
<div class="box">
<h1><?=__('dreamjob.premium');?></h1><br/>
<?=$this->Html->image('extra/premium.jpg');?>
<br/>
<ul>
<li>schneller Stellen besetzen</li>
<li>die Bewerber finden, die Ihren Vorstellungen entsprechen</li>
<li>Bewerber kontaktieren und Ihr interesse äußern</li>
</ul>
Funktionen:<br/>
Bewerber suchen<br/>
Bewerberprofile einsehen<br/>
Bewerber kontaktieren<br/>
<br/>
<br/>
Jetzt Informationen per Mail anfordern<br/>
<?php
$default_Form['inputDefaults']['div'] = array('style' => 'margin-top:15px;');
$default_Form['inputDefaults']['between']=false;
$default_Form['inputDefaults']['after']=false;
$default_Form['inputDefaults']['label']=false;
echo $this->Form->create(null,$default_Form);
echo $this->Form->input('mail.company',array('placeholder'=>'Unternehmen'));
echo $this->Form->input('mail.owner',array('placeholder'=>'Ansprechpartner'));
echo $this->Form->input('mail.adresse',array('placeholder'=>'E-Mail'));
echo $this->Form->input('mail.text',array('type'=>'hidden','value'=>'Premium Account'));
?>
<div class="buttonrow">
<?=$this->Form->button('Abschicken',array('div' => false,'class'=>"btn btn-default ",'type' => 'submit'));?>
</div>
<?=$this->Html->image('extra/premium.jpg',array('style'=>'margin:35px 35px 20px;'));?>
<p>Preisliste:</p>
<a href="http://info.dream-job.eu/preisliste/" rel="external" target="_blank">Hier</a>
<br/>
<br/>
<div>
<?php
echo $this->Form->end();
echo $this->Form->create(null,$default_Form);
echo $this->Form->input('DreamjobCompanyPro.worker_mail',array('type'=>'hidden','value'=>1));
echo $this->Form->input('DreamjobCompanyPro.worker_profil',array('type'=>'hidden','value'=>1));
echo $this->Form->button('kostenpflichtig Bestellen',array('div' => false,'class'=>"btn btn-primary",'type' => 'submit'));
echo $this->Form->end();
?>
<br/>
<br/>
<br/>
<h2>Stellenausschreibung positionieren</h2><br/>
<?=$this->Html->image('extra/stelstar.jpg');?><br/>
<br/>
<ul>
<li>schneller Stellen besetzen</li>
<li>sich abheben</li>
<li>im Vordergrund stehen</li>
</ul>
<br/>
Funktionen:<br/>
<ul>
<li>Stellenausschreibung auf der Startseite</li>
<li>in der Suche der Erste sein</li>
</ul>
<br/>
<br/>
Jetzt Informationen per Mail anfordern<br/>
<?php
$default_Form['inputDefaults']['div'] = array('style' => 'margin-top:15px;');
$default_Form['inputDefaults']['between']=false;
$default_Form['inputDefaults']['after']=false;
$default_Form['inputDefaults']['label']=false;
echo $this->Form->create(null,$default_Form);
echo $this->Form->input('mail.company',array('placeholder'=>'Unternehmen'));
echo $this->Form->input('mail.owner',array('placeholder'=>'Ansprechpartner'));
echo $this->Form->input('mail.adresse',array('placeholder'=>'E-Mail'));
echo $this->Form->input('mail.text',array('type'=>'hidden','value'=>'Stellenausschreibung positionieren'));
?>
<div class="buttonrow">
<?=$this->Form->button('Abschicken',array('div' => false,'class'=>"btn btn-default ",'type' => 'submit'));?>
</div>
<?php
echo $this->Form->end();
?>
</div>
</div>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 152 KiB