Example #1
0
 function editsubscriptionuser()
 {
     //Load model
     $this->load->model('package_model');
     //load validation library
     $this->load->library('form_validation');
     $this->outputData['subscriptionuser'] = $this->package_model->getSubscriptionUser();
     $username = $this->input->post('username');
     $package_name = $this->input->post('package_name');
     $valid = $this->input->post('valid');
     $amount = $this->input->post('amount');
     $subscriptionuser_id = $this->input->post('subscriptionuser_id');
     $updatedData['updated_date'] = get_est_time();
     $sub_count = count($subscriptionuser_id);
     for ($i = 0; $i < $sub_count; $i++) {
         //update the amount value
         $condition = array('subscriptionuser.id' => $subscriptionuser_id[$i]);
         $updateKey = array('subscriptionuser.username' => $username[$i]);
         $this->package_model->updateSubscritionUser(NULL, $updateKey, $condition);
         $updateKey = array('subscriptionuser.package_id' => $package_name[$i]);
         $this->package_model->updateSubscritionUser(NULL, $updateKey, $condition);
         $updateKey = array('subscriptionuser.valid' => $valid[$i]);
         $this->package_model->updateSubscritionUser(NULL, $updateKey, $condition);
         $updateKey = array('subscriptionuser.amount' => $amount[$i]);
         $this->package_model->updateSubscritionUser(NULL, $updateKey, $condition);
         $this->package_model->updateSubscritionUser(NULL, $updatedData, $condition);
     }
     $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('success', $this->lang->line('Update Succesfully Completed')));
     redirect_admin('packages/viewsubscriptionuser');
 }
Example #2
0
 /**
  * Post mail Messages Related To A Project
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function composeMail()
 {
     //Assign the value for check the button is preview or submit
     $preview = FALSE;
     //Assign the value
     $this->outputData['previewMessages'] = array();
     //language file - Change this file to do display text modification
     $this->lang->load('enduser/postMessage', $this->config->item('language_code'));
     //load validation libraray
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //language file - Change this file to do display text modification
     $this->lang->load('enduser/projectMessages', $this->config->item('language_code'));
     //language file - Change this file to do display text modification
     $this->lang->load('enduser/projectMessages', $this->config->item('language_code'));
     //Get Project Id
     $user_id = $this->loggedInUser->id;
     $logged_userrole = $this->loggedInUser->role_id;
     //Get all the users projects who are all won the projects
     if ($logged_userrole == '2') {
         $conditions = array('projects.programmer_id' => $user_id);
     }
     if ($logged_userrole == '1') {
         $conditions = array('projects.creator_id' => $user_id);
     }
     $wonProjects = $this->skills_model->getUsersproject($conditions);
     $this->outputData['wonProjects'] = $wonProjects->result();
     //Get all the users lists
     $usersList = $this->user_model->getUsers();
     $this->outputData['usersList'] = $usersList->result();
     $conditions = array('messages.from_id' => $user_id);
     $userslist = $this->messages_model->getProjectMessages();
     $this->outputData['projects'] = $userslist;
     //Get Form Data
     if ($this->input->post('postMessage') or $this->input->post('previewMessage')) {
         //Set rules
         $this->form_validation->set_rules('message', 'lang:message_validation', 'required|min_length[5]|trim|xss_clean');
         if ($this->form_validation->run()) {
             //Get the message posted user name
             $condition = array('users.user_name' => $this->input->post('to'));
             $userId = $this->user_model->getUsers($condition);
             $user_id = $userId->row();
             $this->outputData['user_name'] = $this->input->post('to');
             $insertData = array();
             $insertData['project_id'] = '0';
             $insertData['to_id'] = $user_id->id;
             $insertData['from_id'] = $this->loggedInUser->id;
             $insertData['message'] = $this->input->post('message');
             $insertData['created'] = get_est_time();
             //Get Username
             $to_id = $this->input->post('to');
             if (!is_numeric($to_id)) {
                 $users_list = $this->messages_model->getUsers();
                 foreach ($users_list as $message) {
                     if ($this->input->post('to') === $message->user_name) {
                         $insertData['to_id'] = $message->id;
                     }
                 }
             }
             if ($this->input->post('previewMessage')) {
                 $this->outputData['previewMessages'] = $insertData;
                 $preview = TRUE;
             }
             if ($this->input->post('postMessage')) {
                 //Create Projects
                 $this->messages_model->postMessage($insertData);
                 $preview = FALSE;
             }
             //echo $preview;
             if ($preview == FALSE) {
                 //Notification message
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Your Message Has Been Posted Successfully')));
                 redirect('info/index/success');
             }
         }
         //If End - Form Validation
     }
     //If End - Check For Form Submission
     //Get Project Id
     if ($this->uri->segment(3)) {
         //Get project id for post message for the particular project
         $project_id = $this->uri->segment(3, '0');
         $conditions = array('projects.id' => $project_id);
         $this->outputData['projects'] = $this->skills_model->getProjects($conditions);
     }
     if (isLoggedIn() === false) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be logged to post messages on the Project Message Board')));
         redirect('info/index/success');
     }
     $this->load->view('messages/composeMail', $this->outputData);
 }
Example #3
0
 /**
  * Loads Contact page.
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function index()
 {
     //load validation library
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //pr($_POST);exit;
     //Get Form Data
     if ($this->input->post('postContact')) {
         //pr($_POST);exit;
         //Set rules
         $this->form_validation->set_rules('c_email', 'lang:contact_email_id', 'required|trim|valid_email|xss_clean');
         $this->form_validation->set_rules('c_subject', 'lang:contact_subject', 'required|trim|xss_clean');
         $this->form_validation->set_rules('c_comments', 'lang:contact_comments', 'required|trim|xss_clean|min_length[25]');
         if ($this->form_validation->run()) {
             //Insert the contacts contents
             $enduser_id = $this->input->post('c_email');
             $subject = $this->input->post('c_subject');
             $comments = $this->input->post('c_comments');
             $from = $this->config->item('site_admin_mail');
             //echo $enduser_id;exit;
             $insertData = array();
             $insertData['email_id'] = $this->input->post('c_email');
             $insertData['subject'] = $this->input->post('c_subject');
             $insertData['comments'] = $this->input->post('c_comments');
             $insertData['created'] = get_est_time();
             //Create User
             $this->contact_model->insertContactPost($insertData);
             $sent_email = $this->email_model->sendHtmlMail($from, $enduser_id, $subject, $comments);
             //Set the Success Message
             $success_msg = 'Your details sent successfully';
             //echo $success_msg;exit;
             //Notification message
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $success_msg));
             redirect('info');
         }
         //Form Validation End
     }
     //If - Form Submission End
     //Get Frequently Asked Questions
     $conditions = array('is_frequent' => 'Y');
     $this->outputData['frequentFaqs'] = $this->faq_model->getFaqs($conditions);
     //Load View
     $this->load->view('contact', $this->outputData);
 }
Example #4
0
 /**
  * Add new transaction
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function addTransaction()
 {
     //print_r($_POST);
     //exit;
     $result = FALSE;
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     $this->outputData['transactionDescription'] = $this->input->post('transactionDescription', TRUE);
     $this->outputData['from_username'] = $this->input->post('from_username', TRUE);
     $this->outputData['to_username'] = $this->input->post('to_username', TRUE);
     $this->outputData['from_usertype'] = $this->input->post('from_usertype', TRUE);
     $this->outputData['to_usertype'] = $this->input->post('to_usertype', TRUE);
     $this->outputData['amount'] = $this->input->post('amount', TRUE);
     if ($this->input->post('addTransaction')) {
         //Set rules
         $this->form_validation->set_rules('transactionDescription', 'lang:Transaction Description', 'required|trim|xss_clean');
         $this->form_validation->set_rules('from_usertype', 'lang:usertype', 'required|trim|xss_clean');
         $this->form_validation->set_rules('from_username', 'lang:username', 'required|trim|xss_clean');
         $this->form_validation->set_rules('to_usertype', 'lang:usertype', 'required|trim|xss_clean');
         $this->form_validation->set_rules('to_username', 'lang:username', 'required|trim|xss_clean');
         $this->form_validation->set_rules('amount', 'lang:Amount', 'required|trim|xss_clean|numeric');
         if ($this->form_validation->run()) {
             //Set Payment Id
             $insertData = array();
             $insertData['id'] = '';
             $insertData['type'] = 'Transfer';
             $insertData['creator_id'] = $this->input->post('from_username', TRUE);
             $insertData['buyer_id'] = '';
             $insertData['provider_id'] = '';
             $insertData['transaction_time'] = get_est_time();
             $insertData['amount'] = $this->input->post('amount', TRUE);
             $insertData['status'] = 'Completed';
             $insertData['description'] = 'Tansfer Amount Through Paypal';
             $insertData['paypal_address'] = '';
             $insertData['user_type'] = 'admin';
             $insertData['reciever_id'] = $this->input->post('to_username', TRUE);
             $insertData['project_id'] = '';
             $min_amount = $this->config->item('payment_settings');
             //Check User Balance
             $condition_balance = array('user_balance.user_id' => $this->input->post('from_username', TRUE));
             $results = $this->transaction_model->getBalance($condition_balance);
             $condition_balance1 = array('user_balance.user_id' => $this->input->post('to_username', TRUE));
             $results1 = $this->transaction_model->getBalance($condition_balance1);
             if ($this->input->post('to_username', TRUE) == $this->input->post('from_username', TRUE)) {
                 $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('error', $this->lang->line('You can not make Transaction for same person')));
                 redirect_admin('payments/addTransaction');
             }
             //If Record already exists
             if ($results->num_rows() > 0) {
                 //get balance detail
                 $rowBalance = $results->row();
                 $balance = $rowBalance->amount - ($min_amount + $this->input->post('amount', TRUE));
                 if ($balance > 0) {
                     //Update Amount
                     $updateKey = array('user_balance.user_id' => $this->input->post('from_username', TRUE));
                     $updateData = array();
                     $updateData['amount'] = $rowBalance->amount - $this->input->post('amount', TRUE);
                     $Update_Amount = $this->transaction_model->updateBalance($updateKey, $updateData);
                     if ($results1->num_rows() > 0) {
                         $rowBalance1 = $results1->row();
                         //Update Amount
                         $updateKey = array('user_balance.user_id' => $this->input->post('to_username', TRUE));
                         $updateData = array();
                         $updateData['amount'] = $rowBalance1->amount + $this->input->post('amount', TRUE);
                         $Update_Amount = $this->transaction_model->updateBalance($updateKey, $updateData);
                         //pr($insertData);
                         $Update_transaction = $this->transaction_model->addTransaction($insertData);
                         redirect_admin('payments/viewTransaction');
                     }
                 } else {
                     $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('error', $this->lang->line('You are not having Sufficient Balance')));
                     $result = TRUE;
                     redirect_admin('payments/addTransaction');
                 }
             }
             // balance If end here
         }
         //validation if end here
     }
     //If - Form Submission End
     $this->load->view('admin/payments/addTransaction', $this->outputData);
 }
Example #5
0
 /**
  * manage Job from Buyer who post project
  *
  * @access	public for buyer
  * @param	project id 
  * @return	contents
  */
 function manageJoblist()
 {
     //Load Language
     $this->lang->load('enduser/createProject', $this->config->item('language_code'));
     $this->lang->load('enduser/project', $this->config->item('language_code'));
     $this->lang->load('enduser/review', $this->config->item('language_code'));
     //load validation libraray
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Check for Login details.
     if (!isset($this->loggedInUser->id)) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be login access to this page')));
         redirect('info');
     }
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if ($this->loggedInUser->role_id) {
         if ($this->loggedInUser->role_id == '2') {
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be logged in as a buyer to post projects')));
             redirect('info');
         }
     }
     //Get Groups
     $this->outputData['groupsWithCategories'] = $this->skills_model->getGroupsWithCategory();
     if ($this->uri->segment(3, 0)) {
         $project_id = $this->uri->segment(3, 0);
     } else {
         $project_id = $this->input->post('projectid');
     }
     $update = $this->input->post('update');
     //Get the project details for post similar projects
     $conditions = array('projects.id' => $project_id, 'projects.creator_id' => $this->loggedInUser->id);
     //pr($conditions);
     $postSimilar = $this->skills_model->getUsersproject($conditions);
     $this->outputData['postSimilar'] = $postSimilar;
     $res = $postSimilar->num_rows();
     if ($res <= 0) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Your are not allow to manage this project')));
         redirect('project/view/' . $project_id);
     }
     $this->form_validation->set_rules('attachment', 'lang:attachment_validation', 'callback_attachment_check');
     $this->form_validation->set_rules('categories[]', 'lang:categories_validation', 'trim|integer|is_natural|abs|xss_clean|callback__maxvalcheckcat');
     if ($this->form_validation->run()) {
         $res = $postSimilar->num_rows();
         //pr($postSimilar->result());
         if ($res <= 0) {
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Your are not allow to manage this project')));
             redirect('project/view/' . $project_id);
         }
         //Create job before it for update the projects datas for manage option
         if ($this->input->post('update') == '0') {
             if ($this->input->post('projectid')) {
                 $insertData = array();
                 $insertData['project_name'] = $this->input->post('projectName');
                 $insertData['description'] = $this->input->post('description');
                 if (isset($this->data['file'])) {
                     $insertData['attachment_url'] = $this->data['file']['file_name'];
                     $insertData['attachment_name'] = $this->data['file']['orig_name'];
                 }
                 if ($this->input->post('categories')) {
                     $categories = $this->input->post('categories');
                     //Work With Project Categories
                     $project_categoriesNameArray = $this->skills_model->convertCategoryIdsToName($categories);
                     $project_categoriesNameString = implode(',', $project_categoriesNameArray);
                     $insertData['project_categories'] = $project_categoriesNameString;
                 }
                 if ($this->input->post('update') == '0') {
                     $insertData['description'] = $this->input->post('description') . '<br/>';
                     $insertData['description'] .= $this->input->post('add_description');
                 } else {
                     $insertData['description'] = $this->input->post('description');
                 }
                 $paymentSettings = $this->settings_model->getSiteSettings();
                 $joblistvalidity = $paymentSettings['JOBLIST_VALIDITY_LIMIT'];
                 $insertData['creator_id'] = $this->loggedInUser->id;
                 $insertData['created'] = get_est_time();
                 $insertData['enddate'] = get_est_time() + $joblistvalidity * 86400;
                 $result = '0';
                 if ($this->input->post('categories')) {
                     $categories = $this->input->post('categories');
                     //Work With Project Categories
                     $project_categoriesNameArray = $this->skills_model->convertCategoryIdsToName($categories);
                     $project_categoriesNameString = implode(',', $project_categoriesNameArray);
                     $insertData['project_categories'] = $project_categoriesNameString;
                 }
                 //Update the data
                 $project = $this->input->post('projectid');
                 $condition = array('projects.id' => $project);
                 $this->skills_model->manageProjects($insertData, $condition);
                 //Notification message
                 //Load Model For Mail
                 $this->load->model('email_model');
                 //Send Mail
                 $conditionUserMail = array('email_templates.type' => 'projectpost_notification');
                 $result = $this->email_model->getEmailSettings($conditionUserMail);
                 $rowUserMailConent = $result->row();
                 $splVars = array("!site_name" => $this->config->item('site_title'), "!username" => $this->loggedInUser->user_name, "!projectid" => $this->db->insert_id(), "!date" => get_datetime(time()));
                 $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                 $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
                 $toEmail = $this->loggedInUser->email;
                 $fromEmail = $this->config->item('site_admin_mail');
                 $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Your Job has been Updated Successfully')));
                 redirect('joblist/viewAlljoblists/flag');
             }
         }
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Your Job has been Updated Successfully')));
         redirect('joblist/viewAlljoblists/flag');
     }
     $this->load->view('joblist/managejoblist', $this->outputData);
 }
