public static function getAllMaintenanceJobs()
 {
     static $ret;
     if (isset($ret)) {
         return $ret;
     }
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (is_instance_of($c, 'Kwf_Util_Maintenance_JobProviderInterface')) {
             $providerClasses[] = $c;
         }
     }
     foreach (Kwf_Model_Abstract::findAllInstances() as $model) {
         if ($model instanceof Kwf_Util_Maintenance_JobProviderInterface) {
             $providerClasses[] = get_class($model);
         }
     }
     $jobClasses = array();
     foreach ($providerClasses as $c) {
         $jobClasses = array_merge($jobClasses, call_user_func(array($c, 'getMaintenanceJobs')));
     }
     $jobClasses = array_unique($jobClasses);
     $ret = array();
     foreach ($jobClasses as $i) {
         $ret[] = new $i();
     }
     usort($ret, array('Kwf_Util_Maintenance_Dispatcher', '_compareJobsPriority'));
     return $ret;
 }
 protected function _build($options)
 {
     echo "\nsettings...\n";
     if (!file_exists('build/component')) {
         mkdir('build/component');
     }
     Kwf_Component_Settings::resetSettingsCache();
     foreach (glob('build/component/*') as $f) {
         unlink($f);
     }
     $fileName = 'build/component/settings';
     try {
         $data = Kwf_Component_Settings::_getSettingsCached();
     } catch (Kwf_Trl_BuildFileMissingException $e) {
         $originatingException = $e->getSettingsNonStaticTrlException();
         if ($originatingException) {
             throw $originatingException;
         }
         throw $e;
     }
     foreach ($data as $cmp => $settings) {
         self::_checkSettings($cmp, $settings);
     }
     file_put_contents($fileName, serialize($data));
     $componentClasses = Kwc_Abstract::getComponentClasses();
     echo "masterLayouts...\n";
     Kwf_Component_MasterLayout_Abstract::_buildAll($componentClasses);
     echo "layouts...\n";
     Kwf_Component_Layout_Abstract::_buildAll($componentClasses);
 }
Пример #3
0
 public static function getLanguages()
 {
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     $possibleUserLanguages = array();
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $possibleUserLanguages[] = $lang;
         }
     }
     $userModel = Kwf_Registry::get('userModel');
     if (isset($userModel->getAuthedUser()->language) && $userModel->getAuthedUser()->language && in_array($userModel->getAuthedUser()->language, $possibleUserLanguages)) {
         $langs[] = $userModel->getAuthedUser()->language;
     }
     if (Kwf_Component_Data_Root::getComponentClass()) {
         $lngClasses = array();
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::hasSetting($c, 'baseProperties') && in_array('language', Kwc_Abstract::getSetting($c, 'baseProperties'))) {
                 $lngClasses[] = $c;
             }
         }
         $lngs = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($lngClasses, array('ignoreVisible' => true));
         foreach ($lngs as $c) {
             if (Kwf_Registry::get('acl')->getComponentAcl()->isAllowed($userModel->getAuthedUser(), $c)) {
                 $langs[] = $c->getLanguage();
             }
         }
     }
     return array_unique($langs);
 }
Пример #4
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_ParentChanged', 'callback' => 'onPageParentChanged');
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         $classWithoutPoint = $class;
         if (($pos = strpos($class, '.')) !== false) {
             $classWithoutPoint = substr($class, 0, $pos);
         }
         if (Kwc_Abstract::getFlag($class, 'hasAlternativeComponent') && in_array($this->_class, call_user_func(array($classWithoutPoint, 'getAlternativeComponents'), $class))) {
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
         }
         foreach (Kwc_Abstract::getSetting($class, 'generators') as $generator) {
             if ($generator['class'] == 'Kwf_Component_Generator_Box_StaticSelect' && is_array($generator['component']) && in_array($this->_class, $generator['component'])) {
                 foreach ($generator['component'] as $componentClass) {
                     if ($componentClass == $this->_class) {
                         continue;
                     }
                     $ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
                     $ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
                 }
             }
         }
     }
     return $ret;
 }
