diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index 4ea1b66..d07f571 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -22,23 +22,7 @@ class JobController extends AppController { */ - public static function sendApplicationMail($mail,$id){ - $Email = new CakeEmail('dreamjobMain'); - $Email->to($mail); - $Email->subject('Welcome to our really cool thing'); - $Email->template('job_application'); - $Email->viewVars(array('app_id'=>$id)); - return $Email->send(); - } - - public static function sendMsgMail($mail,$id){ - $Email = new CakeEmail('dreamjobMain'); - $Email->to($mail); - $Email->subject('Welcome to our really cool thing'); - $Email->template('job_application_msg'); - $Email->viewVars(array('app_id'=>$id)); - return $Email->send(); - } + public function openingList() { $this->MiconwareSession->init($this); diff --git a/app/Controller/RegistrationController.php b/app/Controller/RegistrationController.php index 1c07db3..3bbfdac 100644 --- a/app/Controller/RegistrationController.php +++ b/app/Controller/RegistrationController.php @@ -10,18 +10,9 @@ class RegistrationController extends AppController { * * @var array */ - public $componens = array('Email','MiconwareSession'); + public $componens = array('MiconwareSession'); public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany','User'); - public static function registrationMail($data){ - $Email = new CakeEmail('dreamjobMain'); - $Email->to($data['User']['mail']); - $Email->subject('Welcome to our really cool thing'); - $Email->template('registration'); - $key = substr($data['User']['code'],2); - $Email->viewVars(array('data'=>$data,'key'=>$key)); - return $Email->send(); - } public function main() { $this->MiconwareSession->init($this); diff --git a/app/Model/DreamjobCompany.php b/app/Model/DreamjobCompany.php index 9721ec9..202ea20 100755 --- a/app/Model/DreamjobCompany.php +++ b/app/Model/DreamjobCompany.php @@ -1,5 +1,6 @@ to($data['User']['mail']); + $Email->subject('Welcome to our really cool thing'); + $Email->template('registration'); + $key = substr($data['User']['code'],2); + $Email->viewVars(array('data'=>$data,'key'=>$key)); + return $Email->send(); + } + public function registration($data){ $dataSource = $this->getDataSource(); @@ -73,7 +84,7 @@ class DreamjobCompany extends AppModel { $result=$this->save(); } if($result) - $result = RegistrationController::registrationMail($data); + $result = self::sendMail($data); if ($result) { $dataSource->commit(); return true; diff --git a/app/Model/DreamjobJobApplication.php b/app/Model/DreamjobJobApplication.php index 09cc17d..aa12519 100644 --- a/app/Model/DreamjobJobApplication.php +++ b/app/Model/DreamjobJobApplication.php @@ -1,5 +1,6 @@ to($mail); + $Email->subject('Welcome to our really cool thing'); + $Email->template('job_application'); + $Email->viewVars(array('app_id'=>$id)); + return $Email->send(); + } + public function sendApplication($data){ $dataSource = $this->getDataSource(); $dataSource->begin(); @@ -41,7 +51,7 @@ class DreamjobJobApplication extends AppModel { if($result){ $open = $this->DreamjobJobOpening->find('first', array('conditions' => array('DreamjobJobOpening.id' => $data['DreamjobJobApplication']['opening_id']))); - $result = JobController::sendApplicationMail($open['User']['mail']l,$this->id); + $result = self::sendMail($open['User']['mail']l,$this->id); } if ($result) { diff --git a/app/Model/DreamjobJobMsg.php b/app/Model/DreamjobJobMsg.php index 20f60cf..5d684e4 100644 --- a/app/Model/DreamjobJobMsg.php +++ b/app/Model/DreamjobJobMsg.php @@ -1,5 +1,6 @@ to($mail); + $Email->subject('Welcome to our really cool thing'); + $Email->template('job_application_msg'); + $Email->viewVars(array('app_id'=>$id)); + return $Email->send(); + } public function sendMessage(){ $dataSource = $this->getDataSource(); $dataSource->begin(); @@ -40,9 +49,9 @@ class DreamjobJobMsg extends AppModel { if($result){ $app = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $this->application_id))); if($this->fromcompany) - $result = JobController::sendMsgMail($app['User']['mail'],$this->application_id); + $result = self::sendMail($app['User']['mail'],$this->application_id); else - $result = JobController::sendMsgMail($app['WorkerUser']['mail'],$this->application_id); + $result = sel::sendMail($app['WorkerUser']['mail'],$this->application_id); } if ($result) { $dataSource->commit(); diff --git a/app/Model/DreamjobWorker.php b/app/Model/DreamjobWorker.php index f9444e7..3816db2 100755 --- a/app/Model/DreamjobWorker.php +++ b/app/Model/DreamjobWorker.php @@ -1,5 +1,6 @@ to($data['User']['mail']); + $Email->subject('Welcome to our really cool thing'); + $Email->template('registration'); + $key = substr($data['User']['code'],2); + $Email->viewVars(array('data'=>$data,'key'=>$key)); + return $Email->send(); + } + + public function registration($data){ $dataSource = $this->getDataSource(); @@ -87,7 +100,7 @@ class DreamjobWorker extends AppModel { $result=$this->save(); } if($result) - $result = RegistrationController::registrationMail($data); + $result = self::sendMail($data); if ($result) { $dataSource->commit();