This commit is contained in:
Martin Müller 2014-03-15 01:52:07 +01:00
parent e3ceabbe4c
commit 066f7950fa
11 changed files with 236 additions and 37 deletions

View File

@ -45,6 +45,7 @@
Router::connect('/application', array('controller' => 'job', 'action' => 'applicationList')); Router::connect('/application', array('controller' => 'job', 'action' => 'applicationList'));
Router::connect('/application/:id', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+")); Router::connect('/application/:id', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+"));
Router::connect('/application/:id/page/:page', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+","page" => "[0-9]+")); Router::connect('/application/:id/page/:page', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+","page" => "[0-9]+"));
Router::connect('/application/:id/curriculum:vitea', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'vitea' => '(?i:vitea)'));
Router::connect('/application/:id/mess:ages', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'ages' => '(?i:ages)')); Router::connect('/application/:id/mess:ages', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'ages' => '(?i:ages)'));
Router::connect('/application/:id/arc:hiv', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'hiv' => '(?i:hiv)')); Router::connect('/application/:id/arc:hiv', array('controller' => 'job', 'action' => 'applicationGet'), array("id" => "[0-9]+",'hiv' => '(?i:hiv)'));
@ -53,6 +54,9 @@
Router::connect('/favorite', array('controller' => 'job', 'action' => 'favorite')); Router::connect('/favorite', array('controller' => 'job', 'action' => 'favorite'));
Router::connect('/test/', array('controller' => 'user', 'action' => 'test')); Router::connect('/test/', array('controller' => 'user', 'action' => 'test'));
Router::parseExtensions('json');
Router::connect('/profil/save/cv', array('controller' => 'user', 'action' => 'saveCvJson'));
/** /**
* ...and connect the rest of 'Pages' controller's URLs. * ...and connect the rest of 'Pages' controller's URLs.
*/ */

View File

@ -28,6 +28,17 @@ class MiconwareSessionComponent extends Component {
'after' => '</div>', 'after' => '</div>',
'class' => '')) 'class' => ''))
); );
$controller->set('default_hForm',array(
'inputDefaults' => array(
'div' => array('class' => 'form-group'),
'label' => array('class' => 'col-lg-3 control-label'),
'between' => '<div class="col-lg-9">',
'after' => '</div>',
'error' => array('attribute'=>array('wrap'=>'span','class'=>'help-block')),
'class' => 'form-control '),
'class'=>'hide-form hide-input'
)
);
$controller->set('default_Form',array( $controller->set('default_Form',array(
'inputDefaults' => array( 'inputDefaults' => array(
'div' => array('class' => 'form-group'), 'div' => array('class' => 'form-group'),

View File

@ -10,7 +10,7 @@ class JobController extends AppController {
* @var array * @var array
*/ */
public $uses = array('DreamjobJobOpening','DreamjobJobFavority','DreamjobJobApplication','DreamjobPageText','DreamjobPageImage','DreamjobJobMsg'); public $uses = array('DreamjobJobOpening','DreamjobJobFavority','DreamjobJobApplication','DreamjobPageText','DreamjobPageImage','DreamjobJobMsg','DreamjobCvCategory');
/** /**
* Displays a view * Displays a view
@ -226,7 +226,6 @@ class JobController extends AppController {
$this->MiconwareSession->setFlash('dreamjob.application.msg.error','flash',array('alert'=>'danger')); $this->MiconwareSession->setFlash('dreamjob.application.msg.error','flash',array('alert'=>'danger'));
} }
} }
//TODO Mark as read
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)
@ -234,18 +233,24 @@ class JobController extends AppController {
}else{ }else{
$this->set('msg',false); $this->set('msg',false);
if(!empty($this->request->params['page'])){ // CV
$this->set('pageInh',$this->DreamjobJobApplication->Page->find('first', if(!empty($this->request->params['vitea'])){
array('conditions' => array("Page.id" => $this->request->params['page'])) $cv = $this->DreamjobCvCategory->find('all',array('conditions' => array('worker_id'=> $application['DreamjobJobApplication']['worker_id'])));
)); $this->set("cv",$cv);
$page = $this->DreamjobJobApplication->PageText->find('first', }else{
array('conditions' => array("PageText.page_ptr_id" => $this->request->params['page'])) if(!empty($this->request->params['page'])){
); /*$this->set('pageInh',$this->DreamjobJobApplication->Page->find('first',
if(!is_array($page) or count($page)<= 0) array('conditions' => array("Page.id" => $this->request->params['page']))
$page = $this->DreamjobJobApplication->PageImage->find('first', ));*/
array('conditions' => array("PageImage.page_ptr_id" => $this->request->params['page'])) $page = $this->DreamjobJobApplication->PageText->find('first',
); array('conditions' => array("PageText.page_ptr_id" => $this->request->params['page']))
$this->set('page',$page); );
if(!is_array($page) or count($page)<= 0)
$page = $this->DreamjobJobApplication->PageImage->find('first',
array('conditions' => array("PageImage.page_ptr_id" => $this->request->params['page']))
);
$this->set('page',$page);
}
} }
} }
$this->set('application',$application); $this->set('application',$application);

View File

@ -11,6 +11,7 @@ class UserController extends AppController {
*/ */
public $uses = array('DreamjobListGraducation','DreamjobWorker','DreamjobCompany','DreamjobPageText','DreamjobPageImage','DreamjobJobOpening','DreamjobCvCategory'); public $uses = array('DreamjobListGraducation','DreamjobWorker','DreamjobCompany','DreamjobPageText','DreamjobPageImage','DreamjobJobOpening','DreamjobCvCategory');
public $components = array('MiconwareSession','RequestHandler');
/** /**
* Displays a view * Displays a view
@ -24,8 +25,9 @@ class UserController extends AppController {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this); $this->MiconwareSession->initWeb($this);
$this->autoRender = true;
$this->layout = 'default';
$this->RequestHandler->setContent('html', 'application/html' );
//self check //self check
$self_company = false; $self_company = false;
@ -38,6 +40,9 @@ class UserController extends AppController {
//get Profil //get Profil
$hard_error = false; $hard_error = false;
if(!$this->MiconwareSession->isLoggedin())
$hard_error = true;
$company = false; $company = false;
$page = null; $page = null;
$profil = null; $profil = null;
@ -67,6 +72,8 @@ class UserController extends AppController {
}else{ }else{
if(isset($profil['DreamjobWorker'])){ if(isset($profil['DreamjobWorker'])){
$cv = $this->DreamjobCvCategory->find('all',array('conditions' => array('worker_id'=> $profil['AppUser']['id']))); $cv = $this->DreamjobCvCategory->find('all',array('conditions' => array('worker_id'=> $profil['AppUser']['id'])));
if(!$self_company and $profil['AppUser']['id']==$self['AppUser']['id'])
$this->request->data = $cv;
$this->set("cv",$cv); $this->set("cv",$cv);
} }
} }
@ -98,6 +105,26 @@ class UserController extends AppController {
}else }else
$this->render('/User/worker'); $this->render('/User/worker');
} }
public function saveCvJson(){
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$this->RequestHandler->setContent('json', 'application/json' );
$this->set("cv",null);
$this->set('error', null);
$self = $this->MiconwareSession->getWorker();
if(!empty($self) and count($self)> 0){
$cv = $this->DreamjobCvCategory->find('all',array('conditions' => array('worker_id'=> $self['AppUser']['id'])));
$this->request->data = $cv;
$this->set("cv",$cv);
$this->set('error', false);
}else{
$this->set('error', true);
}
$this->set('_serialize', array('cv','error'));
}
public function test() { public function test() {
$this->MiconwareSession->init($this); $this->MiconwareSession->init($this);

View File

@ -28,13 +28,24 @@ class DreamjobCvCategory extends AppModel {
* @var string * @var string
*/ */
public $displayField = 'id'; public $displayField = 'id';
public $order = 'DreamjobCvCategory.id';
/** /**
* Validation rules * Validation rules
* *
* @var array * @var array
*/ */
public $validate = array( public $validate = array(
'id' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'worker_id' => array( 'worker_id' => array(
'numeric' => array( 'numeric' => array(
'rule' => array('numeric'), 'rule' => array('numeric'),

View File

@ -31,7 +31,7 @@ if($isLoggedin){
<li<?php if(isset($MENU_SETTINGS)){?> class="active"<?php } ?>><a href=""><img src="<c:url value="${STATIC_URL}img/bar-settings.png"/>"/></a></li> <li<?php if(isset($MENU_SETTINGS)){?> class="active"<?php } ?>><a href=""><img src="<c:url value="${STATIC_URL}img/bar-settings.png"/>"/></a></li>
</ul> </ul>
<?php <?php
}elseif($MENU_START){ }elseif(!empty($MENU_START)){
?> ?>
<style type="text/css"> <style type="text/css">
<!-- <!--

View File

@ -0,0 +1,81 @@
<?php
/*
*
*/
$default_hForm['url']=array('controller'=>'user','action'=>'saveCvJson');
echo $this->Form->create('DreamjobCvCategory',$default_hForm);
?>
<h3><?=__("dreamjob.cv");?><span class="label label-default edit"><span class="glyphicon glyphicon-edit"></span><?=__('dreamjob.edit');?></span><span class="label label-default save"><span class="glyphicon glyphicon-floppy-disk"></span><?=__('dreamjob.save');?></span></h3>
<?php
echo $this->Form->text('test',array('class'=>'form-control'));
foreach($cv as $cvc){
?>
<h4><?=$cvc['DreamjobListCvCategory']['name'];?></h4>
<table class="cv">
<?php
foreach($cvc['DreamjobCvEntry'] as $cve){
?>
<tr>
<?php
if($cvc['DreamjobListCvCategory']['startdate'] and $cvc['DreamjobListCvCategory']['enddate'] and $cvc['DreamjobListCvCategory']['place']){
?>
<td><?=$cve['startdate'];?> - <?=$cve['enddate'];?></td>
<td><?=$cve['title'];?><br/><span><?=$cve['place'];?></span></td>
<?php
}else if($cvc['DreamjobListCvCategory']['place']){
if($cvc['DreamjobListCvCategory']['startdate']){
?>
<td><?=$cve['startdate'];?></td>
<?php
}else if($cvc['DreamjobListCvCategory']['enddate']){
?>
<td><?=$cve['enddate'];?></td>
<?php
}else{
?>
<td><?=$cve['title'];?></td>
<td><?=$cve['place'];?></td>
<?php
}
?>
<?php
if($cvc['DreamjobListCvCategory']['startdate'] or $cvc['DreamjobListCvCategory']['enddate']){
?>
<td><?=$cve['title'];?><br/><span><?=$cve['place'];?></span></td>
<?php
}
}else{
if($cvc['DreamjobListCvCategory']['startdate'] and $cvc['DreamjobListCvCategory']['enddate']){
?>
<td><?=$cve['startdate'];?> - <?=$cve['enddate'];?></td>
<?php
}else if($cvc['DreamjobListCvCategory']['startdate']){
?>
<td><?=$cve['startdate'];?></td>
<?php
}else if($cvc['DreamjobListCvCategory']['enddate']){
?>
<td><?=$cve['enddate'];?></td>
<?php
}else{
?>
ERROR
<?php
}
?>
<td><?=$cve['title'];?></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
}
echo $this->Form->end();
?>

View File

@ -60,9 +60,12 @@
<div class="box"> <div class="box">
<div class="tabs-below"> <div class="tabs-below">
<ul class="nav nav-tabs pull-right"> <ul class="nav nav-tabs pull-right">
<li<?php if (empty($page)){?> class="active"<?php } ?>> <li<?php if (empty($page) and empty($cv)){?> class="active"<?php } ?>>
<?=$this->Html->link(__("dreamjob.application"),array('controller'=>'job','action'=>'applicationGet','id'=> $application['DreamjobJobApplication']['id'] ),array('rel'=>"tab")); ?> <?=$this->Html->link(__("dreamjob.application"),array('controller'=>'job','action'=>'applicationGet','id'=> $application['DreamjobJobApplication']['id'] ),array('rel'=>"tab")); ?>
</li> </li>
<li<?php if (!empty($cv)){?> class="active"<?php } ?>>
<?=$this->Html->link(__('dreamjob.cv'),array('controller'=>'job','action'=>'applicationGet','id'=>$application['DreamjobJobApplication']['id'],'vitea'=>'vitea')); ?>
</li>
<?php foreach($application['Page'] as $pag){ ?> <?php foreach($application['Page'] as $pag){ ?>
<li<?php if(isset($page['DreamjobPageInh']['id'])) if ($page['DreamjobPageInh']['id'] == $pag['id']){?> class="active"<?php } ?>> <li<?php if(isset($page['DreamjobPageInh']['id'])) if ($page['DreamjobPageInh']['id'] == $pag['id']){?> class="active"<?php } ?>>
<?=$this->Html->link($pag['title'],array('controller'=>'job','action'=>'applicationGet','id'=> $application['DreamjobJobApplication']['id'],'page'=> $pag['id'] ),array('rel'=>"tab")); ?> <?=$this->Html->link($pag['title'],array('controller'=>'job','action'=>'applicationGet','id'=> $application['DreamjobJobApplication']['id'],'page'=> $pag['id'] ),array('rel'=>"tab")); ?>
@ -94,6 +97,12 @@
</div> </div>
<?php } <?php }
}elseif(!empty($cv)){ ?>
<?php
echo $this->element('user_worker_cv');
?>
</div>
<?php
}elseif($page!=null){ ?> }elseif($page!=null){ ?>
<?php <?php
if(isset($page['PageText'])) if(isset($page['PageText']))

View File

@ -37,15 +37,14 @@ if(( !empty($COMPANY) and is_array($COMPANY) and count($COMPANY) > 0 and ($COMPA
</ul> </ul>
</div> </div>
<?php <?php
if(!empty($edit)){
?>
Bearbeiten.
<?php
}
if(!empty($page)){ if(!empty($page)){
echo $this->element('user_page'); echo $this->element('user_page');
}else{ }else{
echo $this->element('user_worker_cv'); if(!empty($WORKER) and is_array($WORKER) and count($WORKER) > 0 and $WORKER['AppUser']['id']== $profil['AppUser']['id'] and $edit){
echo $this->element('user_worker_cv_edit');
}else{
echo $this->element('user_worker_cv');
}
} }
?> ?>
<!-- /tab --> <!-- /tab -->

View File

@ -379,11 +379,23 @@ body.loading #container{
font-size:16px; font-size:16px;
} }
.cv{ .cv{
width:100%; width:100%;
color:black; color:black;
} }
.cv td{ .cv td{
width:50%; width:50%;
padding-bottom:15px;
}
.cv td span{
font-style:italic;
font-size:12px;
}
.hide-input input.form-control{
background-color:rgba(255,255,255,0);
border-color:rgba(255,255,255,0);
color:black;
box-shadow:none;
} }
.infofield{ .infofield{

View File

@ -20,18 +20,58 @@
return false; return false;
}); });
}); });
$(where+" form").submit(function(e){
$(where+" form:not(.hide-form)").submit(function(e){
e.stopPropagation(); e.stopPropagation();
//e.preventDefault(); //e.preventDefault();
if($(this).attr("back"))
back=window.location.href; if(!$(this).hasClass("hide-form")){
else if($(this).attr("back"))
back=null; back=window.location.href;
load($(this).attr("action"),{data:$(this).serialize(), type:$(this).attr("method"),back:back},($(this).attr('rel')=="tab")); else
return false; back=null;
load($(this).attr("action"),{data:$(this).serialize(), type:$(this).attr("method"),back:back},($(this).attr('rel')=="tab"));
return false;
}
}); });
$(where+" form label.has-error").parent(".form-group").addClass("has-error")
$(where+" form.hide-form").each(function(evt){
that = this;
$('span.edit.label',this).click(function(evt){
$(that).removeClass('hide-input');
$(this).addClass('hide');
$('span.save.label',that).removeClass('hide');
$('input',that).removeAttr('disabled');
});
function handleSend(evt){
that2=this;
$.getJSON($(that).attr("action"),$(that).serialize(),function(evt){
if(!evt.error){
$(that).addClass('hide-input');
$('input',that).attr('disabled','disabled');
$('span.save.label',that).addClass('hide');
$('span.edit.label',that).removeClass('hide');
}else{
//TODO Handle error
console.log("TODO Handle Error");
}
});
}
$('span.save.label',this).addClass('hide');
$('input',this).attr('disabled','disabled');
$('span.save.label',this).click(handleSend);
$(that).submit(function(evt){
evt.stopPropagation();
handleSend(evt);
return false;
});
});
//$(where+" form label.has-error").parent(".form-group").addClass("has-error")
} }
function load(pageurl,conf,tab){ function load(pageurl,conf,tab){
data = {}; data = {};