Example #1
0
 public function getWidgets()
 {
     $output = array();
     if ($this->id) {
         $ws = unserialize(PsPagebuilderHelper::clearUnexpected(trim($this->widget)));
         return $ws;
     }
     return $output;
 }
Example #2
0
 public function buildLayoutData($rows, $ws, $profile, $rl = 1)
 {
     $layout = array();
     $mcrypt = new PtsMcrypt();
     foreach ($rows as $rkey => $row) {
         $row->level = $rl;
         $row = PsPagebuilderHelper::mergeRowData($row);
         foreach ($row->cols as $ckey => $col) {
             $col = PsPagebuilderHelper::mergeColData($col);
             foreach ($col->widgets as $wkey => $w) {
                 $w->wkey = (string) $w->wkey;
                 if ($w && isset($w->wkey) && isset($ws[$w->wkey])) {
                     $content = trim($ws[$w->wkey]['config']);
                     if ($content) {
                         $widget = unserialize(PsPagebuilderHelper::clearUnexpected($content));
                         if (isset($widget['widget'])) {
                             foreach ($widget['widget'] as $k => $v) {
                                 $widget['widget'][$k] = $mcrypt->decode($v);
                             }
                             if (isset($widget['widget']['wtype'])) {
                                 $type = $widget['widget']['wtype'];
                                 $profile->loadWidgetObject($type, $this->context->controller);
                                 $tmp = $profile->getWidgetContent($type, $widget['widget']);
                                 $col->widgets[$wkey]->content = $this->getWidgetContent($w->wkey, $tmp['type'], $tmp['data']);
                             }
                         }
                     }
                 }
             }
             if (isset($col->rows)) {
                 $col->rows = $this->buildLayoutData($col->rows, $ws, $profile, $rl + 1);
             }
             $row->cols[$ckey] = $col;
         }
         $layout[$rkey] = $row;
     }
     return $layout;
 }