Пример #1
0
 public function do_update()
 {
     requirelogin();
     updateLastActive();
     $myID = getUserID();
     $pid = (int) jsonInput('id');
     $myRole = (int) get_project_roles($pid, $myID);
     $query = $this->mdb->project_get($pid);
     if ($query->num_rows()) {
         $row = $query->row();
         if ($myRole > 0 || $myID == $row->creator_id) {
             $title = trim(jsonInput('title'));
             $description = jsonInput('description');
             $status = (int) jsonInput('status');
             $privacy = (int) jsonInput('privacy');
             $task_approval = jsonInput('task_approval') ? 1 : 0;
             $project_approval = jsonInput('project_approval') ? 1 : 0;
             if (empty($title)) {
                 generate_json(array('status' => 0, 'message' => 'Project title is required.'));
             } elseif ($status < 0 || $status > 1) {
                 generate_json(array('status' => 0, 'message' => 'Invalid status.'));
             } elseif ($privacy < 0 || $privacy > 2) {
                 generate_json(array('status' => 0, 'message' => 'Invalid privacy settings.'));
             } else {
                 $sql = $this->mdb->project_update($pid, array('project_name' => $title, 'description' => $description, 'completed' => $status, 'privacy' => $privacy));
                 $this->mdb->projSettings_update(array('project_id' => $pid), array('task_approval' => $task_approval, 'project_approval' => $project_approval));
                 generate_json(array('status' => 1));
             }
         } else {
             generate_json(array('status' => 0, 'message' => 'You are not allowed here.'));
         }
     } else {
         generate_json(array('status' => 0, 'message' => 'Project not found.'));
     }
 }
Пример #2
0
 public function index()
 {
     $myID = getUserID();
     $title = trim(jsonInput('title'));
     $description = jsonInput('description');
     $location = jsonInput('location');
     $start = strtotime(jsonInput('start'));
     $end = strtotime(jsonInput('end'));
     if (empty($title)) {
         generate_json(array('status' => 0, 'message' => 'Please type event title.'));
     } else {
         if (!$start) {
             generate_json(array('status' => 0, 'message' => 'Start Date is required.'));
         } else {
             if ($end && $start > $end) {
                 generate_json(array('status' => 0, 'message' => 'Dates mismatch.'));
             } else {
                 $start = date("Y-m-d", $start);
                 $end = $end ? date("Y-m-d", $end) : $start;
                 $this->mdb->add_event(array('title' => $title, 'description' => $description, 'location' => $location, 'type' => 'default', 'start' => $start, 'end' => $end, 'date_added' => today(), 'source' => 'local', 'user_id' => $myID));
                 generate_json(array('status' => 1));
             }
         }
     }
 }
Пример #3
0
 public function index($pid = 0)
 {
     $myID = getUserID();
     $id = (int) jsonInput('id');
     $pid = (int) $pid;
     $tid = (int) $tid;
 }
Пример #4
0
 private function np_validations()
 {
     $name = trim(jsonInput('name'));
     if (empty($name) || strlen($name) < 2) {
         generate_json(array('status' => 0, 'message' => 'Project name must be atleast 2 characters long.'));
         exit;
     }
     return true;
 }
Пример #5
0
 public function index()
 {
     $myID = getUserID();
     $title = trim(jsonInput('title'));
     if (empty($title)) {
         generate_json(array('status' => 0, 'message' => 'Title is empty.'));
     } else {
         $query = $this->mdb->insert($myID, $title);
         generate_json(array('status' => 1));
     }
 }
Пример #6
0
 public function do_save()
 {
     requireadmin();
     $site_name = jsonInput('site_name');
     $site_address = jsonInput('site_address');
     $site_copy = jsonInput('site_copy');
     $site_email = jsonInput('site_email');
     $site_tz = jsonInput('site_tz');
     $this->change_config(array('site_name' => $site_name, 'site_address' => $site_address, 'site_copy' => $site_copy, 'site_email' => $site_email, 'timezone' => $site_tz));
     generate_json(array('status' => 1));
     audit_trail($this->session->userdata('display_name') . ' updated the site settings');
 }
