This commit is contained in:
Martin Müller 2014-02-23 09:39:07 +01:00
parent f2743d3e9e
commit 98aa6adb91
4 changed files with 36 additions and 9 deletions

View File

@ -37,6 +37,7 @@
Router::connect('/opening', array('controller' => 'job', 'action' => 'openingList'));
Router::connect('/opening/add', array('controller' => 'job', 'action' => 'openingAdd'));
Router::connect('/opening/edit/:id', array('controller' => 'job', 'action' => 'openingEdit'),array("id" => "[0-9]+"));
Router::connect('/opening/:id', array('controller' => 'job', 'action' => 'openingGet'),array("id" => "[0-9]+"));
Router::connect('/opening/:id/:favorite', array('controller' => 'job', 'action' => 'openingGet'), array("id" => "[0-9]+",'favorite' => '(?i:favorite)'));

View File

@ -24,6 +24,10 @@ 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->MiconwareSession->setFlash('dreamjob.opening.delete','flash',array('alert'=>'success'));
}
if(!is_array($self) and count($self) <= 0){
$this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error');
@ -35,6 +39,24 @@ class JobController extends AppController {
}
public function openingAdd() {
}
public function openingEdit() {
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
$opening = false;
if(!empty($this->request->params['id'])){
$this->request->data = $this->DreamjobJobOpening->findById($this->request->params['id']);
}
if(!is_array($opening) and count($opening) <= 0 ){
$this->set('error', 'dreamjob.error.opening.notFound');
$this->render('/Home/error');
}else{
$this->set('opening',$opening);
$this->render('/Job/opening_edit');
}
}
public function openingGet() {
$this->MiconwareSession->init($this);

View File

@ -5,7 +5,7 @@
$opening_in_app = false;
$opening_in_fav=false;
if(is_array($WORKER) and count($WORKER)>0){
if(isset($WORKER) and is_array($WORKER) and count($WORKER)>0){
foreach($WORKER['Favority'] as $val){
if($val['id'] == $opening['DreamjobJobOpening']['id'])
$opening_in_fav=true;
@ -66,12 +66,13 @@ if($opening['AppUser']['take_systemwide']){
</div>
<div class="right">
<div class="btn-group-vertical">
<?=$this->Html->link(__('dreamjob.opening.detail'),array('controller'=>'job', 'action'=>'openingGet', 'id'=> $opening['DreamjobJobOpening']['id']),array("class" => "btn btn-default"));?>
<?php if($COMPANY['AppUser']['id'] == $opening['DreamjobJobOpening']['company_id']){ ?>
<a class="btn btn-default" href="<c:url value="${URL}opening/edit/${opening.id}/"/>">
<?=__("dreamjob.edit");?>
</a>
<?php }elseif(false){ ?>
<?php
echo $this->Html->link(__('dreamjob.opening.detail'),array('controller'=>'job', 'action'=>'openingGet', 'id'=> $opening['DreamjobJobOpening']['id']),array("class" => "btn btn-default"));
if( isset($COMPANY['AppUser']['id']) and $COMPANY['AppUser']['id'] == $opening['DreamjobJobOpening']['company_id']){
echo $this->Html->link(__('dreamjob.opening.edit'),array('controller'=>'job', 'action'=>'openingEdit', 'id'=> $opening['DreamjobJobOpening']['id']),array("class" => "btn btn-default"));
echo $this->Html->link(__('dreamjob.opening.delete'),array('controller'=>'job', 'action'=>'openingList', '?' => array('del'=> $opening['DreamjobJobOpening']['id'])),array("class" => "btn btn-default"));
}elseif(false){ ?>
<c:when test="${opening_in_app}">
<c:set var="count" value="0"/>
<c:set var="newcount" value="0"/>
@ -89,7 +90,7 @@ if($opening['AppUser']['take_systemwide']){
</a>
<?php }else{ ?>
<a class="btn btn-default
<?php if(!is_array($WORKER) and count($WORKER) <= 0){ ?>disabled<?php } ?>"
<?php if(isset($WORKER) and !is_array($WORKER) and count($WORKER) <= 0){ ?>disabled<?php } ?>"
href="{% url de.miconware.dreamjob.jobs.views.application_send opening.pk %}">
<?=__("dreamjob.applicate");?>
</a>

View File

@ -9,13 +9,16 @@
--
CREATE TABLE IF NOT EXISTS `mic_dj_job_opening_worker` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`opening_id` int(11) NOT NULL,
`worker_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `opening_id` (`opening_id`,`worker_id`),
KEY `mic_dj_job_opening_worker_favOpening` (`opening_id`),
KEY `mic_dj_job_opening_worker_favWorker` (`worker_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--