本文整理汇总了PHP中Floxim\Floxim\System\Fx::getComponentNameByClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::getComponentNameByClass方法的具体用法?PHP Fx::getComponentNameByClass怎么用?PHP Fx::getComponentNameByClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::getComponentNameByClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: items
public function items($input)
{
$entity = $input['entity'];
$items = $entity->getAllFields();
$ar = array('type' => 'list', 'filter' => true, 'is_sortable' => true);
// todo: psr0 need verify
$entity_code = fx::getComponentNameByClass(get_class($entity));
$ar['entity'] = 'field';
$ar['values'] = array();
$ar['labels'] = array('keyword' => fx::alang('Keyword', 'system'), 'name' => fx::alang('Name', 'system'), 'type' => fx::alang('Type', 'system'), 'inherited' => fx::alang('Inherited from', 'system'), 'editable' => fx::alang('Editable', 'system'));
foreach ($items as $field) {
$r = array('id' => $field->getId(), 'keyword' => array('name' => $field['keyword'], 'url' => '#admin.' . $entity_code . '.edit(' . $field['component_id'] . ',edit_field,' . $field['id'] . ')'), 'name' => $field['name'], 'type' => fx::alang("FX_ADMIN_FIELD_" . strtoupper($field->getTypeKeyword()), 'system'));
if ($entity['id'] != $field['component_id']) {
$component_name = fx::data('component', $field['component_id'])->get('name');
$r['inherited'] = $component_name;
} else {
$r['inherited'] = ' ';
}
switch ($field['type_of_edit']) {
case CompField\Entity::EDIT_ALL:
$r['editable'] = fx::alang('Yes', 'system');
break;
case CompField\Entity::EDIT_NONE:
$r['editable'] = fx::alang('No', 'system');
break;
case CompField\Entity::EDIT_ADMIN:
$r['editable'] = fx::alang('For admin only', 'system');
break;
}
$ar['values'][] = $r;
}
$result['fields'] = array($ar);
$this->response->addButtons(array(array('key' => 'add', 'title' => fx::alang('Add new field', 'system'), 'url' => '#admin.' . $entity_code . '.edit(' . $entity['id'] . ',add_field)'), "delete"));
return $result;
}
示例2: templates
public function templates($component, $input)
{
// todo: psr0 need verify
$ctr_type = fx::getComponentNameByClass(get_class($component));
$this->response->submenu->setSubactive('templates');
if (isset($input['params'][2])) {
$res = $this->template(array('template_full_id' => $input['params'][2]));
if ($res === false) {
return array('reload' => '#admin.' . $ctr_type . '.edit(' . $input['params'][0] . ',templates)');
}
return $res;
}
$templates = $this->getComponentTemplates($component);
$visuals = fx::data('infoblock_visual')->where('template', $templates->getValues('full_id'))->all();
$field = array('type' => 'list', 'filter' => true);
$field['labels'] = array('name' => fx::alang('Name', 'system'), 'action' => fx::alang('Action', 'system'), 'inherited' => fx::alang('Inherited', 'system'), 'source' => fx::alang('Source', 'system'), 'file' => fx::alang('File', 'system'), 'used' => fx::alang('Used', 'system'));
$field['values'] = array();
foreach ($templates as $tpl) {
$r = array('id' => $tpl['full_id'], 'name' => array('name' => $tpl['name'], 'url' => $ctr_type . '.edit(' . $component['id'] . ',templates,' . $tpl['full_id'] . ')'), 'action' => preg_replace("~^.+\\:~", '', $tpl['of']), 'used' => count($visuals->find('template', $tpl['full_id'])));
$owner_ctr_match = null;
preg_match("~^(component_|widget_)?(.+?)\\..+\$~", $tpl['of'], $owner_ctr_match);
$owner_ctr = $owner_ctr_match ? $owner_ctr_match[2] : null;
if ($owner_ctr == $component['keyword']) {
$r['inherited'] = ' ';
} else {
$r['inherited'] = $owner_ctr;
}
// example: theme.floxim.phototeam:featured_news_list
if (preg_match("#^theme\\.(\\w+)\\.(\\w+)\\:.+\$#i", $tpl['full_id'], $match)) {
// todo: psr0 need use $match[1] for define vendor template
$r['source'] = fx::data('layout')->where('keyword', $match[1] . '.' . $match[2])->one()->get('name') . ' (layout)';
} else {
// todo: psr0 need verify
$c_parts = fx::getComponentParts($tpl['full_id']);
$r['source'] = fx::data($ctr_type, $c_parts['vendor'] . '.' . $c_parts['module'] . '.' . $c_parts['component'])->get('name');
}
$r['file'] = fx::path()->http($tpl['file']);
$field['values'][] = $r;
}
return array('fields' => array('templates' => $field));
}
示例3: __construct
public function __construct($table = null)
{
parent::__construct($table);
$this->setComponent(fx::getComponentNameByClass(get_class($this)));
}