Пример #7
0
 public function index()
 {
     $myID = getUserID();
     $date = today();
     $title = trim(jsonInput('title'));
     $content = jsonInput('content');
     $category = trim(jsonInput('category'));
     if (empty($title)) {
         generate_json(array('status' => 0, 'message' => 'Title is required.'));
     } else {
         $insert_id = $this->mdb->insert_note(array('user_id' => $myID, 'title' => $title, 'content' => $content, 'category' => $category, 'date_created' => $date));
         generate_json(array('status' => 1, 'message' => 'Note successfully created.'));
     }
 }
Пример #8
0
 public function index()
 {
     $myID = getUserID();
     $id = (int) jsonInput('id');
     $title = trim(jsonInput('title'));
     $status = jsonInput('status');
     $status = $status == "true" ? 1 : 0;
     if (empty($title)) {
         generate_json(array('status' => 0, 'message' => 'Title is empty.'));
     } else {
         $query = $this->mdb->update(array('id' => $id, 'user_id' => $myID), array('status' => $status, 'description' => $title));
         generate_json(array('status' => $query));
     }
 }
Пример #9
0
 public function index()
 {
     $myID = getUserID();
     $displayName = trim(jsonInput('display_name'));
     $firstname = trim(jsonInput('firstname'));
     $lastname = trim(jsonInput('lastname'));
     $middlename = jsonInput('middlename');
     $email = jsonInput('email');
     $email_privacy = (int) jsonInput('email_privacy');
     $gender = jsonInput('gender');
     $contact = jsonInput('contact');
     $address = strtolower(jsonInput('address'));
     $address_privacy = (int) jsonInput('address_privacy');
     $company = trim(jsonInput('company'));
     $serializedContacts = '';
     $location = array('location' => $address, 'privacy' => $address_privacy);
     if (is_array($contact) && count($contact) > 0) {
         $contactArr = array();
         foreach ($contact as $cont) {
             if (trim($cont->contact)) {
                 if (!is_numeric($cont->contact)) {
                     generate_json(array('status' => 0, 'message' => $cont->contact . ' is not a valid number.'));
                     exit;
                 }
                 $contactArr[] = array('contact' => $cont->contact, 'privacy' => (int) $cont->privacy);
             }
         }
         $serializedContacts = serialize($contactArr);
     }
     if (strlen($displayName) < 3) {
         generate_json(array('status' => 0, 'message' => 'Display name too short.'));
     } elseif (empty($firstname)) {
         generate_json(array('status' => 0, 'message' => 'First name is required.'));
     } elseif (empty($lastname)) {
         generate_json(array('status' => 0, 'message' => 'Last name is required.'));
     } elseif ($this->mdb->check_if_emailTaken($myID, $email)) {
         generate_json(array('status' => 0, 'message' => 'Email address is already in use.'));
     } else {
         //update users info table
         $where = array('user_id' => $myID);
         $this->mdb->update_user_info($where, array('firstname' => $firstname, 'lastname' => $lastname, 'middlename' => $middlename, 'gender' => $gender, 'location' => serialize($location), 'contact_number' => $serializedContacts, 'company' => $company, 'email_privacy' => $email_privacy));
         //update users table
         $where = array('id' => $myID);
         $this->mdb->update_user($where, array('display_name' => $displayName, 'email_address' => $email));
         //update session
         $sessionUpdate = array('display_name' => $displayName, 'email_address' => $email);
         $this->session->set_userdata($sessionUpdate);
         generate_json(array('status' => 1, 'message' => 'Successfully Updated.'));
     }
 }
Пример #10
0
 public function index()
 {
     $myID = getUserID();
     $new_pass = jsonInput('password');
     $re_type_pass = jsonInput('password2');
     if ($new_pass != $re_type_pass) {
         generate_json(array('status' => 0, 'message' => 'Password does not match.'));
     } elseif (strlen($new_pass) < 4) {
         generate_json(array('status' => 0, 'message' => 'Password too short.'));
     } else {
         $where = array('id' => $myID);
         $this->mdb->update_user($where, array('password' => ts_hash($new_pass)));
         generate_json(array('status' => 1, 'message' => 'Password successfuly changed.'));
     }
 }
