示例#1
0
 public function setup()
 {
     parent::setup();
     if (!($this->dmModule = self::$serviceContainer->getService('module_manager')->getModule($this->dmWidget->get('module')))) {
         throw new dmException('the module "%s" does not exist', $this->dmWidget->get('module'));
     }
     if (!($this->dmComponent = $this->dmModule->getComponent($this->dmWidget->get('action')))) {
         throw new dmException(sprintf('the action "%s" does not exist for module "%s"', $this->dmWidget->get('action'), $this->dmModule));
     }
 }
示例#2
0
 protected function renderEdit(dmWidgetBaseForm $form, dmWidgetType $widgetType, $withCopyActions = true)
 {
     $helper = $this->getHelper();
     $devActions = '';
     if ($this->getUser()->can('code_editor') && $form instanceof dmWidgetProjectForm) {
         $templateDir = dmOs::join(sfConfig::get('sf_app_module_dir'), $form->getDmModule()->getKey(), 'templates', '_' . $form->getDmComponent()->getKey() . '.php');
         if (file_exists($templateDir)) {
             $devActions .= '<a href="#' . dmProject::unRootify($templateDir) . '" class="code_editor s16 s16_code_editor block">' . $this->getI18n()->__('Edit template code') . '</a>';
         }
         $componentDir = dmOs::join(sfConfig::get('sf_app_module_dir'), $form->getDmModule()->getKey(), 'actions/components.class.php');
         if (file_exists($componentDir)) {
             $devActions .= '<a href="#' . dmProject::unRootify($componentDir) . '" class="code_editor s16 s16_code_editor block">' . $this->getI18n()->__('Edit component code') . '</a>';
         }
     }
     if ($devActions) {
         $devActions = '<div class="code_editor_links">' . $devActions . '</div>';
     }
     $copyActions = '';
     if ($withCopyActions && $this->getUser()->can('widget_add')) {
         $copyActions = $helper->tag('div.dm_cut_copy_actions.none', $helper->link('+/dmWidget/cut')->param('widget_id', $form->getDmWidget()->get('id'))->text('')->title($this->getI18n()->__('Cut'))->set('.s16block.s16_cut.dm_widget_cut') . $helper->link('+/dmWidget/copy')->param('widget_id', $form->getDmWidget()->get('id'))->text('')->title($this->getI18n()->__('Copy'))->set('.s16block.s16_copy.dm_widget_copy'));
     }
     return $helper->tag('div.dm.dm_widget_edit.' . dmString::underscore($widgetType->getFullKey()) . '_form', array('json' => array('form_class' => $widgetType->getFullKey() . 'Form', 'form_name' => $form->getName())), $form->render('.dm_form.list.little') . $devActions . $copyActions);
 }