Example #6
0
 function addSuspend()
 {
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if ($this->input->post('addBan')) {
         if ($this->input->post('type') == 'EMAIL') {
             $this->form_validation->set_rules('value', 'lang:Suspend Value', 'required|trim|xss_clean|callback__check_email|callback__check_email_suspend');
         }
         if ($this->input->post('type') == 'USERNAME') {
             $this->form_validation->set_rules('value', 'lang:Suspend Value', 'required|trim|xss_clean|callback__check_email|callback__check_username_suspend');
         }
         if ($this->form_validation->run()) {
             $insertData = array();
             $insertData['suspend_type'] = $this->input->post('type');
             $insertData['suspend_value'] = $this->input->post('value');
             $insertData['suspend_time'] = get_est_time();
             if (strtolower($insertData['suspend_type']) == 'email') {
                 $condition = array('users.email' => $insertData['suspend_value']);
                 $user = $this->user_model->getUsers($condition);
                 $type = $insertData['suspend_type'];
             }
             if (strtolower($insertData['suspend_type']) == 'username') {
                 $condition = array('users.user_name' => $insertData['suspend_value']);
                 $user = $this->user_model->getUsers($condition);
                 $type = $insertData['suspend_type'];
             }
             if (isset($user) and count($user->result()) > 0) {
                 $user = $user->row();
                 $conditionUserMail = array('email_templates.type' => 'email_suspended');
                 $this->load->model('email_model');
                 $result = $this->email_model->getEmailSettings($conditionUserMail);
                 $rowUserMailConent = $result->row();
                 //echo $records;
                 //Update the details
                 $splVars = array("!username" => $user->user_name, "!contact_url" => site_url('contact'), "!site_url" => site_url(), "!type" => $type, '!site_name' => $this->config->item('site_title'));
                 //pr($splVars);
                 $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                 $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
                 $toEmail = $user->email;
                 $fromEmail = $this->config->item('site_admin_mail');
                 $mailContent;
                 $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
             }
             $stat = $this->common_model->insertData('suspend', $insertData);
             if (strtolower($insertData['suspend_type']) == 'username') {
                 $condition = array('users.user_name' => $insertData['suspend_value']);
                 $data = array('users.suspend_status' => '1');
                 $this->common_model->updateTableData('users', NULL, $data, $condition);
             } else {
                 if (strtolower($insertData['suspend_type']) == 'email') {
                     $condition = array('users.email' => $insertData['suspend_value']);
                     $data = array('users.suspend_status' => '1');
                     $this->common_model->updateTableData('users', NULL, $data, $condition);
                 }
             }
             $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('success', $this->lang->line('added_success')));
             redirect_admin('users/editSuspend');
         }
     }
     $this->load->view('admin/users/addSuspend', $this->outputData);
 }
