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 { 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() { public function contact() {
if ($this->request->is('post')) { if ($this->request->is('post')) {
@ -50,21 +55,27 @@ class ExtraController extends AppController {
$this->render('/Extra/worker'); $this->render('/Extra/worker');
} }
public function premium(){ public function premium(){
$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')) { if ($this->request->is('post')) {
$Email = new CakeEmail('dreamjobMain'); $this->request->data['DreamjobCompanyPro']['company_id']=$a['AppUser']['id'];
$Email->to('service@dream-job.eu'); $this->request->data['DreamjobCompanyPro']['order']=date("Y-m-d");
$Email->from(array($this->request->data['mail']['adresse'] => $this->request->data['mail']['owner'] . ' von ' . $this->request->data['mail']['company'])); $this->request->data['DreamjobCompanyPro']['till']=ExtraController::monthAdd($this->request->data['DreamjobCompanyPro']['order'],1);
$Email->subject('[Dreamjob-Kontakt-Premium]'); $this->request->data['DreamjobCompanyPro']['orderstatus']=0;
$Email->template('contact'); if($this->DreamjobCompanyPro->askPremium($this->request->data))
$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')); $this->MiconwareSession->setFlash(__('dreamjob.contactSend.success'), 'flash', array('alert' => 'success'));
else else
$this->MiconwareSession->setFlash(__('dreamjob.contactSend.error'), 'flash', array('alert' => 'danger')); $this->MiconwareSession->setFlash(__('dreamjob.contactSend.error'), 'flash', array('alert' => 'danger'));
} }
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$this->set('title',__('dreamjob.premium'));
$this->render('/Extra/premium'); $this->render('/Extra/premium');
} }
public function advertise(){ public function advertise(){

View File

@ -1,5 +1,6 @@
<?php <?php
App::uses('AppModel', 'Model'); App::uses('AppModel', 'Model');
App::uses('CakeEmail', 'Network/Email');
/** /**
*/ */
class DreamjobCompanyPro extends AppModel { class DreamjobCompanyPro extends AppModel {
@ -32,6 +33,34 @@ class DreamjobCompanyPro extends AppModel {
public $validate = array( 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( public $hasOne = array(
'DreamjobCompany' => array( 'DreamjobCompany' => array(

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 <?php
/* /*
* * <h1><?=__('dreamjob.premium');?></h1><br/>
*/ */
?> ?>
<div class="box"> <div class="box">
<h1><?=__('dreamjob.premium');?></h1><br/> <?=$this->Html->image('extra/premium.jpg',array('style'=>'margin:35px 35px 20px;'));?>
<?=$this->Html->image('extra/premium.jpg');?> <p>Preisliste:</p>
<br/> <a href="http://info.dream-job.eu/preisliste/" rel="external" target="_blank">Hier</a>
<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/>
<br/> <br/>
Jetzt Informationen per Mail anfordern<br/> <div>
<?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>
<?php <?php
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(); 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> </div>
<?php </div>
echo $this->Form->end();
?>
</div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 152 KiB