Пример #11
0
 public function index()
 {
     $myID = getUserID();
     $id = (int) jsonInput('id');
     $title = trim(jsonInput('title'));
     $content = jsonInput('content');
     $category = jsonInput('category');
     if (empty($title)) {
         generate_json(array('status' => 0, 'message' => 'Title is required.'));
     } else {
         $data = array('title' => $title, 'content' => $content, 'category' => $category);
         $query = $this->mdb->update_note($data, array('user_id' => $myID, 'id' => $id));
         // print_r($this->db->last_query());
         generate_json(array('status' => 1, 'message' => 'Note successfully updated.'));
     }
 }
Пример #12
0
 public function generate($pid = 0)
 {
     requirelogin();
     updateLastActive();
     $type = jsonInput('type');
     $member = (int) jsonInput('member');
     $dateFrom = jsonInput('date_from');
     $dateTo = jsonInput('date_to');
     $myID = getUserID();
     if (!validate_access('valid_member', array('project_id' => $pid, 'user_id' => $myID))) {
         generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
     } else {
         switch ($type) {
             case 'project':
                 $this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type));
                 generate_json(array('status' => 1));
                 break;
             case 'member':
                 $this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type, 'date_from' => $dateFrom, 'date_to' => $dateTo));
                 generate_json(array('status' => 1));
                 break;
             case 'task':
                 $statuses = array('active', 'completed', 'pending', 'active_complete');
                 $taskStat = trim(jsonInput('task_status'));
                 $taskStat = in_array($taskStat, $statuses) ? $taskStat : "";
                 $this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type, 'status' => $taskStat, 'date_from' => $dateFrom, 'date_to' => $dateTo));
                 generate_json(array('status' => 1));
                 break;
             case 'personel':
                 if ($member > 0) {
                     if (validate_access('valid_member', array('project_id' => $pid, 'user_id' => $member))) {
                         $this->session->set_userdata('project_report', array('member' => $member, 'project_id' => $pid, 'type' => $type));
                         generate_json(array('status' => 1));
                     } else {
                         generate_json(array('status' => 0, 'message' => 'This user is not a member of this project.'));
                     }
                 } else {
                     generate_json(array('status' => 0, 'message' => 'Please select a member.'));
                 }
                 break;
             default:
                 generate_json(array('status' => 0, 'message' => 'Unknown report type.'));
         }
     }
 }
Пример #13
0
 public function update($id = 0)
 {
     requirelogin();
     updateLastActive();
     $myID = getUserID();
     $query = $this->mdb->feed_details($id);
     $content = trim(jsonInput('post'));
     if ($query->num_rows()) {
         $row = $query->row();
         if ($row->poster_id == $myID) {
             if (!empty($content)) {
                 $this->mdb->feed_update(array('id' => $row->id), array('post_message' => $content));
                 generate_json(array('status' => 1));
             } else {
                 generate_json(array('status' => 0, 'message' => 'Please type a post.'));
             }
         } else {
             generate_json(array('status' => 0, 'message' => 'You cannot edit this post! maybe its not yours'));
         }
     } else {
         generate_json(array('status' => 0, 'message' => 'Post not found.'));
     }
 }