Example #7
0
 /**
  * Loads deposit page of the site.
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function index()
 {
     if (!isset($this->loggedInUser->id)) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You can not access to this page')));
         redirect('info');
     }
     if ($this->loggedInUser->suspend_status == 1) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Suspend Error')));
         redirect('info');
     }
     //Check Whether User Logged In Or Not
     if (isLoggedIn() === false) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Dont have rights to access this page')));
         redirect('info');
     }
     $condition = array('projects.project_status' => '2');
     $projectList = $this->skills_model->getUsersproject($condition);
     $this->outputData['projectList_tranferamount'] = $projectList->result();
     //load validation libraray
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Load escrow transaction
     //Load helper file
     $this->load->helper('transaction');
     $creator_condition = array('transactions.creator_id' => $this->loggedInUser->id);
     $transaction_condition = array('transactions.creator_id' => $this->loggedInUser->id, 'type' => 'Transfer');
     $url = 'transfer/index';
     $page = $this->uri->segment(3, 0);
     $escrow = loadTransaction($creator_condition, $transaction_condition, $url, $page);
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //Check User Balance
     $this->load->model('transaction_model');
     $condition_balance = array('user_balance.user_id' => $this->loggedInUser->id);
     $results = $this->transaction_model->getBalance($condition_balance);
     if ($results->num_rows() > 0) {
         //get balance detail
         $rowBalance = $results->row();
         $this->outputData['userAvailableBalance'] = $rowBalance->amount;
         $avail_balance = $rowBalance->amount;
     }
     //Get Form Data
     if ($this->input->post('transferMoney')) {
         //Set Validation Rules
         $this->form_validation->set_rules('total', 'lang:total_validation', 'required|trim|integer|xss_clean|abs');
         $this->form_validation->set_rules('type_id', 'lang:buyer_id_validation', 'required|trim|xss_clean|abs');
         if ($this->form_validation->run() and $this->input->post('type_id') != '0') {
             //redirect it to appropriate payment method
             if ($this->input->post('total') <= '0') {
                 //echo $this->input->post('amount');
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Transfer Amount should not be empty')));
                 redirect('transfer');
             }
             //Get the Minimum Balance amount
             $this->load->model('settings_model');
             $paymentSettings = $this->settings_model->getSiteSettings();
             $paymentSettings['PAYMENT_SETTINGS'];
             $bal_amount = $avail_balance - ($paymentSettings['PAYMENT_SETTINGS'] + $this->input->post('total'));
             if ($bal_amount < 0) {
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You are not having Sufficient Balance to Transfer')));
                 redirect('transfer');
             } else {
                 if ($this->input->post('paymentMethod') == 'paypal') {
                     $view = 'paypalDeposit';
                     $method = 'Paypal';
                 }
                 $method = 'Paypal';
                 $this->outputData['amount'] = $this->input->post('total');
                 //Register Transaction
                 $insertData = array();
                 $insertData['creator_id'] = $this->loggedInUser->id;
                 $insertData['reciever_id'] = $this->input->post('users_load');
                 $insertData['project_id'] = $this->input->post('type_id');
                 $insertData['type'] = 'Transfer';
                 $insertData['amount'] = $this->input->post('total');
                 $insertData['transaction_time'] = get_est_time();
                 $insertData['status'] = 'Completed';
                 //Can Be success,failed,pending
                 $insertData['description'] = 'Transfer Amount for';
                 //Check User Balance
                 $condition_balance = array('user_balance.user_id' => $this->loggedInUser->id);
                 $results = $this->transaction_model->getBalance($condition_balance);
                 if (getSuspendStatus($this->input->post('users_load'))) {
                     $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('The user you are trying to Transfer is currently Suspended')));
                     redirect('transfer');
                 }
                 //If Record already exists
                 if ($results->num_rows() > 0) {
                     //get balance detail
                     $rowBalance = $results->row();
                     //Update Amount
                     $updateKey = array('user_balance.user_id' => $this->loggedInUser->id);
                     $updateData = array();
                     $updateData['amount'] = $rowBalance->amount - $this->input->post('total');
                     $results1 = $this->transaction_model->updateBalance($updateKey, $updateData);
                     $condition = array('users.id' => $insertData['reciever_id']);
                     $registerusers = $this->user_model->getUsers($condition);
                     $registerusers = $registerusers->row();
                     //Update Amount to the receiver id
                     $updateKey = array('user_balance.user_id' => $insertData['reciever_id']);
                     $updateData = array();
                     // Getting the account balance of the receiver ---->stat
                     $condition_balance_receiver = array('user_balance.user_id' => $insertData['reciever_id']);
                     $results_receiver = $this->transaction_model->getBalance($condition_balance_receiver);
                     if ($results_receiver->num_rows() > 0) {
                         $rowBalance_receiver = $results_receiver->row();
                         $updateData['amount'] = $rowBalance_receiver->amount + $this->input->post('total');
                         $results1 = $this->transaction_model->updateBalance($updateKey, $updateData);
                     }
                     //  Getting the account balance of the receiver -->End
                     //  $updateData['amount'] = $rowBalance->amount   +   $this->input->post('total');
                     //  $results1 			  = $this->transaction_model->updateBalance($updateKey,$updateData);
                     $projects_condition = array('projects.id' => $insertData['project_id']);
                     $projects = $this->skills_model->getUsersproject($projects_condition);
                     $projects = $projects->row();
                     //Send email to the user after registration
                     $this->load->model('email_model');
                     $conditionUserMail = array('email_templates.type' => 'transaction');
                     $result = $this->email_model->getEmailSettings($conditionUserMail);
                     $rowUserMailConent = $result->row();
                     $splVars = array("!site_name" => $this->config->item('site_title'), "!username" => $this->loggedInUser->user_name, "!siteurl" => site_url(), "!amount" => $insertData['amount'], "!type" => 'Transfer', "!others" => 'Receiver Name   :' . $registerusers->user_name, "!others1" => 'Project Name   :' . $projects->project_name, "!contact_url" => site_url('contact'));
                     $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                     $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
                     $toEmail = $this->loggedInUser->email;
                     $fromEmail = $this->config->item('site_admin_mail');
                     $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
                 }
                 $this->load->model('transaction_model');
                 $res = $this->transaction_model->addTransaction($insertData);
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Your Transaction successfully Completed')));
                 redirect('account');
             }
         }
         //Validation Failed
     }
     //If End - Check For Form Submission
     $this->load->view('transaction/transferMoney', $this->outputData);
 }
Example #8
0
 /**
  *Buy the new package from  buyer
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function addpackage()
 {
     //Check the User Login or Not
     if (!isset($this->loggedInUser->id)) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be login access to this page')));
         redirect('info');
     }
     // User can Buy the Package
     if ($this->input->post('selectpackage')) {
         //get Package id
         $package_id = $this->input->post('selectpackage');
         foreach ($package_id as $packageid) {
             $condition = array('packages.id' => $packageid);
         }
         // Get Package details.
         $package_list = $this->package_model->getPackages($condition);
         //$package_list=$this->outputData['packages'];
         if ($package_list->num_rows() > 0) {
             $packages = $package_list->row();
             //pr($packages);
             $id = $packages->id;
             $totaldays = $packages->total_days;
             $amount = $packages->amount;
             $enddate = $packages->end_date;
         }
         $this->loggedInUser = $this->common_model->getLoggedInUser();
         $login_user = $this->loggedInUser;
         // $user_id= $login_user->id;
         if (isset($package_list) and $package_list->num_rows() > 0) {
             foreach ($package_list->result() as $packagesLists) {
                 $id = $packagesLists->id;
             }
         }
         //check for already user buy the package or not.
         $condition = array('subscriptionuser.username' => $this->loggedInUser->id);
         $userlists = $this->certificate_model->getCertificateUser($condition);
         if ($userlists->num_rows() > 0) {
             foreach ($userlists->result() as $certificate) {
                 $user_id = $certificate->username;
                 $id = $certificate->id;
                 $condition = array('subscriptionuser.flag' => 1, 'subscriptionuser.id' => $id);
                 $userlists = $this->certificate_model->getCertificateUser($condition);
                 // get the validity
                 $validdate = $userlists->row();
                 $end_date = $validdate->valid;
                 $created_date = $validdate->created;
                 $valid_date = date('d/m/Y', $created_date);
                 $next = $created_date + $end_date * 24 * 60 * 60;
                 $next_day = date('d/m/Y', $next) . "\n";
                 if (time() <= $next) {
                     $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Already You have Package')));
                     redirect('info');
                 }
             }
         }
         $insertData = array();
         $insertData['username'] = $login_user->id;
         $insertData['package_id'] = $id;
         $insertData['valid'] = $totaldays;
         $insertData['amount'] = $amount;
         $insertData['flag'] = 1;
         $insertData['created'] = get_est_time();
         $insertData['updated_date'] = get_est_time();
         //Check user balance
         $condition_balance = array('user_balance.user_id' => $this->loggedInUser->id);
         $results = $this->transaction_model->getBalance($condition_balance);
         if ($results->num_rows() > 0) {
             //get balance detail
             $rowBalance = $results->row();
             $this->outputData['userAvailableBalance'] = $rowBalance->amount;
             $withdrawvalue = $rowBalance->amount - $amount;
         }
         if ($rowBalance->amount == 0) {
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('your not having sufficient balance')));
             redirect('info');
         } else {
             if ($withdrawvalue < 0) {
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('your not having sufficient balance')));
                 redirect('info');
             } else {
                 //Check User Balance
                 //Update Amount
                 $updateKey = array('user_balance.user_id' => $this->loggedInUser->id);
                 $updateData = array();
                 $updateData['amount'] = $rowBalance->amount - $amount;
                 $results = $this->transaction_model->updateBalance($updateKey, $updateData);
                 //Insert transaction for post projects
                 $insertTransaction = array();
                 $insertTransaction['creator_id'] = $this->loggedInUser->id;
                 $insertTransaction['type'] = $this->lang->line('Package Fee');
                 $insertTransaction['amount'] = $amount;
                 $insertTransaction['transaction_time'] = get_est_time();
                 $insertTransaction['status'] = 'Completed';
                 //Can Be success,failed,pending
                 $insertTransaction['description'] = $this->lang->line('Package Fee');
                 $insertTransaction['package_id'] = $packagesLists->id;
                 if ($this->loggedInUser->role_id == '1') {
                     $insertTransaction['buyer_id'] = $this->loggedInUser->id;
                     $insertTransaction['user_type'] = $this->lang->line('Package Fee');
                 }
                 if ($this->loggedInUser->role_id == '2') {
                     $insertTransaction['provider_id'] = $this->loggedInUser->id;
                     $insertTransaction['user_type'] = $this->lang->line('Package Fee');
                 }
                 $this->load->model('transaction_model');
                 $this->transaction_model->addTransaction($insertTransaction);
                 $this->certificate_model->createPackageUser($insertData);
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Your Package has been Posted Successfully')));
                 redirect('info');
             }
         }
     } else {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Please Select the Package')));
         redirect('info');
     }
     $this->load->view('certificate/viewallpackage', $this->outputData);
 }
Example #9
0
													}
														
											 }
										  }
										}  	?>

                                                    
													


                                                      </a> 

													 


										<?php if(isset($user_details->certifyend))if($user_details->certifyend >= get_est_time()){ ?> <img src="<?php echo image_url('certified.png');  ?>" alt="Special User" border="0" width="10"	height="13"> <?php  }?>			  

											  </td>
													  <td> <?php if (isset($bid->bid_desc))echo $bid->bid_desc; ?></td>
                                                    <td><?php echo $currency.$bid->bid_amount;?></td>
                                                    <td><?php if($bid->bid_hours == 0 && $bid->bid_days == 0) 
											echo $this->lang->line('Immediately'); elseif($bid->bid_days != 0) echo $bid->bid_days.$this->lang->line('days');?>
                                                      &nbsp;
                                                      <?php if($bid->bid_hours != 0) echo $bid->bid_hours." ".$this->lang->line('hours');?>
                                                    </td>
                                                    <td><?php echo get_datetime($bid->bid_time);?></td>
                                                    <td><?php if($bid->num_reviews == 0)
							echo '(No Feedback Yet) ';
							else{ ?>
                                                      <a href="<?php echo site_url('owner/review/'.$bid->uid);?>"> <img height="7" border="0" width="81" alt="rating" src="<?php echo image_url('rating_'.$bid->user_rating.'.gif');?>"/> (<b><?php echo $bid->num_reviews;?> </b> <?php echo $this->lang->line('reviews');?>)</a>
                                                      <?php } ?>
Example #10
0
 /**
  * Loads withdraw amount details for the loggedInUser
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function withDrawAmount()
 {
     //Load payment settings
     $this->load->model('payment_model');
     $paymentGateways = $this->payment_model->getPaymentSettings();
     $this->outputData['paymentGateways'] = $paymentGateways;
     //store the values
     $this->outputData['total'] = $this->input->post('total', true);
     $this->outputData['creator_id'] = $this->input->post('creator_id', true);
     $this->outputData['withdraw'] = $this->input->post('withdraw', true);
     $this->outputData['paymentMethod'] = $this->input->post('paymentMethod', true);
     $this->outputData['withdraw_minimum'] = $this->input->post('withdraw_minimum', true);
     $this->outputData['userAvailableBalance'] = $this->input->post('userAvailableBalance', true);
     if ($this->input->post('email')) {
         //Set Validation Rules
         $this->form_validation->set_rules('email', 'lang:email', 'required|trim|valid_email|xss_clean');
         if ($this->form_validation->run()) {
             if (strtolower($this->input->post('paymentMethod')) == strtolower('Paypal')) {
                 $view = 'paypalWithdraw';
                 $method = 'Paypal';
             }
             //Load usermodel for get the userinformation to store buyer or programmer
             $this->load->model('user_model');
             //get user details
             $conditions = array('users.id' => $this->outputData['creator_id']);
             $query = $this->user_model->getUsers($conditions);
             foreach ($query->result() as $row) {
                 $role = $row->role_name;
                 $role_id = $row->role_id;
             }
             //Register Transaction
             $insertData = array();
             $insertData['creator_id'] = $this->loggedInUser->id;
             $insertData['type'] = 'Withdraw';
             $insertData['amount'] = $this->outputData['total'];
             $insertData['transaction_time'] = get_est_time();
             $insertData['status'] = 'Pending';
             //Can Be success,failed,pending
             $insertData['description'] = $this->lang->line('Withdraw Amount From') . ' ' . $method;
             $insertData['paypal_address'] = $this->input->post('email');
             $insertData['user_type'] = $role;
             if ($role_id == '1') {
                 $insertData['buyer_id'] = $this->loggedInUser->id;
             }
             if ($role_id == '2') {
                 $insertData['provider_id'] = $this->loggedInUser->id;
             }
             $this->load->model('transaction_model');
             $res = $this->transaction_model->addTransaction($insertData);
             //Check User Balance
             $condition_balance = array('user_balance.user_id' => $this->loggedInUser->id);
             $results = $this->transaction_model->getBalance($condition_balance);
             //If Record already exists
             if ($results->num_rows() > 0) {
                 //get balance detail
                 $rowBalance = $results->row();
                 //Update Amount
                 /*
                 $updateKey 			  = array('user_balance.user_id'=>$this->loggedInUser->id);	
                 $updateData 		  = array();
                 $updateData['amount'] = $rowBalance->amount   -   $this->input->post('total');
                 $results1 			  = $this->transaction_model->updateBalance($updateKey,$updateData);
                 */
                 //Send email to the user after registration
                 $this->load->model('email_model');
                 $conditionUserMail = array('email_templates.type' => 'transaction');
                 $result = $this->email_model->getEmailSettings($conditionUserMail);
                 $rowUserMailConent = $result->row();
                 $splVars = array("!site_name" => $this->config->item('site_title'), "!username" => $this->loggedInUser->user_name, "!siteurl" => site_url(), "!amount" => $insertData['amount'], "!type" => 'Withdraw', "!others" => '', "!others1" => '', "!contact_url" => site_url('contact'));
                 $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                 $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
                 $toEmail = $this->loggedInUser->email;
                 $fromEmail = $this->config->item('site_admin_mail');
                 $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
             }
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Withdraw success')));
             redirect('info');
             //Get Transaction id and set this in to transactions custom field
             $this->outputData['transactionId'] = $this->db->insert_id();
         } else {
             //load if email is invalid
             $this->load->view('transaction/paypalWithdraw', $this->outputData);
         }
     } else {
         //load text is empty
         $this->load->view('transaction/paypalWithdraw', $this->outputData);
     }
 }
