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


PHP Message::setId方法代码示例

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


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

示例1: testSetGet

 public function testSetGet()
 {
     $now = new \DateTime();
     $testCase = ['id' => 123, 'level' => 2, 'subject' => 'TEST SUBJECT', 'message' => 'TEST MESSAGE', 'source' => 'TEST_SOURCE', 'dateCreated' => $now, 'dateCreatedString' => $now->format(\DateTime::ISO8601)];
     $unit = new Message();
     $unit->setId($testCase['id']);
     $this->assertEquals($testCase['id'], $unit->getId());
     $unit->setLevel(0);
     $this->assertEquals(Message::LEVEL_DEFAULT, $unit->getLevel());
     $unit->setLevel($testCase['level']);
     $this->assertEquals($testCase['level'], $unit->getLevel());
     $unit->setSubject($testCase['subject']);
     $this->assertEquals($testCase['subject'], $unit->getSubject());
     $unit->setMessage($testCase['message']);
     $this->assertEquals($testCase['message'], $unit->getMessage());
     $unit->setSource('');
     $this->assertNull($unit->getSource());
     $unit->setSource($testCase['source']);
     $this->assertEquals($testCase['source'], $unit->getSource());
     $unit->setDateCreated(null);
     $this->assertNull($unit->getDateCreatedString());
     $unit->setDateCreated($testCase['dateCreated']);
     $this->assertEquals($testCase['dateCreated'], $unit->getDateCreated());
     $unit->setDateCreatedString($testCase['dateCreatedString']);
     $this->assertEquals($testCase['dateCreatedString'], $unit->getDateCreatedString());
     $this->assertEquals($testCase['id'], $unit->toArray()['id']);
     $this->assertTrue(is_array($unit->toArray()));
 }
开发者ID:reliv,项目名称:rcm-message,代码行数:28,代码来源:MessageTest.php

示例2: testSetId

 public function testSetId()
 {
     $msg = new Message();
     $msg->setId('foo');
     $this->assertEquals('foo', $msg->getId());
     $this->assertEquals(['apns-id' => 'foo'], $msg->getMessageHeaders());
 }
开发者ID:gepo,项目名称:apns-http2,代码行数:7,代码来源:MessageTest.php

示例3: constructByRow

 /**
  * Instantiate a Message from and message table row
  * @param array $row   row from message table
  * @return \Message
  */
 public static function constructByRow($row)
 {
     if (isset($row['id'])) {
         $message = new Message($row['sender_id'], $row['recipient_id'], $row['thread_id'], $row['message'], $row['created'], $row['updated'], $row['sender_visibility'], $row['recipient_visibility']);
         $message->setId($row['id']);
         return $message;
     }
     return null;
 }
开发者ID:allanjg89,项目名称:Pet-Basket-Website,代码行数:14,代码来源:message.php

示例4: convertToMessage

 function convertToMessage($msg)
 {
     $message = new Message();
     $message->setId($msg['id']);
     $message->setDate($msg['sent_date']);
     $message->setFrom($msg['msg_from']);
     $message->setMessage($msg['message']);
     $message->setSubject($msg['subject']);
     return $message;
 }
开发者ID:ArRolin,项目名称:WP-Message-Plugin,代码行数:10,代码来源:messageService.php

示例5: testPut

 public function testPut()
 {
     $message = new Message();
     $message->setId(1);
     $message->setSubject('Un message');
     $message->setContent('Bonjour. Une modification');
     $message->setDatePost('2012-12-14 19:45:45');
     $message->setIdSender(1);
     $message->setIdReceiver(3);
     $messageMapper = new MessageMapper();
     $messageMapper->setId(1);
     $messageMapper->updateMessage($message);
     $this->assertEquals($message, $messageMapper->selectMessage());
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:14,代码来源:MessageMapperTest.php

示例6: read_message

function read_message()
{
	global $CONF;
	$user = $_SESSION['user'];

	if (!isset($_GET['id_read_message']) || empty($_GET['id_read_message']))
		return array('ok'=>false, 'error'=>'no message');

	$message = new Message();

	$message->setId($_GET['id_read_message']);
	$message->read();
	return array('ok'=>true, 'error'=>'');

}
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:15,代码来源:read_message.php

示例7: mapRow

 /**
  *  get db object by record
  *  @param  row
  *  @return TahScan object
  */
 public function mapRow($row)
 {
     $object = new Message();
     $object->setId($row['id']);
     $object->setMessageId($row['message_id']);
     $object->setUpdateId($row['update_id']);
     $object->setUserId($row['user_id']);
     $object->setFirstName($row['first_name']);
     $object->setLastName($row['last_name']);
     $object->setChatType($row['chat_type']);
     $object->setChatId($row['chat_id']);
     $object->setChatTitle($row['chat_title']);
     $object->setContent($row['content']);
     $object->setCreateMessageTime(strtotime($row['create_message_time']));
     $object->setIsUsed($row['is_used']);
     $object->setProperties(unserialize($row['properties']));
     return $object;
 }
开发者ID:glennfriend,项目名称:tg-bot,代码行数:23,代码来源:Messages.php

示例8: getMessage

 public function getMessage($id, $cacheMinutes = 0)
 {
     $sql_query = "SELECT main.*, extra.`sender`, extra.`replied`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`" . Tbl::get('TBL_MESSAGES') . "` main\n\t\t\t\t\t\tLEFT JOIN\n\t\t\t\t\t\t\t`" . Tbl::get('TBL_EXTRA') . "` extra\n\t\t\t\t\t\tON (main.`id` = extra.`message_id`)\n\t\t\t\t\t\tWHERE main.`id` = '" . intval($id) . "'\n\t\t\t\t\t\tAND extra.`sender` = extra.`receiver`";
     if (!$this->query->exec($sql_query, $cacheMinutes)) {
         return false;
     }
     if (($message = $this->query->fetchRecord()) != false) {
         $msg = new Message();
         $msg->setId($message["id"]);
         $msg->sender = $message["sender"];
         $msg->subject = $message["subject"];
         $msg->message = $message["message"];
         $msg->date = date(DEFAULT_DATETIME_FORMAT, $message["date"]);
         $msg->parent = $message["replied"];
         $receivers = $this->getReceivers($msg, true, $cacheMinutes);
         if (is_array($receivers)) {
             $msg->receivers = array_values(array_diff($receivers, array($message["sender"])));
         } else {
             $msg->receivers = array();
         }
         $msg->read = array();
         $msg->trashed = array();
         for ($i = 0; $i < count($msg->receivers); $i++) {
             $msg->read[$msg->receivers[$i]] = $this->getReadStatus($msg->receivers[$i], $msg, $cacheMinutes);
         }
         for ($i = 0; $i < count($receivers); $i++) {
             $msg->trashed[$receivers[$i]] = $this->getTrashedStatus($receivers[$i], $msg, $cacheMinutes);
         }
         return $msg;
     } else {
         return false;
     }
 }
开发者ID:alexamiryan,项目名称:stingle,代码行数:33,代码来源:MessageManagement.class.php

示例9: testGetSetId

 public function testGetSetId()
 {
     $message = new Message();
     $message->setId(1);
     $this->assertEquals(1, $message->getId());
 }
开发者ID:noxa02,项目名称:REST_ANNONCE,代码行数:6,代码来源:MessageTest.php

示例10: engine_doit

function engine_doit(){
	global $CONF;
	$whats = explode(',', $_GET['what']);
	$result = null;

	if (isset($_GET['SYSTEM_redirect'])){
		unset($_GET['SYSTEM_redirect']);
		switch($_GET['what']){
			case 'topic':
				include('basichtml/viewtopic.php');
				break;
			case 'datetopics':
				include('basichtml/topic_list.php');
				break;
			case 'confirm_user':
				include('controller/confirm_user.php');
				break;
			case 'user_stopmail':
				include('controller/user_stopmail.php');
				break;
			case 'add_email':
				include('controller/add_email.php');
				break;
			case 'remove_email':
				include('controller/remove_email.php');
				break;
			case 'restore_password':
				include('controller/restore_password.php');
				break;
			case 'followchannel_acceptreject':
				include('controller/followchannel_acceptreject.php');
				break;
			case 'autoopenchannel':
				include('controller/autoopenchannel.php');
				break;
			case 'autoopentopic':
				include('controller/autoopentopic.php');
				break;
/*			case 'ETUEngine':
				include('tool/ETUEngine.php');
				$etu=new ETUEngine();
				$etu->start(1);
				break;
*/

		}
		return;
	} 
	foreach ($whats as $what)
	{
		switch($what)
		{
			case 'fromname':
				require_once("controller/fromname.php");
				$result['fromname'] = fromname($_GET['id_fromname']);
				break;
			case 'setuserfrom':
				require_once("class/User.php");
				$tuser = new RegUser();
				$tuser->setNickname($_GET['nick_setuserfrom']);
				$valid = $tuser->validatePassword($_GET['pass_setuserfrom']);
				if ($valid)
				{
					$tuser->load();
					$tuser->setCameFrom($_GET['fromid_setuserfrom']);
					$tuser->save();
				}
				break;
			case 'message':
				require_once('template/TMessage.php');
				require_once('class/Message.php');
				$message = new Message(); 
				if (isset($_GET['id_message']) && !empty($_GET['id_message']))
					$message->setId($_GET['id_message']);
				else { $result['message']=array(); break; }
				$tmessage = new TMessage(); $tmessage->setMessage($message);
				$result['message']=$tmessage->getJsonTags();
				break;
			case 'mymessages':
				require_once('template/TListMessage.php');
				$tlist = new TListMessage();	$tlist->setListType("cloneMy"); $tlist->setOnlySubsumed(true);
				if (isset($_GET['sorting_mymessages'])) $tlist->setSorting($_GET['sorting_mymessages']);
				if (isset($_GET['lastid_mymessages'])) $tlist->setLastId($_GET['lastid_mymessages']);
				$result['mymessages']=$tlist->getJsonTags();
				break;
			case 'regchannel':
				require_once("template/TChannel.php");
				require_once("class/Channel.php");
				$t = new TChannel();
				$o=new Channel();
				$prettyUrl='';
				if (isset($_GET['id_regchannel'])) {
					$o->setId($_GET['id_regchannel']);
				} elseif (isset($_GET['name_regchannel'])) {
					if (substr($_GET['name_regchannel'],-1,1)=='-'){
						$result['regchannel']=array("ok"=>false,"error"=>"invalid name","exist"=>true,'prettyUrl'=>'');
						break;
					} else {
						$o->setName($_GET['name_regchannel']);
						$prettyUrl=Channel::prettyUrlAvailable($_GET['name_regchannel']);
//.........这里部分代码省略.........
开发者ID:rczeus,项目名称:Rapid-Coffee,代码行数:101,代码来源:engine.php

示例11: Message

<?php

session_start();
require_once '../resources/require.php';
// Tworzy nowy obiekt message w oparciu o ID z tablicy GET, zmienia status wiadomości na 1 (przeczytana)
$message = new Message($mysqli);
$message->setId($_GET['message_id']);
$message->loadFromDB();
if ($message->getSenderId() != $_SESSION['user_id'] && $message->getStatus() == 0) {
    $message->updateStatus();
}
?>
<!DOCTYPE html>
<html lang="pl-PL">

<title>Twitter | Wiadomości</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
      integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-inverse">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand active" href="#">Twitter</a>
        </div>
        <div>
            <ul class="nav navbar-nav">
                <li><a href="index.php">Strona główna</a></li>
开发者ID:PanBlacha,项目名称:twitter,代码行数:31,代码来源:show_message.php

示例12: loadAllSent

 public function loadAllSent()
 {
     $conn = $this->connection;
     $arrayWithMessages = [];
     $sqlQuery = "SELECT id, text, receiver_id, created_at FROM messages WHERE sender_id = {$this->id} ORDER BY messages.created_at DESC";
     $result = $conn->query($sqlQuery);
     if ($result->num_rows > 0) {
         while (list($id, $text, $receiverId, $createdAt) = $result->fetch_array(MYSQLI_NUM)) {
             $message = new Message($conn);
             $message->setId($id);
             $message->setText($text);
             $message->setSenderId($this->id);
             $message->setReceiverId($receiverId);
             $message->setCreatedAt($createdAt);
             $arrayWithMessages[] = $message;
         }
         return $arrayWithMessages;
     }
     return false;
 }
开发者ID:Witoso,项目名称:twitter_app,代码行数:20,代码来源:User.php


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