Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/www/core/model/modx/processors/system/dashboard/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/system/dashboard/duplicate.class.php
<?php
/**
 * Duplicates a dashboard.
 *
 * @param integer $id The dashboard to duplicate
 * @param string $name The name of the new chunk.
 *
 * @var modX $modx
 * @var array $scriptProperties
 * @var modProcessor $this
 *
 * @package modx
 * @subpackage processors.system.dashboard
 */
class modDashboardDuplicateProcessor extends modObjectDuplicateProcessor {
    public $classKey = 'modDashboard';
    public $languageTopics = array('dashboards');
    public $permission = 'dashboards';
    public $objectType = 'dashboard';

    public function beforeSave() {
        $this->duplicatePlacements();
        return parent::beforeSave();
    }

    public function duplicatePlacements() {
        $oldPlacements = $this->modx->getCollection('modDashboardWidgetPlacement',array(
            'dashboard' => $this->object->get('id'),
        ));
        $placements = array();
        /** @var modDashboardWidgetPlacement $placement */
        foreach ($oldPlacements as $placement) {
            /** @var modDashboardWidgetPlacement $placementCopy */
            $placementCopy = $this->modx->newObject('modDashboardWidgetPlacement');
            $placementCopy->fromArray(array(
                'widget' => $placement->get('widget'),
                'rank' => $placement->get('rank'),
            ),'',true,true);
            $placements[] = $placementCopy;
        }
        $this->newObject->addMany($placements);
    }
}
return 'modDashboardDuplicateProcessor';

Spamworldpro Mini