Example #11
0
 /**
  * inviteProgrammer 
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function inviteProgrammer()
 {
     //Load language file
     $this->lang->load('enduser/postMessage', $this->config->item('language_code'));
     $this->lang->load('enduser/userlist', $this->config->item('language_code'));
     $userid = $this->uri->segment(3, 0);
     $this->outputData['userid'] = $userid;
     $conditions2 = array('users.id' => $userid);
     $this->outputData['touser'] = $this->user_model->getUsers($conditions2);
     $conditions = array('user_list.creator_id' => $this->loggedInUser->id, 'user_list.user_role' => '1');
     $this->outputData['favouriteUsers'] = $this->user_model->getFavourite($conditions);
     //Get Projects List
     $condition = array('projects.project_status' => '0', 'projects.creator_id' => $this->loggedInUser->id, 'projects.project_status' => '0');
     $result = $this->skills_model->getProjects($condition);
     $this->outputData['projectsList'] = $result->result();
     if ($this->loggedInUser) {
         $condition = array('projects.creator_id' => $this->loggedInUser->id, 'projects.project_status' => '0');
         $res = $this->skills_model->getUsersproject($condition);
         if ($res->num_rows() > 0) {
             if ($this->input->post('inviteProgrammer')) {
                 if ($this->input->post('projects')) {
                     //Load model
                     $this->load->model('email_model');
                     $userid = $this->input->post('toid');
                     $conditions2 = array('users.id' => $userid);
                     $buyer = $this->user_model->getUsers($conditions2);
                     $buyerRow = $buyer->row();
                     //Send Mail to programmer as invitaion
                     $conditionUserMail = array('email_templates.type' => 'privateInvitation');
                     $result = $this->email_model->getEmailSettings($conditionUserMail);
                     $rowUserMailConent = $result->row();
                     $list = $this->input->post('projects');
                     $projectnames = '"';
                     $project_ids = '';
                     foreach ($list as $res) {
                         $condition = array('projects.id' => $res);
                         $result = $this->skills_model->getProjects($condition);
                         foreach ($result->result() as $rec) {
                             $projectnames .= $rec->project_name . ',';
                         }
                     }
                     $projectnames .= '"';
                     $url = '';
                     if (isset($list)) {
                         if (count($list) > 0) {
                             foreach ($list as $res) {
                                 $url .= site_url('project/view/' . $res) . '<br>';
                             }
                         } else {
                             $url = site_url('project/view/' . $res);
                         }
                     }
                     $splVars = array("!buyername!" => $this->loggedInUser->user_name, "(!projectname!)" => $projectnames, "!projecturl!" => $url, "!siteurl!" => $this->config->item('base_url'));
                     $mailSubject = $rowUserMailConent->mail_subject;
                     $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
                     $toEmail = $buyerRow->email;
                     $fromEmail = $this->config->item('site_admin_mail');
                     $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
                     $project_id = implode(',', $list);
                     if ($this->input->post('toid')) {
                         //Insert values to the project invitaion lists
                         $insertData = array();
                         $insertData['id'] = '';
                         $insertData['project_id'] = $project_id;
                         $insertData['sender_id'] = $this->loggedInUser->id;
                         $insertData['receiver_id'] = $this->input->post('toid');
                         $insertData['invite_date'] = get_est_time();
                         $this->user_model->insertProgrammerInvitation($insertData);
                     }
                     $others = $this->input->post('otheruser');
                     $others = explode(',', $others);
                     foreach ($others as $user) {
                         $conditions2 = array('users.user_name' => $user, 'users.role_id' => '2');
                         $buyer = $this->user_model->getUsers($conditions2);
                         $buyerRow = $buyer->row();
                         if ($buyerRow) {
                             $toEmail = $buyerRow->email;
                             $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
                             //Insert values to the project invitaion lists
                             $insertData = array();
                             $insertData['id'] = '';
                             $insertData['project_id'] = $project_id;
                             $insertData['sender_id'] = $this->loggedInUser->id;
                             $insertData['receiver_id'] = $buyerRow->id;
                             $insertData['invite_date'] = get_est_time();
                             $this->user_model->insertProgrammerInvitation($insertData);
                         }
                     }
                     //Notification message
                     $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Your Message Has Been Posted Successfully')));
                     redirect('info/index/success');
                 } else {
                     $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Choose Project')));
                     redirect('info');
                 }
             }
         } else {
             //Notification message
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be post project to invite programmers')));
             redirect('info');
         }
     } else {
         //Notification message
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be logged to invite programmers')));
         redirect('info');
     }
     $this->load->view('buyer/inviteIndividual', $this->outputData);
 }
Example #12
0
 /**
  * Edit Category.
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function editCategory()
 {
     //Get id of the category
     $id = is_numeric($this->uri->segment(4)) ? $this->uri->segment(4) : 0;
     //Load model
     $this->load->model('skills_model');
     //load validation library
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if ($this->input->post('editCategory')) {
         //Set rules
         $this->form_validation->set_rules('category_name', 'lang:category_name_validation', 'required|trim|xss_clean|callback_categoryNameCheck');
         $this->form_validation->set_rules('group_id', 'lang:group_id_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('is_active', 'lang:is_active_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('description', 'lang:description_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('page_title', 'lang:page_title_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('meta_keywords', 'lang:meta_keywords_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('meta_description', 'lang:meta_description_validation', 'required|trim|xss_clean');
         if ($this->form_validation->run()) {
             //prepare update data
             $updateData = array();
             $updateData['category_name'] = $this->input->post('category_name');
             $updateData['group_id'] = $this->input->post('group_id');
             $updateData['is_active'] = $this->input->post('is_active');
             $updateData['description'] = $this->input->post('description');
             $updateData['page_title'] = $this->input->post('page_title');
             $updateData['meta_keywords'] = $this->input->post('meta_keywords');
             $updateData['meta_description'] = $this->input->post('meta_description');
             $updateData['modified'] = get_est_time();
             //Add Groupss
             $this->skills_model->updateCategory($this->input->post('id', true), $updateData);
             //Notification message
             $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('success', $this->lang->line('updated_success')));
             redirect_admin('skills/viewCategories');
         }
     }
     //If - Form Submission End
     //Get Groups
     $this->outputData['groups'] = $this->skills_model->getGroups();
     //Set Condition To Fetch The Category
     $condition = array('categories.id' => $id);
     //Get Categories
     $this->outputData['categories'] = $this->skills_model->getCategories($condition);
     //Load View
     $this->load->view('admin/skills/editCategory', $this->outputData);
 }
Example #13
0
 /**
  * Add Faq Category.
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function addFaqCategory()
 {
     //load validation library
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if ($this->input->post('addFaqCategory')) {
         //Set rules
         $this->form_validation->set_rules('faq_category_name', 'lang:faq_category_name_validation', 'required|trim|xss_clean|callback_faqCategoryNameCheck');
         if ($this->form_validation->run()) {
             //prepare insert data
             $insertData = array();
             $insertData['category_name'] = $this->input->post('faq_category_name');
             $insertData['created'] = get_est_time();
             //Add Category
             $this->faq_model->addFaqCategory($insertData);
             //Notification message
             $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('success', $this->lang->line('added_success')));
             redirect_admin('faq/viewFaqCategories');
         }
     }
     //If - Form Submission End
     //Load View
     $this->load->view('admin/faq/addFaqCategory', $this->outputData);
 }
Example #14
0
<div align="right"><b><font color="#6b80a1"><?php 
echo $this->lang->line('Local time');
?>
 </font><?php 
echo show_date(get_est_time());
?>
</b></div>
      <div class="slidetabsmenu">
	  <?php 
if (!isset($innerClass)) {
    $innerClass = '';
}
?>
		<ul>
		 	<li class="<?php 
if (isset($innerClass0)) {
    echo $innerClass0;
}
?>
"><a href="<?php 
echo site_url('affiliate');
?>
"><span><?php 
echo $this->lang->line('About');
?>
</span></a></li>
		 	<li class="<?php 
if (isset($innerClass1)) {
    echo $innerClass1;
}
Example #15
0
 /**
  * To post the affiliate questions
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function manageAffiliates()
 {
     //Load model
     $this->load->model('settings_model');
     //load validation library
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     if (!isset($this->loggedInUser->id)) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You can not access to this page')));
         redirect('info');
     }
     $condition = array('sales.refid' => $this->loggedInUser->user_name);
     $this->outputData['affiliate_sales'] = $this->affiliate_model->getAffiliateSales($condition);
     // get affiliate sales total
     $condition1 = array('sales.refid' => $this->loggedInUser->user_name);
     $this->outputData['affiliate_sales_total'] = $this->affiliate_model->getSalesTotal($condition1);
     // get affiliate welcome messages
     $condition2 = array('affiliate_welcome_msg.refid' => $this->loggedInUser->user_name, 'msg_status' => 0);
     $msg_result = $this->affiliate_model->getAffiliateWelcomeMsg($condition2);
     $msg_num_rows = $msg_result->num_rows();
     $msg_result_row = $msg_result->row();
     if (isset($msg_result_row->welcome_msg)) {
         $this->outputData['affiliate_welcome_msg'] = $msg_result_row->welcome_msg;
     }
     //Innermenu tab selection
     $this->outputData['innerClass5'] = '';
     $this->outputData['innerClass5'] = 'selected';
     if ($this->input->post('welcomemsg')) {
         //Set rules
         $this->form_validation->set_rules('welcome_message', 'lang:welcome_message_validation', 'required|trim|xss_clean');
         if ($this->form_validation->run()) {
             $welcome_msg = $this->input->post('welcome_message');
             if ($msg_num_rows == 0) {
                 //prepare insert data
                 $insertData = array();
                 $insertData['refid'] = $this->loggedInUser->user_name;
                 $insertData['welcome_msg'] = $welcome_msg;
                 //print_r($insertData);
                 //Add Category
                 $this->affiliate_model->addAffiliateWelcomeMsg($insertData);
                 $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('success', $this->lang->line('updated_success')));
                 //$this->load->view('affiliate/affilateCenter',$this->outputData);
             } else {
                 $updateKey1 = array('affiliate_welcome_msg.refid' => $this->loggedInUser->user_name, 'id' => $msg_result_row->id);
                 $updateData1 = array();
                 $updateData1['welcome_msg '] = $welcome_msg;
                 //Update Site Settings
                 $this->affiliate_model->updateAffiliateWelcomeMeg($updateKey1, $updateData1);
                 $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('success', $this->lang->line('updated_success')));
             }
         }
     }
     // get affiliate welcome messages
     $condition2 = array('affiliate_welcome_msg.refid' => $this->loggedInUser->user_name);
     $msg_result = $this->affiliate_model->getAffiliateWelcomeMsg($condition2);
     $msg_num_rows = $msg_result->num_rows();
     $msg_result_row = $msg_result->row();
     if (isset($msg_result_row->welcome_msg)) {
         $this->outputData['affiliate_welcome_msg'] = $msg_result_row->welcome_msg;
     }
     // insert total affiliate amount
     $this->load->model('affiliate_model');
     $this->load->model('user_model');
     $results = $this->affiliate_model->getReleasePayments();
     //pr($results->result());
     if ($results->num_rows() > 0) {
         foreach ($results->result() as $row) {
             //prepare insert data
             $insertData = array();
             $insertData['refid'] = $row->refid;
             $insertData['account_type'] = $row->account_type;
             $insertData['payment'] = $row->total;
             // get user
             $condition = array('users.user_name' => $insertData['refid']);
             $user_data = $this->user_model->getUsers($condition);
             //$user_data_result = $user_data->result();
             $user_data_row = $user_data->row();
             $user_id = 0;
             if (isset($user_data_row->id)) {
                 if ($user_data_row->id != '') {
                     $user_id = $user_data_row->id;
                 }
             }
             $insertData['user_id'] = $user_id;
             $insertData['created_date'] = get_est_time();
             $date_with_time = show_date($insertData['created_date']);
             $arr = explode(' ', $date_with_time);
             //pr($arr_str);
             for ($i = 0; $i < count($arr); $i++) {
                 $mon = $arr[0];
                 $year = $arr[2];
             }
             $created_date_forrmat = $mon . ", " . $year;
             $insertData['created_date_format'] = $created_date_forrmat;
             $insertData['is_released'] = '0';
             $unrelease_condition = array('refid' => $row->refid, 'is_released' => '0');
             $unrelease_results = $this->affiliate_model->getUnReleasePayments($unrelease_condition);
             $unreleased_row = $unrelease_results->row();
             $released_condition = array('refid' => $row->refid, 'is_released' => '1');
             $released_results = $this->affiliate_model->getUnReleasePayments($released_condition);
             $released_row = $released_results->row();
             if ($unrelease_results->num_rows() > 0) {
                 $updateKey['payment'] = $row->total;
                 $cond = array('affiliate_unreleased_payments.refid' => $row->refid, 'affiliate_unreleased_payments.id' => $unreleased_row->id);
                 $result = $this->affiliate_model->updateUnReleasedPayments(TRUE, $updateKey, $cond);
             } else {
                 if ($released_results->num_rows() > 0) {
                     foreach ($released_results->result() as $row1) {
                         $sales_total = $row->total;
                         $released_total = $row1->total;
                         $check_balance = $sales_total - $released_total;
                         if ($check_balance > 0) {
                             //prepare insert data
                             $insertData1 = array();
                             $insertData1['refid'] = $row->refid;
                             $insertData1['account_type'] = $row->account_type;
                             $insertData1['payment'] = $check_balance;
                             $user_id;
                             $insertData1['user_id'] = $user_id;
                             $insertData1['created_date'] = get_gmt_time();
                             $insertData1['created_date_format'] = $created_date_forrmat;
                             $insertData1['is_released'] = '0';
                             $condition = array('users.user_name' => $insertData1['refid']);
                             $this->affiliate_model->addUnReleasedPayments($insertData1);
                         }
                     }
                 }
             }
             if ($unrelease_results->num_rows() == 0 and $released_results->num_rows() == 0) {
                 $this->affiliate_model->addUnReleasedPayments($insertData);
             }
         }
     }
     //exit;
     $cond = array('affiliate_released_payments.refid' => $this->loggedInUser->user_name);
     $released_amount = $this->affiliate_model->getReleasedPayments($cond);
     $this->outputData['released_amount'] = $released_amount;
     $this->load->view('affiliate/affilateCenter', $this->outputData);
 }
Example #16
0
 function cancelEscrow()
 {
     $request_id = $this->uri->segment(3, 0);
     if ($this->uri->segment(3)) {
         //Get the escrow cancel request details
         $insertData['id'] = '';
         $insertData['transaction_id'] = $request_id;
         $insertData['request_date'] = get_est_time();
         $insertData['status'] = 'Cancel';
         $this->transaction_model->addescorwRelease($insertData);
         //Update transaction
         $updateKey = array('transactions.id' => $request_id);
         $updateData = array();
         $updateData['status'] = 'Cancelled';
         $Update_transaction = $this->transaction_model->updateTransaction($updateKey, $updateData);
         $condition = array('transactions.id' => $request_id);
         $transaction = $this->transaction_model->getallTransactions($condition);
         $transaction = $transaction->row();
         $condition = array('users.id' => $transaction->reciever_id);
         $registerusers = $this->user_model->getUsers($condition);
         $registerusers = $registerusers->row();
         $projects_condition = array('projects.id' => $transaction->project_id);
         $projects = $this->skills_model->getUsersproject($projects_condition);
         $projects = $projects->row();
         //Send email to the user after escrow cancel
         $this->load->model('email_model');
         $conditionUserMail = array('email_templates.type' => 'transaction');
         $result = $this->email_model->getEmailSettings($conditionUserMail);
         $rowUserMailConent = $result->row();
         $splVars = array("!site_name" => $this->config->item('site_title'), "!username" => $this->loggedInUser->user_name, "!siteurl" => site_url(), "!amount" => $transaction->amount, "!type" => 'Escrow Cancel', "!others" => 'Receiver Name   :' . $registerusers->user_name, "!others1" => 'Project Name   :' . $projects->project_name, "!contact_url" => site_url('contact'));
         $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
         $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
         $toEmail = $this->loggedInUser->email;
         $fromEmail = $this->config->item('site_admin_mail');
         $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
         redirect('account');
     }
 }
Example #17
0
 /**
  * Loads site settings page.
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function index()
 {
     $this->load->model('settings_model');
     //pr($_POST);
     //load validation library
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //Get Form Details
     if ($this->input->post('siteSettings')) {
         //Set rules
         $this->form_validation->set_rules('site_title', 'lang:site_title_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('site_slogan', 'lang:site_slogan_validation', 'required|alpha_space|trim|xss_clean');
         $this->form_validation->set_rules('site_admin_mail', 'lang:site_admin_mail_validation', 'required|trim|valid_email|xss_clean');
         $this->form_validation->set_rules('site_language', 'lang:site_language_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('offline_message', 'lang:offline_message_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('offline_message', 'lang:offline_message_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('forced_escrow', 'lang:forced_escrow_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('forced_escrow', 'lang:forced_escrow_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('payment_settings', 'lang:payment_settings_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('featured_projects_limit', 'lang:featured_projects_limit_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('urgent_projects_limit', 'lang:urgent_projects_limit_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('latest_projects_limit', 'lang:latest_projects_limit_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('provider_commission_amount', 'lang:provider_commission_amount_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('featured_projects_amount', 'lang:featured_projects_amount_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('urgent_projects_amount', 'lang:urgent_projects_amount_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('hide_projects_amount', 'lang:hide_projects_amount_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('joblist_projects_amount', 'lang:joblist_projects_amount_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('joblist_validity_days', 'lang:joblist_validity_days_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('file_manager_limit', 'lang:file_manager_limit_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('base_url', 'lang:base_url_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('featured_projects_amount_cm', 'lang:featured_projects_amount_cm_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('urgent_projects_amount_cm', 'lang:urgent_projects_amount_cm_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('hide_projects_amount_cm', 'lang:hide_projects_amount_cm_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('private_projects_amount_cm', 'lang:private_projects_amount_cm_validation', 'numeric|required|trim|xss_clean');
         $this->form_validation->set_rules('twitter_username', 'lang:twitter_username_validation', 'alpha_numeric|trim|xss_clean');
         $this->form_validation->set_rules('twitter_password', 'lang:twitter_password_validation', 'alpha_numeric|trim|xss_clean');
         //$this->form_validation->set_rules('file','Upload File','callback_upload_file');
         $this->form_validation->set_rules('private_project_amount', 'lang:private_project_amount_validation', 'numeric|required|trim|xss_clean');
         if ($this->form_validation->run()) {
             $updateData = array();
             $updateData['site_title'] = $this->input->post('site_title');
             $updateData['site_language'] = $this->input->post('site_language');
             $updateData['twitter_username'] = $this->input->post('twitter_username');
             $updateData['twitter_password'] = $this->input->post('twitter_password');
             $updateData['site_slogan'] = $this->input->post('site_slogan');
             $updateData['site_admin_mail'] = $this->input->post('site_admin_mail');
             $updateData['site_status'] = $this->input->post('site_status');
             $updateData['offline_message'] = $this->input->post('offline_message');
             $updateData['forced_escrow'] = $this->input->post('forced_escrow');
             $updateData['payment_settings'] = $this->input->post('payment_settings');
             $updateData['featured_projects_limit'] = $this->input->post('featured_projects_limit');
             $updateData['urgent_projects_limit'] = $this->input->post('urgent_projects_limit');
             $updateData['latest_projects_limit'] = $this->input->post('latest_projects_limit');
             $updateData['provider_commission_amount'] = $this->input->post('provider_commission_amount');
             $updateData['featured_projects_amount'] = $this->input->post('featured_projects_amount');
             $updateData['urgent_projects_amount'] = $this->input->post('urgent_projects_amount');
             $updateData['joblist_projects_amount'] = $this->input->post('joblist_projects_amount');
             $updateData['joblist_validity_days'] = $this->input->post('joblist_validity_days');
             $updateData['hide_projects_amount'] = $this->input->post('hide_projects_amount');
             $updateData['private_project_amount'] = $this->input->post('private_project_amount');
             $updateData['featured_projects_amount_cm'] = $this->input->post('featured_projects_amount_cm');
             $updateData['urgent_projects_amount_cm'] = $this->input->post('urgent_projects_amount_cm');
             $updateData['hide_projects_amount_cm'] = $this->input->post('hide_projects_amount_cm');
             $updateData['private_project_amount_cm'] = $this->input->post('private_projects_amount_cm');
             $updateData['file_manager_limit'] = $this->input->post('file_manager_limit');
             $updateData['base_url'] = $this->input->post('base_url');
             $updateData['created'] = get_est_time();
             if (isset($this->outputData['file'])) {
                 $this->load->helper('file');
                 $Data['file'] = $this->outputData['file']['file_name'];
                 $thumb1 = $this->outputData['file']['file_path'] . 'h1_logo.jpg';
                 createLogo($this->outputData['file']['full_path'], $thumb1, 276, 79);
             }
             // pr($updateData);
             //Update Site Settings
             $this->settings_model->updateSiteSettings($updateData);
             //Notification message
             $this->session->set_flashdata('flash_message', $this->common_model->admin_flash_message('success', $this->lang->line('updated_success')));
             redirect_admin('siteSettings');
         }
     }
     //If - Form Submission End
     $this->outputData['settings'] = $this->settings_model->getSiteSettings();
     $this->load->view('admin/settings/siteSettings', $this->outputData);
 }
Example #18
0
 /**
  * Loads the professionals 
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function professional()
 {
     //Load Language
     $this->lang->load('enduser/searchProfessional', $this->config->item('language_code'));
     //Load Models
     $this->load->model('search_model');
     //Get Search Parameters
     if ($this->input->get('keyword', true)) {
         $keyword = $this->input->get('keyword', true);
     }
     if ($this->input->get('category', true)) {
         $category = $this->input->get('category', true);
     }
     if ($this->uri->segment(3)) {
         $keyword = $this->uri->segment(3);
     }
     $this->outputData['category'] = $this->input->get('category', true);
     $page = $this->input->get('p', true);
     if (isset($page) === false or empty($page)) {
         $page = 1;
     }
     $this->outputData['page'] = $page;
     //Get Sorting order
     $field = $this->input->get('field', true);
     $order = $this->input->get('sort', true);
     $this->outputData['order'] = $order;
     $orderby = array();
     if ($field) {
         $orderby = array($field, $order);
     }
     if ($this->input->post('customizeDisplay')) {
         //Get Customize data fields
         $this->session->set_userdata('show_cat', $this->input->post('show_cat', true));
         $this->session->set_userdata('show_budget', $this->input->post('show_budget', true));
         $this->session->set_userdata('show_bids', $this->input->post('show_bids', true));
         $this->session->set_userdata('show_avgbid', $this->input->post('show_avgbid', true));
         $this->session->set_userdata('show_status', $this->input->post('show_status', true));
         $this->session->set_userdata('show_date', $this->input->post('show_date', true));
         $this->session->set_userdata('show_desc', $this->input->post('show_desc', true));
         $this->session->set_userdata('show_num', $this->input->post('show_num', true));
     } else {
         $this->session->set_userdata('show_cat', '1');
         $this->session->set_userdata('show_budget', '1');
         $this->session->set_userdata('show_bids', '1');
         $this->session->set_userdata('show_num', '10');
     }
     $page_rows = $this->session->userdata('show_num');
     $max = array($page_rows, ($page - 1) * $page_rows);
     //Match With The Keywords
     if ($this->input->get('keyword')) {
         $like = array('users.user_name' => $this->input->get('keyword'));
     } else {
         $like = '';
     }
     if ($this->input->get('category')) {
         $like1 = array('user_categories.user_categories' => $this->input->get('category'));
     } else {
         $like1 = '';
     }
     if ($this->uri->segment(3, 0)) {
         $conditions = array('users.role_id' => '2', 'users.user_name' => $this->uri->segment(3));
     } else {
         $conditions = array('users.role_id' => '2');
     }
     $users = $this->search_model->getUsers($conditions, NULL, $like, $max, $orderby, $like1);
     $users1 = $this->search_model->getUsers($conditions, NULL, $like, NULL, NULL, $like1);
     if ($users1->num_rows() > 0 and $this->input->get('keyword', true)) {
         $insertData = array();
         $insertData['keyword'] = $this->input->get('keyword', true);
         $insertData['type'] = 'user';
         $insertData['created'] = get_est_time();
         //Insert keyword for popular search
         $this->skills_model->addPopularSearch($insertData);
     }
     $this->outputData['users'] = $users;
     $this->load->library('pagination');
     if (!isset($keyword)) {
         $keyword = '';
     }
     if (!isset($category)) {
         $category = '';
     }
     $config['base_url'] = $this->config->item('base_url') . "?c=search&keyword=" . $keyword . "&category=" . $category . '&m=professional';
     $config['total_rows'] = $users1->num_rows();
     $config['per_page'] = $page_rows;
     $config['cur_page'] = $page;
     $this->pagination->initialize($config);
     $this->outputData['base_url'] = $config['base_url'];
     $this->outputData['pagination'] = $this->pagination->create_links(false);
     $this->load->view('search/listProfessional', $this->outputData);
 }
Example #19
0
 /**
  * Loads Home page of the site.
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function login()
 {
     //language file
     $this->lang->load('enduser/loginUsers', $this->config->item('language_code'));
     //Load Models - for this function
     $this->load->model('user_model');
     //load validation libraray
     $this->load->library('form_validation');
     //Load cookie
     $this->load->helper('cookie');
     //Load Form Helper
     $this->load->helper('form');
     //Load Library File
     $this->load->library('encrypt');
     // check the login for remember user
     if ($this->auth_model->getUserCookie('user_name') != '' and $this->auth_model->getUserCookie('user_password') != '') {
         $conditions = array('user_name' => $this->auth_model->getUserCookie('user_name'), 'password' => md5($this->auth_model->getUserCookie('user_password')), 'users.user_status' => '1');
         $query = $this->user_model->getUsers($conditions);
         if ($query->num_rows() > 0) {
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', 'Logged In Successfull'));
         }
         redirect('account');
     }
     if ($this->uri->segment(3, 0)) {
         if ($this->uri->segment(3, 0) == 'support') {
             $this->session->set_userdata('support', 'support');
         } elseif ($this->uri->segment(3, 0) == 'project') {
             $this->session->set_userdata('job', 'project');
             $this->session->set_userdata('job_view', 'view');
             $this->session->set_userdata('job_id', $this->uri->segment(5, 0));
         }
     }
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //pr($_POST);
     //Get Form Data
     if ($this->input->post('usersLogin')) {
         //Set rules
         $this->form_validation->set_rules('username', 'lang:user_name_validation', 'required|trim|min_length[5]|xss_clean');
         $this->form_validation->set_rules('pwd', 'lang:password_validation', 'required|trim|xss_clean');
         if ($this->form_validation->run()) {
             if (getBanStatus($this->input->post('username'))) {
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Ban Error')));
                 redirect('info');
             }
             // Puhal Changes Removed the role Id from the conditions, inorder to remove the buyer and programmer radio button (Sep 17 Issue 4)
             $conditions = array('user_name' => $this->input->post('username'), 'password' => md5($this->input->post('pwd')), 'users.user_status' => '1');
             $query = $this->user_model->getUsers($conditions);
             if ($query->num_rows() > 0) {
                 $row = $query->row();
                 // update the last activity in the users table
                 $updateData = array();
                 $updateData['last_activity'] = get_est_time();
                 //Get Activation Key
                 $activation_key = $row->id;
                 // update process for users table
                 $this->user_model->updateUser(array('id' => $row->id), $updateData);
                 //Check For Password
                 //if($this->input->post('pwd')==$this->common_model->getDecryptedString($row->password))
                 if (1) {
                     //pr($row);
                     //Set Session For User
                     $this->auth_model->setUserSession($row);
                     // Puhal Changes for the Remember me button (Sep 17 Issue 3)
                     if ($this->input->post('remember')) {
                         $insertData = array();
                         $insertData['username'] = $this->input->post('username');
                         $insertData['password'] = $this->input->post('pwd');
                         $expire = 60 * 60 * 24 * 100;
                         if ($this->auth_model->getUserCookie('uname') == '') {
                             $this->user_model->addRemerberme($insertData, $expire);
                         }
                     } else {
                         $this->user_model->removeRemeberme();
                     }
                     //Notification message
                     $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', 'Logged In Successfull'));
                     if ($this->session->userdata('job_id') != '') {
                         $jobid = $this->session->userdata('job_id');
                         $this->session->unset_userdata('job');
                         $this->session->unset_userdata('view');
                         $this->session->unset_userdata('job_id');
                         redirect('project/view/' . $jobid);
                     }
                     // check for private project user login
                     if ($this->session->userdata('private_user') != '') {
                         if ($this->session->userdata('private_user') == $row->id or $this->session->userdata('creator_id') == $row->id) {
                             $project_id = $this->session->userdata('project_id');
                             $this->session->unset_userdata('private');
                             $this->session->unset_userdata('type');
                             $this->session->unset_userdata('private_user');
                             $this->session->unset_userdata('project_id');
                             $this->session->unset_userdata('creator_id');
                             redirect('project/view/' . $project_id);
                         } else {
                             $this->session->unset_userdata('private');
                             $this->session->unset_userdata('type');
                             $this->session->unset_userdata('private_user');
                             $this->session->unset_userdata('project_id');
                             $this->session->unset_userdata('creator_id');
                             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('This is not your private project')));
                             redirect('info');
                         }
                     }
                     if ($this->session->userdata('support') == '' and $this->session->userdata('project') == '') {
                         redirect('account');
                     } elseif ($this->session->userdata('support') != '') {
                         $this->session->unset_userdata('support');
                         redirect('support');
                     } elseif ($this->session->userdata('project') != '') {
                         $id = $this->session->userdata('id');
                         $this->session->unset_userdata('project');
                         $this->session->unset_userdata('view');
                         $this->session->unset_userdata('id');
                         redirect('project/view/' . $id);
                     }
                 } else {
                     //Notification message
                     $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', 'Login failed! Incorrect username or password'));
                     redirect('users/login');
                 }
             } else {
                 //Notification message
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', 'Login failed! Incorrect username or password'));
                 redirect('users/login');
             }
             //If username exists
         }
         //If End - Check For Validation
     }
     //If End - Check For Form Submission
     $this->load->view('users/loginUsers', $this->outputData);
 }
Example #20
0
<?php

$this->load->view('header');
$this->load->view('sidebar');
?>
<!--MAIN-->

<div id="main">
  <!--POST PROJECT-->
  <?php 
$this->load->view('innerMenu');
$currentDate = current_date(get_est_time());
$mailCount = 0;
$unreadcount = 0;
$mailData = array();
$unreadmsg = array();
foreach ($mailList->result() as $mail) {
    if (current_date($mail->created) == $currentDate) {
        $mailCount = $mailCount + 1;
        $mailData[$mailCount] = $mail->id;
    }
    $unreadcount = $unreadcount + 1;
    $unreadmsg[$unreadcount] = $mail->id;
}
//Add comma between values for post values to controller
if (isset($mailData)) {
    $mailData = implode(',', $mailData);
}
if (isset($unreadmsg)) {
    $unreadmsg = implode(',', $unreadmsg);
}
Example #21
0
 /**
  * upload_file for both buyer and programmer
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function upload_file()
 {
     // check
     if (isset($_FILES) and $_FILES['attachment']['name'] == '') {
         return true;
     }
     // intialize the config items
     $config['upload_path'] = 'files/tempFiles/';
     $config['max_size'] = $this->config->item('max_upload_size');
     $config['encrypt_name'] = TRUE;
     $config['remove_spaces'] = TRUE;
     $config['allowed_types'] = 'jpeg|jpg|png|gif|JPEG|JPG|PNG|GIF|zip|ZIP|RAR|rar|doc|DOC|txt|TXT|xlsx|XLSX|xls|XLS|ppt|PPT|pdf|PDF|docx|DOCX|PPTX|pptx|CSV|csv';
     $this->load->library('upload', $config);
     // check if the file is upload or not.
     if ($this->upload->do_upload('attachment')) {
         $this->outputData['file'] = $this->upload->data();
         $condition = array('files.user_id' => $this->loggedInUser->id);
         $totalSize = $this->file_model->getFileSize($condition);
         $totalsize = $totalSize->row();
         $oldSize = $totalsize->totalsize;
         //Get the file size for uplaod file
         $size = $this->outputData['file']['file_size'];
         //Get the Maximum Limit
         $maximum = $this->config->item('upload_limit');
         $this->outputData['maximum_size'] = $maximum;
         //Convert the maximum limit to Bytes
         $maximum = $maximum * 1024;
         $balance_size = $maximum - $oldSize;
         $check_size = $balance_size - $size;
         if ($check_size < 0) {
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('File size is Exceed')));
             redirect('file/index');
         }
         //Get Uploaded file data
         $file = $this->outputData['file']['file_name'];
         $type = $this->outputData['file']['file_type'];
         //pr($this->outputData['file']);
         $insertData = array();
         $insertData['location'] = $this->outputData['file']['file_name'];
         $insertData['user_id'] = $this->loggedInUser->id;
         $insertData['description'] = $this->input->post('files_desc');
         $insertData['key'] = md5(time());
         $insertData['file_size'] = $this->outputData['file']['file_size'];
         $insertData['file_type'] = $this->outputData['file']['file_ext'];
         $insertData['created'] = get_est_time();
         $insertData['delete'] = get_est_time() + 3;
         $insertData['original_name'] = $this->outputData['file']['orig_name'];
         $this->file_model->postFile($insertData);
         //Notification message
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('update_confirm_success')));
         redirect('file/index');
         return true;
     } else {
         $this->form_validation->set_message('upload_file', $this->upload->display_errors($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag')));
         return false;
     }
     //If end
 }
Example #22
0
 /**
  * Loads deposit index page of the site.
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function index()
 {
     if (!isset($this->loggedInUser->role_id)) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You can not access to this page')));
         redirect('info');
     }
     if ($this->loggedInUser->suspend_status == 1) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Suspend Error')));
         redirect('info');
     }
     //Load Language
     $this->lang->load('enduser/depositMoney', $this->config->item('language_code'));
     //Load payment settings
     $this->load->model('payment_model');
     $paymentGateways = $this->payment_model->getPaymentSettings();
     $this->outputData['paymentGateways'] = $paymentGateways;
     if ($this->input->post('amount')) {
         $this->outputData['amount'] = $this->input->post('amount');
     }
     //Check Whether User Logged In Or Not
     if (isLoggedIn() === false) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Dont have rights to access this page')));
         redirect('info');
     }
     //load validation libraray
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //Check User Balance
     $condition_balance = array('user_balance.user_id' => $this->loggedInUser->id);
     $results = $this->transaction_model->getBalance($condition_balance);
     //Load transfer transaction
     //Load helper file
     $this->load->helper('transaction');
     $creator_condition = array('transactions.creator_id' => $this->loggedInUser->id);
     $transaction_condition = array('transactions.creator_id' => $this->loggedInUser->id, 'type' => 'Deposit');
     $url = 'deposit/index';
     $page = $this->uri->segment(3, 0);
     $escrow = loadTransaction($creator_condition, $transaction_condition, $url, $page);
     //If Record already exists
     if ($results->num_rows() > 0) {
         //get balance detail
         $rowBalance = $results->row();
         //check balance Amount
         $updateKey = array('user_balance.user_id' => $this->loggedInUser->id);
         $updateData = array();
         $this->outputData['userAvailableBalance'] = $rowBalance->amount;
         if ($rowBalance->amount > $this->input->post('total')) {
             $this->outputData['with_balance'] = $this->lang->line('check balance');
         }
     }
     //Get Form Data
     if ($this->input->post('depositMoney')) {
         //Set Validation Rules
         $this->form_validation->set_rules('total', 'lang:total_validation', 'required|trim|integer|xss_clean|abs|is_natural_no_zero');
         $this->form_validation->set_rules('paymentMethod', 'lang:paymentMethod_validation', 'required|trim|xss_clean');
         if ($this->form_validation->run()) {
             //redirect it to appropriate payment method
             $total = $this->input->post('total');
             $this->outputData['total'] = $total;
             if ($this->input->post('paymentMethod') == 'paypal') {
                 $view = 'paypalDeposit';
                 $method = 'Paypal';
             }
             //Load the minimum deposit value
             foreach ($paymentGateways as $res) {
                 $deposit_minimum = $res['deposit_minimum'];
                 $commission = $res['commission'];
                 $this->outputData['commission'] = $commission;
             }
             $total_comm = $total + $total * ($commission / 100);
             $this->outputData['total_with_commission'] = sprintf("%1\$.2f", $total_comm);
             if ($deposit_minimum > $this->input->post('total')) {
                 $this->outputData['min_deposit'] = '0';
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Minimum deposit amount :') . $deposit_minimum . '.00'));
                 redirect('deposit');
             }
             $this->load->model('user_model');
             $this->loggedInUser->id;
             //Conditions
             $conditions = array('users.id' => $this->loggedInUser->id);
             $query = $this->user_model->getUsers($conditions);
             foreach ($query->result() as $row) {
                 $role = $row->role_name;
                 $role_id = $row->role_id;
             }
             //Register Transaction
             $insertData = array();
             $insertData['creator_id'] = $this->loggedInUser->id;
             $insertData['type'] = 'Deposit';
             $insertData['amount'] = $this->outputData['total'];
             $insertData['transaction_time'] = get_est_time();
             $insertData['status'] = 'Pending';
             //Can Be success,failed,pending
             $insertData['description'] = $this->lang->line('Amount Deposited Through') . ' ' . $method;
             $insertData['user_type'] = $role;
             if ($role_id == '1') {
                 $insertData['buyer_id'] = $this->loggedInUser->id;
             }
             if ($role_id == '2') {
                 $insertData['provider_id'] = $this->loggedInUser->id;
             }
             $this->load->model('transaction_model');
             $res = $this->transaction_model->addTransaction($insertData);
             //Get Transaction id and set this in to transactions custom field
             $this->outputData['transactionId'] = $this->db->insert_id();
             //echo $this->outputData['total'];exit;
             //Load Corresponding View Based On Payment Method
             $this->load->view('transaction/' . $view, $this->outputData);
         } else {
             $this->load->view('transaction/depositMoney', $this->outputData);
         }
         //If Check For Validation
     } else {
         $this->load->view('transaction/depositMoney', $this->outputData);
     }
     //If End - Check For Form Submission
 }
Example #23
0
 /**
  * Sending new project notifications every hour to Providers
  *
  * @access	private
  * @param	project id and checkstamp
  * @return	contents
  */
 function hourlyProjectsNotify()
 {
     //Load Models
     $this->load->model('search_model');
     $prev_hour = date('j/n/Y H', get_est_time() - 60 * 60);
     $conditions = array('users.role_id' => '2', 'users.user_status' => '1', 'user_categories.user_categories !=' => '', 'users.project_notify' => 'Hourly');
     $users = $this->user_model->getUsersWithCategories($conditions);
     $prids = array();
     $i = 0;
     foreach ($users->result() as $user) {
         $cate = explode(",", $user->user_categories);
         //Get projects by categories
         foreach ($cate as $cat) {
             $cond = array('categories.id' => $cat);
             $res = $this->skills_model->getCategories($cond);
             $row = $res->row();
             $cname = $row->category_name;
             $like = array('projects.project_categories' => $cname);
             $conditions2 = array("FROM_UNIXTIME( projects.created, '%e/%c/%Y %H' ) = " => $prev_hour, 'projects.project_status' => '0');
             $projects = $this->search_model->getProjects($conditions2, 'projects.id', $like);
             //Get projects
             foreach ($projects->result() as $prid) {
                 $prids[$i] = $prid->id;
                 $i++;
             }
         }
         //Check if projects are available to send notifications
         if (count($prids) > 0) {
             $prids1 = array_unique($prids);
             $mailSubject = $this->config->item('site_title') . " Project Notice";
             $mailContent = "The following " . count($prids1) . " projects were recently added to " . $this->config->item('site_title') . " and match your expertise:<br><br>";
             foreach ($prids as $prj) {
                 $condition3 = array('projects.id' => $prj);
                 $mpr = $this->skills_model->getProjects($condition3);
                 $prj = $mpr->row();
                 $mailContent .= $prj->project_name . " (Posted by " . $prj->user_name . ", " . get_datetime($prj->created) . ", Job type:" . $prj->project_categories . ")" . "<br>" . site_url('project/view/' . $prj->id) . "<br><br>";
             }
             //Send mail
             $toEmail = $user->email;
             $fromEmail = $this->config->item('site_admin_mail');
             $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
         }
     }
 }
