diff --git a/app/Config/routes.php b/app/Config/routes.php
index 595aada..9c97cce 100755
--- a/app/Config/routes.php
+++ b/app/Config/routes.php
@@ -45,6 +45,7 @@
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/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/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('/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.
*/
diff --git a/app/Controller/Component/MiconwareSessionComponent.php b/app/Controller/Component/MiconwareSessionComponent.php
index 8526b53..dbfc06b 100755
--- a/app/Controller/Component/MiconwareSessionComponent.php
+++ b/app/Controller/Component/MiconwareSessionComponent.php
@@ -28,6 +28,17 @@ class MiconwareSessionComponent extends Component {
'after' => '',
'class' => ''))
);
+ $controller->set('default_hForm',array(
+ 'inputDefaults' => array(
+ 'div' => array('class' => 'form-group'),
+ 'label' => array('class' => 'col-lg-3 control-label'),
+ 'between' => '
',
+ 'after' => '
',
+ 'error' => array('attribute'=>array('wrap'=>'span','class'=>'help-block')),
+ 'class' => 'form-control '),
+ 'class'=>'hide-form hide-input'
+ )
+ );
$controller->set('default_Form',array(
'inputDefaults' => array(
'div' => array('class' => 'form-group'),
diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php
index f97fd45..bbd0a5c 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','DreamjobPageText','DreamjobPageImage','DreamjobJobMsg');
+ public $uses = array('DreamjobJobOpening','DreamjobJobFavority','DreamjobJobApplication','DreamjobPageText','DreamjobPageImage','DreamjobJobMsg','DreamjobCvCategory');
/**
* Displays a view
@@ -226,7 +226,6 @@ class JobController extends AppController {
$this->MiconwareSession->setFlash('dreamjob.application.msg.error','flash',array('alert'=>'danger'));
}
}
- //TODO Mark as read
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']));
if(is_array($COMPANY) and count($COMPANY) > 0)
@@ -234,18 +233,24 @@ class JobController extends AppController {
}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);
+ // CV
+ if(!empty($this->request->params['vitea'])){
+ $cv = $this->DreamjobCvCategory->find('all',array('conditions' => array('worker_id'=> $application['DreamjobJobApplication']['worker_id'])));
+ $this->set("cv",$cv);
+ }else{
+ 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);
diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php
index 72ffb3e..938b2d1 100755
--- a/app/Controller/UserController.php
+++ b/app/Controller/UserController.php
@@ -11,6 +11,7 @@ class UserController extends AppController {
*/
public $uses = array('DreamjobListGraducation','DreamjobWorker','DreamjobCompany','DreamjobPageText','DreamjobPageImage','DreamjobJobOpening','DreamjobCvCategory');
+ public $components = array('MiconwareSession','RequestHandler');
/**
* Displays a view
@@ -24,8 +25,9 @@ class UserController extends AppController {
$this->MiconwareSession->init($this);
$this->MiconwareSession->initWeb($this);
-
-
+ $this->autoRender = true;
+ $this->layout = 'default';
+ $this->RequestHandler->setContent('html', 'application/html' );
//self check
$self_company = false;
@@ -38,6 +40,9 @@ class UserController extends AppController {
//get Profil
$hard_error = false;
+ if(!$this->MiconwareSession->isLoggedin())
+ $hard_error = true;
+
$company = false;
$page = null;
$profil = null;
@@ -67,6 +72,8 @@ class UserController extends AppController {
}else{
if(isset($profil['DreamjobWorker'])){
$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);
}
}
@@ -98,6 +105,26 @@ class UserController extends AppController {
}else
$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() {
$this->MiconwareSession->init($this);
diff --git a/app/Model/DreamjobCvCategory.php b/app/Model/DreamjobCvCategory.php
index ccff020..7197486 100644
--- a/app/Model/DreamjobCvCategory.php
+++ b/app/Model/DreamjobCvCategory.php
@@ -28,13 +28,24 @@ class DreamjobCvCategory extends AppModel {
* @var string
*/
public $displayField = 'id';
-
+
+ public $order = 'DreamjobCvCategory.id';
/**
* Validation rules
*
* @var 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(
'numeric' => array(
'rule' => array('numeric'),
diff --git a/app/View/Elements/barleft.ctp b/app/View/Elements/barleft.ctp
index 0c66a3c..c169992 100755
--- a/app/View/Elements/barleft.ctp
+++ b/app/View/Elements/barleft.ctp
@@ -31,7 +31,7 @@ if($isLoggedin){
class="active">"/>