diff --git a/app/Config/routes.php b/app/Config/routes.php
index 27b1307..595aada 100755
--- a/app/Config/routes.php
+++ b/app/Config/routes.php
@@ -40,8 +40,15 @@
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)'));
+ Router::connect('/opening/:id/application', array('controller' => 'job', 'action' => 'applicationByOpening'),array("id" => "[0-9]+"));
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/page/:page', array('controller' => 'job', 'action' => 'applicationGet'),array("id" => "[0-9]+","page" => "[0-9]+"));
+ 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('/applicate/:id', array('controller' => 'job', 'action' => 'applicationSend'),array("id" => "[0-9]+"));
Router::connect('/favorite', array('controller' => 'job', 'action' => 'favorite'));
diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php
index c250c6e..2a48477 100644
--- a/app/Controller/JobController.php
+++ b/app/Controller/JobController.php
@@ -10,7 +10,7 @@ class JobController extends AppController {
* @var array
*/
- public $uses = array('DreamjobJobOpening','DreamjobJobFavority','DreamjobJobApplication');
+ public $uses = array('DreamjobJobOpening','DreamjobJobFavority','DreamjobJobApplication','DreamjobPageText','DreamjobPageImage','DreamjobJobMsg');
/**
* Displays a view
@@ -25,14 +25,20 @@ 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){
+
+ if(!is_array($self) or count($self) <= 0){
$this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error');
}else{
+ if(!empty($this->request->query['del'])){
+ $o =$this->DreamjobJobOpening->findById($this->request->query['del']);
+ if($o['AppUser']['id']== $self['AppUser']['id']){
+ $this->DreamjobJobOpening->delete($this->request->query['del'],false);
+ $this->MiconwareSession->setFlash('dreamjob.opening.delete','flash',array('alert'=>'success'));
+ }else{
+ $this->MiconwareSession->setFlash('dreamjob.opening.delete.error','flash',array('alert'=>'danger'));
+ }
+ }
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => array('DreamjobJobOpening.company_id' => $self['AppUser']['id'])));
$this->set('openings',$openings);
$this->render('/Job/opening_list');
@@ -110,7 +116,7 @@ class JobController extends AppController {
if(!empty($this->request->params['id'])){
- if(!empty($this->request->params['favorite']) and count($this->request->params['favorite'])>0){
+ if(!empty($this->request->params['favorite']) or count($this->request->params['favorite'])>0){
$WORKER = $this->MiconwareSession->getWorker();
$fav=false;
foreach($WORKER['Favority'] as $val){
@@ -135,7 +141,7 @@ class JobController extends AppController {
$this->MiconwareSession->refreshCache();
$this->MiconwareSession->initWeb($this);
- if(!is_array($opening) and count($opening) <= 0 ){
+ if(!is_array($opening) or count($opening) <= 0 ){
$this->set('error', 'dreamjob.error.opening.notFound');
$this->render('/Home/error');
}else{
@@ -149,7 +155,7 @@ class JobController extends AppController {
$this->MiconwareSession->initWeb($this);
$self = $this->MiconwareSession->getWorker();
- if(!is_array($self) and count($self) <= 0){
+ if(!is_array($self) or count($self) <= 0){
$this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error');
}else{
@@ -158,6 +164,7 @@ class JobController extends AppController {
$fav_id[]=$fav['id'];
$openings = $this->DreamjobJobOpening->find('all',array('conditions' => array('DreamjobJobOpening.id' =>$fav_id)));
$this->set('openings',$openings);
+ $this->set('opening_MINI',true);
$this->render('/Job/favorite');
}
}
@@ -167,14 +174,115 @@ class JobController extends AppController {
$this->MiconwareSession->initWeb($this);
$self = $this->MiconwareSession->getWorker();
- if(!is_array($self) and count($self) <= 0){
+ if(!is_array($self) or count($self) <= 0){
$this->set('error', 'dreamjob.error.noPermision');
$this->render('/Home/error');
}else{
$applications = $this->DreamjobJobApplication->find('all',array('conditions' => array('DreamjobJobApplication.worker_id' => $self['AppUser']['id'])));
$this->set('applications',$applications);
+ $this->set('opening_MINI',true);
$this->render('/Job/applicationWorker_list');
}
}
+ public function applicationGet() {
+ $this->MiconwareSession->init($this);
+
+ $this->MiconwareSession->initWeb($this);
+ $WORKER = $this->MiconwareSession->getWorker();
+ $COMPANY = $self = $this->MiconwareSession->getCompany();
+ $application = null;
+ if(isset($this->request->params['id'])){
+ if(is_array($WORKER) and count($WORKER) > 0)
+ $application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.worker_id' => $WORKER['AppUser']['id'],'DreamjobJobApplication.id'=> $this->request->params['id'] )));
+ if(is_array($COMPANY) and count($COMPANY) > 0)
+ $application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'],'DreamjobJobApplication.id'=> $this->request->params['id'] )));
+ }
+
+ if(!is_array($application) or count($application) <= 0){
+ $this->set('error', 'dreamjob.error.noPermision');
+ $this->render('/Home/error');
+ }else{
+ $this->set('page',null);
+ if(!empty($this->request->params['hiv'])){
+ $this->DreamjobJobApplication->id = $application['DreamjobJobApplication']['id'];
+ if ($this->DreamjobJobApplication->saveField('closed',!$application['DreamjobJobApplication']['closed'])) {
+ $application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.id'=> $this->request->params['id'] )));
+ $this->MiconwareSession->setFlash('dreamjob.application.archiv','flash',array('alert'=>'success'));
+ }else{
+ $this->MiconwareSession->setFlash('dreamjob.application.archiv.error','flash',array('alert'=>'danger'));
+ }
+ }
+ if(!empty($this->request->params['ages'])){
+ $this->set('msg',true);
+ if ($this->request->is('post')) {
+ $this->DreamjobJobMsg->create($this->request->data);
+ $this->DreamjobJobMsg->data['DreamjobJobMsg']['saw'] = false;
+ $this->DreamjobJobMsg->data['DreamjobJobMsg']['application_id'] = $application['DreamjobJobApplication']['id'];
+ $this->DreamjobJobMsg->data['DreamjobJobMsg']['fromcompany'] = is_array($COMPANY) and count($COMPANY) > 0;
+ if ($this->DreamjobJobMsg->save()) {
+ $application = $this->DreamjobJobApplication->find('first',array('conditions' => array('DreamjobJobApplication.id'=> $this->request->params['id'] )));
+ $this->MiconwareSession->setFlash('dreamjob.application.msg.add','flash',array('alert'=>'success'));
+ }else{
+ $this->MiconwareSession->setFlash('dreamjob.application.msg.error','flash',array('alert'=>'danger'));
+ }
+ }
+ }else{
+ $this->set('msg',false);
+ if(!empty($this->request->params['page'])){
+ $this->set('pageInh',$this->DreamjobJobApplication->Page->find('first',
+ array('conditions' => array("Page.id" => $this->request->params['page']))
+ ));
+ $page = $this->DreamjobJobApplication->PageText->find('first',
+ array('conditions' => array("PageText.page_ptr_id" => $this->request->params['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->render('/Job/application');
+ }
+ }
+ public function applicationByOpening(){
+ $this->MiconwareSession->init($this);
+
+ $this->MiconwareSession->initWeb($this);
+ $COMPANY = $self = $this->MiconwareSession->getCompany();
+ $applications = null;
+ $opening = null;
+ if(isset($this->request->params['id'])){
+ if(is_array($COMPANY) and count($COMPANY) > 0)
+ $opening = $this->DreamjobJobOpening->find('first',array('conditions' => array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'],'DreamjobJobOpening.id'=> $this->request->params['id'] )));
+ $filter_current = false;
+ $filter_archiv = false;
+ $condition = array('DreamjobJobOpening.company_id' => $COMPANY['AppUser']['id'],'DreamjobJobApplication.opening_id'=> $this->request->params['id']);
+ if(isset($this->request->query['filter']) and $this->request->query['filter'] =='all'){
+ }elseif(isset($this->request->query['filter']) and $this->request->query['filter'] =='archiv'){
+ $condition['closed'] = true;
+ $filter_archiv = true;
+ }else{
+ $condition['closed'] = false;
+ $filter_current = true;
+ }
+
+
+ $applications = $this->DreamjobJobApplication->find('all',array('conditions' =>$condition));
+ $this->set("filter_archiv",$filter_archiv);
+ $this->set("filter_current",$filter_current);
+ }
+ if(!is_array($opening) or count($opening) <= 0){
+ $this->set('error', 'dreamjob.error.noPermision');
+ $this->render('/Home/error');
+ }else{
+ $this->set('opening',$opening);
+ $this->set('applications',$applications);
+ $this->render('/Job/applicationCompany_list');
+ }
+ }
+ public function applicationSend() {
+ }
}
?>
diff --git a/app/Model/DreamjobJobApplication.php b/app/Model/DreamjobJobApplication.php
index 62a203a..ca9a092 100644
--- a/app/Model/DreamjobJobApplication.php
+++ b/app/Model/DreamjobJobApplication.php
@@ -145,6 +145,19 @@ class DreamjobJobApplication extends AppModel {
public $hasOne = array(
+ 'WorkerGraducation' => array(
+ 'className' => 'DreamjobListGraducation',
+ 'foreignKey' => false,
+ 'conditions' => array('DreamjobWorker.graducation_id = WorkerGraducation.id'),
+ 'limit' => 1
+ ),
+ 'WorkerUser' => array(
+ 'className' => 'User',
+ 'foreignKey' => false,
+ 'conditions' => array('DreamjobJobApplication.worker_id = AppUserWorker.id and WorkerUser.id = AppUserWorker.user_id'),
+ 'limit' => 1
+ ),
+ //achtung
'DreamjobCompany' => array(
'className' => 'DreamjobCompany',
'foreignKey' => false,
@@ -183,4 +196,34 @@ class DreamjobJobApplication extends AppModel {
),
);
+ public $hasAndBelongsToMany = array(
+ 'PageText' =>
+ array(
+ 'className' => 'DreamjobPageText',
+ 'with' => 'DreamjobJobApplicationPage',
+ 'foreignKey' => 'application_id',
+ 'associationForeignKey' => 'page_id'
+ ),
+ 'PageImage' =>
+ array(
+ 'className' => 'DreamjobPageImage',
+ 'with' => 'DreamjobJobApplicationPage',
+ 'foreignKey' => 'application_id',
+ 'associationForeignKey' => 'page_id'
+ ),
+ 'Page' =>
+ array(
+ 'className' => 'DreamjobPageInh',
+ 'with' => 'DreamjobJobApplicationPage',
+ 'foreignKey' => 'application_id',
+ 'associationForeignKey' => 'page_id'
+ )
+ );
+
+ public $hasMany = array(
+ 'DreamjobJobMsg' => array(
+ 'className' => 'DreamjobJobMsg',
+ 'foreignKey' => 'application_id'
+ ),
+ );
}
diff --git a/app/Model/DreamjobJobApplicationPage.php b/app/Model/DreamjobJobApplicationPage.php
new file mode 100644
index 0000000..7fbcc88
--- /dev/null
+++ b/app/Model/DreamjobJobApplicationPage.php
@@ -0,0 +1,87 @@
+ 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
+ ),
+ ),
+ 'application_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
+ ),
+ ),
+ 'page_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
+ ),
+ ),
+ );
+
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+/**
+ * belongsTo associations
+ *
+ * @var array
+ */
+ public $belongsTo = array(
+ 'DreamjobJobApplication' => array(
+ 'className' => 'DreamjobJobApplication',
+ 'foreignKey' => 'application_id'
+ ),
+ 'DreamjobPage' => array(
+ 'className' => 'DreamjobPageInh',
+ 'foreignKey' => 'page_id'
+ ),
+ );
+}
diff --git a/app/Model/DreamjobJobMsg.php b/app/Model/DreamjobJobMsg.php
new file mode 100644
index 0000000..cff130a
--- /dev/null
+++ b/app/Model/DreamjobJobMsg.php
@@ -0,0 +1,95 @@
+ 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
+ ),
+ ),
+ 'fromcompany' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ //'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
+ ),
+ ),
+ 'saw' => array(
+ 'boolean' => array(
+ 'rule' => array('boolean'),
+ //'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
+ ),
+ ),
+ 'text' => array(
+ 'notEmpty' => array(
+ 'rule' => array('notEmpty'),
+ //'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
+ ),
+ ),
+ );
+
+ //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+/**
+ * belongsTo associations
+ *
+ * @var array
+ */
+ public $belongsTo = array(
+ 'Application' => array(
+ 'className' => 'Application',
+ 'foreignKey' => 'application_id',
+ 'conditions' => '',
+ 'fields' => '',
+ 'order' => ''
+ )
+ );
+}
diff --git a/app/Model/DreamjobWorker.php b/app/Model/DreamjobWorker.php
index 0987af7..be1e053 100755
--- a/app/Model/DreamjobWorker.php
+++ b/app/Model/DreamjobWorker.php
@@ -164,6 +164,10 @@ class DreamjobWorker extends AppModel {
'DreamjobPageInh' => array(
'className' => 'DreamjobPageInh',
'foreignKey' => 'user_id'
+ ),
+ 'DreamjobJobApplication' => array(
+ 'className' => 'DreamjobJobApplication',
+ 'foreignKey' => 'worker_id'
)
);
}
diff --git a/app/View/Elements/job_opening_item.ctp b/app/View/Elements/job_opening_item.ctp
index efc27f5..fff0275 100644
--- a/app/View/Elements/job_opening_item.ctp
+++ b/app/View/Elements/job_opening_item.ctp
@@ -10,6 +10,11 @@
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;
@@ -21,11 +26,11 @@ if($opening['AppUser']['take_systemwide']){
$avatar = true;
}
?>
-=$opening['DreamjobJobOpening']['title'];?>
-