Example #24
0
 /**
  * Get Bids
  *	
  * @access	private
  * @param	array	conditions to fetch data
  * @return	object	object with result set
  */
 function awardProject($conditions = array())
 {
     //Check For Conditions
     if (is_array($conditions) and count($conditions) > 0) {
         $this->db->where($conditions);
     }
     $this->db->from('bids');
     $result = $this->db->get();
     $row = $result->row();
     $prog_id = $row->user_id;
     $checkstamp = md5("Cogzidel:" . $prog_id . ":" . $row->project_id . ":" . microtime());
     //echo $checkstamp;exit;
     $data = array('programmer_id' => $prog_id, 'checkstamp' => $checkstamp, 'project_status' => '1', 'project_award_date' => get_est_time());
     //print_r($data);exit;
     $this->db->where('projects.id', $row->project_id);
     $this->db->update('projects', $data);
     return $this->db->affected_rows();
     //return $num;
 }
Example #25
0
 function dispute_time_left($time, $hrs)
 {
     //echo date('d-m-Y',$time);exit;
     $CI =& get_instance();
     $CI->lang->load('enduser/cancelProject');
     $mod = $CI->load->model('skills_model');
     $today = get_est_time();
     $lastday = $time;
     $difference = $today - $lastday;
     $day = floor($difference / 84600);
     $difference -= 84600 * floor($difference / 84600);
     $hours = floor($difference / 3600);
     $difference -= 3600 * floor($difference / 3600);
     $min = floor($difference / 60);
     $sec = $difference -= 60 * floor($difference / 60);
     //echo $min;
     if ($day == 0 && $hours == 0) {
         $resp_mins = $hrs * 60;
         $rem = $resp_mins - $min + 0.1;
         return "<b>" . round_up($rem / 60, 2) . " " . $CI->lang->line('hours left to respond') . "</b>";
     } elseif ($day == 0 && $hours < $hrs) {
         $rem = $hrs - $hours;
         return "<b>" . round_up($rem, 2) . " " . $CI->lang->line('hours left to respond') . "</b>";
     } else {
         return "<b>" . $CI->lang->line('response time') . ' (' . $hrs . ' hrs) ' . $CI->lang->line('is over') . "</b>";
     }
     //return "$day days $hours hours $min minutes, and $difference seconds ago.";
 }
