91
Tarik
Re: Open letter to module devs
  • 2011/2/12 3:44

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


In my opinion i disagree with the fact about laziness (new GUI every time), I think a new GUI isn't always disturbing but at the contrary exiting -discovering a new world - and it's as @aph3x said annoying to have all modules with the same architecture design (not that it's bad but that architecture is bad used) like using tables .
Tables are for me the hard element to style because it doesn't give you freedom to manipulate but what make it a hell, is that there is no id or class to address a specific table because most table have some basic ids like 'form' or nothing at all so most of times when i use a modules, i always have to make some modifications on the modules templates scale and sometimes even on the PHP (not that it's hard but why to have to do it), i should give an example to make it clearer: when i first used TDMDownloads i like it but the way it look was old fashioned (the same look as mydownloads, wfsdownloads) so i had to hack the modules file to first i had to clean the tables nest ( a lot of tables) to what is easier to style so i practically changed all the templates but at the end most of the the thing has no ids and classes (not the ones in templates but element generated by PHP and displayed by one tpl variable so i had to go to PHP side to identify every thing i found so why this...
Designers make developers life a lot easier as example when coding a page displaying an error all i have to do is to echo it in a div with id=errorMsg only without further work (admin side)
In addition a new module GUI give the website a unique look




Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



92
Tarik
Re: Ajax File Uploading 1.01
  • 2011/2/4 12:55

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


thank you very much, it's what i needed
i will give results asap
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



93
Tarik
Re: XoopsObject & XoopsObjectHandler some guidelines?
  • 2011/2/4 12:53

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


Sorry for the late response, but it's what I'm wondering about XoopsObjectHandler has methods undefined as opposite they are redefined in XoopsPresistentObjectHandler, so what is the deal between these two
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



94
Tarik
Re: XE Banner
  • 2011/2/4 12:49

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


Resized Image
not the best one but here it is
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



95
Tarik
Re: XoopsObject & XoopsObjectHandler some guidelines?
  • 2011/1/29 17:32

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


Ghia & Trabis, Thank you very much for this big amount of info
as for variables to be sanitized before giving it to the object i found very odd that the XoopsObject do already the work so thank you for clearing it.

I have an other dummy question what is the diffrence between XoopsObjectHandler and XoopsPresistentObjectHandler?
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



96
Tarik
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/29 17:28

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


if it's in a template you can use

<{$xoops_userid}>
User ID of the member

<{$xoops_uname}>
Uname for the member
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



97
Tarik
Re: The big problem I have whit XOOPS
  • 2011/1/26 21:21

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


Quote:
[off]I hope ForMusS baby is fine and make good and long nights. Please baby, be wise ! We need your dady back [/off]

My best wishes to ForMusS btw

as for the content module it's necessarily to adopt a content module as official because when we setup a xoops website we can at least make some pages

but what must be considered is what type of content module, is it a fully customized one (news, xnews, publisher ...) or a simple one (content ...)

in my point of view i vote for a simpler one like content and publisher as a second choice ( fully customized need some features nut it's a very good module )
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



98
Tarik
Re: XoopsObject & XoopsObjectHandler some guidelines?
  • 2011/1/26 20:42

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


here are my questions
1- what is the role of identifierName when constructing the handlerclass
2- how do function tables relation (jointures in french) like category table and download table
3- the link for the class generator is broken
4- is there any thing wrong so far
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



99
Tarik
XoopsObject & XoopsObjectHandler some guidelines?
  • 2011/1/26 20:24

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


Hello, everybody I'm Tarik not new to xoops (almost 2 years), I xoopsed some themes and created some of my own but now i want to upgrade my knowledge about module developing, and the basic thing to know when creating a Modules with poo - using classes instead of functions -
The tutos and resources about this two classes are quite few here it will give you a start but the problem is when you want to develop on a certain level you need to have a full idea about the function of each class and the difference between them so i opened this tread - finally the reason - to expose some of the things that are flow to me and in the same time expose what i learned (maybe exporting the result to media wiki)

here is what i have got until now about these two classes:

Quote:
The object model in xoops is based on 2 classes XoopsObject and XoopsObjectHandler both encoded in the file /kernel/object.php. These two classes form the gateway to access to persistent data such as it is described in the DAO pattern. It is by specializing them we implement the model for a particular entity (often associated to a single table BD) as do all classes of the kernel directory which is the core of xoops. I strongly encourage developers of new modules based on xoops tables `BD using this model.

XoopsObject has all the services related to managing an object (an instance of the class) and attributes (getter and setter)

XoopsObjectHandler while serving manipulator or controller instances (insertion, modification or selection objects..)

(translated from here)


example of it (liaise)
class PmMessage extends XoopsObject

{

    function 
__construct() {
        
$this->XoopsObject();
        
$this->initVar('msg_id'XOBJ_DTYPE_INTnullfalse);
        
$this->initVar('msg_image'XOBJ_DTYPE_OTHER'icon1.gif'false100);
        
$this->initVar('subject'XOBJ_DTYPE_TXTBOXnulltrue255);
        
$this->initVar('from_userid'XOBJ_DTYPE_INTnulltrue);
        
$this->initVar('to_userid'XOBJ_DTYPE_INTnulltrue);
        
$this->initVar('msg_time'XOBJ_DTYPE_INTtime(), false);
        
$this->initVar('msg_text'XOBJ_DTYPE_TXTAREAnulltrue);
        
$this->initVar('read_msg'XOBJ_DTYPE_INT0false);
        
$this->initVar('from_delete'XOBJ_DTYPE_INT1false);
        
$this->initVar('to_delete'XOBJ_DTYPE_INT0false);
        
$this->initVar('from_save'XOBJ_DTYPE_INT0false);
        
$this->initVar('to_save'XOBJ_DTYPE_INT0false);
    }

    function 
PmMessage(){
        
$this->__construct();
    }
}


and the sql table that this class is intended to has this skeleton:
CREATE TABLE `pm_messages` (

  `
msg_id`      int(10unsigned        NOT NULL auto_increment,
  `
msg_image`   varchar(255)            default NULL,
  `
subject`     varchar(255)            NOT NULL default '',
  `
from_useridmediumint(8unsigned   NOT NULL default '0',
  `
to_userid`   mediumint(8unsigned   NOT NULL default '0',
  `
msg_time`    int(10unsigned        NOT NULL default '0',
  `
msg_text`    text,  
  `
read_msg`    tinyint(1unsigned     NOT NULL default '0',
  `
from_deletetinyint(1unsigned     NOT NULL default '1',
  `
from_save`   tinyint(1unsigned     NOT NULL default '0',
  `
to_delete`   tinyint(1unsigned     NOT NULL default '0',
  `
to_save`     tinyint(1unsigned     NOT NULL default '0',

  

  
PRIMARY KEY  (`msg_id`),
  
KEY to_userid (`to_userid`),
  
KEY inbox (`to_userid`,`read_msg`),
  
KEY outbox (`from_userid`, `read_msg`),
  
KEY prune (`msg_time`, `read_msg`, `from_save`, `to_delete`)
TYPE=MyISAM;


so basically the class extended from xoopsobject
class Moduletable extends XoopsObject {
    function 
__construct(){
        
$this->XoopsObject();
    
//    key, data_type, value, req, max, opt
        //        foreach column
        
$this->initVar(keydata_typevaluereqmaxopt);
    }
        function 
Moduletable() {
              
$this->__construct();
        }
}

Data Types (for initVar function above):

* XOBJ_DTYPE_TXTBOX - Text Box
* XOBJ_DTYPE_TXTAREA - Text Area
* XOBJ_DTYPE_INT - Integer
* XOBJ_DTYPE_URL - URLs
* XOBJ_DTYPE_EMAIL - E-mails
* XOBJ_DTYPE_ARRAY - Arrays
* XOBJ_DTYPE_OTHER - Others (won't be cleaned)
* XOBJ_DTYPE_SOURCE -
* XOBJ_DTYPE_STIME - Short Time
* XOBJ_DTYPE_MTIME - Medium Time
* XOBJ_DTYPE_LTIME - Long Time

now come the xoopsobjecthandler
here is an example
class PmMessageHandler extends XoopsPersistableObjectHandler{
    function 
__construct(&$db) {
        
parent::__construct($db"priv_msgs"'PmMessage''msg_id''subject');
    }
    function 
PmMessageHandler(&$db){
        
$this->__construct($db);
    }
}


so the form is
class ModuletableHandler extends XoopsPersistableObjectHandler{
    function 
__construct(&$db) {
        
parent::__construct($db"table name"'Moduletable''keyName''identifierName');
    }
    function 
ModuletableHandler(&$db){
        
$this->__construct($db);
    }
}

all this is good when wanting to retrive an object
$name_handler =& xoops_getModuleHandler('Modulename''classname);

then retrieve the object with an id
$name =& $name_handler->get($id);

finally we can have values for each column of the table
$name->getVar('Key')


Now for inserting data
here is an example
$pm_handler =& xoops_getModuleHandler('message''pm');
        
$pm =& $pm_handler->create();
        
$pm->setVar("msg_time"time());
        
$pm->setVar("subject"$_POST['subject']);
        
$pm->setVar("msg_text"$_POST['message']);
        
$pm->setVar("to_userid"$_POST['to_userid']);
        
$pm->setVar("from_userid"$GLOBALS['xoopsUser']->getVar("uid"));

        if (!
$pm_handler->insert($pm)) {
            echo 
$pm->getHtmlErrors();
        }

so the first line is for acessing the handler
the second line is to creating a new object
then setting vars
to finally insert them

with getHtmlErrors() to have errors

all these things are simple
hope someone would get some info from tis
Tarik
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.



100
Tarik
Re: Looking to get current user information and some fields from user profile.
  • 2011/1/25 12:36

  • Tarik

  • Not too shy to talk

  • Posts: 170

  • Since: 2010/2/3 1


global $xoopuser;

this line is used when you ant to use $xoopuser in a function, class...
because it make her a global variable accessed from anywhere
further explanation here
Some people like what you do,
-- some people hate what you do,
---- but most people simply don’t give a damn.




TopTop
« 1 ... 7 8 9 (10) 11 12 13 ... 15 »



Login

Who's Online

170 user(s) are online (111 user(s) are browsing Support Forums)


Members: 0


Guests: 170


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits