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


PHP Tree::instance方法代码示例

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


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

示例1: action_add

 /**
  * Add
  */
 public function action_add()
 {
     $this->title = __('publications.page_add');
     $obj = ORM::factory('Publications_Page');
     if ($this->request->is_post()) {
         $tags = Arr::get($_POST, 'tags');
         $obj->prepare();
         $obj->values($_POST);
         try {
             $obj->save();
             if (Module::is_on('cms_tags')) {
                 $obj->save_tags($tags, Model_Tag::TYPE_PUBLICATION);
             }
             Message::success(__('publications.page_added'));
             $this->_redirect($obj->id);
         } catch (ORM_Validation_Exception $e) {
             Message::error(__('settings.error_saving'));
             $errors = $e->errors('validation');
         }
     } else {
         $tags = '';
     }
     $sel_category = Tree::instance('publications_categories', $this->curr_module)->form_select('category_id', $obj->category_id, ['', ''], ['class' => 'form-control']);
     $this->content = View::factory($this->form, ['obj' => $obj, 'sel_category' => $sel_category])->bind('tags', $tags)->bind('errors', $errors);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:28,代码来源:Page.php

示例2: getInstance

 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
开发者ID:zhendeguoke1008,项目名称:shop-1,代码行数:7,代码来源:Tree.class.php

示例3: action_edit

 /**
  * Edit
  */
 public function action_edit()
 {
     $this->title = __('shop.category_edit');
     $obj = ORM::factory('Shop_Category', $this->request->param('id'));
     if (!$obj->loaded()) {
         throw new HTTP_Exception_404();
     }
     if ($this->request->is_post()) {
         $obj->prepare();
         $obj->values($_POST);
         try {
             $obj->save();
             Message::success(__('settings.changes_saved'));
             $this->_redirect($obj->id);
         } catch (ORM_Validation_Exception $e) {
             Message::error(__('settings.error_saving'));
             $errors = $e->errors('validation');
         }
     }
     $sel_category = Tree::instance('shop_categories', $this->curr_module, ['last' => false])->form_select('parent_id', $obj->parent_id, [0, ''], ['class' => 'form-control']);
     $this->content = View::factory($this->form, ['obj' => $obj, 'sel_category' => $sel_category])->bind('errors', $errors);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:25,代码来源:Category.php

示例4: action_edit

 /**
  * Edit
  */
 public function action_edit()
 {
     Assets::instance()->add_styles(['vendor/crop/css/cropper.min.css', 'vendor/crop/css/screen.css'])->add_scripts(['vendor/fileuploader/jquery.ui.widget.js', 'vendor/fileuploader/jquery.iframe-transport.js', 'vendor/fileuploader/jquery.fileupload.js', 'vendor/crop/js/cropper.min.js', 'vendor/crop/js/main.js']);
     $this->title = __('shop.product_edit');
     $obj = ORM::factory('Shop_Product', $this->request->param('id'));
     if (!$obj->loaded()) {
         throw new HTTP_Exception_404();
     }
     if ($this->request->is_post()) {
         $obj->prepare();
         $obj->values($_POST);
         try {
             $obj->save();
             Message::success(__('settings.changes_saved'));
             $this->_redirect($obj->id);
         } catch (ORM_Validation_Exception $e) {
             Message::error(__('settings.error_saving'));
             $errors = $e->errors('validation');
         }
     }
     $sel_category = Tree::instance('shop_categories', $this->curr_module)->form_select('category_id', $obj->category_id, ['', ''], ['class' => 'form-control']);
     $this->content = View::factory($this->form, ['obj' => $obj, 'sel_category' => $sel_category])->bind('errors', $errors);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:26,代码来源:Product.php


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