Example #26
0
 /**
  * View the cancellation/Dispute case
  *
  * @access	private
  * @param	case id
  * @return	contents
  */
 function viewCase()
 {
     //Load Language
     $this->lang->load('enduser/cancelProject', $this->config->item('language_code'));
     //Check Whether User Logged In Or Not
     if (isLoggedIn() === false) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Please login to view case')));
         redirect('info');
     }
     //If Admin try to access this url...redirect him
     if (isAdmin() === true) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Please login to view case')));
         redirect('info');
     }
     //Load model
     $this->load->helper('users');
     $this->load->helper('projectcases');
     //load validation libraray
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //Get Form Data
     if ($this->input->post('respondCase')) {
         //Set rules
         if ($this->input->post('updates') == '0') {
             $this->form_validation->set_rules('problem_description', 'lang:problem_description_validation', 'required|trim|xss_clean');
         } else {
             $this->form_validation->set_rules('problem_description', 'lang:problem_description_validation', 'trim|xss_clean');
         }
         $this->form_validation->set_rules('comments', '', 'trim|xss_clean');
         if ($this->form_validation->run()) {
             if (check_form_token() === false) {
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('token_error')));
                 redirect('info');
             }
             $insertData = array();
             $insertData['parent'] = $this->input->post('case_id');
             $insertData['problem_description'] = $this->input->post('problem_description');
             $insertData['private_comments'] = $this->input->post('comments');
             $insertData['user_id'] = $this->loggedInUser->id;
             $insertData['created'] = get_est_time();
             if ($this->input->post('updates') != '0') {
                 $insertData['updates'] = $this->input->post('updates');
             }
             //Create Case
             $this->dispute_model->insertProjectCase($insertData);
             $project_id = $this->input->post('project_id');
             $condition2 = array('projects.id' => $project_id);
             $res = $this->skills_model->getProjects($condition2);
             $prj = $res->row();
             if (isProgrammer()) {
                 $other_user = $prj->user_name;
                 $user_type = 'Provider';
             }
             if (isBuyer()) {
                 $provider_id = $prj->programmer_id;
                 $providerRow = getUserInfo($provider_id);
                 $other_user = $providerRow->user_name;
                 $user_type = 'Buyer';
             }
             //Send Mail to other user about the case
             $conditionUserMail = array('email_templates.type' => 'respond_case');
             $result = $this->email_model->getEmailSettings($conditionUserMail);
             $rowUserMailConent = $result->row();
             //Update the details
             $splVars = array("!project_name" => '<a href="' . site_url('project/view/' . $prj->id) . '">' . $prj->project_name . '</a>', "!pr_name" => $prj->project_name, "!other_user" => $other_user, "!contact_url" => site_url('contact'), "!user" => $this->loggedInUser->user_name, '!site_title' => $this->config->item('site_title'), "!link" => site_url('dispute/viewCase/' . $insertData['parent']));
             $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
             $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
             $toEmail = $prj->email;
             $fromEmail = $this->config->item('site_admin_mail');
             $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
             //Send acknowledgement Mail to siteadmin
             $conditionUserMail = array('email_templates.type' => 'response_case_admin');
             $result = $this->email_model->getEmailSettings($conditionUserMail);
             $rowUserMailConent = $result->row();
             //Update the details
             $splVars = array("!project_name" => '<a href="' . site_url('project/view/' . $prj->id) . '">' . $prj->project_name . '</a>', "!user" => $this->loggedInUser->user_name, '!user_type' => $user_type, '!case_id' => $insertData['parent']);
             $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
             $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
             $toEmail = $this->config->item('site_admin_mail');
             $fromEmail = $prj->email;
             $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
             //Notification message
             $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('response added successfully')));
             redirect('dispute/viewCase/' . $insertData['parent']);
         }
     }
     if ($this->input->post('reopen')) {
         $insertData = array();
         $insertData['parent'] = $this->input->post('case_id');
         $insertData['user_id'] = $this->loggedInUser->id;
         $insertData['created'] = get_est_time();
         $insertData['updates'] = $this->lang->line('case reopened');
         //Create Case
         $this->dispute_model->insertProjectCase($insertData);
         //prepare update data
         $updateData = array();
         $updateData['status'] = 'open';
         //update case
         $this->skills_model->updateProjectCase($this->input->post('case_id'), $updateData);
         //Notification message
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Case reopened successfully')));
         redirect('dispute/viewCase/' . $insertData['parent']);
     }
     $caseid = $this->uri->segment('3', 0);
     $condition2 = array('project_cases.id' => $caseid);
     $res = $this->dispute_model->getProjectCases($condition2);
     if ($res->num_rows() == 0) {
         //Notification message
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('Invalid input given')));
         redirect('info');
     }
     $this->outputData['projectCase'] = $res->row();
     $condition3 = array('project_cases.parent' => $caseid);
     $this->outputData['caseResolution'] = $this->dispute_model->getProjectCases($condition3);
     //pr($this->outputData['projectCase']);exit;
     //$this->outputData['provider'] = getUserInfo($this->outputData['project']->programmer_id);
     $this->load->view('dispute/viewCase', $this->outputData);
 }