Пример #14
0
 public function create($id = 0)
 {
     requirelogin();
     updateLastActive();
     $id = (int) $id;
     $myID = getUserID();
     if (!validate_access('valid_member', array('project_id' => $id, 'user_id' => $myID))) {
         generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
     } else {
         $name = trim(jsonInput('name'));
         $description = jsonInput('description');
         $parentTask = (int) jsonInput('parent_task');
         $priority = (int) jsonInput('priority');
         $dateStart = strtotime(jsonInput('date_start'));
         $dateEnd = strtotime(jsonInput('date_end'));
         $members = jsonInput('members');
         //Form validations
         if (empty($name)) {
             generate_json(array('status' => 0, 'message' => 'Task name is empty.'));
             exit;
         }
         //Check parent task
         if ($parentTask > 0) {
             $query = $this->mdb->task_get($parentTask);
             if ($query->num_rows()) {
                 $row = $query->row();
                 if ($row->project_id != $id) {
                     generate_json(array('status' => 0, 'message' => 'It seems that parent task belongs to another project.'));
                     exit;
                 }
             } else {
                 generate_json(array('status' => 0, 'message' => 'Parent task does not exists.'));
                 exit;
             }
         }
         //Priority check
         $priorities = $this->config->item('priorities');
         if ($priority < 0 || $priority >= count($priorities)) {
             generate_json(array('status' => 0, 'message' => 'Priority error! please refresh the page.'));
             exit;
         }
         //Date validation
         if ($dateStart && $dateEnd) {
             if ($dateStart > $dateEnd) {
                 generate_json(array('status' => 0, 'message' => 'Dates mismatch!'));
                 exit;
             }
         }
         $dateStart = $dateStart ? date("Y-m-d H:i:s", $dateStart) : NULL;
         $dateEnd = $dateEnd ? date("Y-m-d H:i:s", $dateEnd) : NULL;
         //Check members
         if (is_array($members) && count($members)) {
             foreach ($members as $member) {
                 $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                 if ($qChkUser->num_rows()) {
                     $row = $qChkUser->row();
                     if (!validate_access('valid_member', array('project_id' => $id, 'user_id' => $row->id))) {
                         generate_json(array('status' => 0, 'message' => $member . ' is not a member of this project.'));
                         exit;
                     }
                 } else {
                     generate_json(array('status' => 0, 'message' => $member . ' does not exists.'));
                     exit;
                 }
             }
         }
         $is_accepted = 1;
         $projSett = $this->mdb->projSettings_get($id);
         if ($projSett->num_rows()) {
             $projSettRow = $projSett->row();
             $is_accepted = (int) $projSettRow->task_approval ? 0 : 1;
         }
         //finally create the task
         $result = $this->mdb->task_add(array('project_id' => $id, 'creator_id' => $myID, 'title' => $name, 'description' => $description, 'date_created' => today(), 'date_start' => $dateStart, 'date_end' => $dateEnd, 'date_completed' => null, 'status' => 0, 'parent_task' => $parentTask, 'is_accepted' => $is_accepted, 'priority' => $priority));
         //add members to task
         if (is_array($members) && count($members) && $result > 0) {
             foreach ($members as $member) {
                 $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                 if ($qChkUser->num_rows()) {
                     $row = $qChkUser->row();
                     $checkIfAlreadyAdded = $this->mdb->taskMembers_get(array('task_id' => $result, 'user_id' => $row->id));
                     if ($checkIfAlreadyAdded->num_rows() == 0) {
                         $this->mdb->taskMembers_add(array('task_id' => $result, 'user_id' => $row->id, 'assigned_by' => $myID, 'is_accepted' => $row->id == $myID ? 1 : 0, 'date_joined' => today()));
                         //notification
                         notify('task_invite', $row->id, array('project_id' => $id, 'task_id' => $result));
                         $qProj = $this->db->get_where('projects', array('id' => $id));
                         if ($qProj->num_rows()) {
                             $qProjRow = $qProj->row();
                             $myName = $this->session->userdata('display_name');
                             $redirectLink = base_url('#/app/projects/' . $id . '/task/' . $result);
                             do_sendmail($row->id, $qProjRow->project_name, "{$myName} assigned a task for you in <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
                         }
                     }
                 }
             }
         }
         projectLogs_add('task_add', $id, array('task_id' => $result, 'task_name' => $name));
         generate_json(array('status' => 1));
     }
 }
Пример #15
0
 public function add($pid = 0)
 {
     $myID = getUserID();
     $members = jsonInput('members');
     if (!validate_access('valid_member', array('project_id' => $pid, 'user_id' => $myID))) {
         generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
     } else {
         if (is_array($members) && count($members) > 0) {
             $errMsg = array();
             $message = '';
             foreach ($members as $member) {
                 $query = $this->mmdb->get_member($pid, $member);
                 if ($query->num_rows()) {
                     $row = $query->row();
                     if ($row->is_accepted == 1) {
                         $errMsg[] = "{$member} is already a member.";
                     } else {
                         if ($row->joined_by > 0) {
                             $errMsg[] = "{$member} is already invited.";
                         } else {
                             $this->mmdb->update_member(array('project_id' => $pid, 'email_address' => $member), array('is_accepted' => 1));
                         }
                     }
                 } else {
                     $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                     if ($qChkUser->num_rows()) {
                         $pmRow = $qChkUser->row();
                         $this->mmdb->project_member_add(array('project_id' => $pid, 'user_id' => $pmRow->id, 'email_address' => $pmRow->email_address, 'joined_by' => $myID, 'date_joined' => today(), 'last_visit' => NULL, 'is_accepted' => 0, 'project_role' => $this->siteinfo->config('project_roles_default')));
                         //Notify
                         notify('project_invite', $pmRow->id, array('project_id' => $pid));
                         $qProj = $this->db->get_where('projects', array('id' => $pid));
                         if ($qProj->num_rows()) {
                             $qProjRow = $qProj->row();
                             $myName = $this->session->userdata('display_name');
                             $redirectLink = base_url('#/app/projects/' . $pid);
                             do_sendmail($pmRow->id, $qProjRow->project_name, "{$myName} invited you to join <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
                         }
                     } else {
                         $this->mmdb->project_member_add(array('project_id' => $pid, 'user_id' => 0, 'email_address' => $member, 'joined_by' => $myID, 'date_joined' => today(), 'last_visit' => NULL, 'is_accepted' => 0, 'project_role' => $this->siteinfo->config('project_roles_default')));
                     }
                 }
             }
             if (count($errMsg)) {
                 $message = $errMsg[0];
             } else {
                 $message = 'Member(s) were successfully invited to this project. It will notify once they accepted it.';
             }
             generate_json(array('status' => count($errMsg) ? 0 : 1, 'message' => $message));
         } else {
             generate_json(array('status' => 0, 'message' => 'Please type a member username / email.'));
         }
     }
 }
Пример #16
0
 public function index()
 {
     $myID = getUserID();
     $post_id = (int) jsonInput('post_id');
     $comment_id = (int) jsonInput('comment_id');
     $message = trim(jsonInput('message'));
     $length = (int) jsonInput('items');
     if (empty($message)) {
         generate_json(array('status' => 0, 'message' => 'Please type a comment.'));
     } else {
         $query = $this->mdb->getPostDetails($post_id);
         if ($query->num_rows() == 0) {
             generate_json(array('status' => 0, 'message' => 'Post does not exists.'));
         } else {
             $row = $query->row();
             $validate = validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $myID));
             if (!$validate) {
                 generate_json(array('status' => 0, 'message' => 'You are not authorized to do this.'));
             } else {
                 $this->mdb->comment_add(array('post_id' => $post_id, 'comment_id' => $comment_id, 'user_id' => $myID, 'comment' => $message, 'date_posted' => today(), 'params' => ''));
                 if ($comment_id > 0) {
                     //notify commentor
                     $qchkComment = $this->mdb->get_comment_projID($comment_id);
                     if ($qchkComment->num_rows()) {
                         $chkCommentRow = $qchkComment->row();
                         notify('reply_comment', $chkCommentRow->poster_id, array('post_id' => $row->id, 'poster_id' => $row->poster_id, 'project_id' => $row->project_id, 'task_id' => $row->task_id, 'comment_id' => $comment_id));
                     }
                 } else {
                     //notify poster
                     if ($row->task_id > 0) {
                         notify('post_comment_task', $row->poster_id, array('post_id' => $row->id, 'project_id' => $row->project_id, 'task_id' => $row->task_id));
                         $qProj = $this->db->get_where('projects', array('id' => $row->project_id));
                         if ($qProj->num_rows()) {
                             $qProjRow = $qProj->row();
                             $myName = $this->session->userdata('display_name');
                             $taskName = $this->db->get_where('tasks', array('id' => $row->task_id));
                             $qTaskRow = $taskName->row();
                             $redirectLink = base_url('#/app/projects/' . $row->project_id . '/task/' . $row->task_id . '/feed/' . $row->id);
                             do_sendmail($row->poster_id, $qProjRow->project_name, "{$myName} commented on your update in task <b><a href='{$redirectLink}'>" . $qTaskRow->title . "</a></b>");
                         }
                     } else {
                         notify('post_comment', $row->poster_id, array('post_id' => $row->id, 'project_id' => $row->project_id, 'task_id' => $row->task_id));
                         $qProj = $this->db->get_where('projects', array('id' => $row->project_id));
                         if ($qProj->num_rows()) {
                             $qProjRow = $qProj->row();
                             $myName = $this->session->userdata('display_name');
                             $redirectLink = base_url('#/app/projects/' . $row->project_id . '/feed/' . $row->id);
                             do_sendmail($row->poster_id, $qProjRow->project_name, "{$myName} commented on your post in <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
                         }
                     }
                 }
                 $length++;
                 $this->mdb->post_setLastupdate($post_id);
                 $query = $this->mdb->get_comment_snippet($post_id, $comment_id, $length);
                 $items = $this->loopComments($row->id, $query);
                 $qNxtChck = $this->mdb->get_comment_snippet($post_id, $comment_id, $length + 1);
                 $adc = $this->mdb->get_adc_counts($post_id, $comment_id);
                 generate_json(array('status' => 1, 'items' => $items, 'adc' => $adc->row(), 'shownextcommentslink' => $qNxtChck->num_rows() > $length ? 1 : 0));
             }
         }
     }
 }
Пример #17
0
 public function add_member()
 {
     requirelogin();
     updateLastActive();
     $id = (int) jsonInput('id');
     $members = jsonInput('members');
     $myID = getUserID();
     $query = $this->mdb->task_get($id);
     if ($query->num_rows()) {
         $row = $query->row();
         $isModerator = validate_access('is_moderator', array('project_id' => $row->project_id, 'user_id' => $myID));
         $qMember = $this->mdb->taskMembers_get(array('task_id' => $row->id, 'user_id' => $myID, 'is_accepted' => 1));
         if ($isModerator || $qMember->num_rows() || $myID == $row->creator_id) {
             if (is_array($members) && count($members)) {
                 foreach ($members as $member) {
                     $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                     if ($qChkUser->num_rows()) {
                         $memberRow = $qChkUser->row();
                         $qChkIfMember = $this->mdb->taskMembers_get(array('task_id' => $row->id, 'user_id' => $memberRow->id));
                         if ($qChkIfMember->num_rows()) {
                             generate_json(array('status' => 0, 'message' => $member . ' is already assigned to this task.'));
                             exit;
                         } else {
                             if (!validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $memberRow->id))) {
                                 generate_json(array('status' => 0, 'message' => $member . ' is not a member of this project.'));
                                 exit;
                             }
                         }
                     } else {
                         generate_json(array('status' => 0, 'message' => $member . ' does not exists.'));
                         exit;
                     }
                 }
                 foreach ($members as $member) {
                     $qChkUser = $this->model->getUserInfo(array('email_address' => $member));
                     if ($qChkUser->num_rows()) {
                         $memberRow = $qChkUser->row();
                         $this->mdb->taskMembers_add(array('task_id' => $row->id, 'user_id' => $memberRow->id, 'assigned_by' => $myID, 'is_accepted' => $memberRow->id == $myID ? 1 : 0, 'date_joined' => today()));
                         //notification
                         notify('task_invite', $memberRow->id, array('project_id' => $row->project_id, 'task_id' => $row->id));
                         $qProj = $this->db->get_where('projects', array('id' => $row->project_id));
                         if ($qProj->num_rows()) {
                             $qProjRow = $qProj->row();
                             $myName = $this->session->userdata('display_name');
                             $redirectLink = base_url('#/app/projects/' . $row->project_id . '/task/' . $row->id);
                             do_sendmail($memberRow->id, $qProjRow->project_name, "{$myName} assigned a task for you in <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
                         }
                     }
                 }
                 generate_json(array('status' => 1, 'message' => 'Member(s) was invited to this task.'));
             } else {
                 generate_json(array('status' => 0, 'message' => 'No people(s) to add.'));
             }
         } else {
             generate_json(array('status' => 0, 'message' => 'You are not allowed to do this.'));
         }
     } else {
         generate_json(array('status' => 0, 'message' => 'Task does not exists.'));
     }
 }