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


PHP common_node::listing方法代码示例

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


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

示例1: mainAction

 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * node_id is mandatory input
      */
     if (is_numeric($this->GET['node_id'])) {
         $node_id = $this->GET['node_id'];
     } else {
         msg("menu_prevnext: missing node_id", 'error');
         return false;
     }
     /**
      * get detail and list
      */
     $Node = new common_node();
     $first_parent_type_page_node_id = $Node->getParentPageId($node_id);
     $parent_page_detail = $Node->getDetail($first_parent_type_page_node_id);
     $current_node_detail = $Node->getDetail($node_id);
     if ($current_node_detail['node_group'] == 'page') {
         // the specific node_id is page type
         $current_page_detail = $current_node_detail;
         $parent_page_detail = $Node->getDetail($Node->getParentPageId($current_page_detail['parent']));
     } else {
         // we need to first parent type page
         $current_page_detail = $parent_page_detail;
         $parent_page_detail = $Node->getDetail($current_page_detail['parent']);
     }
     $siblings = $Node->listing("parent = {$current_page_detail['parent']} AND node_group = 'page' AND publish = 1", 'priority DESC, id ASC');
     if (is_array($siblings)) {
         /**
          * find prev/next node
          */
         foreach ($siblings as $k => $item) {
             if ($item['id'] == $current_page_detail['id']) {
                 $prev_node = $siblings[$k - 1];
                 $next_node = $siblings[$k + 1];
                 break;
             }
         }
         /**
          * cycle
          */
         if (!is_array($prev_node)) {
             $count = count($siblings);
             $prev_node = $siblings[$count - 1];
         }
         if (!is_array($next_node)) {
             $next_node = $siblings[0];
         }
     }
     /**
      * assign
      */
     $this->tpl->assign('PREV', $prev_node);
     $this->tpl->assign('ALL', $parent_page_detail);
     $this->tpl->assign('NEXT', $next_node);
     return true;
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:61,代码来源:prevnext.php