Пример #5
0
 private function _getAllLanguages()
 {
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $langs[] = $lang;
         }
     }
     if (Kwf_Component_Data_Root::getComponentClass()) {
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::getFlag($c, 'hasAvailableLanguages')) {
                 foreach (call_user_func(array($c, 'getAvailableLanguages'), $c) as $i) {
                     if (!in_array($i, $langs)) {
                         $langs[] = $i;
                     }
                 }
             }
         }
     }
     $langs = array_unique($langs);
     return $langs;
 }
 public function alterBackendOrderForm(Kwc_Shop_AddToCartAbstract_FrontendForm $form)
 {
     $component = null;
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (is_instance_of($c, 'Kwc_Shop_Products_Directory_Component')) {
             $detailClasses = Kwc_Abstract::getChildComponentClasses($c, 'detail');
             foreach ($detailClasses as $key => $class) {
                 if (Kwc_Abstract::getChildComponentClass($class, 'addToCart') == $this->_class) {
                     $component = $key;
                 }
             }
         }
     }
     $m = Kwf_Model_Abstract::getInstance('Kwc_Shop_Products');
     $s = $m->select();
     $s->whereEquals('visible', 1);
     if ($component) {
         $s->whereEquals('component', $component);
     }
     $s->order('pos');
     $data = array();
     foreach ($m->getRows($s) as $product) {
         $data[] = array($product->current_price_id, $product->__toString() . ' (' . $product->current_price . ' €)');
     }
     $form->prepend(new Kwf_Form_Field_Select('shop_product_price_id', trlKwfStatic('Product')))->setValues($data)->setAllowBlank(false);
 }
 public function findModels()
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $componentClass) {
         $cls = strpos($componentClass, '.') ? substr($componentClass, 0, strpos($componentClass, '.')) : $componentClass;
         $m = call_user_func(array($cls, 'createOwnModel'), $componentClass);
         if ($m) {
             self::_findAllInstancesProcessModel($ret, $m);
         }
         $m = call_user_func(array($cls, 'createChildModel'), $componentClass);
         if ($m) {
             self::_findAllInstancesProcessModel($ret, $m);
         }
         foreach (Kwc_Abstract::getSetting($componentClass, 'generators') as $g) {
             if (isset($g['model'])) {
                 self::_findAllInstancesProcessModel($ret, $g['model']);
             }
         }
     }
     if ($root = Kwf_Component_Data_Root::getInstance()) {
         foreach ($root->getPlugins('Kwf_Component_PluginRoot_Interface_Models') as $plugin) {
             foreach ($plugin->getModels() as $model) {
                 self::_findAllInstancesProcessModel($ret, $model);
             }
         }
     }
     return $ret;
 }
Пример #8
0
 public function getListeners()
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (Kwc_Abstract::getFlag($c, 'requestHttps')) {
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onComponentAdded');
         }
     }
     return $ret;
 }
Пример #9
0
 public static function getItemDirectoryClasses($directoryClass)
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (is_instance_of($c, 'Kwc_Blog_Directory_Component')) {
             $ret[] = $c;
         }
     }
     return $ret;
 }
Пример #10
0
 public static function getItemDirectoryClasses($directoryClass)
 {
     $ret = array();
     $class = self::getSetting($directoryClass, 'showDirectoryClass');
     foreach (Kwc_Abstract::getComponentClasses() as $cls) {
         if (is_instance_of($cls, $class)) {
             $ret[] = $cls;
         }
     }
     return $ret;
 }
Пример #11
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         if (in_array('Kwc_Advanced_SearchEngineReferer_Component', Kwc_Abstract::getParentClasses($class))) {
             $m = Kwc_Abstract::createChildModel($class);
             $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowInsert');
         }
     }
     return $ret;
 }
Пример #12
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         if ($this->_canCreateUsIndirectly($class)) {
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onClassContentChanged');
             $ret[] = array('class' => $class, 'event' => 'Kwc_Abstract_Image_ImageChangedEvent', 'callback' => 'onImageChanged');
         }
     }
     return $ret;
 }
Пример #13
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (Kwc_Abstract::getFlag($c, 'assetsPackage')) {
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onComponentAddedRemoved');
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Removed', 'callback' => 'onComponentAddedRemoved');
         }
     }
     return $ret;
 }
Пример #14
0
 /**
  * Returns all component classes that can create $createdClass. Optionally filtering instances of $createClass.
  */
 protected function _getCreatingClasses($createdClass, $createClass = null)
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (!$createClass || in_array($createClass, Kwc_Abstract::getParentClasses($c))) {
             if (Kwc_Abstract::getChildComponentClasses($c, array('componentClass' => $createdClass))) {
                 $ret[] = $c;
             }
         }
     }
     return $ret;
 }
