本文整理汇总了PHP中Floxim\Floxim\System\Fx::alang方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::alang方法的具体用法?PHP Fx::alang怎么用?PHP Fx::alang使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::alang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
public function validate()
{
$res = true;
if (!$this['keyword']) {
$this->validate_errors[] = array('field' => 'keyword', 'text' => fx::alang('Specify field keyword', 'system'));
$res = false;
}
if ($this['keyword'] && !preg_match("/^[a-z][a-z0-9_]*\$/i", $this['keyword'])) {
$this->validate_errors[] = array('field' => 'keyword', 'text' => fx::alang('Field keyword can contain only letters, numbers, and the underscore character', 'system'));
$res = false;
}
$modified = $this->modified_data['keyword'] && $this->modified_data['keyword'] != $this->data['keyword'];
if (!$this->column_created && !$this->getPayload('skip_sql') && $this['component_id'] && ($modified || !$this['id'])) {
/// Edit here
$component = fx::data('component')->where('id', $this['component_id'])->one();
$chain = $component->getChain();
foreach ($chain as $c_level) {
if (fx::db()->columnExists($c_level->getContentTable(), $this->data['keyword'])) {
$this->validate_errors[] = array('field' => 'keyword', 'text' => fx::alang('This field already exists', 'system'));
$res = false;
}
}
}
if (!$this['name']) {
$this->validate_errors[] = array('field' => 'name', 'text' => fx::alang('Specify field name', 'system'));
$res = false;
}
return $res;
}
示例2: formatSettings
public function formatSettings()
{
$fields = array();
$fields[] = array('id' => 'format[source]', 'name' => 'format[source]', 'type' => 'hidden', 'value' => 'manual');
$fields[] = array('name' => 'format[values]', 'label' => fx::alang('Elements', 'system'), 'type' => 'set', 'tpl' => array(array('name' => 'id', 'type' => 'string'), array('name' => 'value', 'type' => 'string')), 'values' => $this['format']['values'] ? $this['format']['values'] : array(), 'labels' => array('id', 'value'));
return $fields;
}
示例3: getFakeIb
protected function getFakeIb()
{
static $fake_counter = 0;
$fake_ib = fx::data('infoblock')->create();
$fake_ib['id'] = 'fake-' . $fake_counter++;
$fake_ib['name'] = fx::alang('New infoblock');
return $fake_ib;
}
示例4: formatSettings
public function formatSettings()
{
$fields = array();
$comp_values = array_merge(fx::data('component')->getSelectValues(), array(array('site', 'Site'), array('component', 'Component'), array('infoblock', 'Infoblock'), array('lang', 'Language')));
$fields[] = array('id' => 'format[target]', 'name' => 'format[target]', 'label' => fx::alang('Links to', 'system'), 'type' => 'select', 'values' => $comp_values, 'value' => $this['format']['target'] ? $this['format']['target'] : '');
$fields[] = array('id' => 'format[prop_name]', 'name' => 'format[prop_name]', 'label' => fx::alang('Key name for the property', 'system'), 'value' => $this->getPropName());
$fields[] = array('id' => 'format[is_parent]', 'name' => 'format[is_parent]', 'label' => fx::alang('Bind value to the parent', 'system'), 'type' => 'checkbox', 'value' => $this['format']['is_parent']);
$fields[] = array('id' => 'format[render_type]', 'name' => 'format[render_type]', 'label' => fx::alang('Render type', 'system'), 'type' => 'select', 'values' => array('livesearch' => fx::alang('Live search', 'system'), 'select' => fx::alang('Simple select', 'system')), 'value' => $this['format']['render_type']);
return $fields;
}
示例5: validateValue
public function validateValue($value)
{
if (!is_array($value) && !is_object($value)) {
$value = trim($value);
}
if ($this['is_required'] && !$value) {
$this->error = sprintf(fx::alang('Field "%s" is required'), $this['name']);
return false;
}
return true;
}
示例6: show
public function show($input)
{
$this->response->breadcrumb->addItem(fx::alang('Console'), '#admin.console.show');
$this->response->submenu->setMenu('console');
$fields = array('console_text' => array('name' => 'console_text', 'type' => 'text', 'code' => 'htmlmixed', 'value' => isset($input['console_text']) ? $input['console_text'] : '<?php' . "\n"));
$fields[] = $this->ui->hidden('entity', 'console');
$fields[] = $this->ui->hidden('action', 'execute');
$this->response->addFormButton(array('label' => fx::alang('Execute') . ' (Ctrl+Enter)', 'is_submit' => false, 'class' => 'execute'));
$this->response->addFields($fields);
fx::page()->addJsFile(fx::path('@floxim') . '/Admin/js/console.js');
return array('show_result' => 1);
}
示例7: show
public function show($input)
{
$log_id = $input['params'][0];
$logger = fx::debug();
$meta = $logger->getIndex($log_id);
$this->response->breadcrumb->addItem(fx::alang('Logs'), '#admin.log.all');
if ($meta) {
$name = '[' . $meta['method'] . '] ' . $meta['url'] . ', ' . date('d.m.Y, H:i:s', round($meta['start']));
$this->response->breadcrumb->addItem($name, '#admin.log.show');
}
$this->response->submenu->setMenu('log');
return array('fields' => array(array('type' => 'buttons', 'buttons' => array(array('type' => 'button', 'label' => fx::alang('Delete', 'system'), 'options' => array('action' => 'drop_log', 'entity' => 'log', 'fx_admin' => 'true', 'log_id' => $log_id)), array('type' => 'button', 'label' => fx::alang('Delete all', 'system'), 'options' => array('action' => 'drop_all', 'entity' => 'log', 'fx_admin' => 'true')))), array('type' => 'html', 'html' => '<div class="fx_debug_entries">' . $logger->showItem($log_id) . "</div>")));
}
示例8: getFields
/**
* Get fields for website create/edit form
*
* @param type fx_site $site
*
* @return array
*/
protected function getFields($site)
{
$main_fields = array();
$main_fields[] = $this->ui->input('name', fx::alang('Site name', 'system'), $site['name']);
$main_fields[] = $this->ui->input('domain', fx::alang('Domain', 'system'), $site['domain']);
$main_fields[] = array('name' => 'mirrors', 'label' => fx::alang('Aliases', 'system'), 'value' => $site['mirrors'], 'type' => 'text');
$languages = fx::data('lang')->all()->getValues('lang_code', 'lang_code');
$main_fields[] = array('name' => 'language', 'type' => 'select', 'values' => $languages, 'value' => $site['language'], 'label' => fx::alang('Language', 'system'));
$layouts = fx::data('layout')->all();
$layouts_select = array();
foreach ($layouts as $layout) {
$layouts_select[] = array($layout['id'], $layout['name']);
}
$main_fields[] = array('name' => 'layout_id', 'type' => 'select', 'values' => $layouts_select, 'value' => $site['layout_id'], 'label' => fx::alang('Layout', 'system'));
return $main_fields;
}
示例9: getVendorField
public function getVendorField()
{
$field = array('name' => 'vendor', 'label' => fx::alang('Vendor', 'system'), 'type' => 'select', 'values' => array());
$vendor = fx::config('dev.vendor');
$vendor = explode(",", $vendor);
foreach ($vendor as $num => $part) {
$part = trim($part);
if (empty($part)) {
unset($vendor[$num]);
}
}
$vendor[] = 'my';
foreach ($vendor as $v) {
$v = fx::util()->underscoreToCamel($v, true);
$field['values'][$v] = $v;
}
return $field;
}
示例10: __construct
public function __construct()
{
$this->options['login'] = 'admin';
$this->options['action_link'] = fx::config('path.admin');
$this->addMoreMenu(Controller\Adminpanel::getMoreMenu());
$this->addButtons(Controller\Adminpanel::getButtons());
$main_menu = array('manage' => array('name' => fx::alang('Management', 'system'), 'key' => 'manage', 'href' => '/floxim/#admin.administrate.site.all'), 'develop' => array('name' => fx::alang('Development', 'system'), 'key' => 'develop', 'href' => '/floxim/#admin.component.all'));
$site = fx::env('site');
if ($site) {
$main_menu['site'] = array('name' => fx::env('site')->getLocalDomain(), 'key' => 'site', 'href' => '/');
$other_sites = fx::data('site')->where('id', $site['id'], '!=')->all();
if (count($other_sites) > 0) {
$main_menu['site']['children'] = array();
foreach ($other_sites as $other_site) {
$domain = $other_site->getLocalDomain();
$main_menu['site']['children'][] = array('name' => $domain, 'href' => 'http://' . $domain . '/');
}
}
}
$this->addMainMenu($main_menu);
}
示例11: configColumns
public function configColumns($settings)
{
$variants = array('n-w', 'w-n', 'w-w', 'n-w-n', 'w-w-w', 'n-n-w', 'w-n-n', 'n-w-w', 'w-w-n', 'w-n-w');
$values = array();
foreach ($variants as $var) {
$parts = explode("-", $var);
$count_wide = 0;
foreach ($parts as $p) {
if ($p === 'w') {
$count_wide++;
}
}
$b = 'fx_grid_livesearch';
$bv = $b . '_variant';
$val = '<span class="' . $bv . ' ' . $bv . '__' . count($parts) . '_cols ' . $bv . '__' . $var . ' ' . $bv . '__' . $count_wide . '_w">';
foreach ($parts as $part) {
$val .= '<span class="' . $b . '_col ' . $b . '_col__' . $part . '"></span>';
}
$val .= '</span>';
$val = str_replace('"', '\'', $val);
$values[] = array('id' => $var, 'name' => $val);
}
return array('name' => fx::alang('Columns'), 'settings' => array('cols' => array('label' => fx::alang('Columns'), 'type' => 'livesearch', 'allow_empty' => false, 'values' => $values, 'value' => 'n-w')));
}
示例12: array
<?php
use Floxim\Floxim\System\Fx as fx;
$source_ibs = fx::data('infoblock')->getContentInfoblocks('floxim.nav.section')->find('site_id', fx::env('site')->get('id'))->getValues('name', 'id');
return array('actions' => array('*list*' => array('icon' => 'Nav', 'name' => 'Меню', 'defaults' => array('!is_pass_through' => true, '!limit' => 0, '!create_record_ib' => false, '!sorting' => 'manual', '!sorting_dir' => 'asc', '!pagination' => false, '!submenu' => 'none'), 'settings' => array('extra_infoblocks' => array('name' => 'extra_infoblocks', 'label' => 'Добавить ссылки из другого блока', 'type' => 'livesearch', 'is_multiple' => true, 'ajax_preload' => true, 'content_type' => 'infoblock', 'conditions' => array('controller' => array(fx::data('component', 'page')->getAllVariants()->getValues(function ($ch) {
return $ch['keyword'];
}), 'IN'), 'id' => array($this->getParam('infoblock_id'), '!='), 'site_id' => fx::env('site_id'), 'action' => 'list_infoblock')))), 'list_infoblock' => array('name' => 'Меню', 'default_scope' => function () {
$ds = fx::env('site')->get('index_page_id') . '-descendants-';
return $ds;
}), 'breadcrumbs' => array('icon' => 'Nav', 'icon_extra' => 'bre', 'name' => fx::alang('Breadcrumbs', 'component_section'), 'settings' => array('header_only' => array('name' => 'header_only', 'type' => 'checkbox', 'label' => fx::alang('Show only header?', 'component_section'))))));
示例13: afterDelete
protected function afterDelete()
{
parent::afterDelete();
fx::alang()->dropDictFiles($this['dict']);
}
示例14: formatSettings
public function formatSettings()
{
$fields = array();
if (!$this['component_id']) {
return $fields;
}
$com = fx::data('component', $this['component_id']);
$chain = $com->getChain();
$chain_ids = $chain->getValues('id');
$link_fields = fx::data('field')->where('type', Field\Entity::FIELD_LINK)->where('component_id', 0, '!=')->all();
// select from the available fields-links
$linking_field_values = array();
// array of InputB with specification of the data type
$res_datatypes = array();
// array of InputB with specification of the field for many-many
$res_many_many_fields = array();
// array of InputB with specification of the type for many-many
$res_many_many_types = array();
foreach ($link_fields as $lf) {
if (in_array($lf['format']['target'], $chain_ids)) {
// the component that owns the current box-link
$linking_field_owner_component = fx::data('component', $lf['component_id']);
$linking_field_values[] = array($lf['id'], $linking_field_owner_component['keyword'] . '.' . $lf['keyword']);
// get the list of references component and all of its descendants
$component_tree = fx::data('component')->getSelectValues($lf['component_id']);
$res_datatypes[$lf['id']] = array();
foreach ($component_tree as $com_variant) {
$linking_component = fx::data('component', $com_variant[0]);
$res_datatypes[$lf['id']][] = array($com_variant[0], $com_variant[1]);
// For links many_many relations
// get the field-component links that point to other components
$linking_component_links = $linking_component->getAllFields()->find('type', Field\Entity::FIELD_LINK)->find('id', $lf['id'], '!=');
// exclude fields, connected to the parent
if ($lf['format']['is_parent']) {
$linking_component_links = $linking_component_links->find('keyword', 'parent_id', '!=');
}
if (count($linking_component_links) === 0) {
continue;
}
// key for many-many
$mmf_key = $lf['id'] . '_' . $com_variant[0];
$res_many_many_fields[$mmf_key] = array(array('', '--'));
foreach ($linking_component_links as $linking_component_link) {
// skip pseudo-components
// @todo needs a better workaround
if (in_array($linking_component_link['format']['target'], array('lang', 'site', 'infoblock'))) {
continue;
}
$res_many_many_fields[$mmf_key][] = array($linking_component_link['id'], $linking_component_link['keyword']);
$target_component = fx::data('component', $linking_component_link['format']['target']);
$end_tree = fx::data('component')->getSelectValues($target_component['id']);
$mmt_key = $mmf_key . '|' . $linking_component_link['id'];
$res_many_many_types[$mmt_key] = array();
foreach ($end_tree as $end_com) {
$end_component = fx::data('component', $end_com[0]);
$res_many_many_types[$mmt_key][] = array($end_com[0], $end_component['keyword']);
}
}
}
}
}
$fields[] = array('id' => 'format[linking_field]', 'name' => 'format[linking_field]', 'label' => fx::alang('Linking field'), 'type' => 'select', 'values' => $linking_field_values, 'value' => $this['format']['linking_field']);
foreach ($res_datatypes as $rel_field_id => $linking_datatype) {
$field_id = 'format[linking_field_' . $rel_field_id . '_datatype]';
$fields[] = array('id' => $field_id, 'name' => $field_id, 'type' => 'select', 'label' => fx::alang('Linked datatype'), 'parent' => array('format[linking_field]' => $rel_field_id), 'values' => $linking_datatype, 'value' => $this['format']['linking_datatype']);
}
foreach ($res_many_many_fields as $res_mmf_key => $mm_fields) {
list($check_field, $check_type) = explode("_", $res_mmf_key);
$field_id = 'format[linking_mm_field_' . $res_mmf_key . ']';
$fields[] = array('id' => $field_id, 'name' => $field_id, 'type' => 'select', 'label' => 'Many-many field', 'parent' => array('format[linking_field_' . $check_field . '_datatype]' => $check_type, 'format[linking_field]' => $check_field), 'values' => $mm_fields, 'value' => $this['format']['mm_field']);
}
foreach ($res_many_many_types as $res_mmt_key => $mmt_fields) {
list($check_mmf, $check_field) = explode("|", $res_mmt_key);
$field_id = 'format[linking_mm_type_' . str_replace("|", "_", $res_mmt_key) . ']';
$fields[] = array('id' => $field_id, 'name' => $field_id, 'type' => 'select', 'label' => 'Many-many datatype', 'parent' => array('format[linking_mm_field_' . $check_mmf . ']' => $check_field), 'values' => $mmt_fields, 'value' => $this['format']['mm_datatype']);
}
$fields[] = array('id' => 'format[render_type]', 'name' => 'format[render_type]', 'label' => fx::alang('Render type', 'system'), 'type' => 'select', 'values' => array('livesearch' => fx::alang('Live search', 'system'), 'table' => fx::alang('Fields table', 'system')), 'value' => $this['format']['render_type']);
fx::log($fields);
return $fields;
}
示例15: addInfoblockMeta
protected function addInfoblockMeta($html_result)
{
$controller_meta = $this->getResultMeta();
if (!fx::isAdmin() && (!isset($controller_meta['ajax_access']) || !$controller_meta['ajax_access'])) {
return $html_result;
}
$ib_info = array('id' => $this['id']);
if (($vis = $this->getVisual()) && $vis['id']) {
$ib_info['visual_id'] = $vis['id'];
}
$ib_info['controller'] = $this->getPropInherited('controller') . ':' . $this->getPropInherited('action');
$ib_info['name'] = $this['name'];
$meta = array('data-fx_infoblock' => $ib_info, 'class' => 'fx_infoblock fx_infoblock_' . $this['id']);
foreach ($this->infoblock_meta as $meta_key => $meta_val) {
// register only non-empty props
if ($meta_val && !is_array($meta_val) || count($meta_val) > 0) {
$meta['data-fx_' . $meta_key] = $meta_val;
}
}
if (isset($_POST['_ajax_base_url'])) {
$meta['data-fx_ajax_base_url'] = $_POST['_ajax_base_url'];
}
if ($this->isFake()) {
$meta['class'] .= ' fx_infoblock_fake';
if (!$this->getIbController()) {
$controller_meta['hidden_placeholder'] = fx::alang('Fake infoblock data', 'system');
}
}
if (isset($controller_meta['hidden']) && $controller_meta['hidden']) {
$meta['class'] .= ' fx_infoblock_hidden';
}
if (count($controller_meta) > 0 && fx::isAdmin()) {
$meta['data-fx_controller_meta'] = $controller_meta;
}
if ($this->isLayout()) {
$meta['class'] .= ' fx_unselectable';
$html_result = preg_replace_callback('~<body[^>]*?>~is', function ($matches) use($meta) {
$body_tag = Template\HtmlToken::createStandalone($matches[0]);
$body_tag->addMeta($meta);
return $body_tag->serialize();
}, $html_result);
} elseif ($this->output_is_subroot && preg_match("~^(\\s*?)(<[^>]+?>)~", $html_result)) {
$html_result = preg_replace_callback("~^(\\s*?)(<[^>]+?>)~", function ($matches) use($meta) {
$tag = Template\HtmlToken::createStandalone($matches[2]);
$tag->addMeta($meta);
return $matches[1] . $tag->serialize();
}, $html_result);
} else {
$html_proc = new Template\Html($html_result);
$html_result = $html_proc->addMeta($meta, mb_strlen($html_result) > 10000);
}
return $html_result;
}