本文整理汇总了PHP中Kwc_Abstract::createOwnModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Abstract::createOwnModel方法的具体用法?PHP Kwc_Abstract::createOwnModel怎么用?PHP Kwc_Abstract::createOwnModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Abstract
的用法示例。
在下文中一共展示了Kwc_Abstract::createOwnModel方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getComponentsForTarget
public static function getComponentsForTarget($componentClass, $targetId, $includeSubpages)
{
if (!isset(self::$_pageIds[$componentClass])) {
$ids = array();
$model = Kwc_Abstract::createOwnModel($componentClass);
foreach ($model->export(Kwf_Model_Abstract::FORMAT_ARRAY) as $row) {
$target = $row['target'];
if (!isset($ids[$target])) {
$ids[$target] = array();
}
$ids[$target][] = $row['component_id'];
}
self::$_pageIds[$componentClass] = $ids;
}
$ret = array();
foreach (self::$_pageIds[$componentClass] as $targetPageId => $dbIds) {
$ids = array();
if ($includeSubpages) {
if ((string) $targetPageId == (string) $targetId || substr($targetPageId, 0, strlen($targetId) + 1) == $targetId . '-' || substr($targetPageId, 0, strlen($targetId) + 1) == $targetId . '_') {
$ids = $dbIds;
}
} else {
if ((string) $targetPageId === (string) $targetId) {
$ids = $dbIds;
}
}
foreach ($ids as $dbId) {
$ret = array_merge($ret, Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($dbId));
}
}
return $ret;
}
示例2: _getModel
protected function _getModel()
{
if (!$this->_model) {
$this->_model = Kwc_Abstract::createOwnModel($this->_class);
}
return $this->_model;
}
示例3: _getLinkRow
private function _getLinkRow()
{
if (!isset($this->_linkRow)) {
$m = Kwc_Abstract::createOwnModel($this->componentClass);
$this->_linkRow = $m->getRow($this->dbId);
}
return $this->_linkRow;
}
示例4: _getData
protected function _getData($select = array())
{
$m = Kwc_Abstract::createOwnModel($this->componentClass);
if ($column = $m->fetchColumnByPrimaryId('target_component_id', $this->dbId)) {
return Kwf_Component_Data_Root::getInstance()->getComponentByDbId($column, array('subroot' => $this));
}
return false;
}
示例5: _onCategoryChanged
private function _onCategoryChanged($categoryIds)
{
$model = Kwc_Abstract::createOwnModel($this->_class);
$select = $model->select()->whereEquals('category_id', $categoryIds);
foreach ($model->getRows($select) as $row) {
$this->_deleteCache($row->component_id);
}
}
示例6: _getLinkRow
private function _getLinkRow()
{
if (!isset($this->_linkRow)) {
$m = Kwc_Abstract::createOwnModel($this->componentClass);
$cols = array('target', 'open_type', 'width', 'height', 'menubar', 'toolbar', 'locationbar', 'statusbar', 'scrollbars', 'resizable');
$this->_linkRow = (object) $m->fetchColumnsByPrimaryId($cols, $this->dbId);
}
return $this->_linkRow;
}
示例7: getListeners
public function getListeners()
{
$ret = array();
$ownModel = Kwc_Abstract::createOwnModel($this->_class);
$models = Kwf_Model_Abstract::getInstance($ownModel)->getDependentModels();
$model = $models['Networks'];
$ret[] = array('class' => $model, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onNetworksRowUpdate');
$ret[] = array('class' => $model, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onNetworksRowUpdate');
$ret[] = array('class' => $model, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onNetworksRowUpdate');
return $ret;
}
示例8: __construct
public function __construct($name, $class)
{
$this->setClass($class);
if ($class) {
if (!$this->getModel()) {
$model = Kwc_Abstract::createOwnModel($class);
if ($model) {
$this->setModel($model);
}
}
$this->setCreateMissingRow(true);
}
parent::__construct($name);
}
示例9: getListeners
public function getListeners()
{
$ret = parent::getListeners();
if (Kwc_Abstract::hasSetting($this->_class, 'throwContentChangedOnOwnMasterModelUpdate') || Kwc_Abstract::hasSetting($this->_class, 'throwHasContentChangedOnMasterRowColumnsUpdate')) {
$masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass');
$m = Kwc_Abstract::createOwnModel($masterComponentClass);
if (!$m) {
throw new Kwf_Exception("Master component '{$masterComponentClass}' doesn't have ownModel");
}
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onMasterOwnRowUpdate');
$ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onMasterOwnRowUpdate');
}
return $ret;
}
示例10: load
public function load($row)
{
$model = Kwc_Abstract::createOwnModel($this->_class);
$componentId = $row->component_id . '-' . $row->id;
if ($this->_subComponent) {
$componentId .= $this->_subComponent;
}
$row = $model->getRow($componentId);
if ($row && $row->kwf_upload_id) {
$hashKey = Kwf_Util_Hash::hash($row->kwf_upload_id);
return Kwf_Setup::getBaseUrl() . '/kwf/media/upload/preview?uploadId=' . $row->kwf_upload_id . '&hashKey=' . $hashKey . '&size=' . $this->_size;
} else {
return '';
}
}
示例11: _getComponentDbIdsForTarget
private static function _getComponentDbIdsForTarget($componentClass, $targetIds, $includeSubpages)
{
if (!isset(self::$_pageIds[$componentClass])) {
$ids = array();
$model = Kwc_Abstract::createOwnModel($componentClass);
foreach ($model->export(Kwf_Model_Abstract::FORMAT_ARRAY) as $row) {
$target = $row['target'];
if (!isset($ids[$target])) {
$ids[$target] = array();
}
$ids[$target][] = $row['component_id'];
}
self::$_pageIds[$componentClass] = $ids;
}
$ret = array();
foreach (self::$_pageIds[$componentClass] as $targetPageId => $dbIds) {
$ids = array();
if ($includeSubpages) {
foreach ($targetIds as $targetId) {
if ((string) $targetPageId == $targetId || substr($targetPageId, 0, strlen($targetId) + 1) == $targetId . '-' || substr($targetPageId, 0, strlen($targetId) + 1) == $targetId . '_') {
$ret = array_merge($ret, $dbIds);
break;
}
}
} else {
if (in_array((string) $targetPageId, $targetIds, true)) {
$ret = array_merge($ret, $dbIds);
}
}
}
return $ret;
}