Beispiel #1
0
 /**
  * Custom logic code here for setting placeholders, etc
  *
  * @param array $scriptProperties
  * @return array
  */
 public function process(array $scriptProperties = array())
 {
     if (empty($this->scriptProperties['id']) || strlen($this->scriptProperties['id']) !== strlen((int) $this->scriptProperties['id'])) {
         return $this->failure($this->modx->lexicon('dashboard_err_ns'));
     }
     $this->dashboard = $this->modx->getObject('modDashboard', array('id' => $this->scriptProperties['id']));
     if (empty($this->dashboard)) {
         return $this->failure($this->modx->lexicon('dashboard_err_nf'));
     }
     $this->dashboardArray = $this->dashboard->toArray();
     $this->dashboardArray['widgets'] = $this->getWidgets();
     return $this->dashboardArray;
 }
    /**
     * Register custom CSS/JS for the page
     * @return void
     */
    public function loadCustomCssJs()
    {
        $this->addJavascript($this->modx->getOption('manager_url') . 'assets/modext/widgets/modx.panel.welcome.js');
        $this->addJavascript($this->modx->getOption('manager_url') . 'assets/modext/sections/welcome.js');
        $this->addHtml('<script type="text/javascript">
Ext.onReady(function() {
    MODx.load({
        xtype: "modx-page-welcome"
        ,dashboard: ' . $this->modx->toJSON($this->dashboard->toArray()) . '
    });
});
</script>');
        if ($this->showWelcomeScreen) {
            $url = $this->modx->getOption('welcome_screen_url', null, 'http://misc.modx.com/revolution/welcome.20.html');
            $this->addHtml('<script type="text/javascript">
// <![CDATA[
Ext.onReady(function() { MODx.loadWelcomePanel("' . $url . '"); });
// ]]></script>');
        }
    }