コード例 #1
0
 public function onStylesRowUpdate(Kwf_Events_Event_Row_Updated $e)
 {
     $s = new Kwf_Model_Select();
     $s->whereEquals('uses_styles', true);
     $s->where(new Kwf_Model_Select_Expr_Like('content', '%class="style' . $e->row->id . '"%'));
     $rows = Kwc_Basic_Text_Component::createOwnModel($this->_class)->export(Kwf_Model_Interface::FORMAT_ARRAY, $s, array('columns' => array('component_id')));
     foreach ($rows as $row) {
         foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($row['component_id']) as $c) {
             if ($c->componentClass == $this->_class) {
                 $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
             }
         }
     }
 }
コード例 #2
0
ファイル: Form.php プロジェクト: nsams/koala-framework
 public function __construct($name, $class, $id = null)
 {
     $this->setModel(Kwc_Basic_Text_Component::createOwnModel($class));
     parent::__construct($name, $class, $id);
     $field = new Kwf_Form_Field_HtmlEditor('content', trlKwf('Text'));
     $field->setData(new Kwf_Data_Kwc_ComponentIds('content'));
     $field->setHideLabel(true);
     $ignoreSettings = array('tablename', 'componentName', 'default', 'assets', 'assetsAdmin', 'placeholder', 'plugins');
     $c = strpos($class, '.') ? substr($class, 0, strpos($class, '.')) : $class;
     foreach (call_user_func(array($c, 'getSettings')) as $key => $val) {
         if (!in_array($key, $ignoreSettings)) {
             $method = 'set' . ucfirst($key);
             $field->{$method}($val);
         }
     }
     $generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
     $classes = $generators['child']['component'];
     if ($classes['link']) {
         $cfg = new Kwf_Component_Abstract_ExtConfig_Form($classes['link']);
         $c = $cfg->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
         $field->setLinkComponentConfig($c['form']);
     }
     if ($classes['image']) {
         $c = Kwc_Admin::getInstance($classes['image'])->getExtConfig();
         $field->setImageComponentConfig($c['form']);
     }
     if ($classes['download']) {
         $c = Kwc_Admin::getInstance($classes['download'])->getExtConfig();
         $field->setDownloadComponentConfig($c['form']);
     }
     if (Kwc_Abstract::getSetting($this->getClass(), 'enableStylesEditor')) {
         $admin = Kwc_Admin::getInstance($class);
         $field->setStylesEditorConfig(array('xtype' => 'kwc.basic.text.styleseditor', 'blockStyleUrl' => $admin->getControllerUrl('BlockStyle'), 'inlineStyleUrl' => $admin->getControllerUrl('InlineStyle'), 'masterStyleUrl' => $admin->getControllerUrl('MasterStyle')));
     }
     $t = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($class, 'stylesModel'));
     $field->setStyles($t->getStyles());
     $field->setComponentClass($class);
     $field->setControllerUrl(Kwc_Admin::getInstance($class)->getControllerUrl());
     $this->fields->add($field);
     $this->setAssetsPackage(Kwf_Assets_Package_Default::getInstance('Frontend'));
 }