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