Exemplo n.º 1
0
	/**
	 * @param CommentTable    $row
	 * @param Comments        $stream
	 * @param int             $output 0: Normal, 1: Raw, 2: Inline, 3: Load, 4: Save
	 * @param UserTable       $user
	 * @param UserTable       $viewer
	 * @param cbPluginHandler $plugin
	 * @return null|string
	 */
	static public function showEdit( $row, $stream, $output, $user, $viewer, $plugin )
	{
		global $_PLUGINS;

		$cbModerator	=	CBActivity::isModerator( (int) $viewer->get( 'id' ) );
		$messageLimit	=	( $cbModerator ? 0 : (int) $stream->get( 'message_limit', 400 ) );

		$rowId			=	$stream->id() . '_edit_' . (int) $row->get( 'id' );

		$editBody		=	null;
		$editFooter		=	null;

		$_PLUGINS->trigger( 'activity_onDisplayCommentEdit', array( &$row, &$editBody, &$editFooter, $stream, $output ) );

		$return			=	'<div class="streamMediaBody streamItemEdit commentContainerContentEdit media-body text-small hidden">'
						.		'<form action="' . $stream->endpoint( 'save', array( 'id' => (int) $row->get( 'id' ) ) ) . '" method="post" enctype="multipart/form-data" name="' . $rowId . 'Form" id="' . $rowId . 'Form" class="cb_form streamItemForm form">'
						.			'<textarea id="' . $stream->id() . '_message_edit_' . (int) $row->get( 'id' ) . '" name="message" rows="1" class="streamInput streamInputAutosize streamInputMessage form-control" placeholder="' . htmlspecialchars( ( $stream->get( 'type' ) == 'comment' ? CBTxt::T( 'Write a reply...' ) : CBTxt::T( 'Write a comment...' ) ) ) . '"' . ( $messageLimit ? ' data-cbactivity-input-limit="' . (int) $messageLimit . '" maxlength="' . (int) $messageLimit . '"' : null ) . '>' . htmlspecialchars( $row->get( 'message' ) ) . '</textarea>'
						.			$editBody
						.			'<div class="commentContainerFooter">'
						.				'<div class="commentContainerFooterRow clearfix">'
						.					'<div class="commentContainerFooterRowLeft pull-left">'
						.						$editFooter
						.					'</div>'
						.					'<div class="commentContainerFooterRowRight pull-right text-right">'
						.						'<button type="submit" class="commentButton commentButtonEditSave streamItemEditSave btn btn-primary btn-xs">' . CBTxt::T( 'Done Editing' ) . '</button>'
						.						' <button type="button" class="commentButton commentButtonEditCancel streamItemEditCancel btn btn-default btn-xs">' . CBTxt::T( 'Cancel' ) . '</button>'
						.					'</div>'
						.				'</div>'
						.			'</div>'
						.		'</form>'
						.	'</div>';

		return $return;
	}