Example #27
0
 /**
  * review buyers
  *
  * @access	private
  * @param	nil
  * @return	void
  */
 function reviewBuyer()
 {
     //Load Language
     $this->lang->load('enduser/review', $this->config->item('language_code'));
     //Check For Buyer Session
     if (!isProgrammer()) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be logged in as a Programmer to review Buyer')));
         redirect('info');
     }
     if ($this->input->post('reviewBuy')) {
         $insertData = array();
         $insertData['comments'] = $this->input->post('comment', true);
         $insertData['rating'] = $this->input->post('rate', true);
         $insertData['review_type'] = '1';
         $insertData['review_time'] = get_est_time();
         $insertData['project_id'] = $this->input->post('pid', true);
         $insertData['buyer_id'] = $this->input->post('bid', true);
         $insertData['provider_id'] = $this->loggedInUser->id;
         //Create Review
         $reviewId = $this->skills_model->createReview($insertData);
         //Update projects
         $this->skills_model->updateProjects($insertData['project_id'], array('buyer_rated' => '1'));
         $condition = array('reviews.project_id' => $insertData['project_id']);
         $rev = $this->skills_model->getReviews($condition);
         //pr($rev->result());exit;
         //Send Mail
         $conditionUserMail = array('email_templates.type' => 'programmer_review');
         $result = $this->email_model->getEmailSettings($conditionUserMail);
         $rowUserMailConent = $result->row();
         //Get Project details
         $condition = array('projects.id' => $insertData['project_id']);
         $projectDetails = $this->skills_model->getProjects($condition, 'projects.project_name');
         $prjRow = $projectDetails->row();
         //Get User details
         $getuser = $this->user_model->getUsers(array('users.id' => $insertData['buyer_id']));
         $user = $getuser->row();
         $splVars = array("!programmer_name" => $this->loggedInUser->user_name, "!project_name" => $prjRow->project_name, "!site_name" => site_url(''), '!site_title' => $this->config->item('site_title'));
         $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
         $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
         $toEmail = $user->email;
         $fromEmail = $this->config->item('site_admin_mail');
         //Send mail
         $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
         if ($rev->num_rows() == 2) {
             //Increase number of reviews
             $num_reviews = $user->num_reviews + 1;
             //Rating
             if ($user->user_rating == 0) {
                 $rating = $insertData['rating'];
             } else {
                 $rating = ($user->user_rating + $insertData['rating']) / 2;
             }
             $tot_rating2 = $rating * $num_reviews;
             //Update buyer
             $this->skills_model->updateUsers($insertData['buyer_id'], array('user_rating' => $rating, 'num_reviews' => $num_reviews, 'tot_rating' => $tot_rating2));
             //Get Provider details
             $getHold = $this->skills_model->getRatingHold(array('rating_hold.user_id' => $this->loggedInUser->id, 'rating_hold.project_id' => $insertData['project_id']));
             $holdRow = $getHold->row();
             if ($getuser->num_rows() > 0) {
                 //Get Provider details
                 $getuser = $this->user_model->getUsers(array('users.id' => $this->loggedInUser->id), 'users.user_rating,users.num_reviews');
                 $providerRow = $getuser->row();
                 //Rating
                 if ($providerRow->user_rating == 0) {
                     $rating = $holdRow->rating;
                 } else {
                     $rating = ($providerRow->user_rating + $holdRow->rating) / 2;
                 }
                 //Increase number of reviews
                 $num_reviews = $providerRow->num_reviews + 1;
                 $tot_rating = $rating * $num_reviews;
                 //Update Provider
                 $this->skills_model->updateUsers($this->loggedInUser->id, array('user_rating' => $rating, 'num_reviews' => $num_reviews, 'tot_rating' => $tot_rating));
                 $condition2 = array('reviews.project_id' => $insertData['project_id'], 'reviews.provider_id' => $this->loggedInUser->id, 'reviews.review_type' => '2');
                 $getrev = $this->skills_model->getReviews($condition2, 'reviews.id');
                 $revRow = $getrev->row();
                 //echo $reviewId;exit;
                 $this->skills_model->updateReviews($revRow->id, array('reviews.hold' => '0'));
             }
         }
         if ($rev->num_rows() == 1) {
             $insertData2 = array();
             $insertData2['rating'] = $insertData['rating'];
             $insertData2['user_id'] = $insertData['buyer_id'];
             $insertData2['project_id'] = $insertData['project_id'];
             $this->skills_model->insertRatingHold($insertData2);
             $this->skills_model->updateReviews($reviewId, array('reviews.hold' => '1'));
         }
         //Notification message
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('review_added')));
         redirect('info/index/success');
     }
     //Get project id
     $projectid = $this->uri->segment(3, '0');
     $condition = array('projects.id' => $projectid);
     $projectDetails = $this->skills_model->getProjects($condition);
     $this->outputData['projectDetails'] = $projectDetails;
     $prjRow = $projectDetails->row();
     $condition2 = array('reviews.project_id' => $projectid, 'reviews.buyer_id' => $prjRow->creator_id, 'reviews.review_type' => '1');
     $this->outputData['reviewDetails'] = $this->skills_model->getReviews($condition2);
     //pr($this->outputData['reviewDetails']->result());exit;
     $this->load->view('programmer/reviewBuyer', $this->outputData);
 }
