本文整理汇总了PHP中Format类的典型用法代码示例。如果您正苦于以下问题:PHP Format类的具体用法?PHP Format怎么用?PHP Format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Format类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
function process()
{
global $current_user, $timedate, $app_list_strings, $current_language, $mod_strings;
$mod_strings = return_module_language($current_language, 'ProductComponents');
$format = new Format();
parent::process();
if ($this->viaAJAX) {
// override for ajax call
$this->ss->assign('saveOnclick', "onclick='if(check_form(\"productComponentsQuickCreate\")) return SUGAR.subpanelUtils.inlineSave(this.form.id, \"productcomponents\"); else return false;'");
$this->ss->assign('cancelOnclick', "onclick='return SUGAR.subpanelUtils.cancelCreate(\"subpanel_productcomponents\")';");
}
$this->ss->assign('viaAJAX', $this->viaAJAX);
$this->javascript = new javascript();
$this->javascript->setFormName('productComponentsQuickCreate');
$focus = new ProductComponents();
$this->javascript->setSugarBean($focus);
$this->javascript->addAllFields('');
$app_list_strings['products_format_options'] = $format->Get_Dropdown_Data();
$this->ss->assign('additionalScripts', $this->javascript->getScript(false));
$this->ss->assign('run_style_options', get_select_options_with_id($app_list_strings['layout_type_options'], ''));
$this->ss->assign('type_options', get_select_options_with_id($app_list_strings['type_options'], $focus->type));
$this->ss->assign('color_side_a', get_select_options_with_id($app_list_strings['color_side_a'], $focus->color_side_a));
$this->ss->assign('color_side_b', get_select_options_with_id($app_list_strings['color_side_b'], $focus->color_side_b));
$this->ss->assign("STATUS_OPTIONS", get_select_options_with_id($app_list_strings['project_task_status_options'], $focus->status));
$this->ss->assign("FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format));
$this->ss->assign("RUN_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format));
$this->ss->assign("BLEED_FORMAT_OPTIONS", get_select_options_with_id($app_list_strings['products_format_options'], $focus->format));
$ppref = 'PRD';
$pnumber = $focus->get_pnum();
$number_suf = $focus->generate_number();
$this->ss->assign('number_pref', $ppref);
$this->ss->assign('pnum', $pnumber);
$this->ss->assign('number_suf', $number_suf);
$this->ss->assign("LAYOUTROWS", $focus->getLayoutRow(new Layoutline(), 0, true, true));
//$this->ss->parse("main.row1");
$json = getJSONobj();
///////////////////////////////////////
///
/// SETUP PARENT POPUP
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'projectTypeQuickCreate', 'field_to_name_array' => array('id' => 'parent_id', 'name' => 'parent_name'));
$encoded_parent_popup_request_data = $json->encode($popup_request_data);
$this->ss->assign('encoded_parent_popup_request_data', $encoded_parent_popup_request_data);
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'productComponentsQuickCreate', 'field_to_name_array' => array('id' => 'paperid', 'pname' => 'paper'));
$this->ss->assign('encoded_paper_popup_request_data', $json->encode($popup_request_data));
//machines popup
/* $popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'productComponentsQuickCreate',
'field_to_name_array' => array(
'id' => 'machine_id',
'name' => 'machine',
),
);
$encoded_popup_request_data = $json->encode($popup_request_data);
$this->ss->assign('encoded_machine_popup_request_data', $encoded_popup_request_data);
*/
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:58,代码来源:ProductComponentsQuickCreate.php
示例2: testSetGetFormat
/**
* @covers \Tivie\GitLogParser\Format::setFormat
* @covers \Tivie\GitLogParser\Format::getFormatString
* @covers \Tivie\GitLogParser\Format::getCommitDelimiter
* @covers \Tivie\GitLogParser\Format::getFieldDelimiter
*/
public function testSetGetFormat()
{
$format = new Format();
$cDel = '<br>';
$fDel = '|';
$formatStr = "%h{$fDel}%d{$fDel}%B{$cDel}";
$format->setFormat($formatStr, $cDel, $fDel);
self::assertEquals($cDel, $format->getCommitDelimiter());
self::assertEquals($fDel, $format->getFieldDelimiter());
self::assertEquals($formatStr, $format->getFormatString());
}
开发者ID:tivie,项目名称:php-git-log-parser,代码行数:17,代码来源:FormatTest.php
示例3: action_add_blocked
public function action_add_blocked($block = null)
{
if (empty($block) === true) {
$block = $_POST['blocked'];
} else {
$block = str_replace('-', '.', $block);
}
$blacklist_item = Model_Blacklist::query()->where('expression', $block)->get_one();
if (empty($blacklist_item) === true) {
$blacklist_item = Model_Blacklist::forge(array('expression' => $block));
$blacklist_item->save();
if (Input::is_ajax() === true) {
echo $blacklist_item->id;
}
} else {
if (Input::is_ajax() === true) {
print_r(Format::forge(array('error' => 'Already Exists'))->to_json());
} else {
Session::set('error', $block . ' is already in the blacklist!');
}
}
if (Input::is_ajax() === true) {
die;
}
Response::Redirect_Back();
}
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:26,代码来源:admin.php
示例4: handle
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
try {
//dd($this->req);
\DB::begintransaction();
$me = \Me::data()->id_karyawan;
// Create PO
$po = data_po::create(['id_sph' => $this->req['id'], 'id_vendor' => $this->req['vendor'], 'deadline' => $this->req['deadline'], 'id_pembuat' => $me, 'id_acc' => 0, 'adjustment' => $this->req['adjustment'], 'diskon' => $this->req['gdiskon'], 'ppn' => $this->req['gppn'], 'keterangan' => $this->req['ket'], 'titipan' => $this->req['titipan']]);
foreach ($this->req['id_barang'] as $i => $id_barang) {
data_po_item::create(['id_po' => $po->id_po, 'id_item' => $id_barang, 'req_qty' => $this->req['qty'][$i], 'qty' => $this->req['qty'][$i], 'harga' => $this->req['harga'][$i], 'diskon' => $this->req['diskon'][$i], 'keterangan' => $this->req['kets'][$i], 'id_satuan' => $this->req['satuan'][$i], 'id_prq' => $this->req['id_prq'][$i]]);
data_prq::find($this->req['id_prq'][$i])->update(['status' => 2]);
// update Harga
data_barang::find($id_barang)->update(['harga_beli' => $this->req['harga'][$i]]);
// Update Log harga
data_harga::create(['id_barang' => $id_barang, 'harga' => $this->req['harga'][$i], 'keterangan' => 'Update berdasarkan PO', 'id_po' => $po->id_po, 'id_karyawan' => $me, 'tipe' => 1]);
data_prq_item::find($this->req['id_prq_item'][$i])->update(['status' => 2]);
}
$format = 'PO-';
$po->no_po = $format . \Format::code($po->id_po);
$po->save();
\Loguser::create('Membuat PO dengan No. PO ' . $po->no_po);
\DB::commit();
return ['result' => true, 'err' => 'PO berhasil dibuat dengan No. ' . $po->no_po];
} catch (\Exception $e) {
\DB::rollback();
return ['result' => false, 'err' => $e->getMessage()];
}
}
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:33,代码来源:CreatePOJob.php
示例5: filter_comment_content_out
public function filter_comment_content_out($content, $comment)
{
if ($this->should_pee('C-' . $comment->typename)) {
$content = Format::autop($content);
}
return $content;
}
开发者ID:ringmaster,项目名称:selectivep,代码行数:7,代码来源:selectivep.plugin.php
示例6: validate_url
/**
* A validation function that returns an error if the value passed in is not a valid URL.
*
* @param string $text A string to test if it is a valid URL
* @param FormControl $control The control that defines the value
* @param FormContainer $form The container that holds the control
* @param string $warning An optional error message
* @return array An empty array if the string is a valid URL, or an array with strings describing the errors
*/
public static function validate_url($text, $control, $form, $warning = null, $schemes = array('http', 'https'), $guess = true)
{
if (!empty($text)) {
$parsed = InputFilter::parse_url($text);
if ($parsed['is_relative']) {
if ($guess) {
// guess if they meant to use an absolute link
$parsed = InputFilter::parse_url('http://' . $text);
if ($parsed['is_error']) {
// disallow relative URLs
$warning = empty($warning) ? _t('Relative urls are not allowed') : $warning;
return array($warning);
} else {
$warning = empty($warning) ? _t('Relative urls are not allowed') : $warning;
return array($warning);
}
}
}
if ($parsed['is_pseudo'] || !in_array($parsed['scheme'], $schemes)) {
// allow only http(s) URLs
$warning = empty($warning) ? _t('Only %s urls are allowed', array(Format::and_list($schemes))) : $warning;
return array($warning);
}
}
return array();
}
开发者ID:habari,项目名称:system,代码行数:35,代码来源:formvalidators.php
示例7: add_user_play
public static function add_user_play($username, $password, $artist, $album, $title, $length)
{
// ensure we have the length in milliseconds.
$length = Format::fix_length($length);
if ($length === -1) {
Logger::log("add_play: failed to convert length to milliseconds");
return false;
}
// unknown artist/album ("") becomes "N/A"
if ($artist === "") {
$artist = "N/A";
}
if ($album === "") {
$album = "N/A";
}
$db = Database::instance();
$sql = 'SELECT api_add_user_play(?, ?, ?, ?, ?, ?) AS success';
$params = array($username, $password, $artist, $album, $title, $length);
try {
$rows = $db->select($sql, $params);
} catch (Exception $e) {
Logger::log("add_user_play: database failure: " . $e->getMessage());
return false;
}
return count($rows) === 1 && $rows[0]['success'] === true;
}
开发者ID:horgh,项目名称:song_tracker,代码行数:26,代码来源:API.php
示例8: getDatapembelian
public function getDatapembelian(Request $req)
{
if ($req->ajax()) {
$res = [];
$out = '';
$kat = [];
$seri = [];
$items = data_po::grafikpembelian($req->tahun)->get();
foreach ($items as $item) {
$kat[] = \Format::indoDate2($item->tanggal);
$seri[] = (int) $item->total;
}
$res['po'] = ['kategori' => $kat, 'data' => $seri];
$kato = [];
$serio = [];
$obats = data_po_item::grafikpembelian(1, $req->tahun)->get();
foreach ($obats as $o) {
$kato[] = \Format::indoDate2($o->tanggal);
$serio[] = (int) $o->total;
}
$res['obat'] = ['kategori' => $kato, 'data' => $serio];
$katb = [];
$serib = [];
$barangs = data_po_item::grafikpembelian(2, $req->tahun)->get();
foreach ($barangs as $b) {
$katb[] = \Format::indoDate2($b->tanggal);
$serib[] = (int) $b->total;
}
$res['barang'] = ['kategori' => $katb, 'data' => $serib];
return json_encode($res);
}
}
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:32,代码来源:GrafikPOController.php
示例9: _to_client
protected function _to_client()
{
$web_format = config('settings', 'web_format');
header('Content-type: application/' . $web_format);
echo Format::converter(Command::get_report(), $web_format);
exit;
}
开发者ID:viking2000,项目名称:web-antarix,代码行数:7,代码来源:commands.php
示例10: onTicketCreated
function onTicketCreated($answer)
{
try {
global $ost;
if (!($ticket = Ticket::lookup($answer->object_id))) {
die('Unknown or invalid ticket ID.');
}
//Slack payload
$payload = array('attachments' => array(array('pretext' => "New Ticket <" . $ost->getConfig()->getUrl() . "scp/tickets.php?id=" . $ticket->getId() . "|#" . $ticket->getId() . "> in " . Format::htmlchars($ticket->getDept() instanceof Dept ? $ticket->getDept()->getName() : '') . " via " . $ticket->getSource() . " (" . Format::db_datetime($ticket->getCreateDate()) . ")", 'fallback' => "New Ticket <" . $ost->getConfig()->getUrl() . "scp/tickets.php?id=" . $ticket->getId() . "|#" . $ticket->getId() . "> in " . Format::htmlchars($ticket->getDept() instanceof Dept ? $ticket->getDept()->getName() : '') . " via " . $ticket->getSource() . " (" . Format::db_datetime($ticket->getCreateDate()) . ")", 'color' => "#D00000", 'fields' => array(array('title' => "From: " . mb_convert_case(Format::htmlchars($ticket->getName()), MB_CASE_TITLE) . " (" . $ticket->getEmail() . ")", 'value' => '', 'short' => false)))));
//Curl to webhook
$data_string = utf8_encode(json_encode($payload));
$url = $this->getConfig()->get('slack-webhook-url');
if (!function_exists('curl_init')) {
error_log('osticket slackplugin error: cURL is not installed!');
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
if ($result === false) {
error_log($url . ' - ' . curl_error($ch));
} else {
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($statusCode != '200') {
error_log($url . ' Http code: ' . $statusCode);
}
}
curl_close($ch);
} catch (Exception $e) {
error_log('Error posting to Slack. ' . $e->getMessage());
}
}
开发者ID:Quivr,项目名称:osticket-slack,代码行数:34,代码来源:slack.php
示例11: getAllitems
public function getAllitems(Request $req)
{
if ($req->ajax()) {
$res = [];
$items = ref_jabatan::where('nm_jabatan', $req->src)->paginate(10);
$out = '';
if ($items->total() > 0) {
$no = $items->currentPage() == 1 ? 1 : $items->perPage() * $items->currentPage() - $items->perPage() + 1;
foreach ($items as $item) {
$out .= '
<tr class="item_' . $item->id . ' items">
<td>' . $no . '</td>
<td>' . $item->nm_jabatan . '</td>
<td>
<div>
' . \Format::indoDate($item->created_at) . '
</div>
<small class="text-muted">' . \Format::hari($item->created_at) . ', ' . \Format::jam($item->created_at) . '</small>
</td>
</tr>
';
$no++;
}
} else {
$out = '
<tr>
<td colspan="3">Tidak ditemukan</td>
</tr>
';
}
$res['data'] = $out;
$res['pagin'] = $items->render();
return json_encode($res);
}
}
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:35,代码来源:JabatanController.php
示例12: getSubstitution
function getSubstitution()
{
$subs = array();
$subs['[today]'] = Format::date(date("Y-m-d H:i:s"), 'date');
$subs['[year]'] = date("Y");
return $subs;
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:7,代码来源:certificate.misc.php
示例13: converter
public static function converter($data, $format = NULL, $decode = FALSE)
{
if (!$format) {
$format = config('data_format');
}
if ($decode) {
$result = array();
switch ($format) {
case 'json':
$result = json_decode($data, TRUE);
break;
}
return is_array($result) ? $result : array();
}
//encode
switch ($format) {
case 'json':
Format::$_code = 0;
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', function ($val) {
$val = hexdec($val[1]);
if (Format::$_code) {
$val = ((Format::$_code & 0x3ff) << 10) + ($val & 0x3ff) + 0x10000;
Format::$_code = 0;
} elseif ($val >= 0xd800 and $val < 0xe000) {
Format::$_code = $val;
return '';
}
return html_entity_decode(sprintf('&#x%x;', $val), ENT_NOQUOTES, 'utf-8');
}, json_encode($data));
break;
}
}
开发者ID:viking2000,项目名称:web-antarix,代码行数:32,代码来源:format.php
示例14: getTransaction
public function getTransaction($start_index, $results, $sort, $dir, $filter = false)
{
$query = "SELECT t.id_trans, t.date_creation, t.date_activated, t.paid, SUM(ti.price) as price, u.userid, u.firstname, u.lastname" . " FROM %adm_transaction as t" . " JOIN %adm_transaction_info as ti ON t.id_trans = ti.id_trans" . " JOIN %adm_user as u ON t.id_user = u.idst" . " WHERE 1";
$query .= " GROUP BY t.id_trans";
switch ($sort) {
case 'userid':
$query .= " ORDER BY u.userid " . $dir;
break;
case 'firstname':
$query .= " ORDER BY u.firstname " . $dir;
break;
case 'lastname':
$query .= " ORDER BY u.lastname " . $dir;
break;
case 'date_creation':
$query .= " ORDER BY t.date_creation " . $dir;
break;
case 'date_activated':
$query .= " ORDER BY t.date_activated " . $dir;
break;
}
$start_index === false ? '' : ($query .= " LIMIT " . $start_index . ", " . $results);
$result = sql_query($query);
$res = array();
while ($row = sql_fetch_assoc($result)) {
$row['userid'] = $this->acl_man->relativeId($row['userid']);
$row['date_creation'] = Format::date($row['date_creation'], 'datetime');
$row['date_activated'] = Format::date($row['date_activated'], 'datetime');
$row['paid'] = $row['paid'] == 1 ? Get::img('standard/status_active.png', Lang::t('_ACTIVATED', 'transaction')) : Get::img('standard/status_deactive.png', Lang::t('_NOT_ACTIVATED', 'transaction'));
$row['edit'] = '<a href="index.php?r=alms/transaction/mod&id_trans=' . $row['id_trans'] . '" title="' . Lang::t('_MOD', 'transaction') . '">' . Get::img('standard/edit.png', Lang::t('_MOD', 'transaction')) . '</a>';
$res[] = $row;
}
return $res;
}
开发者ID:abhinay100,项目名称:forma_app,代码行数:34,代码来源:TransactionAlms.php
示例15: Dados
function Dados($setor)
{
$this->AddPage();
$this->setFillColor(200);
$periodo = explode(' - ', Input::get('periodo'));
$periodo[0] = Format::dbDate($periodo[0]);
$periodo[1] = Format::dbDate($periodo[1]);
$this->Cell(0, 5, $setor->descricao, 0, 0, 'C', 1);
$this->Ln();
foreach ($setor->colaboradores()->orderBy('nome')->get() as $colaborador) {
if ($colaborador->monitoramentos($periodo[0], $periodo[1])->count()) {
$this->SetFont('Arial', '', 8);
$this->Cell(0, 5, utf8_decode($colaborador->nome . ' - ' . $colaborador->posto_trabalho_descricao), 1, 0, 'L', 0);
$this->Ln();
$this->SetFont('Arial', '', 6);
$count = 0;
foreach ($colaborador->monitoramentos($periodo[0], $periodo[1]) as $monitoramento) {
$this->Cell(38, 4, date('d/m/Y', strtotime($monitoramento->created_at)) . ' - ' . utf8_decode(substr($monitoramento->diagnostico, 0, 17)), 0, 0, 'L', 0);
$count = $count + 1;
if ($count == 5) {
$this->Ln();
$count = 0;
}
}
$this->Ln();
}
}
}
开发者ID:kuell,项目名称:buriti,代码行数:28,代码来源:colaborador_monitoramento.blade.php
示例16: handle
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
try {
\DB::begintransaction();
$sph = data_sph::find($this->id);
$grup = data_sph_grup::whereId_sph_grup($sph->id_sph_grup)->select('status')->first();
if ($grup->status == 2) {
throw new \Exception("Maaf SPH No. " . $sph->no_sph_item . " sudah kadaluarsa!", 1);
}
$nsph = data_sph::create(['id_sph_grup' => $sph->id_sph_grup, 'id_vendor' => $sph->id_vendor, 'deadline' => $sph->deadline, 'id_pembuat' => \Me::data()->id_karyawan, 'id_acc' => $sph->id_acc, 'diskon' => $sph->diskon, 'ppn' => $sph->ppn, 'pph' => $sph->pph, 'adjustment' => $sph->adjustment]);
$items = data_sph_item::whereId_sph($this->id)->get();
foreach ($items as $item) {
data_sph_item::create(['id_sph' => $nsph->id_sph, 'id_prq' => $item->id_prq, 'id_item' => $item->id_item, 'qty' => $item->qty, 'harga' => $item->harga, 'diskon' => $item->diskon, 'ppn' => $item->ppn, 'pph' => $item->pph, 'id_satuan' => $item->id_satuan]);
}
$fo = 'ISPH/';
$nsph->no_sph_item = $fo . \Format::code($nsph->id_sph);
$nsph->save();
\Loguser::create('Menduplikasi data SPH dari No. ' . $sph->no_sph_item);
\DB::commit();
return ['err' => 'SPH berhasil di duplikasi dengan No. ' . $nsph->no_sph_item];
} catch (\Exception $e) {
\DB::rollback();
return ['err' => $e->getMessage()];
}
}
开发者ID:pedangkayu,项目名称:rsos-git,代码行数:30,代码来源:CopySPHJob.php
示例17: testParseBBCode
public function testParseBBCode()
{
$this->assertEquals("", Format::parseBBCode(""));
$this->assertEquals("test", Format::parseBBCode("test"));
$this->assertEquals("<b>test</b>", Format::parseBBCode("[b]test[/b]"));
// TODO complete
}
开发者ID:KasaiDot,项目名称:Zero-Fansub-website,代码行数:7,代码来源:FormatTest.php
示例18: Index
public function Index($Offset = 0, $Limit = NULL)
{
$this->AddJsFile('/js/library/jquery.gardenmorepager.js');
$this->AddJsFile('search.js');
$this->Title(Translate('Search'));
if (!is_numeric($Limit)) {
$Limit = Gdn::Config('Garden.Search.PerPage', 20);
}
$Search = $this->Form->GetFormValue('Search');
$ResultSet = $this->SearchModel->Search($Search, $Offset, $Limit);
$this->SetData('SearchResults', $ResultSet, TRUE);
$this->SetData('SearchTerm', Format::Text($Search), TRUE);
$NumResults = $ResultSet->NumRows();
if ($NumResults == $Offset + $Limit) {
$NumResults++;
}
// Build a pager
$PagerFactory = new PagerFactory();
$Pager = $PagerFactory->GetPager('MorePager', $this);
$Pager->MoreCode = 'More Results';
$Pager->LessCode = 'Previous Results';
$Pager->ClientID = 'Pager';
$Pager->Configure($Offset, $Limit, $NumResults, 'garden/search/%1$s/%2$s/?Search=' . Format::Url($Search));
$this->SetData('Pager', $Pager, TRUE);
$this->View = 'results';
$this->Render();
}
开发者ID:Aetasiric,项目名称:Garden,代码行数:27,代码来源:search.php
示例19: processData
/**
* @param array $data
*
* @return array
*/
public function processData(array $data = array())
{
if (!$this->Format) {
$this->loadFormat();
}
return $this->Format->processData($data);
}
开发者ID:vgrish,项目名称:gl,代码行数:12,代码来源:gl.class.php
示例20: Save
public function Save($FormPostValues)
{
$Session = Gdn::Session();
// Define the primary key in this model's table.
$this->DefineSchema();
// Add & apply any extra validation rules:
$this->Validation->ApplyRule('Body', 'Required');
$this->AddInsertFields($FormPostValues);
// Validate the form posted values
$MessageID = FALSE;
if ($this->Validate($FormPostValues)) {
$Fields = $this->Validation->SchemaValidationFields();
// All fields on the form that relate to the schema
$MessageID = $this->SQL->Insert($this->Name, $Fields);
$ConversationID = ArrayValue('ConversationID', $Fields, 0);
// Update the conversation's DateUpdated field
$this->SQL->Update('Conversation')->Set('DateUpdated', Format::ToDateTime())->Set('UpdateUserID', $Session->UserID)->Where('ConversationID', $ConversationID)->Put();
// NOTE: INCREMENTING COUNTS INSTEAD OF GETTING ACTUAL COUNTS COULD
// BECOME A PROBLEM. WATCH FOR IT.
// Update the message counts for all users in the conversation
$this->SQL->Update('UserConversation')->Set('CountMessages', 'CountMessages + 1', FALSE)->Where('ConversationID', $ConversationID)->Put();
$this->SQL->Update('UserConversation')->Set('CountNewMessages', 'CountNewMessages + 1', FALSE)->Where('ConversationID', $ConversationID)->Where('UserID <>', $Session->UserID)->Put();
// Update the CountUnreadConversations count on each user related to the discussion.
$this->UpdateCountUnreadConversations($ConversationID, $Session->UserID);
// Update the userconversation records to reflect the most recently
// added message for all users other than the one that added the
// message (otherwise they would see their name/message on the
// conversation list instead of the person they are conversing with).
$this->SQL->Update('UserConversation')->Set('LastMessageID', $MessageID)->Where('ConversationID', $ConversationID)->Where('UserID <>', $Session->UserID)->Put();
}
return $MessageID;
}
开发者ID:kidmax,项目名称:Garden,代码行数:32,代码来源:class.conversationmessagemodel.php
注:本文中的Format类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论