xoops forums

Forum Index


Board index » All Posts (luciorota)




luciorota

Module Developer
Posted on: 9/12 13:58
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#1

Re: xoopsClone issues

Thanks

Quote:

One potential problem is that the XoopsObject has no internal knowledge of it's primary key, so while the object is marked new, it still has any auto-increment PK set. You can work around this issue by doing a $newObject->destroyVars('key-variable-name'); to clean up after a clone.


In fact this is a problem I encountered

Also $vars[$key]['changed'] property si cloned as false, for this reason the cloned object cannot be correctly stored in the database.

In your opinion, can it make sense to correct the xoopsClone() method to create working objects?
Thx


luciorota

Module Developer
Posted on: 9/11 9:52
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#2

xoopsClone issues

Someone can explain to me the correct use of the xoopsClone() method?


luciorota

Module Developer
Posted on: 8/27 14:24
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#3

Re: Display multiple modules inside a list page

Dear,
this is the Xoops site, and is quite different from XOOPS Cube Legacy.
I would like the two projects to become one, but ...

Keep on dreaming fellas!


luciorota

Module Developer
Posted on: 8/23 13:58
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#4

Re: Display multiple modules inside a list page

Welcome!
Which version of Xoops are you using?
Which modules are installed?

Is not possible to show multiple modules in a page but it's possible to show blocks from differents modules ...


luciorota

Module Developer
Posted on: 8/21 12:49
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#5

Re: Database: How do I set a column value to NULL

This is not a solution but a temporary patch.
Define your objects a subclass of ModuleXoopsObject class... this way it is possible to set a column value to NULL...

abstract class ModuleXoopsObject extends XoopsObject {
    
/**
     * @var moduleHelper
     * @access private
     */
    
private $moduleHelper null;

    
/**
     * constructor
     */
    
public function __construct()
    {
        
$this->moduleHelper XmfModuleHelper::getHelper('module');
        
$this->db XoopsDatabaseFactory::getDatabaseConnection();
        
//
        
parent::__construct();
    }
    
    
/**
     * assign a value to a variable (also null is allowed)
     *
     * @access public
     * @param string $key   name of the variable to assign
     * @param mixed  $value value to assign
     * @param bool   $not_gpc
     */
    
public function setVar($key$value$not_gpc false)
    {
        if (!empty(
$key) && isset($value) && isset($this->vars[$key])) {
            
$this->vars[$key]['value']   =& $value;
            
$this->vars[$key]['not_gpc'] = $not_gpc;
            
$this->vars[$key]['changed'] = true;
            
$this->setDirty();
        }
        if (!empty(
$key) && is_null($value) && isset($this->vars[$key])) {
            
$this->vars[$key]['value']   = null;
            
$this->vars[$key]['not_gpc'] = $not_gpc;
            
$this->vars[$key]['changed'] = false;
            
$this->setDirty();
        }
    }
}



abstract class 
ModuleXoopsObjectHandler extends XoopsPersistableObjectHandler
{
    
/**
     * @var moduleHelper
     * @access private
     */
    
private $moduleHelper null;

    
/**
     * @param null|object   $db
     */
    
public function __construct($db null$table ''$className ''$keyName ''$identifierName '')
    {
        
parent::__construct($db$table$className$keyName$identifierName);
        
$this->moduleHelper XmfModuleHelper::getHelper('module');
    }
    
    
/**
     * insert an object into the database
     *
     * @param  XoopsObject $object {@link XoopsObject} reference to object
     * @param  bool        $force  flag to force the query execution despite security settings
     * @return mixed       object ID
     */
    
public function insert(XoopsObject $object$force true)
    {
        
$ret parent::insert($object$force);
        
// handle null values
        
$queryFunc = empty($force) ? 'query' 'queryF';
        
$vars $object->getVars();
        foreach (
$vars as $key => $value) { 
            if (
is_null($value['value'])) {
                
$sql "UPDATE `{$this->table}` SET `{$key}` = NULL WHERE `{$this->keyName}` = {$this->db->quote($object->getVar($this->keyName))}";
                if (!
$result $this->db->{$queryFunc}($sql)) {
                    
//return false;
                

            }
        }
        return 
$ret;
    }
}


luciorota

Module Developer
Posted on: 4/13 14:18
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#6

Re: Module permissions

Quote:

...driving an automated permissions page, similar to the about page


That's exactly what I'm looking for!

2 or more kind of permissions:
- "global permissions" for example: print, user extendee editor, ...
- "per item permissions" for example: read or write into a category, ...
- ...


luciorota

Module Developer
Posted on: 4/11 19:47
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#7

Module permissions

Hi fellas!
Do you know if has anyone tried to move the definition of permissions in the 'xoops_version.php' file?

example
/ ------------------- Perms ------------------- //
$i 0;

$modversion['gperm'] = array();

$modversion['gperm'][] = [
    
'name' => 'itemR',
    
'title' => '_MI_PERM_ITEMR',
    
'description' => '_MI_PERM_ITEMR_DESC',
    
'itemid' => true,
    
'trueifadmin' => true,
    
'category' => ''
];
$modversion['gperm'][] = [
    
'name' => 'itemW',
    
'title' => '_MI_PERM_ITEMW',
    
'description' => '_MI_PERM_ITEMW_DESC',
    
'itemid' => true,
    
'trueifadmin' => true,
    
'category' => ''
];
$modversion['gperm'][] = [
    
'name' => 'itemRW',
    
'title' => '_MI_PERM_ITEMrW',
    
'description' => '_MI_PERM_ITEMRW_DESC',
    
'itemid' => true,
    
'trueifadmin' => true,
    
'category' => ''
];
$modversion['gperm'][] = [
    
'name' => 'print',
    
'title' => '_MI_PERM_PRINT',
    
'description' => '_MI_PERM_PRINT_DESC',
    
'itemid' => false,
    
'trueifadmin' => true,
    
'category' => ''
];


luciorota

Module Developer
Posted on: 1/3 10:24
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#8

Re: Watermark Hack for Xoops Core Imagemanager

Hi
tell us more please


luciorota

Module Developer
Posted on: 12/15 11:37
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#9

Re: Database: How do I set a column value to NULL

Hi Mamba
Everything checked

I think it is a Xoops limit...


luciorota

Module Developer
Posted on: 12/14 22:15
luciorota
luciorota (Show more)
Module Developer
Posts: 197
Since: 2007/4/20
#10

Re: Database: How do I set a column value to NULL

Thanks Mamba
I would like to reset time_update value to NULL
When i use an expression like this:

$itemObj->setVar('myDate'NULL);


does note set 'MyDate' field to NULL but to '0000-00-00'
are there some tips to solve my question?

Thanks again



TopTop
(1) 2 3 4 ... 15 »