public function saveMessage(Core_Sijax_Response $objResponse, $message) { //Save $message to database... if (trim($message) === '') { return $objResponse->alert('Empty messages are not allowed!'); } $timeNow = microtime(true); $messageId = md5($message . $timeNow); $messageContainerId = 'message_' . $messageId; //The message will be invisible at first, and we'll show it using a jquery effect $messageFormatted = ' <div id="' . $messageContainerId . '" style="opacity: 0;"> [<strong>' . date('H:i:s', (int) $timeNow) . '</strong>] ' . $message . ' </div>'; //Append the rendered message at the end $objResponse->htmlAppend('#messages', $messageFormatted); //Clear the textbox and give it focus in case it has lost it $objResponse->attr('#message', 'value', ''); $objResponse->script("\$('#message').focus();"); //Scroll down the messages area $objResponse->script("\$('#messages').attr('scrollTop', \$('#messages').attr('scrollHeight'));"); //Make the new message appear in 400ms $objResponse->script("\$('#{$messageContainerId}').animate({opacity: 1}, 400);"); }
private static function _invalidRequestCallback(Core_Sijax_Response $objResponse, $functionName) { $objResponse->alert('The action you performed is currently unavailable! (Sijax error)'); }