xoops forums

Forum Index


Board index » All Posts (luciorota)




luciorota

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

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: 2019/8/21 12:49
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#12

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: 2019/4/13 14:18
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#13

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: 2019/4/11 19:47
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#14

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: 2019/1/3 10:24
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#15

Re: Watermark Hack for Xoops Core Imagemanager

Hi
tell us more please


luciorota

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

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: 2018/12/14 22:15
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#17

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


luciorota

Module Developer
Posted on: 2018/12/12 15:43
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#18

Database: How do I set a column value to NULL

I have a question.

I have to set a database column value to NULL but ...
My object is an extension of XoopsPersistableObject class.
Var 'date' data type is XOBJ_DTYPE_DATE
Database field is defines as
date DATE NULL DEFAULT NULL

Any suggestion?


luciorota

Module Developer
Posted on: 2018/12/3 15:54
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#19

FOREIGN KEY

Hi everybody
How can I set FOREIGN KEY on module tables when I use Xoops modules installation procedure?
Thanks
Lucio


luciorota

Module Developer
Posted on: 2018/10/15 18:17
luciorota
luciorota (Show more)
Module Developer
Posts: 204
Since: 2007/4/20
#20

Smarty 3.1.33

Hi to everybody
why not update Xoops 2.5.10 Smarty version to 3.xx trunk?
I did not find compatibility problems in my tests.

Lucio



TopTop
« 1 (2) 3 4 5 ... 16 »