本文整理汇总了PHP中Client::find_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::find_by_id方法的具体用法?PHP Client::find_by_id怎么用?PHP Client::find_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client::find_by_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
$article = Client::find_by_id($id);
if ($article->delete()) {
return true;
}
}
示例2: create
function create()
{
if ($_POST) {
$config['upload_path'] = './files/media/';
$config['encrypt_name'] = TRUE;
$config['allowed_types'] = '*';
$this->load->library('upload', $config);
$this->load->helper('notification');
unset($_POST['userfile']);
unset($_POST['file-name']);
unset($_POST['send']);
unset($_POST['_wysihtml5_mode']);
unset($_POST['files']);
$settings = Setting::first();
$client = Client::find_by_id($this->client->id);
$user = User::find_by_id($settings->ticket_default_owner);
$_POST['from'] = $client->firstname . ' ' . $client->lastname . ' - ' . $client->email;
$_POST['company_id'] = $client->company->id;
$_POST['client_id'] = $client->id;
$_POST['user_id'] = $settings->ticket_default_owner;
$_POST['queue_id'] = $settings->ticket_default_queue;
$_POST['type_id'] = $settings->ticket_default_type;
$_POST['status'] = $settings->ticket_default_status;
$_POST['created'] = time();
$_POST['subject'] = htmlspecialchars($_POST['subject']);
$ticket_reference = Setting::first();
$_POST['reference'] = $ticket_reference->ticket_reference;
$ticket = Ticket::create($_POST);
$new_ticket_reference = $_POST['reference'] + 1;
$ticket_reference->update_attributes(array('ticket_reference' => $new_ticket_reference));
if (!$this->upload->do_upload()) {
$error = $this->upload->display_errors('', ' ');
$this->session->set_flashdata('message', 'error:' . $error);
} else {
$data = array('upload_data' => $this->upload->data());
$attributes = array('ticket_id' => $ticket->id, 'filename' => $data['upload_data']['orig_name'], 'savename' => $data['upload_data']['file_name']);
$attachment = TicketHasAttachment::create($attributes);
}
if (!$ticket) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_create_ticket_error'));
redirect('ctickets');
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_create_ticket_success'));
if (isset($user->email) && isset($ticket->reference)) {
send_ticket_notification($user->email, '[Ticket#' . $ticket->reference . '] - ' . $_POST['subject'], $_POST['text'], $ticket->id);
}
if (isset($client->email) && isset($ticket->reference)) {
send_ticket_notification($client->email, '[Ticket#' . $ticket->reference . '] - ' . $_POST['subject'], $_POST['text'], $ticket->id);
}
redirect('ctickets/view/' . $ticket->id);
}
} else {
$this->theme_view = 'modal';
$this->view_data['title'] = $this->lang->line('application_create_ticket');
$this->view_data['form_action'] = 'ctickets/create';
$this->content_view = 'tickets/client_views/_ticket';
}
}
示例3: __construct
function __construct()
{
parent::__construct();
$this->view_data['core_settings'] = Setting::first();
if ($this->input->cookie('language') != "") {
$language = $this->input->cookie('language');
} else {
if (isset($this->view_data['language'])) {
$language = $this->view_data['language'];
} else {
if (!empty($this->view_data['core_settings']->language)) {
$language = $this->view_data['core_settings']->language;
} else {
$language = "english";
}
}
}
$this->lang->load('application', $language);
$this->lang->load('messages', $language);
$this->lang->load('event', $language);
$this->user = $this->session->userdata('user_id') ? User::find_by_id($this->session->userdata('user_id')) : FALSE;
$this->client = $this->session->userdata('client_id') ? Client::find_by_id($this->session->userdata('client_id')) : FALSE;
if ($this->client) {
$this->theme_view = 'application_client';
}
$this->view_data['datetime'] = date('Y-m-d H:i', time());
$this->view_data['sticky'] = Project::all(array('conditions' => 'sticky = 1'));
$this->view_data['quotations_new'] = Quote::find_by_sql("select count(id) as amount from quotations where status='New'");
if ($this->user || $this->client) {
$access = $this->user ? $this->user->access : $this->client->access;
$access = explode(",", $access);
if ($this->user) {
$this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'main')));
$this->view_data['widgets'] = Module::find('all', array('conditions' => array('id in (?) AND type = ?', $access, 'widget')));
} else {
$this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'client')));
}
if ($this->user) {
$update = User::find($this->user->id);
} else {
$update = Client::find($this->client->id);
}
$update->last_active = time();
$update->save();
if ($this->user) {
$this->view_data['user_online'] = User::all(array('conditions' => array('last_active+(30 * 60) > ? AND status = ?', time(), "active")));
$this->view_data['client_online'] = Client::all(array('conditions' => array('last_active+(30 * 60) > ? AND inactive = ?', time(), "0")));
}
$email = $this->user ? 'u' . $this->user->id : 'c' . $this->client->id;
$this->view_data['messages_new'] = Privatemessage::find_by_sql("select count(id) as amount from privatemessages where `status`='New' AND recipient = '" . $email . "'");
$this->view_data['tickets_new'] = Ticket::find_by_sql("select count(id) as amount from tickets where `status`='New'");
}
/*$this->load->database();
$sql = "select * FROM templates WHERE type='notes'";
$query = $this->db->query($sql); */
$this->view_data["note_templates"] = "";
//$query->result();
}
示例4: set_pseudo
protected function set_pseudo()
{
if (isset($this->client_id)) {
$client = Client::find_by_id((int) $this->client_id);
if ($client) {
$this->pseudo = $client->pseudo;
}
}
}
示例5: closeTicket
/**
* method to close a ticket
*
*/
public function closeTicket()
{
if (isset($_POST['id']) && !empty($_POST["id"])) {
$partTicket = Ticket::find_by_id($_POST["id"]);
$partTicket->status = "Closed";
$theUser = Employee::find_by_id($_SESSION['emp_ident']);
$cemail = !empty($_POST['cemail']) ? explode(",", $_POST['cemail']) : "";
// print_r($partTicket);
array_push($cemail, $partTicket->contact_email, $theUser->emp_email);
$client = Client::find_by_id($partTicket->client_id);
array_push($cemail, $client->email);
$partTicket->datemodified = date("Y-m-d H:i:s");
$msg = "Your Complaint ticket status has been closed<br />";
$subject = "Robert Johnson Holdings(Technical Support) Ticket #'" . $partTicket->id . "' Close";
//print_r($cemail);
//mail("amedora09@gmail.com","Robert Johnson Holdings, Technical Support" , "all good");
if ($partTicket->update()) {
// $this->sendMail("Customer",$subject ,$msg,$cemail);
return true;
} else {
return false;
}
}
}
示例6: elseif
<p>Total Tickets</p>
</div>
<div class="icon">
<i class="ion ion-pie-graph"></i>
</div>
<a href="<?php
echo $uri->link("supportticket/index");
?>
" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
</div>
</div><!-- ./col -->
<?php
global $session;
$user = Client::find_by_id($_SESSION['client_ident']);
if ($_SESSION['user_role'] == "admin") {
echo "<div class='col-lg-2 col-xs-6'>\n <!-- small box -->\n <div class='small-box bg-teal'>\n <div class='inner'>\n <h3>{$this->usercount} </h3>\n <p>Users</p>\n </div>\n <div class='icon'>\n <i class='ion ion-person-add'></i>\n </div>\n <a href='";
echo $_SESSION['user_role'] === 'admin' ? $uri->link("users/index") : "javascript:void(0)";
echo "' class='small-box-footer'>More info <i class='fa fa-arrow-circle-right'></i></a>\n\n </div>\n </div>";
} elseif (strtolower($_SESSION['user_role']) == "standard user" || strtolower($_SESSION['user_role']) == "standard") {
$me = Clientuser::find_by_id($_SESSION['user_ident']);
}
?>
</div><!-- /.row -->
<div class="row">
<div class="col-lg-6">
<div class="box box-info">
示例7: client
function client($id = FALSE)
{
$this->load->helper('notification');
if ($_POST) {
unset($_POST['send']);
unset($_POST['_wysihtml5_mode']);
$id = $_POST['id'];
unset($_POST['id']);
$client = Client::find_by_id($_POST['client_id']);
$assign = Ticket::find_by_id($id);
$attr = array('client_id' => $client->id, 'company_id' => $client->company->id);
$assign->update_attributes($attr);
if (isset($_POST['notify'])) {
send_ticket_notification($client->email, '[Ticket#' . $assign->reference . '] - ' . $_POST['subject'], $_POST['message'], $assign->id);
$_POST['internal'] = "0";
}
unset($_POST['notify']);
$_POST['subject'] = htmlspecialchars($_POST['subject']);
$_POST['datetime'] = time();
$_POST['from'] = $this->user->firstname . " " . $this->user->lastname . ' - ' . $this->user->email;
$_POST['reply_to'] = $this->user->email;
$_POST['ticket_id'] = $id;
$_POST['to'] = $_POST['client_id'];
unset($_POST['client_id']);
$article = TicketHasArticle::create($_POST);
if (!$assign) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_ticket_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_assign_ticket_success'));
}
redirect('tickets/view/' . $id);
} else {
$this->view_data['clients'] = Client::find('all', array('conditions' => array('inactive=?', '0')));
$this->view_data['ticket'] = Ticket::find($id);
$this->theme_view = 'modal';
$this->view_data['title'] = $this->lang->line('application_client');
$this->view_data['form_action'] = 'tickets/client';
$this->content_view = 'tickets/_client';
}
}
示例8: head
head('Welcome to Urban Illustration');
topbar();
?>
<div id="content">
<div id="maincontent">
<div class="textcontentalone">
<?php
$tmpclt = Client::find_by_id($_GET['tclt']);
if ($tmpclt->coupon == 'family') {
$price = '$150';
} else {
$price = '$190';
}
?>
<h2>Thank you for Joining:
The <?php
echo DateManager::frontdisplaytimefromtmstp($classtojoin->c_date);
?>
Class part of the <?php
echo $sessiontojoin->name;
?>
示例9: getById
public function getById($id)
{
return Client::find_by_id($id);
// $myaccount = Accounts::find_by_phone($phone);
}
示例10: trim
$client->{$variable} = trim(${$variable});
break;
}
}
$sql = "SELECT * FROM Strada WHERE Denumire='" . str_replace("%20", " ", $client->idStrada) . "'";
$stradaList = Strada::find_by_sql($sql);
$strada = array_shift($stradaList);
$client->idStrada = $strada->id;
$client->TelefonMobil = preg_replace("/[^0-9]/", "", $client->TelefonMobil);
$client->TelefonFix = preg_replace("/[^0-9]/", "", $client->TelefonFix);
$client->TelefonFax = preg_replace("/[^0-9]/", "", $client->TelefonFax);
$client->TelefonServici = preg_replace("/[^0-9]/", "", $client->TelefonServici);
$client->save();
redirect_to("client_view.php?id=" . $client->id);
} else {
$client = Client::find_by_id($_GET['id']);
$flow = $_GET['flow'];
$strada = Strada::find_by_id($client->idStrada);
}
?>
<!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" xml:lang="ro" lang="ro">
<head>
<title>Imobiliare - Modificare client</title>
<link rel="stylesheet" type="text/css" href=".././styles/main.css" />
<link rel="stylesheet" type="text/css" href=".././javascripts/jscal/css/jscal2.css" />
<link rel="stylesheet" type="text/css" href=".././javascripts/jscal/css/gold/gold.css" />
<script type="text/javascript" src=".././javascripts/jscal/js/jscal2.js"></script>
<script type="text/javascript" src=".././javascripts/jscal/js/lang/en.js"></script>
示例11: sendestimate
function sendestimate($id = FALSE)
{
$this->load->helper(array('dompdf', 'file'));
$this->load->library('parser');
$data["estimate"] = Invoice::find($id);
//check if client contact has permissions for estimates and grant if not
if (isset($data["estimate"]->company->client->id)) {
$access = explode(",", $data["estimate"]->company->client->access);
if (!in_array("107", $access)) {
$client_estimate_permission = Client::find_by_id($data["estimate"]->company->client->id);
$client_estimate_permission->access = $client_estimate_permission->access . ",107";
$client_estimate_permission->save();
}
}
$data["estimate"]->estimate_sent = date("Y-m-d");
$data["estimate"]->estimate_status = "Sent";
$data['items'] = InvoiceHasItem::find('all', array('conditions' => array('invoice_id=?', $id)));
$data["core_settings"] = Setting::first();
$due_date = date($data["core_settings"]->date_format, human_to_unix($data["estimate"]->due_date . ' 00:00:00'));
//Set parse values
$parse_data = array('client_contact' => $data["estimate"]->company->client->firstname . ' ' . $data["estimate"]->company->client->lastname, 'client_company' => $data["estimate"]->company->name, 'due_date' => $due_date, 'estimate_id' => $data["core_settings"]->estimate_prefix . $data["estimate"]->reference, 'client_link' => $data["core_settings"]->domain, 'company' => $data["core_settings"]->company, 'logo' => '<img src="' . base_url() . '' . $data["core_settings"]->logo . '" alt="' . $data["core_settings"]->company . '"/>', 'invoice_logo' => '<img src="' . base_url() . '' . $data["core_settings"]->invoice_logo . '" alt="' . $data["core_settings"]->company . '"/>');
// Generate PDF
$html = $this->load->view($data["core_settings"]->template . '/' . $data["core_settings"]->estimate_pdf_template, $data, true);
$html = $this->parser->parse_string($html, $parse_data);
$filename = $this->lang->line('application_estimate') . '_' . $data["estimate"]->reference;
pdf_create($html, $filename, FALSE);
//email
$subject = $this->parser->parse_string($data["core_settings"]->estimate_mail_subject, $parse_data);
$this->email->from($data["core_settings"]->email, $data["core_settings"]->company);
if (!isset($data["estimate"]->company->client->email)) {
$this->session->set_flashdata('message', 'error:This client company has no primary contact! Just add a primary contact.');
redirect('estimates/view/' . $id);
}
$this->email->to($data["estimate"]->company->client->email);
$this->email->subject($subject);
$this->email->attach("files/temp/" . $filename . ".pdf");
$email_estimate = read_file('./application/views/' . $data["core_settings"]->template . '/templates/email_estimate.html');
$message = $this->parser->parse_string($email_estimate, $parse_data);
$this->email->message($message);
if ($this->email->send()) {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_send_estimate_success'));
$data["estimate"]->update_attributes(array('status' => 'Sent', 'sent_date' => date("Y-m-d")));
log_message('error', 'Estimate #' . $data["core_settings"]->estimate_prefix . $data["estimate"]->reference . ' has been send to ' . $data["estimate"]->company->client->email);
} else {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_send_estimate_error'));
log_message('error', 'ERROR: Estimate #' . $data["core_settings"]->estimate_prefix . $data["estimate"]->reference . ' has not been send to ' . $data["estimate"]->company->client->email . '. Please check your servers email settings.');
}
unlink("files/temp/" . $filename . ".pdf");
redirect('estimates/view/' . $id);
}
示例12: update
public function update()
{
if (!empty($_POST['cname']) && !empty($_POST['cphone']) && !empty($_POST['cemail'])) {
$thisClient = Client::find_by_id((int) preg_replace('#[^0-9]#i', '', $_SESSION['client_ident']));
$error = array();
if (ctype_digit($_POST["cphone"]) == false) {
array_push($error, "Phone Number entered is incorrect");
} else {
$thisClient->contact_phone = $_POST["cphone"];
}
if (!preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})\$/i", $_POST["cemail"])) {
array_push($error, "Email entered is incorrect");
} else {
$thisClient->contact_email = $_POST["cemail"];
}
if (strlen($_POST["cname"]) < 3) {
array_push($error, "Name entered is incorrect");
} else {
$thisClient->contact_name = strip_tags($_POST["cname"]);
}
if (!empty($error)) {
$message = "Please check the following errors:<br /> ";
$lenght = count($error);
for ($i = 0; $i < $lenght; $i++) {
$message = $message . $error[$i] . "<br />";
}
echo "<div data-alert class='alert-box error'><a href='#' class='close'>×</a>{$message}</div>";
exit;
}
if ($thisClient->update()) {
return 1;
} else {
return 2;
}
}
/**
* Section to update password
* for client
*/
if (!empty($_POST['opword']) && !empty($_POST['pword'])) {
$thisClient = Client::find_by_id((int) preg_replace('#[^0-9]#i', '', $_SESSION['client_ident']));
$error = array();
if ($thisClient->password != $_POST["opword"]) {
array_push($error, "Old Password is Incorrect");
}
if ($_POST["pword2"] != $_POST["pword"]) {
array_push($error, "The new Password and Re-typed Password entered do not match.");
} elseif (strlen($_POST['pword']) < 6) {
array_push($error, "Password entered is too short. Minimum of Six(6) characters required.");
}
if (!empty($error)) {
$message = "Please check the following errors:<br /> ";
$lenght = count($error);
for ($i = 0; $i < $lenght; $i++) {
$message = $message . $error[$i] . "<br />";
}
echo "<div data-alert class='alert-box error'><a href='#' class='close'>×</a>{$message}</div>";
exit;
}
$thisClient->password = $_POST["pword"];
if ($thisClient->update()) {
return 1;
} else {
return 2;
}
}
}
示例13: foreach
<tr >
<td class="header" width="5%">Cod</td>
<td class="header" width="15%">Client</td>
<td class="header" width="10%">Telefon</td>
<td class="header" width="5%">Tip proprietate</td>
<td class="header" width="5%">Camere</td>
<td class="header" width="10%">Tip ap.</td>
<td class="header" width="5%">Etaje</td>
<td class="header" width="30%">Zone</td>
<td class="header" width="10%">Buget</td>
<td class="header" width="5%">Plata</td>
</tr>
<?php
$i = 0;
foreach ($cerereList as $cerere) {
$client = Client::find_by_id($cerere->idClient);
$zoneIdList = explode(",", $cerere->Zona);
$TipProprietateList = "";
if (strlen($cerere->TipProprietate) > 0) {
$tmplist = explode(",", substr($cerere->TipProprietate, 1, -1));
foreach ($tmplist as $tmpx) {
if ($tmpx == 1) {
$tmpx = "apartament";
}
if ($tmpx == 2) {
$tmpx = "ap. in vila";
}
if ($tmpx == 3) {
$tmpx = "casa";
}
if ($tmpx == 4) {
示例14: sendMailCloseTicket
public function sendMailCloseTicket($id)
{
$ticket = Ticket::find_by_id($id);
$ccemails = Ccemail::find_by_ticket($id);
$client = Client::find_by_id($_SESSION['client_ident']);
$to = 'support@robertjohnsonholdings.com';
$subject = 'RE: Ticket Number: #' . str_pad($ticket->id, 8, "0", STR_PAD_LEFT) . " " . $ticket->subject;
$headers = "From: " . $client->name . "<" . $client->email . ">\r\n";
$headers .= "Reply-To: " . $ticket->contact_email . "\r\n";
if ($ccemails) {
$copyaddy = array();
$cc = "";
foreach ($ccemails as $ccemail) {
array_push($copyaddy, $ccemail->email);
}
for ($i = 0; $i < count($copyaddy); $i++) {
if ($i == count($copyaddy) - 1) {
$cc .= $copyaddy[$i];
} else {
$cc .= $copyaddy[$i] . ", ";
}
}
$to .= ", " . $cc;
}
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '
<html><body>
<h1>Robert Johnson Holdings Limited</h1>
<h2>Ticket Number #' . str_pad($ticket->id, 8, "0", STR_PAD_LEFT) . '</h2>
<table width="100%" border="0">
<tr>
<th scope="row" width="30%">Client</th>
<td width="70%">' . $client->name . '</td>
</tr>
<tr>
<th scope="row">Contact Person</th>
<td>' . $ticket->contact_name . '</td>
</tr>
<tr>
<th scope="row">Contact Phone Number</th>
<td>' . $ticket->contact_phone . '</td>
</tr>
<tr>
<th scope="row">Contact Email</th>
<td>' . $ticket->contact_email . '</td>
</tr>';
if ($ccemails) {
$message .= '<tr>
<th scope="row">Copied Emails</th>
<td>' . $cc . '</td>
</tr>
<tr>';
}
$message .= '<th scope="row">Department</th>
<td>' . $ticket->department . '</td>
</tr>
<tr>
<th scope="row">Ticket Status</th>
<td>' . $ticket->status . '</td>
</tr>
<tr>
<th scope="row">Priority Level</th>
<td>' . $ticket->priority . '</td>
</tr>
<tr>
<th scope="row">Related Product/Service</th>
<td>' . $ticket->prod_name . ' at ' . $ticket->location . '</td>
</tr>
<tr>
<th scope="row">Subject</th>
<td>' . $ticket->subject . '</td>
</tr>
<tr>
<th scope="row">Issue/Complaint/Suggestion</th>
<td>Ticket has been closed.</td>
</tr>
</table>
</body></html>';
if (mail($to, $subject, $message, $headers)) {
return true;
} else {
return false;
}
}
示例15:
?>
">back to classes</a>
<table id="tbschedualdisplay">
<tr class="tabletitle"><td>Client Name</td><td>Child Name</td><td>Email</td><td>Phone</td><td>Coupon</td><td>Update</td><td>Remove</td></tr>
<?php
Client::displayclients($_GET['clsid']);
?>
</table>
<?php
if (isset($_GET['updclt'])) {
$updateclient = Client::find_by_id($_GET['updclt']);
?>
<div class="box">
<h2>Update Client : <?php
echo $updateclient->p_lastname;
?>
</h2>
<form action="clients-view.php?clsid=<?php
echo $_GET['clsid'];
?>
" method="post">
<input type="hidden" value="<?php
echo $updateclient->id;
?>