Implementation of feature request 1412. Creating view for empty resultset

Refactored work of pull request 226. 

I created two functions 

getViewLinkForQuery whose work is to generate span tag for View. The function was used in _getResultOperation also. It's purpose was to reduce code duplication

The second function was getCreateViewQueryResultOp() whose purpose is to display create view link in case empty resultset is produced. It calls getViewLinkForQuery() to generate span tag and it is called from sql.php

If function names are not appropriate, then please suggest one, because i feel like they are not right.