<br><br><div class="gmail_quote">On Tue, May 22, 2012 at 6:02 PM, Rouslan Placella <span dir="ltr"><<a href="mailto:rouslan@placella.com" target="_blank">rouslan@placella.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>On 22/05/12 12:57, Chanaka Dharmarathna wrote:<br>
> On Tue, May 22, 2012 at 12:54 AM, Chanaka Dharmarathna<<br>
> <a href="mailto:pe.chanaka.ck@gmail.com" target="_blank">pe.chanaka.ck@gmail.com</a>> wrote:<br>
><br>
>><br>
>><br>
>> On Mon, May 21, 2012 at 6:58 PM, Chanaka Dharmarathna<<br>
>> <a href="mailto:pe.chanaka.ck@gmail.com" target="_blank">pe.chanaka.ck@gmail.com</a>> wrote:<br>
>><br>
>>><br>
>>><br>
>>> On Mon, May 21, 2012 at 6:31 PM, Michal Èihaø<<a href="mailto:michal@cihar.com" target="_blank">michal@cihar.com</a>> wrote:<br>
>>><br>
>>>> Hi<br>
>>>><br>
>>>> Dne Mon, 21 May 2012 12:28:42 +0530<br>
>>>> Chanaka Dharmarathna<<a href="mailto:pe.chanaka.ck@gmail.com" target="_blank">pe.chanaka.ck@gmail.com</a>> napsal(a):<br>
>>>><br>
>>>>> Thanks for giving your feedback.<br>
>>>>> Yes, I did more changes to the code.<br>
>>>>> Pleas get me into the right track if I'm going wrong.<br>
>>>><br>
>>>> I think you're heading in right direction - splitting the code to<br>
>>>> smaller blocks which are easy to understand always helps.<br>
>>>><br>
>>>> I'm currently commenting some things in your commits, so let's keep<br>
>>>> this part on github.<br>
>>>><br>
>>>> --<br>
>>>> Michal Èihaø | <a href="http://cihar.com" target="_blank">http://cihar.com</a> | <a href="http://blog.cihar.com" target="_blank">http://blog.cihar.com</a><br>
>>>><br>
>>>><br>
>>>> ------------------------------------------------------------------------------<br>
>>>> Live Security Virtual Conference<br>
>>>> Exclusive live event will cover all the ways today's security and<br>
>>>> threat landscape has changed and how IT managers can respond. Discussions<br>
>>>> will include endpoint security, mobile security and the latest in malware<br>
>>>> threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>
>>>> _______________________________________________<br>
>>>> Phpmyadmin-devel mailing list<br>
>>>> <a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
>>>> <a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
>>>><br>
>>>><br>
>>> Hi Michal,<br>
>>><br>
>>> That's good to hear.<br>
>>> I put a reply in github<br>
>>><br>
>>><br>
>>> Regards !<br>
>>> --<br>
>>> ____________________________________<br>
>>><br>
>>> Chanaka Indrajith<br>
>>> Bsc.Computer Engineering Undergraduate<br>
>>> Faculty of Engineering<br>
>>> University of Peradeniya<br>
>>> Sri Lanka<br>
>>> ____________________________________<br>
>>><br>
>>><br>
>> Hi Michal,<br>
>><br>
>> I'm going to change my plans little bit.<br>
>> At the moment I think the most prioritized task is to make the<br>
>> display_tbl.lib.php file as a PHP class.<br>
>> So, if there is no matter of that, I'll involve with this task in this<br>
>> week (In my third week).<br>
>><br>
>><br>
>> Regards !<br>
>> --<br>
>> ____________________________________<br>
>><br>
>> Chanaka Indrajith<br>
>> Bsc.Computer Engineering Undergraduate<br>
>> Faculty of Engineering<br>
>> University of Peradeniya<br>
>> Sri Lanka<br>
>> ____________________________________<br>
>><br>
>><br>
> Hi Michal,<br>
><br>
> I have a plan on introducing Display class instead of the set of global<br>
> functions inside the display_tbl.lib.php file.<br>
><br>
> Currently the only function which used by the outsiders is PMA_getTable().<br>
> And the only outside file accessed this function is sql.php file.<br>
><br>
> With the Display class,<br>
> All fields and methods other that getTable() method are keep as private.<br>
> To remove the use of global fields in every function, instance variables<br>
> are used and they are initialized by a separate function which is inside<br>
> the getTable() method. For initializing them Global variables are used.<br>
><br>
> I have documented the rough plan about my design in my blog [0].<br>
> The design for this should also be extend with the future plans of PMA.<br>
> So I'm waiting to hear your comments and suggestions to create a solid<br>
> design.<br>
><br>
> [0] :<br>
> <a href="http://chanakaindrajith.blogspot.com/2012/05/design-for-display-class-of-pma.html" target="_blank">http://chanakaindrajith.blogspot.com/2012/05/design-for-display-class-of-pma.html</a><br>
><br>
> Regards !<br>
<br>
</div></div>Not sure why your methods are static and you have an initialisation<br>
method. To me it makes more sense to have non-static methods are the use<br>
of a constructor for the class. This way, the usage will be even more<br>
extensible. Also the class name is not very descriptive.<br>
<br>
How about something like this?<br>
<br>
$table = PMA_TableDisplay($GLOBALS['db'], $GLOBALS['table']);<br>
echo $table->getDisplay();<br>
<br>
class PMA_TableDisplay {<br>
private $_db;<br>
private $_table;<br>
public function __contruct($db, $table) {<br>
$this->_db = $db;<br>
$this->_table = $table;<br>
}<br>
public function getDisplay() {<br>
// ...<br>
}<br>
private static function getTableHeaders() {<br>
// ...<br>
$msg = getMessage($this->_db, $this->_table);<br>
// ...<br>
}<br>
// ...<br>
}<br>
<br>
BTW, what about extending our existing PMA_Table class? I'm not sure how<br>
good of an idea it is, so I'm just throwing it out there...<br>
<br>
Bye,<br>
Rouslan<br>
<div><div><br>
------------------------------------------------------------------------------<br>
Live Security Virtual Conference<br>
Exclusive live event will cover all the ways today's security and<br>
threat landscape has changed and how IT managers can respond. Discussions<br>
will include endpoint security, mobile security and the latest in malware<br>
threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>
_______________________________________________<br>
Phpmyadmin-devel mailing list<br>
<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net" target="_blank">Phpmyadmin-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
</div></div></blockquote></div><br>Hi Rouslan,<br><br>Thanks for participating to this discussion and share your valuable suggestions.<br><br>As I remember Michal has already suggested to not to use an object of this case.<br>
And use PMA_Display::someFunction where needed.<br>Thats why I focused on static fields and behaviors.<br><br>The constructor of the function only executed, if create an object of a class. (I think your code trying to say create an object, new keyword is missing there). <br>
So I don't think to get the use of a constructor. That's why I'm using a function for initialize instance variables.<br><br>I'm agreed to use more meaningful name. It is better if we can name it as PMA_DisplayTable .<br>
<br>Regards !<br>-- <br>____________________________________<br><br>Chanaka Indrajith<br>Bsc.Computer Engineering Undergraduate<br>Faculty of Engineering<br>University of Peradeniya<br>Sri Lanka<br>____________________________________<br>
<br>