Created
January 5, 2015 16:00
-
-
Save taleeb35/662f165a3fba446f9d5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function get_assigned_task_list($email,$password) { | |
if(!empty($email) && !empty($password)) { | |
if(isset($email) && isset($password)) { | |
$this->loadModel('User'); | |
$user = $this->User->findByEmailAndPassword($email,$password); | |
if($user) { // If Password and email matched | |
$user_id = $user['User']['id']; | |
$task_list = $this->Control->find('list',array('fields' => array('id','name'),'conditions' => array('owner_id' => $user_id))); | |
if($task_list) { // If User have 1 or more record | |
$this->set(compact('task_list') + array('_serialize' => array('task_list'))); | |
} else { | |
$message = 'You have no Task'; | |
$this->set(compact('message')); | |
$this->set('_serialize', 'message'); | |
} | |
} else { | |
$message = 'Your email or password is wrong.Please try Again'; | |
$this->set(compact('message')); | |
$this->set('_serialize', 'message'); | |
} | |
} else { | |
$message = 'Please provide email and password'; | |
$this->set(compact('message')); | |
$this->set('_serialize', 'message'); | |
} | |
} else { | |
$message = 'Your email or password field is empty'; | |
$this->set(compact('message')); | |
$this->set('_serialize', 'message'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment