本文整理汇总了PHP中Axis::getClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Axis::getClass方法的具体用法?PHP Axis::getClass怎么用?PHP Axis::getClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::getClass方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: box
/**
* Return the singleton instance of box object
*
* @param string $block
* @param array $config
* @return Axis_Core_Box_Abstract
* @throws Axis_Exception
*/
public function box($block, $config = array())
{
$block = Axis::getClass($block, 'Box');
if (Zend_Registry::isRegistered($block)) {
return Zend_Registry::get($block)->refresh()->setFromArray($config);
}
return Axis::single($block, $config);
}
示例2: loadAction
public function loadAction()
{
$id = $this->_getParam('id');
$data = Axis::model('core/template_box')->find($id)->current()->toArray();
list($namespace, $module, $name) = explode('_', $data['class']);
$boxClass = Axis::getClass($namespace . '_' . $module . '/' . $name, 'Box');
$boxObject = Axis::model($boxClass, array('supress_init' => true));
$data['configuration_fields'] = $boxObject->getConfigurationFields();
$data['configuration_values'] = $boxObject->getConfigurationValues();
$select = Axis::model('core/template_box_page')->select('*')->where('box_id = ?', $id);
$data['assignments'] = array();
foreach ($select->fetchAll() as $assignment) {
$data['assignments'][] = $assignment;
}
return $this->_helper->json->setData($data)->sendSuccess();
}
示例3: saveAction
public function saveAction()
{
$path = $this->_getParam('path');
$siteId = $this->_getParam('siteId');
$value = $this->_getParam('value');
$rowField = Axis::single('core/config_field')->select()->where('path = ?', $path)->fetchRow();
$model = Axis::model('core/config_value');
$row = $model->select()->where('path = ?', $path)->where('site_id = ?', $siteId)->fetchRow();
/*
* if such row not founded then create new record
* It possible when we redeclare global config_value for site
*/
if (!$row) {
$row = $model->createRow(array('config_field_id' => $rowField->id, 'path' => $path, 'site_id' => $siteId));
}
if (!empty($rowField->model)) {
$class = Axis::getClass($rowField->model);
if (class_exists($class) && in_array('Axis_Config_Option_Encodable_Interface', class_implements($class))) {
$value = Axis::model($rowField->model)->encode($value);
}
}
$row->value = $value;
$row->save();
Axis::message()->addSuccess(Axis::translate('admin')->__('Configuration option was saved successfully'));
return $this->_helper->json->sendSuccess();
}
示例4: _savePrevious
protected function _savePrevious()
{
$rowData = $this->_rowField;
$this->_rowField = array();
if (empty($rowData)) {
return;
}
$modelField = Axis::single('core/config_field');
$rowField = $modelField->select()->where('path = ?', $rowData['path'])->fetchRow();
if (!$rowField) {
$rowData = array_merge($this->_defaultsRowField, $rowData);
$rowField = $modelField->createRow();
}
if ($this->_isContainer) {
$rowData = array_merge($rowData, array('type' => '', 'model' => ''));
}
$rowField->setFromArray($rowData);
$rowField->save();
if ($this->_isContainer) {
return;
}
$modelValue = Axis::single('core/config_value');
$rowValue = $modelValue->select()->where('path = ?', $rowData['path'])->where('config_field_id = ?', $rowField->id)->where('site_id = ?', 0)->fetchRow();
if (!$rowValue) {
$rowValue = $modelValue->createRow(array('config_field_id' => $rowField->id, 'path' => $rowData['path'], 'site_id' => 0));
}
if (null !== $this->_rawValue) {
$value = $this->_rawValue;
if (!empty($rowData['model'])) {
$class = Axis::getClass($rowData['model']);
if (class_exists($class) && in_array('Axis_Config_Option_Encodable_Interface', class_implements($class))) {
$value = Axis::model($rowData['model'])->encode($value);
}
}
$rowValue->value = $value;
}
$rowValue->save();
}
示例5: _load
private function _load($key, $siteId, $default)
{
if (null === $siteId) {
$siteId = Axis::getSiteId();
}
$hasCache = (bool) Zend_Registry::isRegistered('cache') ? Axis::cache() instanceof Zend_Cache_Core : false;
if (!$hasCache || !($dataset = Axis::cache()->load("config_{$key}_site_{$siteId}"))) {
$dataset = Axis::single('core/config_field')->select(array('path', 'model'))->joinInner('core_config_value', 'ccv.config_field_id = ccf.id', 'value')->where('ccf.path LIKE ?', $key . '/%')->where('ccv.site_id IN(?)', array(0, $siteId))->fetchAssoc();
if ($hasCache) {
Axis::cache()->save($dataset, "config_{$key}_site_{$siteId}", array('config'));
}
}
if (!sizeof($dataset)) {
$this->_data[$key] = $default;
return;
}
$values = array();
foreach ($dataset as $path => $data) {
$parts = explode('/', $path);
$value = $data['value'];
if (!empty($data['model'])) {
$class = Axis::getClass($data['model']);
if (class_exists($class) && in_array('Axis_Config_Option_Encodable_Interface', class_implements($class))) {
$value = Axis::single($data['model'])->decode($value);
}
}
$values[$parts[0]][$parts[1]][$parts[2]] = $value;
}
foreach ($values as $key => $value) {
if (is_array($value)) {
$this->_data[$key] = new self($value, $this->_allowModifications);
} else {
$this->_data[$key] = $value;
}
}
}
示例6: box
/**
* Retrieve the box object
*
* @param string $block
* @param array $config
* @return Axis_Core_Box_Abstract
* @throws Axis_Exception
*/
public function box($block, $config = array())
{
return Axis::model(Axis::getClass($block, 'Box'), $config);
}