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


PHP OOMedia::_getTableJoin方法代码示例

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


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

示例1: getMediaById

 /**
  * @access public
  */
 function getMediaById($id)
 {
     $id = (int) $id;
     if ($id == 0) {
         return null;
     }
     $query = 'SELECT ' . OOMedia::_getTableName() . '.*, ' . OOMediaCategory::_getTableName() . '.name catname  FROM ' . OOMedia::_getTableJoin() . ' WHERE file_id = ' . $id;
     $sql = new rex_sql();
     //    $sql->debugsql = true;
     $result = $sql->getArray($query);
     if (count($result) == 0) {
         trigger_error('No OOMediaCategory found with id "' . $id . '"', E_USER_NOTICE);
         return null;
     }
     $result = $result[0];
     $aliasMap = array('file_id' => 'id', 're_file_id' => 'parent_id', 'category_id' => 'cat_id', 'catname' => 'cat_name', 'filename' => 'name', 'originalname' => 'orgname', 'filetype' => 'type', 'filesize' => 'size');
     $media = new OOMedia();
     foreach ($sql->getFieldNames() as $fieldName) {
         if (in_array($fieldName, array_keys($aliasMap))) {
             $var_name = '_' . $aliasMap[$fieldName];
         } else {
             $var_name = '_' . $fieldName;
         }
         $media->{$var_name} = $result[$fieldName];
     }
     return $media;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:30,代码来源:class.oomedia.inc.php

示例2: OOMedia

 /**
  * @access protected
  */
 function OOMedia($id = null)
 {
     if ($id === null) {
         return;
     }
     $query = 'SELECT ' . $this->_getTableName() . '.*,' . OOMediaCategory::_getTableName() . '.name catname  FROM ' . OOMedia::_getTableJoin() . ' WHERE file_id = ' . $id;
     $sql = new sql();
     //        $sql->debugsql = true;
     $result = $sql->get_array($query);
     if (count($result) == 0) {
         trigger_error('No OOMediaCategory found with id "' . $id . '"', E_USER_ERROR);
     }
     $result = $result[0];
     //        var_dump( $result);
     $this->_id = $result['file_id'];
     $this->_parent_id = $result['re_file_id'];
     $this->_cat_id = $result['category_id'];
     $this->_cat_name = $result['catname'];
     $this->_name = $result['filename'];
     $this->_orgname = $result['originalname'];
     $this->_type = $result['filetype'];
     $this->_size = $result['filesize'];
     $this->_width = $result['width'];
     $this->_height = $result['height'];
     $this->_title = $result['title'];
     $this->_description = $result['description'];
     $this->_copyright = $result['copyright'];
     $this->_updatedate = $result['updatedate'];
     $this->_updateuser = $result['updateuser'];
     $this->_createdate = $result['createdate'];
     $this->_createuser = $result['createuser'];
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:35,代码来源:class.oomedia.inc.php

示例3: sql

 /**
  * @access public
  */
 function &getMediaById($id)
 {
     $id = (int) $id;
     if (!is_numeric($id)) {
         return null;
     }
     $query = 'SELECT ' . OOMedia::_getTableName() . '.*, ' . OOMediaCategory::_getTableName() . '.name catname  FROM ' . OOMedia::_getTableJoin() . ' WHERE file_id = ' . $id;
     $sql = new sql();
     //        $sql->debugsql = true;
     $result = $sql->get_array($query);
     if (count($result) == 0) {
         //trigger_error('No OOMediaCategory found with id "'.$id.'"', E_USER_NOTICE);
         return null;
     }
     $result = $result[0];
     //        var_dump( $result);
     $media = new OOMedia();
     $media->_id = $result['file_id'];
     $media->_parent_id = $result['re_file_id'];
     $media->_cat_id = $result['category_id'];
     $media->_cat_name = $result['catname'];
     $media->_name = $result['filename'];
     $media->_orgname = $result['originalname'];
     $media->_type = $result['filetype'];
     $media->_size = $result['filesize'];
     $media->_width = $result['width'];
     $media->_height = $result['height'];
     $media->_title = $result['title'];
     $media->_description = $result['description'];
     $media->_copyright = $result['copyright'];
     $media->_updatedate = $result['updatedate'];
     $media->_updateuser = $result['updateuser'];
     $media->_createdate = $result['createdate'];
     $media->_createuser = $result['createuser'];
     return $media;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:39,代码来源:class.oomedia.inc.php


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