Opening ende

This commit is contained in:
Martin Müller 2014-03-01 11:17:23 +01:00
parent ad49f5fb0f
commit 09cb5961cf
5 changed files with 89 additions and 130 deletions

View File

@ -25,7 +25,7 @@ class JobController extends AppController {
$this->MiconwareSession->initWeb($this);
$self = $this->MiconwareSession->getCompany();
if(!empty($this->request->query['del'])){
//$this->DreamjobJobFavority->delete($this->request->query['del'],false);
$this->DreamjobJobFavority->delete($this->request->query['del'],false);
$this->MiconwareSession->setFlash('dreamjob.opening.delete','flash',array('alert'=>'success'));
}
if(!is_array($self) and count($self) <= 0){
@ -38,22 +38,66 @@ class JobController extends AppController {
}
}
public function openingAdd() {
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list'));
$this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list'));
if(empty($this->MiconwareSession->getCompany())){
$this->set('error', 'dreamjob.error.noCompany');
$this->render('/Home/error');
}else{
if ($this->request->is('post')) {
$this->DreamjobJobOpening->create($this->request->data);
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $this->MiconwareSession->getCompany()['AppUser']['id'];
if ($this->DreamjobJobOpening->save()) {
$this->MiconwareSession->setFlash('dreamjob.opening.save.add','flash',array('alert'=>'success'));
}else{
$this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger'));
}
}
$this->render('/Job/opening_edit');
}
}
public function openingEdit() {
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$opening = false;
$a = $this->MiconwareSession->getCompany();
if(empty($a)){
$this->set('error', 'dreamjob.error.noCompany');
$this->render('/Home/error');
return null;
}
if(!empty($this->request->params['id'])){
$this->request->data = $this->DreamjobJobOpening->findById($this->request->params['id']);
$load = $this->DreamjobJobOpening->findById($this->request->params['id']);
$cid = $a['AppUser']['id'];
if (!empty($load) and $load['DreamjobJobOpening']['company_id'] == $cid) {
if ($this->request->is(array('post', 'put'))) {
$this->DreamjobJobOpening->create($this->request->data);
$this->DreamjobJobOpening->data['DreamjobJobOpening']['id'] = $this->request->params['id'];
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid;
echo var_dump($this->DreamjobJobOpening);
if ($this->DreamjobJobOpening->save($this->DreamjobJobOpening->data)) {
$this->MiconwareSession->setFlash('dreamjob.opening.save','flash',array('alert'=>'success'));
}else
$this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger'));
}
}
$this->request->data=$load;
$this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list'));
$this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list'));
}
if(!is_array($opening) and count($opening) <= 0 ){
if(empty($this->request->data['DreamjobJobOpening'])){
$this->set('error', 'dreamjob.error.opening.notFound');
$this->render('/Home/error');
}elseif( $this->request->data['DreamjobJobOpening']['company_id'] != $a['AppUser']['id']){
$this->set('error', 'dreamjob.error.noPermission');
$this->render('/Home/error');
}else{
$this->set('opening',$opening);
$this->render('/Job/opening_edit');
}
}

View File

@ -44,15 +44,7 @@ class DreamjobJobOpening extends AppModel {
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
'userDefined' => array(
'rule' => array('userDefined'),
//'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
),
)
),
'street' => array(
'notEmpty' => array(

View File

@ -15,6 +15,7 @@ if($isLoggedin){
}
.column-center{
padding-left:50px;
width:1010px;
}
-->
</style>

View File

@ -20,121 +20,33 @@ echo $this->Form->create('DreamjobJobOpening',$default_Form);
</c:otherwise>
</c:choose>
*/
echo $this->Form->hidden("DreamjobJobOpening.company_id");
if(!empty($this->request->data['DreamjobJobOpening']))
echo $this->request->data['DreamjobJobOpening']['title'];
else
echo __("dreamjob.opening.addForm");
?>
</legend>
<?php echo $this->Form->input('DreamjobJobOpening.title',array('label'=>__("dreamjob.title"))); ?>
<?php echo $this->Form->input('DreamjobJobOpening.title',array('label'=>array('text'=>__("dreamjob.title"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobJobOpening.startdate',array('label'=>array('text'=>__("dreamjob.opening.startdate"),"class"=>$default_Form['inputDefaults']['label']['class']),"style"=>'width:20%;display:inline-block;'));
echo $this->Form->input('DreamjobJobOpening.enddate',array('label'=>array('text'=>__("dreamjob.opening.enddate"),"class"=>$default_Form['inputDefaults']['label']['class']),"style"=>'width:20%;display:inline-block;'));
echo $this->Form->input('DreamjobJobOpening.kindofjob_id',array('label'=>array('text'=>__("dreamjob.kindofjob"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobJobOpening.graducation_id',array('label'=>array('text'=>__("dreamjob.graducation"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobJobOpening.branch',array('label'=>array('text'=>__("dreamjob.branch"),"class"=>$default_Form['inputDefaults']['label']['class']))); ?>
<div class="form-group">
<spring:message code="" var="msg_dreamjob_title"/>
<form:label for="title" path="title" class="col-lg-3 control-label" cssErrorClass="has-error">${msg_dreamjob_title}</form:label>
<label class="col-lg-3 control-label"><?=__("dreamjob.opening.active");?></label>
<div class="col-lg-9">
<form:input class="form-control" type="text" path="title" placeholder="${msg_dreamjob_title}"/>
<form:errors cssClass="has-error" path="title"/>
<?=$this->Form->checkbox('DreamjobJobOpening.active',array("class"=>'form-control',"label"=>__("dreamjob.opening.active")))?>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.startdate',array('label'=>__("dreamjob.opening.startdate"))); ?>
<div class="form-group">
<spring:message code="dreamjob.opening.startdate" var="msg_dreamjob_opening_startdate"/>
<form:label for="startdate" path="startdate" cssErrorClass="has-error" class="col-lg-3 control-label">${msg_dreamjob_opening_startdate}</form:label>
<div class="col-lg-9">
<form:input class="form-control" type="text" path="startdate" placeholder="${msg_dreamjob_opening_startdate}"/>
<form:errors cssClass="has-error" path="startdate"/>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.enddate'); ?>
<div class="form-group">
<spring:message code="dreamjob.opening.enddate" var="msg_dreamjob_opening_enddate"/>
<form:label for="enddate" path="enddate" class="col-lg-3 control-label" cssErrorClass="has-error">${msg_dreamjob_opening_enddate}</form:label>
<div class="col-lg-9">
<form:input class="form-control" type="text" path="enddate" placeholder="${msg_dreamjob_opening_enddate}"/>
<form:errors cssClass="has-error" path="enddate"/>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.kindofjob'); ?>
<div class="form-group">
<spring:message code="dreamjob.kindofjob" var="msg_dreamjob_kindofjob"/>
<form:label for="kindofjob" path="kindofjob" cssErrorClass="has-error" class="col-lg-3 control-label">${msg_dreamjob_kindofjob}</form:label>
<div class="col-lg-9">
<form:select class="form-control" path="kindofjob">
<option value="-1">--- Select ---</option>
<form:options items="${kindofjobList}" itemLabel="name"/>
</form:select>
<form:errors cssClass="has-error" path="kindofjob"/>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.graducation'); ?>
<div class="form-group">
<spring:message code="dreamjob.graducation" var="msg_dreamjob_graducation"/>
<form:label for="graducation" path="graducation" cssErrorClass="has-error" class="col-lg-3 control-label">${msg_dreamjob_graducation}</form:label>
<div class="col-lg-9">
<form:select class="form-control" path="graducation">
<option value="-1">--- Select ---</option>
<form:options items="${graducationList}" itemLabel="name"/>
</form:select>
<form:errors cssClass="has-error" path="graducation"/>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.branch'); ?>
<div class="form-group">
<spring:message code="dreamjob.branch" var="msg_dreamjob_branch"/>
<form:label for="branch" path="branch" cssErrorClass="has-error" class="col-lg-3 control-label">${msg_dreamjob_branch}</form:label>
<div class="col-lg-9">
<form:select class="form-control" path="branch">
<option value="-1">--- Select ---</option>
<form:options items="${branchList}" itemLabel="name" itemValue="name"/>
</form:select>
<form:errors cssClass="has-error" path="branch"/>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.active'); ?>
<div class="form-group">
<div class="col-lg-offset-3 col-lg-9">
<div class="checkbox">
<form:label cssErrorClass="has-error" path="active">
<form:checkbox path="active"/>
<spring:message code="dreamjob.active"/>
</form:label>
</div>
<form:errors cssClass="has-error" path="active"/>
</div>
</div>
<legend><spring:message code="dreamjob.address"/></legend>
<?php echo $this->Form->input('DreamjobJobOpening.street'); ?>
<div class="form-group">
<spring:message code="dreamjob.street" var="msg_dreamjob_street"/>
<form:label for="street" path="street" cssErrorClass="has-error" class="col-lg-3 control-label">${msg_dreamjob_street}</form:label>
<div class="col-lg-9">
<form:input class="form-control" type="text" path="street" placeholder="${msg_dreamjob_street}"/>
<form:errors cssClass="has-error" path="street"/>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.postcode'); ?>
<div class="form-group">
<spring:message code="dreamjob.postcode" var="msg_dreamjob_postcode"/>
<form:label for="postcode" path="postcode" cssErrorClass="has-error" class="col-lg-3 control-label">${msg_dreamjob_postcode}</form:label>
<div class="col-lg-9">
<form:input class="form-control" type="text" path="postcode" placeholder="${msg_dreamjob_postcode}"/>
<form:errors cssClass="has-error" path="postcode"/>
</div>
</div>
<?php echo $this->Form->input('DreamjobJobOpening.city'); ?>
<div class="form-group">
<spring:message code="dreamjob.city" var="msg_dreamjob_city"/>
<form:label for="city" path="city" cssErrorClass="has-error" class="col-lg-3 control-label">${msg_dreamjob_city}</form:label>
<div class="col-lg-9">
<form:input class="form-control" type="text" path="city" placeholder="${msg_dreamjob_city}"/>
<form:errors cssClass="has-error" path="city"/>
</div>
</div>
<legend><spring:message code="dreamjob.text"/></legend>
<?php echo $this->Form->input('DreamjobJobOpening.text'); ?>
<div class="form-group">
<form:textarea class="form-control" path="text" placeholder="${msg_dreamjob_text}" rows="10"></form:textarea>
</div>
<div class="form-group">
<div class="col-lg-offset-3 col-lg-9">
<button type="submit" class="btn btn-default"><spring:message code='dreamjob.save'/></button>
</div>
<legend><?=__("dreamjob.address");?></legend>
<?php echo $this->Form->input('DreamjobJobOpening.street',array('label'=>array('text'=>__("dreamjob.street"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobJobOpening.postcode',array('label'=>array('text'=>__("dreamjob.postcode"),"class"=>$default_Form['inputDefaults']['label']['class'])));
echo $this->Form->input('DreamjobJobOpening.city',array("label" => array('text'=>__("dreamjob.city"),"class"=>$default_Form['inputDefaults']['label']['class']))); ?>
<legend><?=__("dreamjob.text");?></legend>
<?php echo $this->Form->textarea('DreamjobJobOpening.text',array("class"=>'form-control',"rows"=>10)); ?>
<div style="text-align:right;margin-top:25px;">
<?=$this->Form->button(__('dreamjob.save'),array('div' => false,'class'=>"btn btn-default",'type' => 'submit'));?>
</div>
</fieldset>
<?php echo $this->Form->end(); ?>

View File

@ -21,6 +21,9 @@ a:hover{
textarea {
resize: none;
}
legend{
margin-top:20px;
}
/*
* Default
*/
@ -33,6 +36,9 @@ textarea {
margin-bottom: 20px;
color:black;
}
.form-group{
padding:15px 0;
}
/*
* Logo
@ -305,7 +311,11 @@ body.loading #container{
vertical-align: middle;
text-align: center;
white-space: nowrap;
width: 110px;
width: 150px;
}
.openingitem .right .btn-group-vertical > .btn{
width:150px;
overflow-x:hidden;
}
.openingitem.empty {
display: block;