11
luciorota
Re: Datetime problems with Publisher 1.07 Final and Xoops 2.5.10
  • 2020/4/22 19:56

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


Try again ... Xoops using "\DateTime" and not "DateTime"
Quote:

luciorota wrote:
The bug is the result of an incorrect use of the function strtotime(), it must have a format in English to work...

BUGFIX

file: publisher\class\item.php, line 1061
replace
$localTimestamp strtotime($resDate['date']) + $resTime['time'];


with
$dateTimeObj \DateTime::createFromFormat(_SHORTDATESTRING$resDate['date']);
$dateTimeObj->setTime(000);
$localTimestamp $dateTimeObj->getTimestamp() + $resTime['time'];


file: publisher\class\item.php, line 1088

replace
$localTimestamp strtotime($resExDate['date']) + $resExTime['time'];


with
$dateTimeObj \DateTime::createFromFormat(_SHORTDATESTRING$resExDate['date']);
$dateTimeObj->setTime(000);
$localTimestamp $dateTimeObj->getTimestamp() + $resExTime['time'];


Good job! / Buon lavoro!



12
luciorota
Re: Datetime problems with Publisher 1.07 Final and Xoops 2.5.10
  • 2020/4/22 12:23

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


I know



13
luciorota
Re: Datetime problems with Publisher 1.07 Final and Xoops 2.5.10
  • 2020/4/21 19:18

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


The bug is the result of an incorrect use of the function strtotime(), it must have a format in English to work...

BUGFIX

file: publisher\class\item.php, line 1061
replace
$localTimestamp strtotime($resDate['date']) + $resTime['time'];


with
$dateTimeObj DateTime::createFromFormat(_SHORTDATESTRING$resDate['date']);
$dateTimeObj->setTime(000);
$localTimestamp $dateTimeObj->getTimestamp() + $resTime['time'];


file: publisher\class\item.php, line 1088

replace
$localTimestamp strtotime($resExDate['date']) + $resExTime['time'];


with
$dateTimeObj DateTime::createFromFormat(_SHORTDATESTRING$resExDate['date']);
$dateTimeObj->setTime(000);
$localTimestamp $dateTimeObj->getTimestamp() + $resExTime['time'];


Good job! / Buon lavoro!



14
luciorota
Re: Datetime problems with Publisher 1.07 Final and Xoops 2.5.10
  • 2020/4/21 17:59

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


Hi Lupin /Ciao Lupin

Do not change

define('_DBDATESTRING',"Y-m-d");
define('_DBTIMESTRING',"H:i:s");
define('_DBTIMESTAMPSTRING',"Y-m-d H:i:s");


These definition are db related (MySQL date and time data types) and they are NOT dependent on the language used ...

Lucio



15
luciorota
Re: xoopsClone issues
  • 2019/9/12 13:58

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


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



16
luciorota
xoopsClone issues
  • 2019/9/11 9:52

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


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



17
luciorota
Re: Display multiple modules inside a list page
  • 2019/8/27 14:24

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


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!



18
luciorota
Re: Display multiple modules inside a list page
  • 2019/8/23 13:58

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


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 ...



19
luciorota
Re: Database: How do I set a column value to NULL
  • 2019/8/21 12:49

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


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;
    }
}



20
luciorota
Re: Module permissions
  • 2019/4/13 14:18

  • luciorota

  • Module Developer

  • Posts: 211

  • Since: 2007/4/20


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, ...
- ...




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



Login

Username:
Password:

Lost Password? Register now!

Who's Online

69 user(s) are online (42 user(s) are browsing Support Forums)


Members: 0


Guests: 69


more...

Donat-O-Meter

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

Latest GitHub Commits