コード例 #1
0
ファイル: widget.ajax.php プロジェクト: tlo/plugin-widget
     $widget = widget::byPath(init('path'));
     if (!is_object($widget)) {
         throw new Exception(__('Widget non trouvé : ', __FILE__) . init('path'));
     }
     $data = init('data');
     $copy = $widget->copy($data);
     $result = utils::o2a($copy);
     $result['path'] = $copy->generatePath();
     $result['data'] = $data;
     ajax::success($result);
 }
 if (init('action') == 'sidebar') {
     ajax::success(widget::getSideBarList());
 }
 if (init('action') == 'container') {
     ajax::success(widget::getContainer());
 }
 if (init('action') == 'applyWidget') {
     if (init('path') != 'default') {
         $widget = widget::byPath(init('path'));
         if (!is_object($widget)) {
             throw new Exception(__('Widget non trouvé : ', __FILE__) . init('path'));
         }
     }
     $cmds = json_decode(init('cmds'), true);
     foreach ($cmds as $cmd_id) {
         $cmd = cmd::byId($cmd_id);
         if (!is_object($cmd)) {
             throw new Exception(__('Commande introuvable : ', __FILE__) . $cmd_id);
         }
         if (init('path') != 'default') {