本文整理汇总了PHP中Kwc_Abstract::createChildModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Abstract::createChildModel方法的具体用法?PHP Kwc_Abstract::createChildModel怎么用?PHP Kwc_Abstract::createChildModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Abstract
的用法示例。
在下文中一共展示了Kwc_Abstract::createChildModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
public function preDispatch()
{
$this->setModel(new Kwc_Directories_Item_Directory_Trl_AdminModel(array('proxyModel' => Kwc_Abstract::createChildModel(Kwc_Abstract::getSetting($this->_getParam('class'), 'masterComponentClass')), 'trlModel' => Kwc_Abstract::createChildModel($this->_getParam('class')))));
parent::preDispatch();
$url = Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Form');
$this->_editDialog['controllerUrl'] = $url;
}
示例2: preDispatch
public function preDispatch()
{
if (!isset($this->_model) && !isset($this->_tableName) && !isset($this->_modelName)) {
$this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class')));
}
parent::preDispatch();
}
示例3: _getModel
protected function _getModel()
{
if (!$this->_model) {
if (isset($this->_settings['model'])) {
if (is_string($this->_settings['model'])) {
$this->_model = Kwf_Model_Abstract::getInstance($this->_settings['model']);
} else {
$this->_model = $this->_settings['model'];
}
} else {
if (isset($this->_settings['table'])) {
if (is_string($this->_settings['table'])) {
$table = new $this->_settings['table']();
} else {
$table = $this->_settings['table'];
}
if (!$table instanceof Zend_Db_Table_Abstract) {
throw new Kwf_Exception("table setting for generator in {$this->_class} is not a Zend_Db_Table");
}
$this->_model = new Kwf_Model_Db(array('table' => $table));
} else {
if ($this->_loadTableFromComponent) {
$this->_model = Kwc_Abstract::createChildModel($this->_class);
} else {
throw new Kwf_Exception("Can't create model for generator '{$this->getGeneratorKey()}' in '{$this->_class}'");
}
}
}
if (!$this->_model) {
throw new Kwf_Exception('model has to be set for table generator in ' . $this->_class);
}
}
return $this->_model;
}
示例4: getListeners
public function getListeners()
{
$ret = parent::getListeners();
$model = Kwc_Abstract::createChildModel($this->_class);
$siblingModels = $model->getSiblingModels();
$ret[] = array('class' => get_class($siblingModels[0]), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onLanguageUpdate');
return $ret;
}
示例5: getListeners
public function getListeners()
{
$ret = parent::getListeners();
$m = Kwc_Abstract::createChildModel($this->_class);
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onOwnRowEvent');
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onOwnRowEvent');
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onOwnRowEvent');
return $ret;
}
示例6: preDispatch
public function preDispatch()
{
if (!isset($this->_model) && !isset($this->_tableName)) {
$this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class')));
}
parent::preDispatch();
$url = Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Comment');
$this->_editDialog['controllerUrl'] = $url;
}
示例7: _initFields
public function _initFields()
{
$this->_form->setModel(Kwc_Abstract::createChildModel($this->_getParam('class')));
$this->_form->add(new Kwf_Form_Field_ShowField('create_time', trlKwf('Created')));
$this->_form->add(new Kwf_Form_Field_Checkbox('visible', trlKwf('Visible')));
$this->_form->add(new Kwf_Form_Field_TextField('name', trlKwf('Name')))->setWidth(300);
$this->_form->add(new Kwf_Form_Field_TextField('email', trlKwf('E-Mail')))->setWidth(300);
$this->_form->add(new Kwf_Form_Field_TextArea('content', trlKwf('Content')))->setWidth(300)->setHeight(160);
}
示例8: getTrlRowByData
public function getTrlRowByData(Kwf_Component_Data $data)
{
$ret = $this->_getRow($data->dbId);
if (!$ret) {
$m = Kwc_Abstract::createChildModel($this->_class);
$ret = $m->createRow();
$ret->component_id = $data->dbId;
}
return $ret;
}
示例9: getListeners
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;
}
示例10: getListeners
public function getListeners()
{
$ret = parent::getListeners();
$m = Kwc_Abstract::createChildModel($this->_class);
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate');
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowUpdate');
$masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass');
$m = Kwc_Abstract::createChildModel($masterComponentClass);
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onMasterRowUpdate');
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onMasterRowDelete');
return $ret;
}
示例11: getListeners
public function getListeners()
{
$ret = parent::getListeners();
$generators = Kwc_Abstract::getSetting($this->_class, 'generators');
foreach ($generators['paragraphs']['component'] as $component) {
$ret[] = array('class' => $component, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange');
}
$m = Kwc_Abstract::createChildModel($this->_class);
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate');
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowInsertOrDelete');
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onRowInsertOrDelete');
return $ret;
}
示例12: postUpdate
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();
}
}
}
}
}
示例13: setComponentId
public function setComponentId($componentId)
{
$c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($componentId, array('ignoreVisible' => true));
$s = new Kwf_Component_Select();
$s->ignoreVisible();
$s->whereGenerator('paragraphs');
$chainedModel = Kwc_Abstract::createChildModel($c->componentClass);
foreach ($c->getChildComponents($s) as $c) {
$chainedRow = $chainedModel->getRow($c->dbId);
if (!$chainedRow) {
$chainedRow = $chainedModel->createRow(array('component_id' => $c->dbId, 'visible' => false));
}
$this->_data[$c->componentId] = array('id' => $c->chained->row->id, 'component_id' => $componentId, 'component_class' => $c->componentClass, 'component_name' => Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($c->componentClass, 'componentName')), 'component_icon' => (string) new Kwf_Asset(Kwc_Abstract::getSetting($c->componentClass, 'componentIcon')), 'row' => $chainedRow, 'visible' => $chainedRow->visible, 'pos' => $c->chained->row->pos);
}
}
示例14: getListeners
public function getListeners()
{
$ret = parent::getListeners();
$masterGeneratorModel = $this->_getChainedGenerator()->getModel();
$ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onMasterRowUpdate');
$ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onMasterRowAdd');
$ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onMasterRowDelete');
$ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Model_Updated', 'callback' => 'onMasterModelUpdate');
$m = Kwc_Abstract::createChildModel($this->_class);
if ($m) {
$ret[] = array('class' => get_class($m), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate');
$ret[] = array('class' => get_class($m), 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowUpdate');
}
return $ret;
}
示例15: getListeners
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;
}