当前位置: 首页>>代码示例>>PHP>>正文


PHP Conversation::exists方法代码示例

本文整理汇总了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');
 }
开发者ID:agiza,项目名称:DreamVids,代码行数:11,代码来源:tickets_controller.php

示例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);
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:12,代码来源:conversation_controller.php

示例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;
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:13,代码来源:conversation.php

示例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
开发者ID:Osin,项目名称:Intranet,代码行数:31,代码来源:talk.action.php


注:本文中的Conversation::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。