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


PHP Conversation::find方法代码示例

本文整理汇总了PHP中Conversation::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Conversation::find方法的具体用法?PHP Conversation::find怎么用?PHP Conversation::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Conversation的用法示例。


在下文中一共展示了Conversation::find方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showAction

 public function showAction()
 {
     $this->logger->entering();
     $this->logger->info('Loading conversation');
     $conversations = new Conversation();
     $conversation = $conversations->find($this->_getParam('id'))->current();
     $this->logger->info('Loading Item');
     $item = $conversation->findParentItem();
     $this->logger->info('Ensure authorized to view');
     if ($this->session->user_id != $conversation->user_id && $this->session->user_id != $item->owner_id) {
         $this->flash->notice = "Invalid Action";
         $this->_redirect('/');
     }
     $this->logger->info('Loading Messages');
     $messageRows = $conversation->findMessage();
     foreach ($messageRows as $messageRow) {
         $message = $messageRow->toArray();
         $message['user'] = $messageRow->findParentUser()->toArray();
         $messages[] = $message;
     }
     $this->logger->info('Loading View');
     $this->view->assign(array('conversation' => $conversation, 'messages' => $messages, 'item' => $item));
     $this->logger->info('Rendering view');
     $this->render();
     $this->logger->exiting();
 }
开发者ID:josephholsten,项目名称:swaplady,代码行数:26,代码来源:ConversationsController.php

示例2: 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

示例3: sendNew

 public static function sendNew($sender, $conversation, $content, $timeOffset = 0)
 {
     $id = Message::generateId(6);
     $timestamp = Utils::tps() + $timeOffset;
     $message = Message::create(array('id' => $id, 'sender_id' => $sender, 'conversation_id' => $conversation, 'content' => $content, 'timestamp' => $timestamp));
     $recep = array();
     $members = explode(';', trim(Conversation::find($conversation)->members_ids, ';'));
     foreach ($members as $id) {
         if ($id != $sender) {
             $recep[] = trim(UserChannel::find($id)->admins_ids, ';');
         }
     }
     $recep = ';' . implode(';', $recep) . ';';
     $recep = ChannelAction::filterReceiver($recep, "pm");
     ChannelAction::create(array('id' => ChannelAction::generateId(6), 'channel_id' => userChannel::find($sender)->id, 'recipients_ids' => $recep, 'type' => 'pm', 'target' => $conversation, 'timestamp' => $timestamp));
     return $message;
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:17,代码来源:message.php

示例4: show

 public function show($id)
 {
     if (FEUsersHelper::isLogged()) {
         $conversation = Conversation::find($id);
         if ($conversation) {
             if (FEUsersHelper::isCurrentUser($conversation->user1_id) || FEUsersHelper::isCurrentUser($conversation->user2_id)) {
                 return View::make('frontend/messages/show')->with('user', User::find(Session::get('user')['id']))->with('conversations', $this->conversations)->with('conversation', $conversation);
             } else {
                 return Redirect::to('message');
             }
         } else {
             return Redirect::to('message');
         }
     } else {
         return Redirect::to('/');
     }
 }
开发者ID:huuson94,项目名称:WebProject,代码行数:17,代码来源:FEMessagesController.php

示例5: beforeSchemaUpdate

 public static function beforeSchemaUpdate()
 {
     $table = strtolower(get_called_class());
     $schema = Schema::get();
     $schemadef = $schema->getTableDef($table);
     // 2016-01-06 We have to make sure there is no conversation with id==0 since it will screw up auto increment resequencing
     if ($schemadef['fields']['id']['auto_increment']) {
         // since we already have auto incrementing ('serial') we can continue
         return;
     }
     // The conversation will be recreated in upgrade.php, which will
     // generate a new URI, but that's collateral damage for you.
     $conv = new Conversation();
     $conv->id = 0;
     if ($conv->find()) {
         while ($conv->fetch()) {
             // Since we have filtered on 0 this only deletes such entries
             // which I have been afraid wouldn't work, but apparently does!
             // (I thought it would act as null or something and find _all_ conversation entries)
             $conv->delete();
         }
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:23,代码来源:Conversation.php

示例6: create

 public function create($request)
 {
     if (Session::isActive()) {
         $req = $request->getParameters();
         Session::get()->last_visit = Utils::tps();
         Session::get()->save();
         if (isset($req['sender'], $req['conversation'], $req['content']) && !empty($req['conversation']) && !empty($req['sender']) && !empty($req['content'])) {
             $sender = Utils::secure($req['sender']);
             $conversation = Utils::secure($req['conversation']);
             $content = Utils::secure($req['content']);
             $channel = UserChannel::exists($sender) ? UserChannel::find($sender) : false;
             if ($channel && $channel->belongToUser(Session::get()->id) && ($conv = Conversation::find($conversation))) {
                 if (!$conv->containsChannel($channel)) {
                     return Utils::getUnauthorizedResponse();
                 }
                 $message = Message::sendNew($sender, $conversation, $content);
                 $messageData = array('id' => $message->id, 'avatar' => $channel->getAvatar(), 'pseudo' => $channel->name, 'text' => $content, 'mine' => 'true');
                 return new JsonResponse($messageData);
             }
         }
     }
     return new Response(500);
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:23,代码来源:message_controller.php

示例7: getUrlFromNotice

 public static function getUrlFromNotice(Notice $notice, $anchor = true)
 {
     $conv = new Conversation();
     $conv->id = $notice->conversation;
     $conv->find(true);
     if (!$conv instanceof Conversation) {
         common_debug('Conversation does not exist for notice ID: ' . $notice->id);
         throw new NoResultException($conv);
     }
     return $conv->getUrl($anchor ? $notice->id : null);
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:11,代码来源:Conversation.php

示例8: 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

示例9: fixupConversationURIs

function fixupConversationURIs()
{
    printfnq("Ensuring all conversations have a URI...");
    $conv = new Conversation();
    $conv->whereAdd('uri IS NULL');
    if ($conv->find()) {
        $rounds = 0;
        while ($conv->fetch()) {
            $uri = common_local_url('conversation', array('id' => $conv->id));
            $sql = sprintf('UPDATE conversation SET uri="%1$s" WHERE id="%2$d";', $conv->escape($uri), $conv->id);
            $conv->query($sql);
            if (($conv->N - ++$rounds) % 500 == 0) {
                printfnq(sprintf(' %d items left...', $conv->N - $rounds));
            }
        }
    }
    printfnq("DONE.\n");
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:18,代码来源:upgrade.php


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