Пример #15
0
 protected function _build()
 {
     if (!file_exists('build/trl')) {
         mkdir('build/trl');
     }
     foreach (glob('build/trl/*') as $f) {
         unlink($f);
     }
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $langs[] = $lang;
         }
     }
     try {
         if (Kwf_Component_Data_Root::getComponentClass()) {
             foreach (Kwc_Abstract::getComponentClasses() as $c) {
                 if (Kwc_Abstract::getFlag($c, 'hasAvailableLanguages')) {
                     foreach (call_user_func(array($c, 'getAvailableLanguages'), $c) as $i) {
                         if (!in_array($i, $langs)) {
                             $langs[] = $i;
                         }
                     }
                 }
             }
         }
     } catch (Kwf_Trl_BuildFileMissingException $e) {
         $originatingException = $e->getSettingsNonStaticTrlException();
         if ($originatingException) {
             throw $originatingException;
         }
         throw $e;
     }
     foreach ($langs as $l) {
         if ($l != $config->webCodeLanguage) {
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, true);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, true), serialize($c));
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, false);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, false), serialize($c));
         }
         if ($l != 'en') {
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, true);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, true), serialize($c));
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, false);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, false), serialize($c));
         }
     }
 }
 public function postUpdate()
 {
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (is_instance_of($c, 'Kwc_Root_TrlRoot_Component')) {
             if ($m = Kwc_Abstract::createChildModel($c)) {
                 foreach ($m->getRows() as $r) {
                     $r->visible = true;
                     $r->save();
                 }
             }
         }
     }
 }
 public function getListeners()
 {
     $ret = array();
     $processInputClasses = array();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (Kwc_Abstract::getFlag($c, 'processInput')) {
             $processInputClasses[] = $c;
         }
     }
     $ret[] = array('class' => $processInputClasses, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onComponentAddedOrRemoved');
     $ret[] = array('class' => $processInputClasses, 'event' => 'Kwf_Component_Event_Component_Removed', 'callback' => 'onComponentAddedOrRemoved');
     return $ret;
 }
Пример #18
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         foreach (Kwc_Abstract::getChildComponentClasses($class) as $childClass) {
             if ($childClass == $this->_class) {
                 $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onParentContentChanged');
                 $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_AllPartialChanged', 'callback' => 'onParentPartialsChanged');
             }
         }
     }
     return $ret;
 }
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (is_instance_of($c, 'Kwc_Newsletter_Component')) {
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onComponentAddedRemoved');
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Removed', 'callback' => 'onComponentAddedRemoved');
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_InvisibleAdded', 'callback' => 'onComponentAddedRemoved');
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_InvisibleRemoved', 'callback' => 'onComponentAddedRemoved');
         }
     }
     return $ret;
 }
