function getJson($people) { $list = array(); foreach ($people as $person) { $company = getCompany($person->{'company-id'}); $person->{'company-name'} = $company->name; $id = (string) $person->id; $list[$id] = "'{$id}': " . json_encode($person); } return implode(",\n", $list); }
<?php $posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'speaker')); foreach ($posts as $key => $post) { $acfs = get_fields($post->ID); $customs = array(); foreach (get_post_custom($post->ID) as $ckey => $value) { if (strpos($ckey, '_conferencer_') !== 0) { continue; } $ckey = substr($ckey, 13); $customs[$ckey] = @unserialize($value[0]) ? @unserialize($value[0]) : $value[0]; } $posts[$key] = array_merge((array) $post, (array) $customs, (array) $acfs); $posts[$key]['company'] = $posts[$key]['company'] ? getCompany($posts[$key]['company']) : ''; } function getCompany($id) { $post = get_post($id); $acfs = get_fields($post->ID); $post = array_merge((array) $post, (array) $acfs); return $post; } header('Content-Type: application/json'); echo json_encode($posts);
<td width="3.5%"></td> <td style="font-size:13px;width:90%" ><br><div style="display:none;border:1px solid black;padding:10px !important;"><b> Please Fax to: </b>(714)526-2397 - Attn : Judy<br> Or scan signed copy and email to: <b>judyL@jonel.com</b></div> <br><table cellpadding="5" width="50%" style="float:right;border:1px solid black;font-size:11px;"> <tr><td> <b>Please Fax to: </b>(714)526-2397 - Attn : Judy</td></tr> <tr><td> Or scan signed copy and email to: <b>judyL@jonel.com</b></td></tr> </table> </td> </tr> </table> </div> EOD; if (!is_dir($baseDir . "/modules/companies/exported-pdf/temp")) { @mkdir($baseDir . "/modules/companies/exported-pdf/temp"); } $company_details = getCompany($_REQUEST['company_id']); //if(isset($_POST['print_maintenance_report']) && (strtotime($_POST['contract_begin_date_hidden']) < strtotime($company_details['application_date']))): if (isset($_POST['print_maintenance_report'])) { //Create the folder inside the url. if (!is_dir($baseDir . "/modules/companies/exported-pdf/" . $company_name)) { @mkdir($baseDir . "/modules/companies/exported-pdf/" . $company_name); } $html = ""; $html = $page1 . $page2; $pdfName = 'Batch-Maintenance-Report-' . time() . ".pdf"; //exit($html); //Hve to use the curl now to get the job done. $curl = curl_init(); // Set some options - we are passing in a useragent too here curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $baseUrl . "/tcpdf/examples/pdf-report-generator.php", CURLOPT_USERAGENT => 'Codular Sample cURL Request', CURLOPT_POST => 1, CURLOPT_POSTFIELDS => array('page1' => $page1, 'page2' => $page2, 'pdfName' => $pdfName, 'pdf_link' => $baseUrl . "/index.php?m=companies&a=view-pdf&company_id={$company_id}&pdf_type=batching&comp_name={$company_name}&pdf=" . base64_encode($baseUrl . "/modules/companies/exported-pdf/temp/" . $pdfName), 'pdf_path' => $baseDir . "/modules/companies/exported-pdf/temp/" . $pdfName))); // Send the request & save response to $resp
back(); break; case 'employee': include 'actions/employee.php'; back(); break; default: header('Location: ' . BASE_URL); die; break; } } //include page header include_once 'template/header.php'; //get Company information $companyInfo = getCompany(); $departments = getDepartment(); switch (get_input('section')) { case 'department': $did = get_input('did'); $total = companyTotal($did); if (get_input('add') == 'add') { $pdid = get_input('pdid', 0); include 'template/newdepartment.php'; } else { $employees = getEmployees($did); $departmentInfo = getDepartment($did); $subDepartments = getDepartment($did, true); include 'template/department.php'; } break;
return; } } else { $jsondata = array("status" => 0, "msg" => "Unauthorised Access. Invalid Signature"); publishOutput($jsondata); return; } if ($_SERVER['REQUEST_METHOD'] == "GET" && !empty($_GET['method'])) { $request_parts = explode('/', $_GET['method']); $method = $request_parts[1]; switch ($method) { case "addCompany": $jsondata = addCompany(); break; case "getCompany": $jsondata = getCompany(); break; case "editCompany": $jsondata = editCompany(); break; case "updateCompany": $jsondata = updateCompany(); break; case "deleteCompany": $jsondata = deleteCompany(); break; } publishOutput($jsondata); } else { $jsonoutput = array("status" => 0, "msg" => "Unauthorised Access!"); publishOutput($jsonoutput);
function monthly() { $this->load->model('invoicemodel'); $data = $this->invoicemodel->getMonthlyUsers(); // e($data); $this->load->library('email'); $config['charset'] = 'utf-8'; $config['wordwrap'] = TRUE; $config['mailtype'] = 'html'; $this->email->initialize($config); foreach ($data as $rows) { //echo $rows['property_id']; $application_id = $rows['id']; $company_detail = getCompany($rows['property_id']); $comId = $company_detail->company_id; $applicantId = $rows['applicant_id']; $payable_install_fees = $rows['invoice_amount']; //e($company_detail); $addvat = $this->invoicemodel->vat($payable_install_fees); $without_value = $this->invoicemodel->withoutvat($payable_install_fees); $invoicedata = $this->invoicemodel->getInvoice($application_id, $applicantId, $comId, $payable_install_fees, $addvat, 'M'); $sendto = $rows['email']; $fname = $rows['fname']; $lname = $rows['lname']; $home_address = $rows['address']; $invoice_ref_code = $invoicedata["invoice_id"]; $created_on = $invoicedata["created_date"]; $due_on = $invoicedata["due_date"]; $senddata = array("firstname" => $fname, "lastname" => $lname, "homeaddress" => $home_address, "invoice_no" => $invoicedata["invoice_id"], "created_date" => $invoicedata["created_date"], "due_date" => $invoicedata["due_date"], "installment_amount" => $payable_install_fees, "vat_value" => $without_value, "after_vat" => $addvat); $msg_body = $this->load->view('invoice', $senddata, true); // As PDF creation takes a bit of memory, we're saving the created file in /downloads/reports/ $filename = $invoicedata["invoice_id"]; $pdfFilePath = FCPATH . "upload/virtcab/doc/{$filename}.pdf"; include_once APPPATH . 'third_party/mpdf/mpdf.php'; ini_set('memory_limit', '64M'); $param = '"en-GB-x","A4","","",10,10,10,10,6,3'; $mpdf = new mPDF('c'); $mpdf->WriteHTML($msg_body); $mpdf->Output($pdfFilePath, 'F'); $this->invoicemodel->updatevirtualcabnet($applicantId, $comId, $filename); $this->email->set_newline("\r\n"); $this->email->from('*****@*****.**', 'Landlord Masters'); // change it to yours $this->email->to($sendto); // change it to yours $this->email->subject('Invoice Notification'); $this->email->message($msg_body); if ($this->email->send()) { $this->invoicemodel->updateIsFirst($application_id); echo "sent"; } else { show_error($this->email->print_debugger()); } } }
function getUserCompanies($user) { if (is_object($user)) { $user = $user->id; } if (!is_numeric($user)) { throw new Exception('User must be an instance of people or be an id'); } $owners = bigDb('option')->where(['object_database', '=', SITE_NAME])->where(['object_table', '=', 'company'])->where(['name', '=', 'owner'])->where(['value', '=', $user])->exec(); $members = bigDb('option')->where(['object_database', '=', SITE_NAME])->where(['object_table', '=', 'company'])->where(['name', '=', 'member'])->where(['value', '=', $user])->exec(); $collection = []; foreach ($owners as $owner) { $tab = getCompany($owner['object_id'])->assoc(); $tab['type'] = 'owner'; array_push($collection, $tab); } foreach ($members as $member) { $tab = getCompany($member['object_id'])->assoc(); $tab['type'] = 'member'; array_push($collection, $tab); } return $collection; }
$diff = $interval->format('%r%a'); if ($diff >= 0) { echo "<tr>\n\n <td><a class=\"btn btn-primary btn-xs link_ajax\" href=\"../../controllers/newOrder.php?user="******"&product={$id}&company=" . $_GET['company'] . "\" role=\"button\">Pedir</a></td>\n\n <td>{$description}</td>\n\n <td>" . date("d/m/Y", strtotime($production)) . "</td>\n\n <td>" . $expir->format('d/m/Y') . "</td>\n\n <td>R\$ {$price}</td>\n\n <td>{$amount}</td>\n\n </tr>"; } else { // echo "<br>Diferença negativa do produto $id."; // echo "<br>".$diff; } } } $stmt->close(); $conn->close(); } else { echo "Falha na conexão: " . $conn->error; } } $company = getCompany($_GET['company']); ?> <div class="col-md-8 col-md-offset-2"> <div class="col-md-2"> <div class="text-center"> <img src="../../assets/img/company/<?php echo $company['logo']; ?> " class="img-circle img-thumbnail" alt="avatar"> </div> </div> <div class="col-md-10"> <a class="btn btn-default" href="../../controllers/newFavorite.php?company=<?php echo $_GET['company']; ?> &user=<?php