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


PHP Resources::getTables方法代码示例

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


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

示例1: initQuery

 function initQuery($params)
 {
     $tables = Resources::getTables();
     $rltable = $tables['resource_labels']['columns'];
     $this->addSelectField($rltable['id'], 'id');
     $this->addSelectField($rltable['res_prefix'], 'prefix');
     $this->addSelectField($rltable['res_label'], 'label');
     $this->addSelectField($rltable['res_text'], 'def_value');
     $this->addSelectField('_ml_.value', 'value');
     $this->setMultiLangAlias('_ml_', 'resource_labels', $rltable['res_text'], $rltable['id'], 'Resources', '', true, $params['lng']);
     // filter conditions
     $where = array();
     if (isset($params['label'])) {
         if (isset($params['label']['exactly']) && $params['label']['exactly'] == 'Y') {
             $where[] = array($rltable['res_label'], DB_EQ, '\'' . $this->DBAddSlashes($params['label']['value']) . '\'');
         } else {
             $where[] = array($rltable['res_label'], DB_LIKE, '\'%' . str_replace('_', '\\_', $this->DBAddSlashes($params['label']['value'])) . '%\'');
         }
     }
     if (isset($params['pattern'])) {
         if (isset($params['pattern']['exactly']) && $params['pattern']['exactly'] == 'Y') {
             $where[] = array('(', $rltable['res_text'], DB_EQ, '\'' . $this->DBAddSlashes($params['pattern']['value']) . '\'', DB_OR, '_ml_.value', DB_EQ, '\'' . $this->DBAddSlashes($params['pattern']['value']) . '\'', ')');
         } else {
             $where[] = array('(', $rltable['res_text'], DB_LIKE, '\'%' . str_replace('_', '\\_', $this->DBAddSlashes($params['pattern']['value'])) . '%\'', DB_OR, '_ml_.value', DB_LIKE, '\'%' . str_replace('_', '\\_', $this->DBAddSlashes($params['pattern']['value'])) . '%\'', ')');
         }
     }
     if (isset($params['type'])) {
         switch ($params['type']) {
             case 'all':
                 break;
             case 'storefront':
                 $where[] = array($rltable['res_prefix'], DB_EQ, '\'CZ\'');
                 break;
             case 'storefront_cz':
                 $where[] = array($rltable['res_prefix'], DB_EQ, '\'CZ\'');
                 $where[] = array($rltable['res_label'], DB_NLIKE, '\'CUSTOM\\_%\'');
                 break;
             case 'admin':
                 $where[] = array($rltable['res_prefix'], DB_NEQ, '\'CZ\'');
                 break;
             case 'CZ_CUSTOM':
                 $where[] = array($rltable['res_prefix'], DB_EQ, '\'CZ\'');
                 $where[] = array($rltable['res_label'], DB_LIKE, '\'CUSTOM\\_%\'');
                 break;
             default:
                 $where[] = array($rltable['res_prefix'], DB_EQ, '\'' . $params['type'] . '\'');
                 break;
         }
     }
     if (isset($params['status'])) {
         if ($params['status'] == 'translated') {
             $where[] = array('_ml_.ml_id', DB_NNULL);
         } elseif ($params['status'] == 'nontranslated') {
             $where[] = array('_ml_.ml_id', DB_IS_NULL);
         }
     }
     if (isset($params['label_id'])) {
         $where[] = array($rltable['id'], DB_EQ, '\'' . $params['label_id'] . '\'');
     }
     // building the where condition
     if (!empty($where)) {
         foreach ($where as $k => $v) {
             if ($k != 0) {
                 array_push($this->WhereList, DB_AND);
             }
             foreach ($v as $vv) {
                 array_push($this->WhereList, $vv);
             }
         }
     }
     $this->SelectOrder($rltable['res_label']);
     if (isset($params['paginator']) && is_array($params['paginator'])) {
         list($offset, $count) = $params['paginator'];
         $this->SelectLimit($offset, $count);
     } elseif (isset($params['limit']) && is_array($params['limit'])) {
         list($offset, $count) = $params['limit'];
         $this->SelectLimit($offset, $count);
     }
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:79,代码来源:common.php

示例2: addLabelsArrayToDB

 function addLabelsArrayToDB($data, $prefix)
 {
     global $application;
     if (empty($data)) {
         return false;
     }
     loadCoreFile('db_multiple_insert.php');
     $tables = Resources::getTables();
     $table = "resource_labels";
     $columns = $tables[$table]['columns'];
     $fields = array($columns['res_prefix'], $columns['res_label'], $columns['res_text']);
     $query = new DB_Multiple_Insert($table);
     $query->setInsertFields($fields);
     foreach ($data as $key => $value) {
         $params = array($columns['res_prefix'] => $prefix, $columns['res_label'] => $key, $columns['res_text'] => $value);
         $query->addInsertValuesArray($params);
     }
     $application->db->PrepareSQL($query);
     $application->db->DB_Exec();
     return true;
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:21,代码来源:resources_api.php

示例3: initQuery

 function initQuery($params)
 {
     $tables = Resources::getTables();
     $p = $tables['resource_labels']['columns'];
     $this->addSelectField($p['res_prefix'], 'res_prefix');
     $this->addSelectField($p['res_label'], 'res_label');
     $this->setMultiLangAlias('_ml', 'resource_labels', $p['res_text'], $p['id'], 'Resources', 0, true, $params['res_lng']);
     $this->addSelectField($this->getMultiLangAlias('_ml'), 'res_text');
     $this->WhereValue($p['res_prefix'], DB_EQ, $params['prefix']);
     $this->WhereAnd();
     $this->WhereValue($p['res_label'], DB_EQ, $params['label']);
 }
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:12,代码来源:common.php


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