Пример #20
0
 private static function _getParentsWithHasHomeFlagComponentClasses($cls)
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (in_array($cls, Kwc_Abstract::getChildComponentClasses($c))) {
             if (Kwc_Abstract::getFlag($c, 'hasHome')) {
                 $ret[] = $c;
             }
             $ret = array_merge($ret, self::_getParentsWithHasHomeFlagComponentClasses($c));
         }
     }
     return $ret;
 }
 protected function _initFields()
 {
     $this->_form->setModel(Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting(Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'))->parent->componentClass, 'childModel'))->getReferencedModel('Order'));
     $this->_form->add(new Kwf_Form_Field_ComboBoxText('origin', trlKwf('Origin')))->setValues(array(trlKwf('Internet'), trlKwf('Phone'), trlKwf('Folder'), trlKwf('Fair')))->setShowNoSelection(true);
     $cc = Kwc_Abstract::getChildComponentClasses($this->_getParam('class'), 'payment');
     $payments = array();
     foreach ($cc as $k => $c) {
         $payments[$k] = Kwc_Abstract::getSetting($c, 'componentName');
     }
     if (count($payments) > 1) {
         $this->_form->add(new Kwf_Form_Field_Select('payment', trlKwf('Payment')))->setValues($payments)->setAllowBlank(false);
     }
     $cols = $this->_form->add(new Kwf_Form_Container_Columns());
     $col = $cols->add();
     $col->add(new Kwf_Form_Field_ShowField('order_number', trlKwf('Order Nr')));
     $col = $cols->add();
     $col->add(new Kwf_Form_Field_ShowField('customer_number', trlKwf('Customer Nr')));
     if (Kwc_Abstract::getSetting($this->_getParam('class'), 'generateInvoices')) {
         $this->_form->add(new Kwf_Form_Field_ShowField('invoice_number', trlKwf('Invoice Nr')));
         $this->_form->add(new Kwf_Form_Field_DateField('invoice_date', trlKwf('Invoice Date')));
     }
     $this->_form->add(new Kwf_Form_Field_DateField('payed', trlKwf('Payed')));
     $this->_form->add(new Kwf_Form_Field_ShowField('shipped', trlKwf('Shipped')))->setTpl('{value:localizedDate}');
     $this->_form->add(new Kwf_Form_Field_Checkbox('canceled', trlKwf('Canceled')));
     $fs = $this->_form->add(new Kwf_Form_Container_FieldSet(trlKwf('Customer')));
     $formComponent = Kwc_Abstract::getChildComponentClass($this->_getParam('class'), 'child', 'form');
     $formClass = Kwc_Admin::getComponentClass($formComponent, 'FrontendForm');
     $customerForm = new $formClass('form', $formComponent);
     $customerForm->setIdTemplate('{0}');
     $customerForm->setModel($this->_form->getModel());
     $fs->add($customerForm);
     unset($customerForm->fields['payment']);
     foreach ($customerForm->fields as $f) {
         if ($f->getHideFieldInBackend()) {
             $customerForm->fields->remove($f);
         }
     }
     $customerForm->fields['email']->setAllowBlank(true);
     $customerForm->setAllowEmptyCart(true);
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         $g = Kwc_Abstract::getSetting($c, 'generators');
         if (isset($g['checkout']) && $g['checkout']['component'] == $this->_getParam('class')) {
             foreach (Kwc_Abstract::getSetting($c, 'plugins') as $p) {
                 if (is_instance_of($p, 'Kwc_Shop_Cart_Plugins_Interface')) {
                     $p = new $p();
                     $p->alterBackendOrderForm($this->_form);
                 }
             }
         }
     }
 }
Пример #22
0
 public function testIt()
 {
     $this->assertContains('Kwf_Component_Generator_InheritDifferentComponentClass_Box_Inherit_Component', Kwc_Abstract::getComponentClasses());
     $this->assertEquals('Kwf_Component_Generator_InheritDifferentComponentClass_Box_Component', $this->_root->getChildComponent('-box')->componentClass);
     $c = $this->_root;
     $this->assertEquals('Kwf_Component_Generator_InheritDifferentComponentClass_Box_Component', $c->getChildComponent('-box')->componentClass);
     $this->assertEquals('boxnormal', $c->getChildComponent('-box')->render());
     $c = $c->getChildComponent('_page1');
     $this->assertEquals('Kwf_Component_Generator_InheritDifferentComponentClass_Box_Inherit_Component', $c->getChildComponent('-box')->componentClass);
     $this->assertEquals('boxinherit', $c->getChildComponent('-box')->render());
     $c = $c->getChildComponent('_page2');
     $this->assertEquals('Kwf_Component_Generator_InheritDifferentComponentClass_Box_Inherit_Component', $c->getChildComponent('-box')->componentClass);
     $this->assertEquals('boxinherit', $c->getChildComponent('-box')->render());
 }
Пример #23
0
 private static function _getAllPossiblePageComponentClasses()
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         foreach (Kwf_Component_Generator_Abstract::getInstances($class, array('pseudoPage' => true)) as $g) {
             foreach ($g->getChildComponentClasses() as $c) {
                 if (!in_array($c, $ret)) {
                     $ret[] = $c;
                 }
             }
         }
     }
     return $ret;
 }
 private function _getFrontendPackages()
 {
     $ret = array();
     $ret[] = Kwf_Assets_Package_ComponentFrontend::getInstance();
     $packageNames = array();
     foreach (Kwc_Abstract::getComponentClasses() as $cls) {
         if (Kwc_Abstract::getFlag($cls, 'assetsPackage')) {
             $packageName = Kwc_Abstract::getFlag($cls, 'assetsPackage');
             if ($packageName != 'Default' && !in_array($packageName, $packageNames)) {
                 $packageNames[] = $packageName;
                 $ret[] = Kwf_Assets_Package_ComponentPackage::getInstance($packageName);
             }
         }
     }
     return $ret;
 }
