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


PHP Resource::getComments方法代码示例

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


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

示例1: loadEContentComments

 function loadEContentComments()
 {
     global $interface;
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     $resource->source = 'EContent';
     if ($resource->find(true)) {
         $commentLists = $resource->getComments();
         $interface->assign('commentList', $commentLists['user']);
         $interface->assign('staffCommentList', $commentLists['staff']);
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:12,代码来源:UserComments.php

示例2: getItem

 /**
  * Get information about a particular item and return it as JSON
  */
 function getItem()
 {
     global $timer;
     global $configArray;
     $itemData = array();
     //Load basic information
     $this->id = $_GET['id'];
     $itemData['id'] = $this->id;
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $url = $configArray['Index']['url'];
     $this->db = new $class($url);
     if ($configArray['System']['debugSolr']) {
         $this->db->debug = true;
     }
     // Retrieve Full Marc Record
     if (!($record = $this->db->getRecord($this->id))) {
         return array('error', 'Record does not exist');
     }
     $this->record = $record;
     if ($record['recordtype'] == 'econtentRecord') {
         require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
         $eContentRecord = new EContentRecord();
         $eContentRecord->id = substr($record['id'], strlen('econtentRecord'));
         if (!$eContentRecord->find(true)) {
             $itemData['error'] = 'Cannot load eContent Record for id ' . $record['id'];
         } else {
             $itemData['isbn'] = $eContentRecord->getIsbn();
             $itemData['issn'] = $eContentRecord->getissn();
             $itemData['upc'] = $eContentRecord->getUpc();
             $itemData['issn'] = '';
             $itemData['title'] = $record['title'];
             $itemData['author'] = $eContentRecord->author;
             $itemData['publisher'] = $eContentRecord->publisher;
             $itemData['allIsbn'] = $eContentRecord->getPropertyArray('isbn');
             $itemData['allUpc'] = $eContentRecord->getPropertyArray('upc');
             $itemData['allIssn'] = $eContentRecord->getPropertyArray('issn');
             $itemData['format'] = $eContentRecord->format();
             $itemData['formatCategory'] = $eContentRecord->format_category();
             $itemData['language'] = $eContentRecord->language;
             $itemData['cover'] = $configArray['Site']['coverUrl'] . "/bookcover.php?id={$itemData['id']}&isbn={$itemData['isbn']}&issn={$itemData['issn']}&upc={$itemData['upc']}&category={$itemData['formatCategory']}&format={$itemData['format'][0]}&size=medium";
             $itemData['description'] = $eContentRecord->description;
             require_once ROOT_DIR . '/sys/eContent/EContentRating.php';
             $eContentRating = new EContentRating();
             $eContentRating->recordId = $eContentRecord->id;
             $itemData['ratingData'] = $eContentRating->getRatingData(false, false);
             // Retrieve tags associated with the record
             $limit = 5;
             $resource = new Resource();
             $resource->record_id = $eContentRecord->id;
             $resource->source = 'eContent';
             if ($tags = $resource->getTags()) {
                 array_slice($tags, 0, $limit);
             }
             $itemData['tagList'] = $tags;
             $timer->logTime('Got tag list');
             $itemData['userComments'] = $resource->getComments();
             require_once ROOT_DIR . '/Drivers/EContentDriver.php';
             $driver = new EContentDriver();
             $itemData['holdings'] = $driver->getHolding($eContentRecord->id);
         }
     } else {
         $this->recordDriver = RecordDriverFactory::initRecordDriver($record);
         $timer->logTime('Initialized the Record Driver');
         // Process MARC Data
         require_once ROOT_DIR . '/sys/MarcLoader.php';
         $marcRecord = MarcLoader::loadMarcRecordFromRecord($record);
         if ($marcRecord) {
             $this->marcRecord = $marcRecord;
         } else {
             $itemData['error'] = 'Cannot Process MARC Record';
         }
         $timer->logTime('Processed the marc record');
         // Get ISBN for cover and review use
         if ($isbnFields = $this->marcRecord->getFields('020')) {
             //Use the first good ISBN we find.
             /** @var File_MARC_Data_Field[] $isbnFields */
             foreach ($isbnFields as $isbnField) {
                 if ($isbnField = $isbnField->getSubfield('a')) {
                     $this->isbn = trim($isbnField->getData());
                     if ($pos = strpos($this->isbn, ' ')) {
                         $this->isbn = substr($this->isbn, 0, $pos);
                     }
                     if (strlen($this->isbn) < 10) {
                         $this->isbn = str_pad($this->isbn, 10, "0", STR_PAD_LEFT);
                     }
                     $itemData['isbn'] = $this->isbn;
                     break;
                 }
             }
         }
         /** @var File_MARC_Data_Field $upcField */
         if ($upcField = $this->marcRecord->getField('024')) {
             if ($upcSubfield = $upcField->getSubfield('a')) {
                 $this->upc = trim($upcSubfield->getData());
                 $itemData['upc'] = $this->upc;
             }
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:ItemAPI.php

示例3: GetComments

 function GetComments()
 {
     global $interface;
     require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php';
     require_once ROOT_DIR . '/services/MyResearch/lib/Comments.php';
     $interface->assign('id', $_GET['id']);
     $resource = new Resource();
     $resource->record_id = $_GET['id'];
     $resource->source = 'eContent';
     $commentList = array();
     if ($resource->find(true)) {
         $commentList = $resource->getComments();
     }
     $interface->assign('commentList', $commentList['user']);
     $userComments = $interface->fetch('Record/view-comments-list.tpl');
     $interface->assign('staffCommentList', $commentList['staff']);
     $staffComments = $interface->fetch('Record/view-staff-reviews-list.tpl');
     return json_encode(array('staffComments' => $staffComments, 'userComments' => $userComments));
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:19,代码来源:AJAX.php

示例4: getComments

 /**
  * Return comments for a particular record and return them as an array.
  *
  * @param $id
  * @return array|null
  */
 static function getComments($id)
 {
     $resource = new Resource();
     $resource->record_id = $id;
     $resource->source = 'VuFind';
     if ($resource->find(true)) {
         $commentList = $resource->getComments();
         return $commentList;
     } else {
         return null;
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:18,代码来源:UserComments.php


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