dreamjob/app/View/Elements/job_opening_item.ctp

105 lines
4.3 KiB
PHP

<?php
/*
*
*/
$opening_in_app = false;
$opening_in_fav=false;
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;
}
foreach($WORKER['DreamjobJobApplication'] as $val){
if($val['opening_id'] == $opening['DreamjobJobOpening']['id'])
$opening_in_app=true;
$opening_inApp=$val;
}
}
$avatar = false;
$url = '';
if($opening['AppUser']['take_systemwide']){
if($opening['User']['avatar']){
$url = $MEDIA.DS.$opening['User']['avatar'];
$avatar = true;
}
}else{
if($opening['AppUser']['avatar']){
$url = $MEDIA.DS.$opening['AppUser']['avatar'];
$avatar = true;
}
}
?>
<?php if(!empty($opening_MINI) or !($opening_in_app or $opening_in_fav)){ ?>
<div class="openingitem">
<h3><?=$opening['DreamjobJobOpening']['title'];?></h3>
<?php if(!empty($WORKER)){ ?>
<?php if(!$opening_in_app){ ?>
<span style="float: right;margin-right:60px;">
<?php
$image='favority_off.png';
if($opening_in_fav)
$image='favority_on.png';
echo $this->Html->image($image,array('url' => array('controller'=>'job','action'=>'openingGet','id'=>$opening['DreamjobJobOpening']['id'],'favorite'=>'favorite')));
?>
</span>
<?php } ?>
<?php } ?>
<div>
<?php if($avatar){ ?>
<div class="icon">
<span><?=$opening['AppUser']['nickname'];?></span>
<div>
<img src="<?=$url;?>"/>
</div>
</div>
<?php
}else{
?>
<div class="noicon-title">
<span><?=$opening['AppUser']['nickname'];?></span>
</div>
<?php } ?>
<div class="left">
<span><?=__("dreamjob.graducation.company");?>: <?=$opening['DreamjobListGraducation']['name'];?></span>
<span><?=__("dreamjob.branch");?>: <?=$opening['DreamjobListBranch']['name'];?></span>
<span><?=__("dreamjob.city");?>: <?=$opening['DreamjobListCity']['name'];?></span>
<span><?=__("dreamjob.kindofjob");?>: <?=$opening['DreamjobListKindofjob']['name'];?></span>
<span<?php if( time() > strtotime($opening['DreamjobJobOpening']['enddate'])){ ?> class="opening_outdate"<?php } ?>><?=__("dreamjob.opening.enddate");?>: <?=$this->Time->format('d.m.Y', $opening['DreamjobJobOpening']['enddate']);?></span>
</div>
<div class="right">
<div class="btn-group-vertical">
<?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.application'),array('controller'=>'job', 'action'=>'applicationByOpening', 'id'=> $opening['DreamjobJobOpening']['id']),array("class" => "btn btn-default"));
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($opening_in_app){
if(!empty($enableMsg)){
$countstr= count($opening['DreamjobJobMsg']);
$newcount=0;
foreach($opening['DreamjobJobMsg'] as $msg)
if(!$msg['saw'])
$newcount++;
if($newcount>0)
$countstr = $newcount."/".$countstr;
$countstr =__('dreamjob.applicated').' <span class="badge">'.$countstr.'</span>';
}else
$countstr =__('dreamjob.applicated');
echo $this->Html->link($countstr,array('controller'=>'job', 'action'=>'applicationGet', 'id' => $opening_inApp['id']),array("class" => "btn btn-default","escape"=>false));
}else{
$class="btn btn-default";
if(isset($WORKER) and !is_array($WORKER) and count($WORKER) <= 0)
$class = "btn btn-default disable";
echo $this->Html->link(__('dreamjob.applicate'),array('controller'=>'job', 'action'=>'applicationSend', 'id'=> $opening['DreamjobJobOpening']['id']),array("class" => $class));
}
?>
</div>
</div>
</div>
</div>
<?php } ?>