示例2: initializeData

 /**
  * Initialize data structures
  */
 protected function initializeData($node_id)
 {
     $this->profile = $this->getProfile();
     // load all pages
     $Node = new common_node();
     $sql = "publish = 1 AND display_in_menu = 1 AND node_group = 'page' AND node_controller <> 'symbolic'";
     if ($node_id) {
         $sql .= " AND id = {$node_id}";
     }
     $this->pageList = $Node->listing($sql);
     // Initialize the HTTP client
     $this->client = new Zend_Http_Client();
     $this->client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:17,代码来源:search_index_build.php

示例3: mainAction

 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $node_list = $Node->listing('', 'modified DESC', '0,20');
     foreach ($node_list as $item) {
         $item['latest_change_by'] = $Node->getCustomerIdForLastModified($item['id']);
         if ($item['publish'] == 0) {
             $item['class'] = 'disabled';
         }
         $this->tpl->assign("ITEM", $item);
         $this->tpl->parse('content.item');
     }
     return true;
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:18,代码来源:node_list_recent.php

示例4: mainAction

 /**
  * main action
  */
 public function mainAction()
 {
     // get selected store for detail
     $node_id = (int) $this->GET['node_id'];
     if ($node_id > 0) {
         $Node = new common_node();
         $node = $Node->detail($node_id);
         $siblings = $Node->listing("node_group = 'page' AND node_controller = 'store' AND content ~ '[0-9]+' AND parent = {$node['parent']}");
         if (count($siblings) > 0) {
             foreach ($siblings as $i => $sibling) {
                 $column = $i % 3 + 1;
                 $this->tpl->assign("STORE", $sibling);
                 $this->tpl->parse("content.list.column{$column}");
             }
             $this->tpl->parse("content.list");
         }
     }
     return true;
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:22,代码来源:store_nearby.php

示例5: findProductInNode

 /**
  * find product in node
  */
 function findProductInNode($product_id)
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     if (is_numeric($product_id)) {
         $current = $Node->listing("node_group = 'page' AND node_controller ~ 'product' AND content = '{$product_id}'", 'id ASC');
         return $current;
     } else {
         msg("ecommerce_product.findProductInNode: product id is not numeric", 'error');
         return false;
     }
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:15,代码来源:ecommerce_product.php

示例6: mainAction

 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     if (is_numeric($this->GET['id'])) {
         $delete_id = $this->GET['id'];
     } else {
         return false;
     }
     //delete
     if ($this->GET['delete'] && is_numeric($delete_id)) {
         $id_map = $Node->getIdMap();
         /**
          * create confirmation code
          */
         $confirmation_code = md5($delete_id . session_id());
         $this->tpl->assign('CONFIRMATION_CODE', $confirmation_code);
         /**
          * safety check we are not trying to delete some core page
          */
         if (!array_search($delete_id, $id_map)) {
             $node_data = $Node->detail($delete_id);
             if (!is_array($node_data)) {
                 msg("Content ID {$delete_id} does not exists", 'error');
                 return false;
             }
             if ($this->GET['confirm']) {
                 //delete only if confirmation code match
                 if ($this->GET['confirm'] === $confirmation_code) {
                     if ($Node->moveToBin($delete_id)) {
                         msg("{$node_data['node_group']} \"{$node_data['title']}\" (id={$node_data['id']}) has been deleted");
                         //if it was a "page", than go to parent page
                         if ($this->GET['ajax'] == 0) {
                             if ($node_data['node_group'] == 'page') {
                                 onxshopGoTo("/page/{$node_data['parent']}");
                             } else {
                                 onxshopGoTo($_SESSION['last_diff'], 2);
                             }
                         }
                     } else {
                         msg("Can't delete!", 'error');
                     }
                 } else {
                     msg("node_delete: incorrect confirmation code", 'error');
                 }
             } else {
                 //get children
                 $children = $Node->listing("parent = {$delete_id}");
                 foreach ($children as $child) {
                     $this->tpl->assign("CHILD", $child);
                     $this->tpl->parse('content.confirm.children.item');
                 }
                 if (count($children) > 0) {
                     $this->tpl->parse('content.confirm.children');
                 }
                 //get linked as shared content
                 $node_data = $Node->detail($delete_id);
                 $this->tpl->assign("NODE", $node_data);
                 $shared_linked = $Node->getShared($delete_id);
                 foreach ($shared_linked as $linked) {
                     $this->tpl->assign("LINKED", $linked);
                     $this->tpl->parse('content.confirm.linked.item');
                 }
                 if (count($shared_linked) > 0) {
                     $this->tpl->parse('content.confirm.linked');
                 }
                 $this->tpl->parse('content.confirm');
             }
         } else {
             msg("This can't be deleted", 'error');
         }
     }
     return true;
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:77,代码来源:node_delete.php

示例7: getStorePages

 /**
  * Returns array of all store pages. Store id is used as array index.
  * 
  * @return Array
  */
 protected function getStorePages()
 {
     $Node = new common_node();
     $pages_raw = $Node->listing("node_group = 'page' AND node_controller = 'store' AND content ~ '[0-9]+'");
     $pages = array();
     foreach ($pages_raw as $page) {
         $store_id = (int) $page['content'];
         $pages[$store_id] = $page;
     }
     return $pages;
 }
开发者ID:uralmax89,项目名称:onxshop,代码行数:16,代码来源:store_locator.php

示例8: findStoreByNode

 /**
  * find store by node_id
  */
 function findStoreByNode($node_id)
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     if (is_numeric($node_id)) {
         $nodes = $Node->listing("node_group = 'page' AND node_controller = 'store' AND id = '{$node_id}'", 'id ASC');
         $store_id = $nodes[0]['content'];
         if (is_numeric($store_id) && $store_id > 0) {
             return $this->detail($store_id);
         }
     } else {
         msg("ecommerce_store.findStoreByNode: node id is not numeric", 'error');
     }
     return false;
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:18,代码来源:ecommerce_store.php

示例9: getRecipeListForTaxonomy

 /**
  * getRecipeListForTaxonomy
  *
  * list recipes for given taxonomy_ids
  * each item contains
  *    - main image details as 'image' field
  *    - page details as 'page' field
  *
  * @param array $taxonomy_ids
  * @param string $sort_by
  * @param string $sort_direction
  * @param int $limit_from
  * @param int $limit_per_page
  * @param string $image_role
  * @param bool $conjunction - whether included recipes should have all given $taxonomy_ids (true) or any of given $taxonomy_ids (false)
  * @param int|string $publish_status - integer to limit by publishing status, string, i.e. 'all' for no restriction by publishing status
  * @return array
  */
 function getRecipeListForTaxonomy($taxonomy_ids, $sort_by = 'created', $sort_direction = 'DESC', $limit_from = false, $limit_per_page = false, $image_role = 'teaser', $conjunction = true, $publish_status = 1)
 {
     /**
      * input filter
      */
     // sorting
     if (!in_array($sort_by, array('title', 'created', 'modified', 'priority', 'share_counter'))) {
         $sort_by = 'created';
     }
     if (!in_array($sort_direction, array('DESC', 'ASC'))) {
         $sort_direction = 'DESC';
     }
     $order_by = " ORDER BY {$sort_by} {$sort_direction}";
     // limit
     if (!is_numeric($limit_from)) {
         $limit_from = false;
     }
     if (!is_numeric($limit_per_page)) {
         $limit_per_page = false;
     }
     // allow to use limit_per_page without providing limit_from
     if (is_numeric($limit_per_page) && $limit_from === false) {
         $limit_from = 0;
     }
     if (is_numeric($limit_from) && is_numeric($limit_per_page)) {
         $limit = " LIMIT {$limit_per_page} OFFSET {$limit_from}";
     } else {
         $limit = '';
     }
     /**
      * initialise
      */
     require_once 'models/common/common_node.php';
     require_once 'models/ecommerce/ecommerce_recipe_taxonomy.php';
     require_once 'models/ecommerce/ecommerce_recipe_image.php';
     require_once 'models/ecommerce/ecommerce_recipe_review.php';
     $Node = new common_node();
     $Image = new ecommerce_recipe_image();
     $Taxonomy = new ecommerce_recipe_taxonomy();
     $Review = new ecommerce_recipe_review();
     /**
      * recipes list
      */
     $recipes = array();
     $where = "";
     if (is_array($taxonomy_ids) && count($taxonomy_ids) > 0) {
         $id_list = implode(",", $taxonomy_ids);
         if ($conjunction) {
             $count = count($taxonomy_ids);
             $where = "AND ecommerce_recipe.id IN (\n\t\t\t\t\tSELECT ecommerce_recipe.id\n\t\t\t\t\tFROM ecommerce_recipe\n\t\t\t\t\tINNER JOIN ecommerce_recipe_taxonomy ON ecommerce_recipe_taxonomy.node_id = ecommerce_recipe.id\n\t\t\t\t\tWHERE ecommerce_recipe_taxonomy.taxonomy_tree_id IN ({$id_list})\n\t\t\t\t\tGROUP BY ecommerce_recipe.id\n\t\t\t\t\tHAVING count(DISTINCT ecommerce_recipe_taxonomy.taxonomy_tree_id) = {$count}\n\t\t\t\t)";
         } else {
             $where = "AND ecommerce_recipe.id IN (SELECT node_id FROM ecommerce_recipe_taxonomy WHERE taxonomy_tree_id IN ({$id_list}))";
         }
     }
     // $publish_status
     if (is_numeric($publish_status)) {
         $where_node_publish = " AND common_node.publish = {$publish_status}";
         $where_recipe_publish = " AND ecommerce_recipe.publish = {$publish_status}";
     }
     $sql = "SELECT ecommerce_recipe.*, common_node.share_counter\n\t\t\tFROM ecommerce_recipe\n\t\t\tINNER JOIN common_node ON (common_node.node_group = 'page' \n\t\t\t\tAND common_node.node_controller = 'recipe'\n\t\t\t\tAND common_node.content = ecommerce_recipe.id::varchar\n\t\t\t\t{$where_node_publish})\n\t\t\tWHERE 1=1 {$where_recipe_publish} {$where}\n\t\t\t{$order_by}\n\t\t\t{$limit}";
     $recipes = $this->executeSql($sql);
     // return empty array if nothing is found
     if (!is_array($recipes)) {
         return array();
     }
     $recipe_pages = $Node->listing("node_group = 'page' AND node_controller = 'recipe' AND content ~ '[0-9]+' AND publish = 1");
     foreach ($recipe_pages as $recipe_page) {
         foreach ($recipes as &$recipe) {
             if ($recipe_page['content'] == $recipe['id']) {
                 // assign page
                 $recipe['page'] = $recipe_page;
                 // load images
                 $image_list = $Image->listFiles($recipe['id'], $image_role);
                 // if empty list, get any image, without specification of image_role
                 if (is_array($image_list) && count($image_list) == 0) {
                     $image_list = $Image->listFiles($recipe['id']);
                 }
                 // return only one image
                 $recipe['image'] = $image_list[0];
                 // load review
                 $recipe['review'] = $Review->getRating($recipe['id']);
             }
//.........这里部分代码省略.........
开发者ID:uralmax89,项目名称:onxshop,代码行数:101,代码来源:ecommerce_recipe.php

示例10: mainAction

 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * initialize
      */
     require_once 'models/common/common_node.php';
     require_once 'models/common/common_image.php';
     $Node = new common_node();
     $Image = new common_image();
     /**
      * find node id
      */
     if (is_numeric($this->GET['id'])) {
         $id = $this->GET['id'];
     } else {
         $id = $Node->conf['id_map-blog'];
     }
     /**
      * set header 
      */
     header('Content-Type: text/xml; charset=UTF-8');
     // flash in IE with SSL dont like Cache-Control: no-cache and Pragma: no-coche
     header("Cache-Control: ");
     header("Pragma: ");
     /**
      * Initialize pagination variables
      */
     if (is_numeric($this->GET['limit_from'])) {
         $from = $this->GET['limit_from'];
     } else {
         $from = 0;
     }
     if (is_numeric($this->GET['limit_per_page'])) {
         $per_page = $this->GET['limit_per_page'];
     } else {
         $per_page = 25;
     }
     $limit = "{$from},{$per_page}";
     /**
      * latest date
      */
     $rss_date = date('r', time());
     $this->tpl->assign("RSS_DATE", $rss_date);
     /**
      * check
      */
     if (!is_numeric($id)) {
         msg('export rss: id is not numeric', 'error');
         return false;
     }
     /**
      * process
      */
     $node_data = $Node->getDetail($id);
     $channel_taxonomy_labels = array();
     if ($node_data['publish'] == 1) {
         $this->tpl->assign('NODE', $node_data);
         $taxonomy_filter = '';
         if (is_numeric($this->GET['taxonomy_tree_id']) && $this->GET['taxonomy_tree_id'] > 0) {
             $taxonomy_filter = " AND id IN (SELECT node_id FROM common_node_taxonomy WHERE taxonomy_tree_id = {$this->GET['taxonomy_tree_id']})";
         }
         $children = $Node->listing("parent = {$id} AND publish = 1 AND node_group='page' {$taxonomy_filter}", "created DESC", $limit);
         foreach ($children as $c) {
             /**
              * create public link
              */
             $link = $Node->getSeoURL($c['id']);
             $c['url'] = "http://{$_SERVER['HTTP_HOST']}{$link}";
             /**
              * format date
              */
             $c['rss_date'] = date('r', strtotime($c['created']));
             /**
              * get categories
              */
             $taxonomy_list = $Node->getRelatedTaxonomy($c['id']);
             foreach ($taxonomy_list as $taxonomy) {
                 $this->tpl->assign('CATEGORY', $taxonomy);
                 $this->tpl->parse('content.item.category');
                 $channel_taxonomy_labels[$taxonomy['label']['title']] = true;
             }
             /**
              * add image (not part of RSS spec)
              */
             $c['image'] = $this->processImage($Image->getTeaserImageForNodeId($c['id']));
             /**
              * assign
              */
             $this->tpl->assign('CHILD', $c);
             if ($c['image']) {
                 $this->tpl->parse("content.item.image");
             }
             $this->tpl->parse("content.item");
         }
     }
     // parse channel category list
     $i = 0;
//.........这里部分代码省略.........
开发者ID:AppChecker,项目名称:onxshop,代码行数:101,代码来源:rss_node.php

示例11: generateURITable

 /**
  * generate uri table
  */
 function generateURITable()
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $nodes = $Node->listing("node_group = 'page'");
     $rewrite_table = array();
     foreach ($nodes as $p) {
         $rewrite_table[$p['id']] = $this->generateSingleURIFullPath($p);
     }
     return $rewrite_table;
 }
开发者ID:AppChecker,项目名称:onxshop,代码行数:14,代码来源:common_uri_mapping.php


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