Пример #25
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         if (is_instance_of($class, 'Kwc_Directories_Category_Directory_Component') && $this->_canCreateUsIndirectly($class)) {
             $childReference = Kwc_Abstract::hasSetting($class, 'childReferenceName') ? Kwc_Abstract::getSetting($class, 'childReferenceName') : 'Categories';
             foreach (call_user_func(array($this->_class, 'getItemDirectoryClasses'), $this->_class) as $dirCls) {
                 $dirModel = Kwc_Abstract::createChildModel($dirCls);
                 $relModel = $dirModel->getDependentModel($childReference);
                 $ret[] = array('class' => $relModel, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onUpdateRow');
                 $ret[] = array('class' => $relModel, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onUpdateRow');
                 $ret[] = array('class' => $relModel, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onUpdateRow');
             }
         }
     }
     return $ret;
 }
Пример #26
0
 public function jsonDataAction()
 {
     $showLogout = true;
     $acl = $this->_getAcl();
     $menus = $acl->getMenuConfig($this->_getAuthData());
     if (empty($menus) && $this->_getUserRole() == 'guest') {
         $menu = array();
         $menu['type'] = 'commandDialog';
         $menu['menuConfig']['text'] = trlKwf('Login');
         $menu['commandClass'] = 'Kwf.User.Login.Dialog';
         $menus[] = $menu;
         $showLogout = false;
     }
     $model = Kwf_Registry::get('userModel')->getEditModel();
     if ($this->_getAuthData() && $model->getRowByKwfUser($this->_getAuthData())) {
         foreach ($acl->getAllResources() as $resource) {
             if ($resource instanceof Kwf_Acl_Resource_UserSelf && $acl->isAllowedUser($this->_getAuthData(), $resource, 'view')) {
                 $this->view->userSelfControllerUrl = $resource->getControllerUrl();
                 break;
             }
         }
     }
     $authData = $this->_getAuthData();
     $this->view->menus = $menus;
     $this->view->showLogout = $showLogout;
     $this->view->userId = $authData ? $authData->id : null;
     $this->view->fullname = $authData ? $authData->__toString() : '';
     $role = Zend_Registry::get('userModel')->getAuthedChangedUserRole();
     $this->view->changeUser = $acl->isAllowed($role, 'kwf_user_changeuser', 'view');
     $this->view->frontendUrls = array();
     if (Kwf_Registry::get('acl')->has('kwf_component_pages')) {
         foreach (Kwc_Abstract::getComponentClasses() as $c) {
             if (Kwc_Abstract::hasSetting($c, 'baseProperties') && in_array('domain', Kwc_Abstract::getSetting($c, 'baseProperties'))) {
                 $domains = Kwf_Component_Data_Root::getInstance()->getComponentsBySameClass($c, array('ignoreVisible' => true));
                 foreach ($domains as $domain) {
                     if ($acl->getComponentAcl()->isAllowed($authData, $domain)) {
                         $this->view->frontendUrls[] = array('href' => Kwf_Setup::getBaseUrl() . '/admin/component/preview?url=' . urlencode($domain->getAbsoluteUrl(true)), 'text' => $domain->name);
                     }
                 }
             }
         }
         if (!$this->view->frontendUrls) {
             $this->view->frontendUrls[] = array('href' => Kwf_Setup::getBaseUrl() . '/admin/component/preview', 'text' => trlKwf('Frontend'));
         }
     }
 }
Пример #27
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         if (is_instance_of($class, 'Kwc_Basic_ImageEnlarge_Trl_Component') && $this->_canCreateUsIndirectly($class)) {
             $imageClass = Kwc_Abstract::getChildComponentClass($class, 'image');
             $ret[] = array('class' => $imageClass, 'event' => 'Kwc_Abstract_Image_ImageChangedEvent', 'callback' => 'onImageChanged');
             $ret[] = array('class' => $imageClass, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onClassContentChanged');
             $masterComponentClass = Kwc_Abstract::getSetting($class, 'masterComponentClass');
             $ret[] = array('class' => $masterComponentClass, 'event' => 'Kwc_Abstract_Image_ImageChangedEvent', 'callback' => 'onMasterImageChanged');
             $ret[] = array('class' => $masterComponentClass, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onClassContentChanged');
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onImageContentChanged');
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onClassContentChanged');
         }
     }
     return $ret;
 }
Пример #28
0
 public function getListeners()
 {
     $ret = array();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         if (in_array('Kwc_Directories_List_Component', Kwc_Abstract::getParentClasses($class)) || in_array('Kwc_Directories_List_Trl_Component', Kwc_Abstract::getParentClasses($class))) {
             if (Kwc_Abstract::hasChildComponentClass($class, 'feed') && $this->_class == Kwc_Abstract::getChildComponentClass($class, 'feed')) {
                 $directoryClasses = call_user_func(array(strpos($class, '.') ? substr($class, 0, strpos($class, '.')) : $class, 'getItemDirectoryClasses'), $class);
                 foreach ($directoryClasses as $directoryClass) {
                     $ret[] = array('class' => $directoryClass, 'event' => 'Kwc_Directories_List_EventItemInserted', 'callback' => 'onDirectoryUpdate');
                     $ret[] = array('class' => $directoryClass, 'event' => 'Kwc_Directories_List_EventItemDeleted', 'callback' => 'onDirectoryUpdate');
                     $ret[] = array('class' => $directoryClass, 'event' => 'Kwc_Directories_List_EventItemUpdated', 'callback' => 'onDirectoryUpdate');
                     $ret[] = array('class' => $directoryClass, 'event' => 'Kwc_Directories_List_EventItemsUpdated', 'callback' => 'onDirectoryUpdate');
                 }
             }
         }
     }
     return $ret;
 }
