当前位置: 首页>>代码示例>>PHP>>正文


PHP Fx::data方法代码示例

本文整理汇总了PHP中Floxim\Floxim\System\Fx::data方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::data方法的具体用法?PHP Fx::data怎么用?PHP Fx::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Floxim\Floxim\System\Fx的用法示例。


在下文中一共展示了Fx::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 public function install($input)
 {
     $patch_id = $input['params'][0];
     if (!$patch_id) {
         return;
     }
     $patch = fx::data('patch', $patch_id);
     if (!$patch) {
         return;
     }
     $this->response->addField(array('type' => 'label', 'value' => '<p>' . sprintf(fx::alang('Installing patch %s...', 'system'), $patch['to']) . '</p>'));
     $res = false;
     try {
         $res = $patch->install();
     } catch (Exception $e) {
         $this->response->addField(array('type' => 'label', 'value' => '<p style="color:#F00;">' . $e->getMessage() . '</p>'));
     }
     if (!$res) {
         $this->response->addField(array('type' => 'label', 'value' => '<p style="color:#F00;">Install failed!</p>'));
     } else {
         // retrieve changes
         $changes = '<ul>';
         $logs = fx::changelog($patch['to']);
         foreach ($logs as $log) {
             $changes .= "<li>{$log['message']}</li>";
         }
         $changes .= '</ul>';
         $this->response->addField(array('type' => 'label', 'value' => '<p>Patch installed sucessfully!</p>' . $changes));
     }
     $this->response->addField(array('type' => 'button', 'url' => 'patch.all', 'label' => 'Back'));
     $this->setLayout($patch);
 }
开发者ID:floxim,项目名称:floxim,代码行数:32,代码来源:Patch.php