Example #28
0
 /**
  * Post mail Messages Related To A Project
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function composeMail()
 {
     if (!isset($this->loggedInUser->id)) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You can not access to this page')));
         redirect('info');
     }
     //Assign the value for check the button is preview or submit
     $preview = FALSE;
     //Assign the value
     $this->outputData['previewMessages'] = array();
     //language file - Change this file to do display text modification
     $this->lang->load('enduser/postMessage', $this->config->item('language_code'));
     //load validation libraray
     $this->load->library('form_validation');
     //Load Form Helper
     $this->load->helper('form');
     //Intialize values for library and helpers
     $this->form_validation->set_error_delimiters($this->config->item('field_error_start_tag'), $this->config->item('field_error_end_tag'));
     //Get Project Id
     $user_id = $this->loggedInUser->id;
     $logged_userrole = $this->loggedInUser->role_id;
     //Get all the users projects who are all won the projects
     if ($logged_userrole == '2') {
         $conditions = array('projects.programmer_id' => $user_id, 'projects.project_status !=' => '2', 'projects.flag' => '0');
     }
     if ($logged_userrole == '1') {
         $conditions = array('projects.creator_id' => $user_id, 'projects.project_status !=' => '2', 'projects.flag' => '0');
     }
     $wonProjects = $this->skills_model->getUsersproject($conditions);
     $count = $wonProjects->num_rows();
     if ($count <= 0) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('There is no open project to Post Mail')));
         redirect('info');
     }
     $this->outputData['wonProjects'] = $wonProjects->result();
     //Get all the users lists
     $usersList = $this->user_model->getUsers();
     $this->outputData['usersList'] = $usersList->result();
     $conditions = array('messages.from_id' => $user_id);
     $userslist = $this->messages_model->getProjectMessages();
     $this->outputData['projects'] = $userslist;
     //Get Form Data
     if ($this->input->post('postMessage') or $this->input->post('previewMessage')) {
         //Set rules
         $this->form_validation->set_rules('message', 'lang:message_validation', 'required|min_length[5]|trim|xss_clean|callback_emailpresent_projectname_check|callback_emailpresent_check|callback__phonenumber_check|callback__phonenumber_projectname_check');
         $this->form_validation->set_rules('to', 'lang:project_validation', 'required|trim|xss_clean');
         $this->form_validation->set_rules('prog_id', 'lang:provider_validation', 'required|is_no|trim|xss_clean');
         if ($this->form_validation->run()) {
             //Get the message posted user name
             $userId = $this->user_model->getUsers();
             $this->outputData['userList'] = $userId->result();
             $user_id = $userId->row();
             $this->outputData['project_name'] = $this->input->post('to');
             $conditions = array('projects.id' => $this->input->post('to'), 'projects.project_status !=' => '2');
             $wonProjects = $this->skills_model->getUsersproject($conditions);
             foreach ($wonProjects->result() as $res) {
                 if ($this->loggedInUser->role_id == '1') {
                     $programmer_id = $res->programmer_id;
                 } else {
                     if ($this->loggedInUser->role_id == '2') {
                         $programmer_id = $res->creator_id;
                     } else {
                         $programmer_id = '0';
                     }
                 }
             }
             $insertData = array();
             $insertData['project_id'] = $this->input->post('to');
             $insertData['to_id'] = $programmer_id;
             $insertData['from_id'] = $this->loggedInUser->id;
             $insertData['message'] = $this->input->post('message');
             $insertData['created'] = get_est_time();
             //Get Username
             $to_id = $this->input->post('to');
             if ($this->input->post('prog_id') == '0') {
                 $this->outputData['user_name'] = 'Everyone';
             } else {
                 $this->outputData['user_name'] = $this->input->post('prog_id');
             }
             if (!is_numeric($to_id)) {
                 $users_list = $this->messages_model->getUsers();
                 foreach ($users_list as $message) {
                     if ($this->input->post('to') === $message->user_name) {
                         $insertData['to_id'] = $message->id;
                     }
                 }
             }
             if ($this->input->post('previewMessage')) {
                 $this->outputData['previewMessages'] = $insertData;
                 $preview = TRUE;
             }
             if ($this->input->post('postMessage')) {
                 if ($this->input->post('prog_id') == '0') {
                     $usercondition = array('users.role_id' => '2');
                     $users = $this->user_model->getUsers($usercondition);
                     $user = $users->row();
                     //pr($users->result());
                     foreach ($users->result() as $users_email) {
                         $insertData = array();
                         $insertData['project_id'] = $this->input->post('to');
                         $insertData['to_id'] = $users_email->id;
                         $insertData['from_id'] = $this->loggedInUser->id;
                         $insertData['message'] = $this->input->post('message');
                         $insertData['created'] = get_est_time();
                         $this->messages_model->postMessage($insertData);
                         //send email to the buyer or programmer receive new mail or PMB
                         $this->load->model('email_model');
                         $conditionUserMail = array('email_templates.type' => 'message_template');
                         $result = $this->email_model->getEmailSettings($conditionUserMail);
                         $rowUserMailConent = $result->row();
                         $splVars = array("!site_name" => $this->config->item('site_title'), "!username" => $user->user_name, "!reason" => 'Project', "!sender_name" => $this->loggedInUser->user_name, "!site_url" => site_url(), "!contact_url" => site_url('contact'));
                         $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                         $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
                         $toEmail = $users_email->email;
                         $fromEmail = $this->config->item('site_admin_mail');
                         $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
                     }
                 }
                 if ($this->input->post('prog_id')) {
                     $usercondition = array('users.id' => $this->input->post('prog_id'));
                     $user = $this->user_model->getUsers($usercondition);
                     $user = $user->row();
                     if (isset($user)) {
                         //Create Projects
                         $insertData = array();
                         $insertData['project_id'] = $this->input->post('to');
                         $insertData['to_id'] = $user->id;
                         $insertData['from_id'] = $this->loggedInUser->id;
                         $insertData['message'] = $this->input->post('message');
                         $insertData['created'] = get_est_time();
                         $this->messages_model->postMessage($insertData);
                         //send email to the buyer or programmer receive new mail or PMB
                         $this->load->model('email_model');
                         $conditionUserMail = array('email_templates.type' => 'message_template');
                         $result = $this->email_model->getEmailSettings($conditionUserMail);
                         $rowUserMailConent = $result->row();
                         $splVars = array("!site_name" => $this->config->item('site_title'), "!username" => $user->user_name, "!reason" => 'Project', "!sender_name" => $this->loggedInUser->user_name, "!site_url" => site_url(), "!contact_url" => site_url('contact'));
                         $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                         $mailContent = strtr($rowUserMailConent->mail_body, $splVars);
                         $toEmail = $user->email;
                         $fromEmail = $this->config->item('site_admin_mail');
                         $this->email_model->sendHtmlMail($toEmail, $fromEmail, $mailSubject, $mailContent);
                     }
                 }
                 /*//Create Projects
                 		  $this->messages_model->postMessage($insertData);
                 		  $usercondition = array('users.id'=>$insertData['to_id']); 
                 		  $user          = $this->user_model->getUsers($usercondition);
                 		  $user          = $user->row();
                 		  if(isset($user->email))  
                 		  {
                 		 //send email to the buyer or programmer receive new mail or PMB
                 		  $this->load->model('email_model');
                 		  $conditionUserMail = array('email_templates.type'=>'message_template');
                 		  $result            = $this->email_model->getEmailSettings($conditionUserMail);
                 		  $rowUserMailConent = $result->row();
                 		  $splVars = array("site_name" => $this->config->item('site_title'),"username" =>$user->user_name,"reason"=>'Project',"sender_name" => $this->loggedInUser->user_name,"!site_url" => site_url(), "contact_url" => site_url('contact'));
                 		  
                 		  $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                 		  $mailContent = strtr($rowUserMailConent->mail_body, $splVars);		
                 		  $toEmail     = $user->email;
                 		  $fromEmail   = $this->config->item('site_admin_mail');
                 		  $this->email_model->sendHtmlMail($toEmail,$fromEmail,$mailSubject,$mailContent);
                 	  	  }
                 		  //Get the receiver name 
                 		else
                 		  {
                 			  //Get all username and send email to all users
                 			  $user          = $this->user_model->getUsers();
                 			  foreach($user->result() as $user) 
                 			  {
                 				 //send email to the buyer or programmer receive new mail or PMB
                 				  $this->load->model('email_model');
                 				  $conditionUserMail = array('email_templates.type'=>'message_template');
                 				  $result            = $this->email_model->getEmailSettings($conditionUserMail);
                 				  $rowUserMailConent = $result->row();
                 				   pr($rowUserMailConent); 
                 				  $splVars = array("site_name" => $this->config->item('site_title'),"username" =>$user->user_name,"reason" =>'Project' ,"!sender_name" => $this->loggedInUser->user_name,"site_url" => site_url(), "contact_url" => site_url('contact'));
                 				  $mailSubject = strtr($rowUserMailConent->mail_subject, $splVars);
                 				  $mailContent = strtr($rowUserMailConent->mail_body, $splVars);		
                 				  $toEmail     = $user->email;
                 				  $fromEmail   = $this->config->item('site_admin_mail');
                 				  $this->email_model->sendHtmlMail($toEmail,$fromEmail,$mailSubject,$mailContent);
                 			  }*/
                 //}
                 $preview = FALSE;
             }
             if ($preview == FALSE) {
                 //Notification message
                 $this->session->set_flashdata('flash_message', $this->common_model->flash_message('success', $this->lang->line('Your Message Has Been Posted Successfully')));
                 redirect('messages/viewMail/', $this->loggedInUser->id);
             }
         }
         //If End - Form Validation
     }
     //If End - Check For Form Submission
     //Get Project Id
     if ($this->uri->segment(3)) {
         //Get project id for post message for the particular project
         $project_id = $this->uri->segment(3, '0');
         $conditions = array('projects.id' => $project_id);
         $this->outputData['projects'] = $this->skills_model->getProjects($conditions);
     }
     if (isLoggedIn() === false) {
         $this->session->set_flashdata('flash_message', $this->common_model->flash_message('error', $this->lang->line('You must be logged to post messages on the Project Message Board')));
         redirect('info/index/success');
     }
     $this->load->view('messages/composeMail', $this->outputData);
 }
Example #29
0
 /**
  * Extend project bid
  *
  * @access	private
  * @param	project id and checkstamp
  * @return	contents
  */
 function extendBid()
 {
     //Load Language
     $this->lang->load('enduser/viewProject', $this->config->item('language_code'));
     if ($this->input->post('extend')) {
         $condition2 = array('projects.id' => $this->input->post('projectid'));
         $res = $this->skills_model->getProjects($condition2);
         $row = $res->row();
         //pr($row);exit;
         if ($row->project_status == 3) {
             $enddate = get_est_time() + $this->input->post('openDays') * 86400;
             $updateKey = array('projects.id' => $this->input->post('projectid'));
             $updateData = array('projects.enddate' => $enddate, 'projects.project_status' => '0');
             $this->skills_model->updateProjects(NULL, $updateData, $updateKey);
             redirect('buyer/viewMyProjects');
         }
     }
     $prjid = $this->uri->segment(3, '0');
     $condition = array('projects.id' => $prjid);
     $this->outputData['project'] = $this->skills_model->getProjects($condition);
     $this->load->view('buyer/extend', $this->outputData);
 }
Example #30
0
 /**
  * Loads admin login interface.
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function index()
 {
     if (!isAdmin()) {
         redirect_admin('login');
     } else {
         $this->outputData['adminlogin'] = '******';
     }
     //Get total buyers
     $buyer_condtition = array('users.role_id' => '1');
     $buyer = $this->admin_model->getUsers($buyer_condtition);
     $this->outputData['buyers'] = $buyer->num_rows();
     //Get total programmer
     $programmer_condtition = array('users.role_id' => '2');
     $programmer = $this->admin_model->getUsers($programmer_condtition);
     $this->outputData['programmers'] = $programmer->num_rows();
     //Get total open projects
     //$this->load->model('skills_model');
     $openproject_condition = array('projects.project_status' => '0');
     $open_projects = $this->skills_model->getProjects($openproject_condition);
     $this->outputData['open_projects'] = $open_projects->num_rows();
     //Get total closed projects
     $closedproject_condition = array('projects.project_status' => '2');
     $closed_projects = $this->skills_model->getProjects($closedproject_condition);
     $this->outputData['closed_projects'] = $closed_projects->num_rows();
     //Get total users
     $this->outputData['users'] = $this->admin_model->getUsers();
     $days = date('Y-m-d', get_est_time());
     $cond1 = '%Y-%m-%d';
     $cond2 = $days;
     $res = $this->admin_model->gettodayProjects();
     $this->outputData['today'] = $res->num_rows();
     //Get total projects for this week
     $days1 = date('W,m,Y', time());
     $cond11 = '%u,%m,%Y';
     $cond21 = $days1;
     $res1 = $this->admin_model->getProjects($cond11, $cond21);
     $this->outputData['week'] = $res1->num_rows();
     //Get total projects for this week
     $days2 = date('m,Y', time());
     $cond12 = '%m,%Y';
     $cond22 = $days2;
     $res2 = $this->admin_model->getProjects($cond12, $cond22);
     $this->outputData['month'] = $res2->num_rows();
     //Get total projects for this week
     $days3 = date('Y', time());
     $cond13 = '%Y';
     $cond23 = $days3;
     $res3 = $this->admin_model->getProjects($cond13, $cond23);
     $this->outputData['year'] = $res3->num_rows();
     //Get total projects
     $days4 = date('d,m,Y', time());
     $cond14 = '%d,%m,%Y';
     $cond24 = $days4;
     $status = '0';
     $projects1 = $this->admin_model->getProjectsdetails1($cond14, $cond24, NULL, $status);
     $this->outputData['open'] = $projects1->num_rows();
     //Get total projects
     $days5 = date('d,m,Y', time());
     $cond15 = '%d,%m,%Y';
     $cond25 = $days5;
     $status = '2';
     $projects2 = $this->admin_model->getProjectsdetails1($cond15, $cond25, NULL, $status);
     $this->outputData['closed'] = $projects2->num_rows();
     //Get the users Balance
     $this->load->model('account_model');
     $res6 = $this->account_model->adminBalance();
     $res6 = $res6->row();
     $this->outputData['adminBalance'] = $res6->amount;
     //Get Transaction Information
     $this->load->model('transaction_model');
     $condition = array('transactions.type' => 'Withdraw', 'transactions.status' => strtolower('Pending'));
     $transactions1 = $this->transaction_model->getTransactions($condition);
     $this->outputData['withdraw'] = $transactions1->num_rows();
     //Get total Report Violation
     $reports = $this->admin_model->getReports();
     $this->outputData['reportViolation'] = $reports->num_rows();
     //Get total projects
     $this->outputData['projects'] = $this->skills_model->getProjects();
     $this->load->view('admin/home', $this->outputData);
 }