Пример #29
0
 public function getControllerClass(Zend_Controller_Request_Abstract $request)
 {
     $module = $request->getModuleName();
     if ($module == 'component' && $request->getControllerName() == 'component' || $module == 'component_test' && $request->getControllerName() == 'component_test') {
         if ($module == 'component_test') {
             //FnF models setzen damit tests nicht in echte tabellen schreiben
             Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
             Kwf_Test_SeparateDb::setDbFromCookie();
             // setzt es nur wenn es das cookie wirklich gibt
             if (!Kwf_Loader::isValidClass($request->getParam('root'))) {
                 throw new Kwf_Exception_NotFound("Invalid root component");
             }
             Kwf_Component_Data_Root::setComponentClass($request->getParam('root'));
             $root = Kwf_Component_Data_Root::getInstance();
             $root->setFilename('kwf/kwctest/' . $request->getParam('root'));
             Kwf_Registry::get('acl')->getComponentAcl()->allowComponent('guest', null);
             //hick hack, für Kwf_Component_Abstract_Admin::getControllerUrl
             Zend_Registry::set('testRootComponentClass', $request->getParam('root'));
         }
         $class = $request->getParam('class');
         $controller = $request->getParam('componentController');
         $controller .= 'Controller';
         if ($controller == 'IndexController') {
             $controller = 'Controller';
         }
         if (($pos = strpos($class, '!')) !== false) {
             $controller = substr($class, $pos + 1) . 'Controller';
             $class = substr($class, 0, $pos);
         }
         if (!in_array($class, Kwc_Abstract::getComponentClasses())) {
             //unknown component class
             return false;
         }
         $className = Kwc_Admin::getComponentClass($class, $controller);
         if (!$className) {
             return false;
         }
         class_exists($className);
         //trigger autoloader
     } else {
         $className = parent::getControllerClass($request);
     }
     return $className;
 }
Пример #30
0
 /**
  * @return Kwc_Abstract_Form
  **/
 public static function createComponentForm($componentClass, $name = null)
 {
     // Es wurde ein dbIdTemplate angegeben
     if (!in_array($componentClass, Kwc_Abstract::getComponentClasses())) {
         return self::createComponentFormByDbIdTemplate($componentClass);
     }
     $formClass = Kwc_Admin::getComponentClass($componentClass, 'Form');
     if (!$formClass || $formClass == 'Kwc_Abstract_Form') {
         return null;
     }
     if (!$name) {
         $name = $componentClass;
     }
     $form = new $formClass($name, $componentClass);
     if ($form instanceof Kwc_Abstract_FormEmpty) {
         return null;
     }
     return $form;
 }