Example #1
0
<?php

//print_array($_POST);
//print_array($this->session->all_userdata());
//print_array(get_pde_info_by_id($this->session->userdata('pdeid'),'title'))
if (isset($errors)) {
    echo error_template($errors);
}
if (isset($results)) {
    ?>

    <!-- TAB NAVIGATION -->
    <ul class="nav nav-tabs" role="tablist">
        <li class="active"><a href="#tab1" role="tab" data-toggle="tab">Report Summary</a></li>
        <li><a href="#tab2" role="tab" data-toggle="tab">Report Details</a></li>

    </ul>
    <!-- TAB CONTENT -->
    <div class="tab-content">
        <div class="active tab-pane fade in" id="tab1">
            <?php 
    /*
    * [0] => Array
            (
                [receiptid] => 100
                [bid_id] => 53
                [providerid] => 10
                [details] =>
                [received_by] => rogers
                [datereceived] => 2015-05-07
                [approved] => Y
Example #2
0
function action_email_template_wrap($to, $subject, $content, $from, $action_link)
{
    if (check_live_server()) {
        $to = $to;
        $subject = $subject;
        $headers = "From: " . strip_tags($from) . "\r\n";
        $headers .= "Reply-To: " . strip_tags($from) . "\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
        $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Actionable emails e.g. reset password</title>


<style type="text/css">
img {
max-width: 100%;
}
body {
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6;
}
body {
background-color: #f6f6f6;
}
@media only screen and (max-width: 640px) {
  body {
    padding: 0 !important;
  }
  h1 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h2 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h3 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h4 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h1 {
    font-size: 22px !important;
  }
  h2 {
    font-size: 18px !important;
  }
  h3 {
    font-size: 16px !important;
  }
  .container {
    padding: 0 !important; width: 100% !important;
  }
  .content {
    padding: 0 !important;
  }
  .content-wrap {
    padding: 10px !important;
  }
  .invoice {
    width: 100% !important;
  }
}
</style>
</head>

<body itemscope itemtype="http://schema.org/EmailMessage" style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6; background: #f6f6f6; margin: 0;">

<table class="body-wrap" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; background: #f6f6f6; margin: 0;">
	<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
		<td style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top"></td>
		<td class="container" width="600" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto;" valign="top">
			<div class="content" style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
				<table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope itemtype="http://schema.org/ConfirmAction" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background: #fff; margin: 0; border: 1px solid #e9e9e9;">
					<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
						<td class="content-wrap" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 20px;" valign="top">
							<meta itemprop="name" content="Confirm Email" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
							<table width="100%" cellpadding="0" cellspacing="0" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
								<tr style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
									<td class="content-block" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
										' . $content . '
									</td>
								</tr>

								<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
									<td class="content-block" itemprop="handler" itemscope itemtype="' . $action_link . '" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
										<a href="' . $action_link . '" itemprop="url" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #FFF; text-decoration: none; line-height: 2; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; background: #348eda; margin: 0; border-color: #348eda; border-style: solid; border-width: 10px 20px;">' . $subject . ' </a>
									</td>
								</tr>

							</table>
						</td>
					</tr>
				</table>
				<div class="footer" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
					<table width="100%" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
						<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
							<td class="aligncenter content-block" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; text-align: center; margin: 0; padding: 0 0 20px;" align="center" valign="top"><a href="' . base_url() . '" style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;"></a> ' . SITE_NAME . ' .</td>
						</tr>
					</table>
				</div></div>
		</td>
		<td style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top"></td>
	</tr>
</table>

</body>
</html>
';
        if (mail($to, $subject, $message, $headers)) {
            return TRUE;
        } else {
            //if not sent
            echo error_template('Mail was not sent');
            return FALSE;
        }
    } else {
        //if on localhost return true
        return TRUE;
    }
}
Example #3
0
                                class="fa fa-plus"></i></a>

                    <?php

                    }
                    ?>

                </p>
                <?php

                if (isset($success_msg)) {
                    echo success_template($success_msg);
                }

                if (isset($error_msg)) {
                    echo error_template($error_msg);
                }

                ?>
                <div class="table-responsive">
                    <table class="table datatable">
                        <thead>
                        <tr>
                            <th>Title</th>
                            <th>URL</th>
                            <th>Logo</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php
                        //print_array($all_houses_paginated);
Example #4
0
function save_user($firstname, $lastname, $email, $password)
{
    $ci =& get_instance();
    $ci->load->model('user_m');
    //echo $ci->input->post('ajax');
    $firstname = $ci->input->post('fname') != '' ? $ci->input->post('fname') : $firstname;
    $lastname = $ci->input->post('lname') != '' ? $ci->input->post('lname') : $lastname;
    $email = $ci->input->post('email') != '' ? $ci->input->post('email') : $email;
    $password = $ci->input->post('password') != '' ? $ci->input->post('password') : $password;
    $usertype = $ci->input->post('usertype') != '' ? $ci->input->post('usertype') : '4';
    $ci->form_validation->set_rules($ci->user_m->add_user_validation);
    $str = '';
    if ($ci->form_validation->run() == FALSE) {
        //if there were errors add them to the errors array
        echo error_template(validation_errors());
    } else {
        $user_data = array('fname' => $firstname, 'lname' => $lastname, 'email' => $email, 'usertype' => $usertype, 'password' => md5($password), 'dateadded' => mysqldate(), 'slug' => now() . random_string('numeric', 8));
        //more validation special cases
        if ($ci->input->post('cpassword') != '') {
            //chek o see id the two match
            if ($ci->input->post('password') != $ci->input->post('cpassword')) {
                echo error_template('Passwords do not match');
            }
        } else {
            $user_id = $ci->user_m->create($user_data);
            if ($user_id) {
                //add him to the roles tables
                //if online
                if (check_live_server()) {
                    //send email to user
                    $salutation = $content = '<p>Hello<strong> ' . ucwords($firstname . ' ' . $lastname) . '</strong>,</p>';
                    $content = '<p>Hello<strong> ' . ucwords($firstname . ' ' . $lastname) . '</strong>,</p>

<p>You have created a new account on <a href="' . base_url() . '>' . base_url() . '</a>.</p>

<p>Below are your login credentials:</p>

<p><strong>Username</strong>: ' . $email . '</p>

<p><strong>Password</strong>: ' . $password . '</p>

<p>Click <a href="' . base_url() . 'admin/login">here</a> to login</p>
';
                    send_html_email($ci->input->post('email'), 'New account', $salutation, $content, SITE_EMAIL);
                }
                //if there were errors add them to the errors array
                $str .= jquery_clear_fields();
                echo $str;
                return $user_id;
            } else {
                //if there were errors add them to the errors array
                echo warning_template('User was not added. Please try one more time');
            }
        }
    }
}
Example #5
0
 function logo_settings()
 {
     if (check_my_access('view_site_info')) {
         if ($this->input->post('ajax')) {
             $str = '';
             switch ($this->input->post('ajax')) {
                 case 'logo_dimensions':
                     //print_array($_POST);
                     $this->form_validation->set_rules($this->site_logo_m->validate_dimensions);
                     $str = '';
                     if ($this->form_validation->run() == FALSE) {
                         $str .= error_template(validation_errors());
                     } else {
                         $info = array('width' => $this->input->post('logo_width'), 'height' => $this->input->post('logo_height'));
                         //check if thetre is info
                         $logo_info = $this->site_logo_m->get_all();
                         if (count($logo_info)) {
                             //then update based on id
                             foreach ($logo_info as $row) {
                                 if ($this->site_logo_m->update($row['id'], $info, 'You updated site logo info')) {
                                     $str .= success_template('Site logo dimensions have been successfully Updated');
                                 } else {
                                     $str .= info_template('No change was made');
                                 }
                             }
                         } else {
                             //insert
                             if ($this->site_logo_m->create($info, 'You updated the site logo info')) {
                                 $str .= success_template('Site logo dimensions have been successfully added');
                             }
                         }
                     }
                     echo $str;
                     break;
             }
             echo $str;
         } else {
             $data['main_content'] = 'admin/settings/logo_home_v';
             $data['pagetitle'] = 'Logo Settings';
             $data['logo_info'] = $this->site_logo_m->get_all();
             if ($this->input->post('upload')) {
                 //if a file is being uploaded
                 if ($_FILES and $_FILES['userfile']['name']) {
                     //check if there is already a logo
                     if ($this->site_logo_m->get_all()) {
                         //delete it
                         foreach ($this->site_logo_m->get_all() as $row) {
                             unlink('uploads/site_logo/' . get_thumbnail($row['logo_name']));
                             unlink('uploads/site_logo/' . $row['logo_name']);
                         }
                     }
                     $image_name = $this->site_logo_m->do_upload('site_logo');
                     // Upload the file
                     if (!$this->upload->display_errors()) {
                         //save file name
                         $image_data = array('logo_name' => $image_name);
                         //print_array($_POST);
                         //check if there is already a logo
                         if ($data['logo_info']) {
                             //do update
                             foreach ($this->site_logo_m->get_all() as $row) {
                                 //save file info
                                 if ($this->site_logo_m->update($row['id'], $image_data, 'updated site logo ')) {
                                     $data['success'] = 'Site logo successfully updated <a class="btn btn-success btn-sx" href="' . current_url() . '">Refresh</a>';
                                 } else {
                                     $data['errors'] = 'File was not saved. Please try again';
                                 }
                             }
                         } else {
                             //save file info
                             if ($this->site_logo_m->create($image_data, 'updated site logo ')) {
                                 $data['success'] = 'Site logo successfully updated  <a class="btn btn-success btn-xs" href="' . current_url() . '">Refresh</a>';
                             } else {
                                 $data['errors'] = 'File was not saved. Please try again';
                             }
                         }
                     } else {
                         $data['errors'] = $this->upload->display_errors();
                     }
                 } else {
                     $data['errors'] = 'Upload an image';
                 }
             }
             //load the admin dashboard view
             $this->load->view('admin/includes/admin_template', $data);
         }
     } else {
         load_access_denied_page();
     }
 }
Example #6
0
 function save_procurement_entry()
 {
     #check user access
     #1: for editing
     if (!empty($data['i'])) {
         check_user_access($this, 'edit_procurement_entry', 'redirect');
     } else {
         check_user_access($this, 'add_procurement_entry', 'redirect');
     }
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'p', 'v'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = add_msg_if_any($this, $data);
     $data = handle_redirected_msgs($this, $data);
     $plan_info = $this->procurement_plan_m->get_by_id(decryptValue($data['v']));
     if (!empty($plan_info)) {
         $plan_info = $plan_info[0];
     }
     #print_array($_POST);
     if (!empty($_POST['save_entry']) || !empty($_POST['save_and_new'])) {
         $data['formdata'] = $_POST;
         $required_fields = array('subject_of_procurement', 'pde_department', 'procurement_type', 'estimated_amount', 'currency', 'funding_source', 'procurement_method', 'contracts_committee_approval_date', 'contracts_committee_approval_of_shortlist_date', 'bid_issue_date', 'bid_closing_date', 'submission_of_evaluation_report_to_cc', 'cc_approval_of_evaluation_report', 'quantity');
         if (!empty($_POST['currency']) && $_POST['currency'] > 1) {
             $required_fields = array_merge($required_fields, array('exchange_rate'));
         }
         #$_POST = clean_form_data($_POST);
         $validation_results = validate_form('', $_POST, $required_fields);
         #Only proceed if the validation for required fields passes
         if ($validation_results['bool']) {
             $procurement_plan_data = array('subject_of_procurement' => $this->input->post('subject_of_procurement'), 'procurement_type' => $this->input->post('procurement_type'), 'procurement_method' => $this->input->post('procurement_method'), 'pde_department' => $this->input->post('pde_department'), 'funding_source' => $this->input->post('funding_source'), 'estimated_amount' => removeCommas($this->input->post('estimated_amount')), 'currency' => $this->input->post('currency'), 'exchange_rate' => $_POST['currency'] == 1 ? 1 : $this->input->post('exchange_rate'), 'pre_bid_events_date' => custom_date_format('Y-m-d', $this->input->post('pre_bid_events_date')), 'contracts_committee_approval_date' => custom_date_format('Y-m-d', $this->input->post('contracts_committee_approval_date')), 'publication_of_pre_qualification_date' => custom_date_format('Y-m-d', $this->input->post('publication_of_pre_qualification_date')), 'proposal_submission_date' => custom_date_format('Y-m-d', $this->input->post('proposal_submission_date')), 'contracts_committee_approval_of_shortlist_date' => custom_date_format('Y-m-d', $this->input->post('contracts_committee_approval_of_shortlist_date')), 'bid_issue_date' => custom_date_format('Y-m-d', $this->input->post('bid_issue_date')), 'bid_submission_opening_date' => custom_date_format('Y-m-d', $this->input->post('bid_issue_date')), 'bid_closing_date' => custom_date_format('Y-m-d', $this->input->post('bid_closing_date')), 'submission_of_evaluation_report_to_cc' => custom_date_format('Y-m-d', $this->input->post('submission_of_evaluation_report_to_cc')), 'secure_necessary_approval_date' => custom_date_format('Y-m-d', $this->input->post('necessary_approval_date')), 'contract_award' => custom_date_format('Y-m-d', $this->input->post('contract_award')), 'best_evaluated_bidder_date' => custom_date_format('Y-m-d', $this->input->post('best_evaluated_bidder_date')), 'contract_sign_date' => custom_date_format('Y-m-d', $this->input->post('contract_sign_date')), 'cc_approval_of_evaluation_report' => custom_date_format('Y-m-d', $this->input->post('cc_approval_of_evaluation_report')), 'negotiation_date' => custom_date_format('Y-m-d', $this->input->post('negotiation_date')), 'negotiation_approval_date' => custom_date_format('Y-m-d', $this->input->post('negotiation_approval_date')), 'performance_security' => custom_date_format('Y-m-d', $this->input->post('performance_security')), 'accounting_officer_approval_date' => custom_date_format('Y-m-d', $this->input->post('accounting_officer_approval_date')), 'best_evaluated_bidder_date' => custom_date_format('Y-m-d', $this->input->post('best_evaluated_bidder_date')), 'advanced_payment_date' => custom_date_format('Y-m-d', $this->input->post('advanced_payment_date')), 'solicitor_general_approval_date' => custom_date_format('Y-m-d', $this->input->post('solicitor_general_approval_date')), 'mobilise_advance_payment' => custom_date_format('Y-m-d', $this->input->post('mobilise_advance_payment')), 'substantial_completion' => custom_date_format('Y-m-d', $this->input->post('substantial_completion')), 'final_acceptance' => custom_date_format('Y-m-d', $this->input->post('final_acceptance')), 'procurement_plan_id' => $plan_info['id'], 'quantity' => $this->input->post('quantity'));
             #check if the procurement already exists
             $similar_proc_ref_no = $this->Query_reader->get_row_as_array('search_table', array('table' => ' procurement_plan_entries', 'orderby' => 'procurement_ref_no', 'limittext' => '', 'searchstring' => ' procurement_plan_id = "' . $plan_info['id'] . '" AND pde_department ="' . $_POST['pde_department'] . '" AND subject_of_procurement = "' . $_POST['subject_of_procurement'] . '"' . (!empty($data['i']) ? ' AND id !="' . decryptValue($data['i']) . '"' : '')));
             if (!empty($similar_proc_ref_no)) {
                 $data['msg'] = 'ERROR: An entry with a similar subject of procurement <b><i>(' . $_POST['subject_of_procurement'] . ')</i></b> has already been created already exists.';
             } else {
                 if (!empty($data['i'])) {
                     $procurement_plan_data['updated_by'] = $this->session->userdata('userid');
                     $result = $this->db->update('procurement_plan_entries', clean_form_data($procurement_plan_data), array('id' => decryptValue($data['i'])));
                 } else {
                     #$procurement_plan_data['procurement_ref_no'] = procurement_plan_ref_number_hint($plan_info['pde_id'], $this->input->post("procurement_type"), $plan_info['financial_year'], decryptValue($data['v']));
                     $procurement_plan_data['author'] = $this->session->userdata('userid');
                     $result = $this->procurement_plan_entry_m->create($procurement_plan_data);
                 }
             }
             #exit($this->db->last_query());
             #event has been added successfully
             if (!empty($result) && $result) {
                 $data['msg'] = "SUCCESS: The procurement entry details have been saved.";
                 $this->session->set_userdata('sres', $data['msg']);
                 #user clicked publish
                 if (!empty($_POST['save_and_new'])) {
                     redirect('procurement/load_procurement_entry_form/m/sres' . (!empty($data['v']) ? "/v/" . $data['v'] : ''));
                 } else {
                     redirect('procurement/procurement_plan_entries/m/sres' . (!empty($data['v']) ? "/v/" . $data['v'] : ''));
                 }
             } elseif (empty($data['msg'])) {
                 $data['msg'] = "ERROR: The procurement entry details could not be saved or were not saved correctly.";
             }
         }
         if ((empty($validation_results['bool']) || !empty($validation_results['bool']) && !$validation_results['bool']) && empty($data['msg'])) {
             $data['msg'] = "WARNING: The highlighted fields are required.";
         }
         $data['requiredfields'] = $validation_results['requiredfields'];
     }
     if ($plan_info) {
         if ($plan_info) {
             //get the plan id
             $pde_id = $plan_info['pde_id'];
             $financial_year = $plan_info['financial_year'];
             $data['page_title'] = get_pde_info_by_id($pde_id, 'title') . ' financial year (' . $financial_year . ') entries';
             $data['current_menu'] = 'view_procurement_plans';
             $data['plan_info'] = $plan_info;
             $data['financial_year'] = $financial_year;
             $data['view_to_load'] = 'procurement/admin/register_entry_v';
             $data['view_data']['form_title'] = $data['page_title'];
             $data['plan_id'] = decryptValue($this->uri->segment(4));
             $data['pde_id'] = $pde_id;
             //print_array($data);
             //load view
             $this->load->view('dashboard_v', $data);
         } else {
             echo error_template('No plan for this year');
         }
     } else {
         //if pde does not exist
         //TODO redirect to a more good looking page
         echo error_template('No data to display');
     }
 }