mirror of
				https://github.com/Mibew/mibew.git
				synced 2025-11-04 04:15:19 +03:00 
			
		
		
		
	Add Thread object creation to /operator/history.php
Replace direct work with thread table's fields by Thread object
This commit is contained in:
		
							parent
							
								
									0b2a379dd8
								
							
						
					
					
						commit
						bebe603a9b
					
				@ -68,10 +68,9 @@ if ($query !== false) {
 | 
				
			|||||||
		$searchConditions[] = "({chatthread}.userName LIKE :query)";
 | 
							$searchConditions[] = "({chatthread}.userName LIKE :query)";
 | 
				
			||||||
		$searchConditions[] = "({chatthread}.remote LIKE :query)";
 | 
							$searchConditions[] = "({chatthread}.remote LIKE :query)";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	select_with_pagintation("DISTINCT {chatthread}.dtmcreated as created, " .
 | 
					
 | 
				
			||||||
		"{chatthread}.dtmmodified as modified, {chatthread}.threadid, " .
 | 
						// Load threads
 | 
				
			||||||
		"{chatthread}.remote, {chatthread}.agentName, {chatthread}.userName, groupid, " .
 | 
						select_with_pagintation("DISTINCT {chatthread}.*",
 | 
				
			||||||
		"messageCount as size",
 | 
					 | 
				
			||||||
		"{chatthread}, {chatmessage}",
 | 
							"{chatthread}, {chatmessage}",
 | 
				
			||||||
		array(
 | 
							array(
 | 
				
			||||||
			"{chatmessage}.threadid = {chatthread}.threadid",
 | 
								"{chatmessage}.threadid = {chatthread}.threadid",
 | 
				
			||||||
@ -80,6 +79,11 @@ if ($query !== false) {
 | 
				
			|||||||
		"order by {chatthread}.dtmcreated DESC",
 | 
							"order by {chatthread}.dtmcreated DESC",
 | 
				
			||||||
		"DISTINCT {chatthread}.dtmcreated", $values);
 | 
							"DISTINCT {chatthread}.dtmcreated", $values);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Build Thread object
 | 
				
			||||||
 | 
						foreach ($page['pagination.items'] as $key => $item) {
 | 
				
			||||||
 | 
							$page['pagination.items'][$key] = Thread::createFromDbInfo($item);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$page['formq'] = topage($query);
 | 
						$page['formq'] = topage($query);
 | 
				
			||||||
} else {
 | 
					} else {
 | 
				
			||||||
	setup_empty_pagination();
 | 
						setup_empty_pagination();
 | 
				
			||||||
 | 
				
			|||||||
@ -84,24 +84,24 @@ if( $page['pagination.items'] ) {
 | 
				
			|||||||
	foreach( $page['pagination.items'] as $chatthread ) { ?>
 | 
						foreach( $page['pagination.items'] as $chatthread ) { ?>
 | 
				
			||||||
	<tr>
 | 
						<tr>
 | 
				
			||||||
		<td>
 | 
							<td>
 | 
				
			||||||
			<a href="<?php echo $webimroot ?>/operator/threadprocessor.php?threadid=<?php echo $chatthread['threadid'] ?>" target="_blank" onclick="this.newWindow = window.open('<?php echo $webimroot ?>/operator/threadprocessor.php?threadid=<?php echo $chatthread['threadid'] ?>', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php echo topage(htmlspecialchars($chatthread['userName'])) ?></a>
 | 
								<a href="<?php echo $webimroot ?>/operator/threadprocessor.php?threadid=<?php echo $chatthread->id ?>" target="_blank" onclick="this.newWindow = window.open('<?php echo $webimroot ?>/operator/threadprocessor.php?threadid=<?php echo $chatthread->id ?>', '', 'toolbar=0,scrollbars=1,location=0,status=1,menubar=0,width=720,height=520,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;"><?php echo topage(htmlspecialchars($chatthread->userName)) ?></a>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
		<td>
 | 
							<td>
 | 
				
			||||||
        	<?php echo get_user_addr(topage($chatthread['remote'])) ?>
 | 
								<?php echo get_user_addr(topage($chatthread->remote)) ?>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
		<td>
 | 
							<td>
 | 
				
			||||||
        	<?php if( $chatthread['agentName'] ) {
 | 
								<?php if( $chatthread->agentName ) {
 | 
				
			||||||
        		echo topage(htmlspecialchars($chatthread['agentName']));
 | 
									echo topage(htmlspecialchars($chatthread->agentName));
 | 
				
			||||||
        	} else if($chatthread['groupid'] && $chatthread['groupid'] != 0 && isset($page['groupName'][$chatthread['groupid']])) {
 | 
								} else if($chatthread->groupId && $chatthread->groupId != 0 && isset($page['groupName'][$chatthread->groupId])) {
 | 
				
			||||||
        		echo "- ".topage(htmlspecialchars($page['groupName'][$chatthread['groupid']]))." -";
 | 
									echo "- ".topage(htmlspecialchars($page['groupName'][$chatthread->groupId]))." -";
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			?>
 | 
								?>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
		<td>
 | 
							<td>
 | 
				
			||||||
        	<?php echo topage(htmlspecialchars($chatthread['size'])) ?>
 | 
								<?php echo topage(htmlspecialchars($chatthread->messageCount)) ?>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
		<td>
 | 
							<td>
 | 
				
			||||||
			<?php echo date_diff_to_text($chatthread['modified']-$chatthread['created']) ?>, <?php echo date_to_text($chatthread['created']) ?>
 | 
								<?php echo date_diff_to_text($chatthread->modified-$chatthread->created) ?>, <?php echo date_to_text($chatthread->created) ?>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
	</tr>
 | 
						</tr>
 | 
				
			||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user