示例2: deleteInfoblocks

 protected function deleteInfoblocks()
 {
     $infoblocks = fx::data('infoblock')->where('site_id', $this['id'])->all();
     foreach ($infoblocks as $infoblock) {
         $infoblock->delete();
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:7,代码来源:Entity.php

示例3: doNeighbours

 public function doNeighbours()
 {
     $item = fx::env('page');
     $q = $this->getFinder()->order(null)->limit(1)->where('site_id', fx::env('site_id'));
     $q_next = clone $q;
     $q_prev = clone $q;
     if ($this->getParam('sorting') === 'auto' && $item['infoblock_id']) {
         $item_ib_params = fx::data('infoblock', $item['infoblock_id'])->get('params');
         $ib_sorting = $item_ib_params['sorting'];
         $this->setParam('sorting', $ib_sorting == 'manual' || $ib_sorting == 'auto' ? 'priority' : $ib_sorting);
         $this->setParam('sorting_dir', $item_ib_params['sorting_dir']);
     }
     $sort_field = $this->getParam('sorting', 'priority');
     if ($sort_field === 'auto') {
         $sort_field = 'priority';
     }
     $dir = strtolower($this->getParam('sorting_dir', 'asc'));
     $where_prev = array(array($sort_field, $item[$sort_field], $dir == 'asc' ? '<' : '>'));
     $where_next = array(array($sort_field, $item[$sort_field], $dir == 'asc' ? '>' : '<'));
     $group_by_parent = $this->getParam('group_by_parent');
     if ($group_by_parent) {
         $c_parent = fx::content($item['parent_id']);
         // todo: psr0 need verify
         $q_prev->order('parent.priority', 'desc')->where('parent.priority', $c_parent['priority'], '<=');
         $q_next->order('parent.priority', 'asc')->where('parent.priority', $c_parent['priority'], '>=');
         $where_prev[] = array('parent_id', $item['parent_id'], '!=');
         $where_next[] = array('parent_id', $item['parent_id'], '!=');
     }
     $q_prev->order($sort_field, $dir == 'asc' ? 'desc' : 'asc')->where($where_prev, null, 'or');
     $prev = $q_prev->all();
     $q_next->order($sort_field, $dir)->where($where_next, null, 'or');
     $next = $q_next->all();
     //fx::log($q_prev->showQuery(), $q_next->showQuery());
     return array('prev' => $prev, 'current' => $item, 'next' => $next);
 }
开发者ID:floxim,项目名称:module-main,代码行数:35,代码来源:Controller.php

示例4: validate

 public function validate()
 {
     $res = true;
     if (!$this['name']) {
         $this->validate_errors[] = array('field' => 'name', 'text' => fx::alang('Specify the name of the widget', 'system'));
         $res = false;
     }
     if (!$this['keyword']) {
         $this->validate_errors[] = array('field' => 'keyword', 'text' => fx::alang('Enter the keyword of widget', 'system'));
         $res = false;
     }
     if ($this['keyword'] && !preg_match("/^[a-z0-9_\\.]+\$/i", $this['keyword'])) {
         $this->validate_errors[] = array('field' => 'keyword', 'text' => fx::alang('Keyword can contain only letters and numbers', 'system') . ' / ' . $this['keyword']);
         $res = false;
     }
     if ($this['keyword']) {
         $widgets = fx::data('widget')->all();
         foreach ($widgets as $widget) {
             if ($widget['id'] != $this['id'] && $widget['keyword'] == $this['keyword']) {
                 $this->validate_errors[] = array('field' => 'keyword', 'text' => fx::alang('This keyword is used by widget', 'system') . ' "' . $widget['name'] . '"');
                 $res = false;
             }
         }
     }
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:26,代码来源:Entity.php

示例5: getErrorPage

 public function getErrorPage($site_id = null)
 {
     if (is_null($site_id)) {
         $site_id = fx::env('site_id');
     }
     $error_page = fx::data('page', fx::data('site', $site_id)->get('error_page_id'));
     return $error_page;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:8,代码来源:Error.php

示例6: 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;
 }
开发者ID:floxim,项目名称:module-layout,代码行数:8,代码来源:Controller.php

示例7: install

 public function install(\Floxim\Floxim\Component\Infoblock\Entity $ib, $ctr, $params)
 {
     if (!isset($params['form_id']) || !$params['form_id']) {
         $form = fx::data('floxim.form.form')->create(array('name' => 'My new form'));
         $form->save();
         $ib->digSet('params.form_id', $form['id']);
         $ib->save();
         fx::log('ib savd', $ib, $params, $form);
     }
 }
开发者ID:floxim,项目名称:module-form,代码行数:10,代码来源:Controller.php

示例8: route

 public function route($url = null, $context = null)
 {
     if (!fx::isAdmin()) {
         return null;
     }
     if (!preg_match("~^/\\~ib/(\\d+|fake(?:\\-\\d+)?)@(\\d+)~", $url, $ib_info)) {
         return null;
     }
     $c_url = fx::input()->fetchGetPost('_ajax_base_url');
     if ($c_url) {
         $_SERVER['REQUEST_URI'] = $c_url;
         $path = fx::router()->getPath(fx::path()->removeBase($c_url));
         if ($path) {
             fx::env('page', $path->last());
         } else {
             fx::env('page', fx::router('error')->getErrorPage());
         }
         $c_url = parse_url($c_url);
         if (isset($c_url['query'])) {
             parse_str($c_url['query'], $_GET);
         }
     }
     $ib_id = $ib_info[1];
     $page_id = $ib_info[2];
     if (!fx::env('page') && $page_id) {
         $page = fx::data('floxim.main.content', $page_id);
         fx::env('page', $page);
     }
     fx::env('ajax', true);
     $page_infoblocks = fx::router('front')->getPageInfoblocks($page_id, fx::env('layout'));
     fx::page()->setInfoblocks($page_infoblocks);
     // import layout template to recreate real env
     fx::router('front')->importLayoutTemplate();
     // front end can try to reload the layout which is out of date
     // when updating from "layout settings" panel
     $infoblock = fx::data('infoblock', $ib_id);
     if (!$infoblock && isset($_POST['infoblock_is_layout']) || $infoblock->isLayout()) {
         //$infoblock = $layout_infoblock;
         $infoblock = fx::router('front')->getLayoutInfoblock(fx::env('page'));
     }
     fx::http()->status('200');
     $infoblock_overs = null;
     if (fx::isAdmin() && isset($_POST['override_infoblock'])) {
         $infoblock_overs = fx::input('post', 'override_infoblock');
         if (is_string($infoblock_overs)) {
             parse_str($infoblock_overs, $infoblock_overs);
             $infoblock_overs = fx::input()->prepareSuperglobal($infoblock_overs);
         }
         $infoblock->override($infoblock_overs);
     }
     $infoblock->overrideParam('ajax_mode', true);
     $res = $infoblock->render();
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:54,代码来源:Infoblock.php

示例9: getPath

 public static function getPath($id)
 {
     if (!is_numeric($id)) {
         return $id;
     }
     $file = fx::data('filetable', $id);
     if (!$file) {
         return null;
     }
     return $file->getHttpPath();
 }
开发者ID:floxim,项目名称:floxim,代码行数:11,代码来源:Entity.php

示例10: beforeSave

 protected function beforeSave()
 {
     parent::beforeSave();
     unset($this['is_stub']);
     if (!$this['priority'] && $this['layout_id']) {
         $last_vis = fx::data('infoblock_visual')->where('layout_id', $this['layout_id'])->where('area', $this['area'])->order(null)->order('priority', 'desc')->one();
         $this['priority'] = $last_vis['priority'] + 1;
     }
     if ($this->needRecountFiles) {
         $this->recountFiles();
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:12,代码来源:Entity.php

示例11: handleLinkers

 protected function handleLinkers()
 {
     fx::listen('after_delete', function ($e) {
         $entity = $e['entity'];
         if (!$entity->isInstanceOf('floxim.main.content') || $entity->isInstanceOf('floxim.main.linker')) {
             return;
         }
         $linkers = fx::data('floxim.main.linker')->where('linked_id', $entity['id'])->all();
         $linkers->apply(function ($l) {
             $l->delete();
         });
     });
 }
开发者ID:floxim,项目名称:module-main,代码行数:13,代码来源:Module.php

示例12: doAdd

 public function doAdd()
 {
     if (isset($_POST["addcomment"]) && isset($_POST["user_name"]) && !empty($_POST["user_name"]) && isset($_POST["comment_text"]) && !empty($_POST["comment_text"])) {
         $comments = fx::data('comment')->create(array('user_name' => $_POST["user_name"], 'comment_text' => $_POST["comment_text"], 'publish_date' => date("Y-m-d H:i:s"), 'parent_id' => $this->getParentId(), 'infoblock_id' => $this->getParam('target_infoblock_id')));
         $comments->save();
         if (!isset($_COOKIE["own_comments"])) {
             setcookie('own_comments', $comments["id"], time() + 60 * 60 * 24 * 30);
         } else {
             setcookie('own_comments', $_COOKIE["own_comments"] . ',' . $comments["id"], time() + 60 * 60 * 24 * 30);
         }
         fx::http()->refresh();
     }
 }
开发者ID:floxim,项目名称:module-blog,代码行数:13,代码来源:Controller.php

示例13: getData

 public function getData()
 {
     $data = parent::getData();
     $types_by_id = $data->getValues('type', 'id');
     unset($types_by_id['']);
     if (count($types_by_id) == 0) {
         return $data;
     }
     $base_component = fx::component($this->component_id);
     $base_type = $base_component['keyword'];
     $base_table = $base_component->getContentTable();
     $types = array();
     foreach ($types_by_id as $id => $type) {
         if ($type != $base_type) {
             if (!isset($types[$type])) {
                 $types[$type] = array();
             }
             $types[$type][] = $id;
         }
     }
     foreach ($types as $type => $ids) {
         if (!$type) {
             continue;
         }
         $type_tables = array_reverse(fx::data($type)->getTables());
         $missed_tables = array();
         foreach ($type_tables as $table) {
             if ($table == $base_table) {
                 break;
             }
             $missed_tables[] = $table;
         }
         $base_missed_table = array_shift($missed_tables);
         if (!$base_missed_table) {
             fx::log('empty base table');
             continue;
         }
         $q = "SELECT * FROM `{{" . $base_missed_table . "}}` \n";
         foreach ($missed_tables as $mt) {
             $q .= " INNER JOIN `{{" . $mt . '}}` ON `{{' . $mt . '}}`.id = `{{' . $base_missed_table . "}}`.id\n";
         }
         $q .= "WHERE `{{" . $base_missed_table . "}}`.id IN (" . join(", ", $ids) . ")";
         $extensions = fx::db()->getIndexedResults($q);
         foreach ($data as $data_index => $data_item) {
             if (isset($extensions[$data_item['id']])) {
                 $data[$data_index] = array_merge($data_item, $extensions[$data_item['id']]);
             }
         }
     }
     return $data;
 }
开发者ID:floxim,项目名称:floxim,代码行数:51,代码来源:Finder.php

示例14: up

 protected function up()
 {
     $new_fields = array(array('keyword' => 'is_published', 'name_en' => 'Is published?', 'name_ru' => '', 'type' => '5', 'not_null' => '0', 'priority' => '267', 'searchable' => '0', 'default' => '1', 'type_of_edit' => '1', 'checked' => '1', 'form_tab' => '0'), array('keyword' => 'is_branch_published', 'name_en' => 'Is branch published?', 'name_ru' => '', 'type' => '5', 'not_null' => '0', 'priority' => '268', 'searchable' => '0', 'default' => '1', 'type_of_edit' => '3', 'checked' => '1', 'form_tab' => '0'));
     $content_id = fx::data('component', 'content')->get('id');
     foreach ($new_fields as $field_props) {
         $field_props['component_id'] = $content_id;
         $field = fx::data('field')->create($field_props);
         $field->save();
         fx::log('add field', $field);
     }
     fx::data('component')->dropStoredStaticCache();
     fx::db()->query('update {{floxim_main_content}} set is_published = 1, is_branch_published = 1');
     fx::cache('meta')->delete('schema');
 }
开发者ID:floxim,项目名称:floxim,代码行数:14,代码来源:m20141208_084116_is_published_field.php

示例15: getFormFieldCondition

 public function getFormFieldCondition($field)
 {
     $jsf = $field->getJsField($this);
     $form = $this['form'];
     if (!$form) {
         $form = fx::data('floxim.form.form')->create();
     }
     $inputs = $form->getInputs();
     $jsf['fields'] = array();
     foreach ($inputs as $input) {
         $jsf['fields'][] = array('name' => $input['label'], 'type' => 'string', 'id' => $input['id'], 'keyword' => 'field.' . $input['id']);
     }
     return $jsf;
 }
开发者ID:floxim,项目名称:module-form,代码行数:14,代码来源:Entity.php


注:本文中的Floxim\Floxim\System\Fx::data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。