• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP orm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: view

 public function view($id, $parity)
 {
     // check to see if the user has access, this is in case we want to make it so that only logged in people can view lightboxes in the future, etc/.
     if ($this->access->allowed('lightboxes', 'read')) {
         $parity_field = 'name';
         // this is a  variable so that it can easily be changed in the future.
         $lightbox = orm::factory('lightbox')->find($id);
         // sanity check and parity check.
         if ($lightbox->loaded && $lightbox->{$parity_field} == url::decode($parity)) {
             // The only times that a lightbox are viewable are when it is public or the current user is the owner. 	A status of approved = public, a status of pending = private
             if ($lightbox->status == 'approved' || $this->user && $this->user->id == $lightbox->creator_id) {
                 $view = new view(url::routes_area() . 'view');
                 // add one to the views for the lightbox.
                 $lightbox->views += 1;
                 $lightbox->save(false);
                 $view->lightbox = $lightbox;
                 $view->is_owner = $this->user && $this->user->id == $lightbox->creator_id;
                 $view->current_user = $this->current;
                 $this->breadcrumbs->add()->url(url::current())->title($lightbox->name);
                 $view->breadcrumbs = $this->breadcrumbs->get();
                 $this->breadcrumbs->delete();
                 $this->template->content = $view;
             } else {
                 $this->notification->add($this->i18n['system.lightbox.status']);
                 url::redirect('account');
             }
         } else {
             $this->notification->add($this->i18n['system.lightbox.invalid']);
             url::redirect('account');
         }
     } else {
         $this->notification->add($this->i18n['system.lightbox.login']);
         url::redirect('account');
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:35,代码来源:lightboxes.php


示例2: index

 /**
  * Used to display the index page but also uses a jquery and the pagination to do preload of next pages
  * of the news articles. Which are then displaye don scroll 
  * @param integer $page the page number  (Matt are you sure this is needed, the pagination is smart enough not to need this). 
  */
 public function index($page = 1)
 {
     $total = orm::factory('news')->where('group', 'site')->where('status', 'approved')->count_all();
     $paging = new Pagination(array('total_items' => $total, 'items_per_page' => 3));
     $articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all($paging->items_per_page, $paging->sql_offset);
     $view = new View(url::location());
     $view->articles = $articles;
     $view->pagination = $paging->render();
     $view->page_number = $paging->page_number();
     // If the request is an ajax request, then the page is attempting to autoupdate
     // the items with in the news, so just send through the news items.
     if (request::is_ajax()) {
         // if the ajax is attempting to get a page which doesnt exist, send 404
         if ($page > $paging->total_pages) {
             Event::run('system.404');
         } else {
             $this->ajax['view'] = $view;
         }
     } else {
         // otherwise its a http request, send throught he entire page with template.
         $this->template->title = 'About Us › News & Updates Archive';
         $this->breadcrumbs->add()->url(false)->title('Archive');
         $view->breadcrumbs = $this->breadcrumbs->cut();
         $this->template->content = $view;
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:31,代码来源:archive.php


示例3: index

 public function index()
 {
     $view = new View(url::location());
     $view->articles = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all(6);
     $this->template->title = 'About Us › News & Updates';
     $this->template->content = $view;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:7,代码来源:news.php


示例4: index

 public function index()
 {
     $view = new View(url::location());
     $this->template->title = 'About Us › Global Alliances';
     $view->breadcrumbs = $this->breadcrumbs->cut();
     $view->locations = orm::factory('location')->where('status', 'approved')->where('group', 'alliances')->find_all();
     $this->template->content = $view;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:8,代码来源:alliances.php


示例5: delete

 /**
  * Simple delete of the object, plus a call to the unify to check to see if the 
  * collection also needs to be deleted. 
  * @return boolean $return, whether or not  the call did everything expected
  */
 public function delete()
 {
     $original = orm::factory('pigment', $this->id);
     $return = parent::delete();
     if ($return) {
         $return = $this->unify($original);
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:13,代码来源:pigment.php


示例6: glossary

 public function glossary()
 {
     $view = new View(url::location());
     $this->template->title = 'Environmental › Glossary';
     $this->breadcrumbs->add()->url(false)->title('Glossary');
     $view->breadcrumbs = $this->breadcrumbs->cut();
     $view->glossaries = orm::factory('glossary')->where('status', 'approved')->find_all();
     $this->template->content = $view;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:9,代码来源:environmental.php


示例7: delete

 /**
  * Simple delete of the object, plus a call to the unify to check to see if the 
  * pigment also needs to be deleted. 
  * @return boolean $return, whether or not  the call did everything expected
  */
 public function delete()
 {
     $original = orm::factory('sheet', $this->id);
     $return = parent::delete();
     // if it was deleted, then verfiy
     if ($return) {
         $return = $this->unify($original);
     }
     return $return;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:15,代码来源:sheet.php


示例8: index

 public function index()
 {
     $this->breadcrumbs->delete();
     $this->template->title = 'Home';
     $view = new view('home/index');
     $view->inspirations = orm::factory('inspiration')->where('status', 'approved')->find_all();
     $view->billboards = orm::factory('billboard')->where('status', 'approved')->find_all();
     $view->populars = orm::factory('paper')->where('status', 'approved')->where('popular', 'true')->orderby(NULL, 'RAND()')->find_all(8);
     $view->news = orm::factory('news')->where('group', 'site')->where('status', 'approved')->find_all(3);
     $this->template->content = $view;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:11,代码来源:home.php


示例9: set

 public function set($name)
 {
     $feature = orm::factory('feature')->where('name', $name)->find();
     if ($feature->loaded) {
         return $feature;
     } else {
         $this->name = $name;
         parent::save();
         return $this;
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:11,代码来源:feature.php


示例10: set

 public function set($name)
 {
     $tip = orm::factory('tip')->where('name', $name)->find();
     if ($tip->loaded) {
         return $tip;
     } else {
         $this->name = $name;
         parent::save();
         return $this;
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:11,代码来源:tip.php


示例11: add

 /**
  * This will call the parentxontent controller to populate the view, while sending throught he type of content that it is 
  * as well as the paper_id, which will be used to autocomplete the paper combo box withg the correct result. 
  * @see Content_Controller::add()
  */
 public function add($paper_id = NULL)
 {
     $paper = orm::factory('paper', $paper_id);
     // load the paper so that we can get all the details required to populate the breadrumbs
     if ($paper->loaded) {
         $this->breadcrumbs->add()->url('products/papers/edit/' . url::encode($paper->name))->title(url::decode($paper->name));
         $this->breadcrumbs->add()->url('products/papers/technicals/index/' . $paper->id)->title('Technicals');
         $this->breadcrumbs->add()->url(false)->title('Add');
     }
     parent::add('technical', $paper->id);
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:16,代码来源:technicals.php


示例12: get

 /**
  * Create as we need to build the paper name if one doesnt exist. 
  */
 public function get()
 {
     $results = parent::get();
     // we have the results, we now need to go through and build the names up
     for ($i = 0; $i < count($results); $i++) {
         if ($results[$i]['name'] == NULL) {
             $collection = orm::factory('collection')->find($results[$i]['collection_id']);
             $results[$i]['name'] = $collection->paper->name . ' ' . $collection->finish->name . ' ' . ucwords($results[$i]['color']);
         }
     }
     return $results;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:15,代码来源:Search_Pigments.php


示例13: calculate_total

 public function calculate_total()
 {
     $price = orm::factory('dish', $this->dish_id)->price;
     $temp = $this->get_ingredients_in_order_dish();
     foreach ($temp as $ingred) {
         $price += $ingred->price;
     }
     $temp = $this->get_subs_in_order_dish();
     foreach ($temp as $sub) {
         $price += $sub->price;
     }
     $this->price = $price;
     $this->save();
 }
开发者ID:nemni8,项目名称:Munch,代码行数:14,代码来源:ordersdish.php


示例14: action_add

 public function action_add($ordersdish_id, $ingredient_id, $price = NULL)
 {
     $ordersdishesingredient = ORM::factory('ordersdishesingredient');
     $ordersdishesingredient->orders_dishes_id = $ordersdish_id;
     $ordersdishesingredient->ingredient_id = $ingredient_id;
     if (!$price) {
         $dish_id = orm::factory('ordersdish', $ordersdish_id)->dish_id;
         $temp = orm::factory('dishesingredient')->where('dish_id', '=', $dish_id)->and_where('ingredient_id', '=', $ingredient_id)->find();
         $ordersdishesingredient->price = $temp->price;
     } else {
         $ordersdishesingredient->price = $price;
     }
     $ordersdishesingredient->save();
 }
开发者ID:nemni8,项目名称:Munch,代码行数:14,代码来源:ordersdishesingredient.php


示例15: action_add

 public function action_add($ordersdish_id, $group_id, $sub_id, $price = NULL)
 {
     $ordersdishesgroupssub = ORM::factory('ordersdishesgroupssub');
     $ordersdishesgroupssub->orders_dishes_id = $ordersdish_id;
     $ordersdishesgroupssub->group_id = $group_id;
     $ordersdishesgroupssub->sub_id = $sub_id;
     if (!$price) {
         $sub = orm::factory('sub')->where('group_id', '=', $group_id)->and_where('sub_id', '=', $sub_id)->find();
         $group_price = orm::factory('group', $group_id)->price;
         $ordersdishesgroupssub->price = $sub->price > 0 ? $sub->price : $group_price;
     } else {
         $ordersdishesgroupssub->price = $price;
     }
     $ordersdishesgroupssub->save();
 }
开发者ID:nemni8,项目名称:Munch,代码行数:15,代码来源:ordersdishesgroupssub.php


示例16: __get

 public function __get($name)
 {
     // Are we trying to get the gsms
     if ($name == 'gsms') {
         // if the gsms are not set ... set them and then return
         if (is_null($this->gsms)) {
             $this->gsms = $this->db->select('gsms.name')->from('gsms')->where('collections.paper_id', $this->id)->join('sheets', 'sheets.id', 'gsms.sheet_id')->join('pigments', 'sheets.pigment_id', 'pigments.id')->join('collections', 'collections.id', 'pigments.collection_id')->orderby('gsms.name')->groupby('gsms.name')->get();
         }
         return $this->gsms;
     } elseif ($name == 'technicals') {
         $technicals = orm::factory('technical')->where('foreign_id', $this->id)->where('type', 'technical');
         return $technicals->find_all();
     } else {
         return parent::__get($name);
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:16,代码来源:paper.php


示例17: index

 public function index()
 {
     $this->profiler = new Profiler();
     $view = new View(url::location());
     $this->template->title = 'Products';
     $view->breadcrumbs = $this->breadcrumbs->cut();
     // get the differnt types of favourite products.
     $types = array('standard', 'sticky', 'digital');
     /// loop through the three types of papers, assign three popular of that type for each one.
     foreach ($types as $type) {
         $var = $type . '_papers';
         $view->{$var} = orm::factory('paper')->where('type', $type)->where('status', 'approved')->where('popular', 'true')->orderby(NULL, 'RAND()')->find_all(3);
     }
     // get three random popular indsutrial items.
     $view->industrials = orm::factory('industrial')->where('status', 'approved')->where('popular', 'true')->orderby(NULL, 'RAND()')->find_all(3);
     $this->template->content = $view;
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:17,代码来源:products.php


示例18: view

 /** 
  * This page will display a page much like the page for the paper products. 
  * 
  * the expcetion will be it will have multiple images and missing some of the relationships that 
  * the papers have.
  * 
  * 
  * @param unknown_type $name
  */
 public function view($name)
 {
     // clean the input, remove and opf the escape characters
     $name = url::encode($name);
     $industrial = orm::factory('industrial')->where('name', $name)->find_all();
     //if ($industrial->loaded)
     //{
     $view = new view(url::location());
     $view->industrial = $industrial[0];
     $this->template->title = ucwords($name);
     $this->template->content = $view;
     //}
     //else
     //{
     // unable to find the industrial item
     //}
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:26,代码来源:industrials.php


示例19: view

 public function view($name)
 {
     $name = url::decode($name);
     // check it exists and is published
     $campaign = orm::factory('campaign')->where('name', $name)->where('status', 'approved')->find();
     if ($campaign->loaded) {
         $this->breadcrumbs->add()->url('campaigns')->title('Campaigns');
         $this->breadcrumbs->add()->url(false)->title($campaign->name);
         $this->template->title = 'Campaigns &rsaquo; ' . $campaign->name;
         $view = new view(url::location());
         $view->campaign = $campaign;
         $view->breadcrumbs = $this->breadcrumbs->cut();
         $this->template->content = $view;
     } else {
         $this->notification->add($this->i18n['system.campaign.invalid']);
         url::redirect(url::routes_area());
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:18,代码来源:campaigns.php


示例20: edit

 public function edit($id)
 {
     if ($this->access->allowed('glossaries', 'update')) {
         $glossary = orm::factory('glossary', $id);
         if ($glossary->loaded) {
             $this->breadcrumbs->add()->url(false)->title($glossary->name);
             $view = new view(url::location());
             $view->glossary = $glossary;
             $this->template->title = 'Edit Glossary Article';
             $this->template->content = $view;
         } else {
             // tell the user that the article doesnt exist
             // @todo add notification
             //$this->notification->add();
             url::redirect(url::routes_area());
         }
     } else {
         Kohana::log('debug', 'User failed method security check');
         url::failed();
     }
 }
开发者ID:HIVE-Creative,项目名称:spicers,代码行数:21,代码来源:glossaries.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP osC_Cache类代码示例发布时间:2022-05-23
下一篇:
PHP org_tubepress_impl_ioc_IocContainer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap