本文整理汇总了PHP中Conversation::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Conversation::exists方法的具体用法?PHP Conversation::exists怎么用?PHP Conversation::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conversation
的用法示例。
在下文中一共展示了Conversation::exists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bug
public function bug($id, $request)
{
$ticket = Ticket::find($id);
$message = "Après étude de votre problème, il en résulte qu'il ne s'agit pas d'un incident isolé mais bien d'un problème technique interne à DreamVids (bug). Nous travaillons actuellement à la détection et à la résolution de ce bug mais nous ne pouvons vous donner de plus amples informations. Nous nous excusons pour la gêne occasionnée et vous remerçions de votre patience.";
$this->mail($ticket, $message);
if ($ticket->conv_id != '' && Conversation::exists($ticket->conv_id)) {
Conversation::find($ticket->conv_id)->removeChannel(User::find(User::getIdByName($ticket->tech))->getMainChannel());
}
$ticket->delete();
return new RedirectResponse(WEBROOT . 'admin/tickets');
}
示例2: destroy
public function destroy($id, $request)
{
$req = $request->getParameters();
if (Session::isActive() && isset($req['channelId']) && ($channel = UserChannel::find($req['channelId']))) {
$conv = Conversation::exists($id) ? Conversation::find($id) : false;
if ($conv && $conv->containsChannel($channel)) {
$conv->removeChannel($channel);
return new Response(200);
}
}
return new Response(500);
}
示例3: generateId
public static function generateId($length)
{
$idExists = true;
while ($idExists) {
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$id = '';
for ($i = 0; $i < $length; $i++) {
$id .= $chars[rand(0, strlen($chars) - 1)];
}
$idExists = Conversation::exists(array('id' => $id));
}
return $id;
}
示例4: array
<?php
include "../../inc/init.inc";
if (isset($_GET['conversation']) && $_GET['conversation'] != 0 && Follower::isFriend($res->user->id, $_GET['conversation'])) {
$filename = $res->user->id > $_GET['conversation'] ? 'conversations/' . $_GET['conversation'] . "-" . $res->user->id . ".xml" : 'conversations/' . $res->user->id . "-" . $_GET['conversation'] . ".xml";
if (!Conversation::exists(array('conditions' => array('filename' => $filename)))) {
$attributes = array("user_id" => $res->user->id, "filename" => $filename);
$conversation = Conversation::create($attributes);
} else {
$conversation = Conversation::find_by_filename($filename);
}
if ($conversation == null) {
throw new Exception('can not init conversation', 504);
}
$xmlfile = VAR_PATH . $conversation->filename;
// <editor-fold defaultstate="collapsed" desc="creation d'un message">
if (isset($_GET['msg'])) {
$msg = $_GET['msg'];
$userChat = isset($_GET['userChat']) ? $_GET['userChat'] : "Invité";
//Load it using simpleXML
$doc = new DOMDocument();
$doc->load($xmlfile);
//Add a conversation item
$item = $doc->createElement("item", $msg);
//Add the sender's name as an attribute
$sender = $doc->createAttribute("sender");
$sender->appendChild($doc->createTextNode($userChat));
//Add another attribute for time on which the message was added
$time = $doc->createAttribute("time");
$time->appendChild($doc->createTextNode(date("H:i", time())));
//Put it together