當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。