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


PHP Resource::fetch方法代码示例

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


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

示例1: getResources

 /**
  * Get all resources associated with the current tag.
  *
  * @return array
  * @access public
  */
 public function getResources()
 {
     $resList = array();
     $sql = 'SELECT "resource".* FROM "resource_tags", "resource" ' . 'WHERE "resource"."id" = "resource_tags"."resource_id" ' . 'AND "resource_tags"."tag_id" = ' . "'" . $this->escape($this->id) . "'";
     $res = new Resource();
     $res->query($sql);
     if ($res->N) {
         while ($res->fetch()) {
             $resList[] = clone $res;
         }
     }
     return $resList;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:19,代码来源:Tags.php

示例2: getResources

 function getResources()
 {
     $resList = array();
     $sql = "SELECT resource.* FROM resource_tags, resource " . "WHERE resource.id = resource_tags.resource_id " . "AND resource_tags.tag_id = '{$this->id}'";
     /** @var Resource|object $res */
     $res = new Resource();
     $res->query($sql);
     if ($res->N) {
         while ($res->fetch()) {
             $resList[] = clone $res;
         }
     }
     return $resList;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:14,代码来源:Tags.php

示例3: fetch

 /**
  * レコードを取得する。
  * 
  * @param Resource    $result    クエリの結果セット。
  * @return    mixed    レコードデータを含む連想配列を返す。レコードが無い場合はfalseを返す。
  */
 public function fetch($result)
 {
     $ret = $result->fetch();
     if (get_magic_quotes_runtime()) {
         return array_map('stripslashes', $ret);
     }
     return $ret;
 }
开发者ID:kaz6120,项目名称:BitWiki,代码行数:14,代码来源:DataBase.php

示例4: getSuggestions

 static function getSuggestions($userId = -1)
 {
     global $configArray;
     if ($userId == -1) {
         global $user;
         $userId = $user->id;
     }
     //Load all titles the user is not interested in
     $notInterestedTitles = array();
     $notInterested = new NotInterested();
     $resource = new Resource();
     $notInterested->joinAdd($resource);
     $notInterested->userId = $userId;
     $notInterested->find();
     while ($notInterested->fetch()) {
         if ($notInterested->source == 'VuFind') {
             $fullId = $notInterested->record_id;
         } else {
             $fullId = 'econtentRecord' . $notInterested->record_id;
         }
         $notInterestedTitles[$fullId] = $fullId;
     }
     //Load all titles the user has rated (print)
     $allRatedTitles = array();
     $allLikedRatedTitles = array();
     $ratings = new UserRating();
     $ratings->userid = $userId;
     $resource = new Resource();
     $notInterested->joinAdd($resource);
     $ratings->joinAdd($resource);
     $ratings->find();
     while ($ratings->fetch()) {
         $allRatedTitles[$ratings->record_id] = $ratings->record_id;
         if ($ratings->rating >= 4) {
             $allLikedRatedTitles[] = $ratings->record_id;
         }
     }
     //Load all titles the user has rated (eContent)
     $econtentRatings = new EContentRating();
     $econtentRatings->userId = $userId;
     $econtentRatings->find();
     while ($econtentRatings->fetch()) {
         $allRatedTitles['econtentRecord' . $econtentRatings->recordId] = 'econtentRecord' . $econtentRatings->recordId;
         if ($econtentRatings->rating >= 4) {
             $allLikedRatedTitles[] = 'econtentRecord' . $econtentRatings->recordId;
         }
     }
     // Setup Search Engine Connection
     $class = $configArray['Index']['engine'];
     $url = $configArray['Index']['url'];
     $db = new $class($url);
     if ($configArray['System']['debugSolr']) {
         $db->debug = true;
     }
     //Get a list of all titles the user has rated (3 star and above)
     $ratings = new UserRating();
     $ratings->whereAdd("userId = {$userId}", 'AND');
     $ratings->whereAdd('rating >= 3', 'AND');
     $ratings->orderBy('rating DESC, dateRated DESC, id DESC');
     //Use the 20 highest ratings to make real-time recommendations faster
     $ratings->limit(0, 5);
     $ratings->find();
     $suggestions = array();
     //echo("User has rated {$ratings->N} titles<br/>");
     if ($ratings->N > 0) {
         while ($ratings->fetch()) {
             $resourceId = $ratings->resourceid;
             //Load the resource
             $resource = new Resource();
             $resource->id = $resourceId;
             $resource->find();
             if ($resource->N != 1) {
                 //echo("Did not find resource for $resourceId<br/>");
             } else {
                 $resource->fetch();
                 //echo("Found resource for $resourceId - {$resource->title}<br/>");
                 $ratedTitles[$resource->record_id] = clone $ratings;
                 $numRecommendations = 0;
                 if ($resource->isbn) {
                     //If there is an isbn for the title, we can load similar titles based on Novelist.
                     $isbn = $resource->isbn;
                     $numRecommendations = Suggestions::getNovelistRecommendations($ratings, $isbn, $resource, $allRatedTitles, $suggestions, $notInterestedTitles);
                     //echo("&nbsp;- Found $numRecommendations for $isbn from Novelist<br/>");
                 }
                 if ($numRecommendations == 0) {
                     Suggestions::getSimilarlyRatedTitles($db, $ratings, $userId, $allRatedTitles, $suggestions, $notInterestedTitles);
                     //echo("&nbsp;- Found $numRecommendations based on ratings from other users<br/>");
                 }
             }
         }
     }
     //Also get eContent the user has rated highly
     $econtentRatings = new EContentRating();
     $econtentRatings->userId = $userId;
     $econtentRatings->whereAdd('rating >= 3');
     $econtentRatings->orderBy('rating DESC, dateRated DESC');
     $econtentRatings->limit(0, 5);
     $econtentRatings->find();
     //echo("User has rated {$econtentRatings->N} econtent titles<br/>");
     if ($econtentRatings->N > 0) {
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:Suggestions.php

示例5: getResources

 /**
  * Load information from the resource table associated with this user.
  *
  * @param array $tags Array of tags to use as a filter (optional).
  *
  * @return array
  * @access public
  */
 public function getResources($tags = null)
 {
     $resourceList = array();
     $sql = 'SELECT DISTINCT "resource".*, "user_resource"."saved" FROM "resource", "user_resource" ' . 'WHERE "resource"."id" = "user_resource"."resource_id" ' . 'AND "user_resource"."user_id" = ' . "'" . $this->escape($this->id) . "'";
     if ($tags) {
         for ($i = 0; $i < count($tags); $i++) {
             $sql .= ' AND "resource"."id" IN ' . '(SELECT DISTINCT "resource_tags"."resource_id" ' . 'FROM "resource_tags", "tags" WHERE ' . '"resource_tags"."tag_id"="tags"."id" AND "tags"."tag" = ' . "'" . $this->escape($tags[$i]) . "'" . ' AND "resource_tags"."user_id" = ' . "'" . $this->escape($this->id) . "')";
         }
     }
     $resource = new Resource();
     $resource->query($sql);
     if ($resource->N) {
         while ($resource->fetch()) {
             $resourceList[] = clone $resource;
         }
     }
     return $resourceList;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:26,代码来源:User.php

示例6: removeResourcesById

 /**
  * Given an array of item ids, remove them from a list
  *
  * @param array  $ids    IDs to remove from the list
  * @param string $source Type of resource identified by IDs
  *
  * @return bool          True on success, false on error.
  * @access public
  */
 public function removeResourcesById($ids, $source = 'VuFind')
 {
     $sqlIDS = array();
     foreach ($ids as $id) {
         if (!empty($id)) {
             $sqlIDS[] = "'" . $this->escape($id) . "'";
         }
     }
     // No work is needed if we have no IDs to delete:
     if (empty($sqlIDS)) {
         return true;
     }
     // Get Resource Ids
     $sql = 'SELECT "id" FROM "resource" WHERE ("record_id" = ' . implode(' OR "record_id" = ', $sqlIDS) . ") ";
     // Don't use source here, MetaLib records would fail
     // . 'AND "source" = ' . "'" . $this->escape($source) . "'";
     $resources = new Resource();
     $resources->query($sql);
     if ($resources->N) {
         while ($resources->fetch()) {
             $resourceList[] = "'" . $this->escape($resources->id) . "'";
         }
     }
     // Remove Resource
     $sql = 'DELETE FROM "user_resource" ' . "WHERE \"user_id\" = '" . $this->escape($this->user_id) . "' " . "AND \"list_id\" = '" . $this->escape($this->id) . "' " . 'AND ("resource_id" =' . implode(' OR "resource_id" =', $resourceList) . ")";
     $removeResource = new User_resource();
     $removeResource->query($sql);
     // Remove Resource Tags
     $sql = 'DELETE FROM "resource_tags" ' . "WHERE \"user_id\" = '" . $this->escape($this->user_id) . "' " . "AND \"list_id\" = '" . $this->escape($this->id) . "' " . 'AND ("resource_id" =' . implode(' OR "resource_id" =', $resourceList) . ")";
     $removeTags = new Resource_tags();
     $removeTags->query($sql);
     // Update list modification date
     $this->updateModifiedDate();
     // If we got this far, there were no fatal DB errors so report success
     return true;
 }
开发者ID:bharatm,项目名称:NDL-VuFind,代码行数:45,代码来源:User_list.php

示例7: getMyTransactions

 public function getMyTransactions($patron, $page = 1, $recordsPerPage = -1, $sortOption = 'dueDate')
 {
     global $configArray;
     global $timer;
     if (is_object($patron)) {
         $patron = get_object_vars($patron);
     }
     if (isset($this->transactions[$patron['id']])) {
         return $this->transactions[$patron['id']];
     }
     if (!$this->useDb) {
         //Get transactions by parsing hip
         $transactions = $this->getMyTransactionsViaHIP($patron);
         $timer->logTime("Got transactions from HIP");
         //return json_decode('[{"id":843869,"itemid":1466355,"duedate":"2011-03-29 12:00:00","checkoutdate":"2011-03-07 12:00:00","barcode":"33025015826504","renewCount":1,"request":null},{"id":944097,"itemid":1897017,"duedate":"2011-03-28 12:00:00","checkoutdate":"2011-03-07 12:00:00","barcode":"33025021052830","renewCount":0,"request":null},{"id":577167,"itemid":2057415,"duedate":"2011-03-29 12:00:00","checkoutdate":"2011-03-07 12:00:00","barcode":"33025021723778","renewCount":3,"request":null}]', true);
     } else {
         $transactions = $this->getMyTransactionsViaDB($patron);
         $timer->logTime("Got transactions from Database");
     }
     if (isset($transactions)) {
         //Load information about titles from Resources table (for peformance)
         $recordIds = array();
         foreach ($transactions as $i => $data) {
             $recordIds[] = "'" . $data['id'] . "'";
         }
         //Get records from resource table
         $resourceInfo = new Resource();
         if (count($recordIds) > 0) {
             $recordIdString = implode(",", $recordIds);
             $resourceSql = "SELECT * FROM resource where source = 'VuFind' AND record_id in ({$recordIdString})";
             $resourceInfo->query($resourceSql);
             $timer->logTime('Got records for all titles');
             //Load title author, etc. information
             while ($resourceInfo->fetch()) {
                 foreach ($transactions as $key => $transaction) {
                     if ($transaction['id'] == $resourceInfo->record_id) {
                         $transaction['shortId'] = $transaction['id'];
                         //Load title, author, and format information about the title
                         $transaction['recordId'] = $transaction['id'];
                         $transaction['title'] = isset($resourceInfo->title) ? $resourceInfo->title : 'Unknown';
                         $transaction['sortTitle'] = isset($resourceInfo->title_sort) ? $resourceInfo->title_sort : 'unknown';
                         $transaction['author'] = isset($resourceInfo->author) ? $resourceInfo->author : null;
                         $transaction['format'] = isset($resourceInfo->format) ? $resourceInfo->format : null;
                         $transaction['isbn'] = isset($resourceInfo->isbn) ? $resourceInfo->isbn : '';
                         $transaction['upc'] = isset($resourceInfo->upc) ? $resourceInfo->upc : '';
                         $transaction['format_category'] = isset($resourceInfo->format_category) ? $resourceInfo->format_category : '';
                         $transaction['renewIndicator'] = $transaction['barcode'] . '|';
                         $transactions[$key] = $transaction;
                     }
                 }
             }
         }
         //Get econtent info and hold queue length
         foreach ($transactions as $key => $transaction) {
             //Check for hold queue length
             $itemData = $this->_loadItemSIP2Data($transaction['barcode'], '');
             $transaction['holdQueueLength'] = intval($itemData['holdQueueLength']);
             $transactions[$key] = $transaction;
         }
     }
     //Process sorting
     $sortKeys = array();
     $i = 0;
     foreach ($transactions as $key => $transaction) {
         $sortTitle = isset($transaction['sortTitle']) ? $transaction['sortTitle'] : "Unknown";
         if ($sortOption == 'title') {
             $sortKeys[$key] = $sortTitle;
         } elseif ($sortOption == 'author') {
             $sortKeys[$key] = (isset($transaction['author']) ? $transaction['author'] : "Unknown") . '-' . $sortTitle;
         } elseif ($sortOption == 'dueDate') {
             if (preg_match('/.*?(\\d{1,2})[-\\/](\\d{1,2})[-\\/](\\d{2,4}).*/', $transaction['duedate'], $matches)) {
                 $sortKeys[$key] = $matches[3] . '-' . $matches[1] . '-' . $matches[2] . '-' . $sortTitle;
             } else {
                 $sortKeys[$key] = $transaction['duedate'] . '-' . $sortTitle;
             }
         } elseif ($sortOption == 'format') {
             $sortKeys[$key] = (isset($transaction['format']) ? $transaction['format'] : "Unknown") . '-' . $sortTitle;
         } elseif ($sortOption == 'renewed') {
             $sortKeys[$key] = (isset($transaction['renewCount']) ? $transaction['renewCount'] : 0) . '-' . $sortTitle;
         } elseif ($sortOption == 'holdQueueLength') {
             $sortKeys[$key] = (isset($transaction['holdQueueLength']) ? $transaction['holdQueueLength'] : 0) . '-' . $sortTitle;
         }
         $sortKeys[$key] = $sortKeys[$key] . '-' . $i++;
     }
     array_multisort($sortKeys, $transactions);
     //Limit to a specific number of records
     $totalTransactions = count($transactions);
     if ($recordsPerPage != -1) {
         $startRecord = ($page - 1) * $recordsPerPage;
         $transactions = array_slice($transactions, $startRecord, $recordsPerPage);
     }
     $this->transactions[$patron['id']] = $transactions;
     return array('transactions' => $transactions, 'numTransactions' => $totalTransactions);
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:94,代码来源:Horizon.php

示例8: getTags

 function getTags()
 {
     $tagList = array();
     $sql = "SELECT resource_tags.* FROM resource, resource_tags, user_resource " . "WHERE resource.id = user_resource.resource_id " . "AND resource.id = resource_tags.resource_id " . "AND user_resource.user_id = '{$this->user_id}' " . "AND user_resource.list_id = '{$this->id}'";
     /** @var Resource|object $resource */
     $resource = new Resource();
     $resource->query($sql);
     if ($resource->N) {
         while ($resource->fetch()) {
             $tagList[] = clone $resource;
         }
     }
     return $tagList;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:14,代码来源:User_list.php

示例9: getResources

 /**
  * Return all resources that the user has saved
  *
  * @param string[] $tags Tags to filter the resources by
  * @return Resource[]
  */
 function getResources($tags = null)
 {
     require_once 'User_resource.php';
     $resourceList = array();
     $sql = "SELECT DISTINCT resource.* FROM resource, user_resource " . "WHERE resource.id = user_resource.resource_id " . "AND user_resource.user_id = '{$this->id}'";
     if ($tags) {
         for ($i = 0; $i < count($tags); $i++) {
             $sql .= " AND resource.id IN (SELECT DISTINCT resource_tags.resource_id " . "FROM resource_tags, tags " . "WHERE resource_tags.tag_id=tags.id AND tags.tag = '" . addslashes($tags[$i]) . "' AND resource_tags.user_id = '{$this->id}')";
         }
     }
     /** @var Resource|object $resource */
     $resource = new Resource();
     $resource->query($sql);
     if ($resource->N) {
         while ($resource->fetch()) {
             $resourceList[] = clone $resource;
         }
     }
     return $resourceList;
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:26,代码来源:User.php

示例10: setEventMessage

    if ($res) {
        $object->busy = $busy;
        $object->mandatory = $mandatory;
        $result = $object->update_element_resource($user);
        if ($result >= 0) {
            setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated'));
            Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . $element . "&element_id=" . $element_id);
            exit;
        } else {
            setEventMessage($object->error, 'errors');
        }
    }
}
// Delete a resource linked to an element
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && GETPOST('confirm') == 'yes') {
    $res = $object->fetch(GETPOST('id'));
    if ($res) {
        $result = $object->delete_resource($lineid, $element);
        if ($result >= 0) {
            setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
            Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . $element . "&element_id=" . $element_id);
            exit;
        } else {
            setEventMessage($object->error, 'errors');
        }
    } else {
        setEventMessage($object->error, 'errors');
    }
}
$parameters = array('resource_id' => resource_id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:31,代码来源:element_resource.php

示例11: getMyHolds

 public function getMyHolds($patron = null, $page = 1, $recordsPerPage = -1, $sortOption = 'title')
 {
     global $timer;
     global $configArray;
     global $user;
     $patronDump = $this->driver->_getPatronDump($this->driver->_getBarcode());
     //Load the information from millennium using CURL
     $sResult = $this->driver->_fetchPatronInfoPage($patronDump, 'holds');
     $timer->logTime("Got holds page from Millennium");
     $holds = $this->parseHoldsPage($sResult);
     $timer->logTime("Parsed Holds page");
     //Get a list of all record id so we can load supplemental information
     $recordIds = array();
     foreach ($holds as $holdSections) {
         foreach ($holdSections as $hold) {
             $recordIds[] = "'" . $hold['shortId'] . "'";
         }
     }
     //Get records from resource table
     $resourceInfo = new Resource();
     if (count($recordIds) > 0) {
         $recordIdString = implode(",", $recordIds);
         mysql_select_db($configArray['Database']['database_vufind_dbname']);
         $resourceSql = "SELECT * FROM resource where source = 'VuFind' AND shortId in (" . $recordIdString . ")";
         $resourceInfo->query($resourceSql);
         $timer->logTime('Got records for all titles');
         //Load title author, etc. information
         while ($resourceInfo->fetch()) {
             foreach ($holds as $section => $holdSections) {
                 foreach ($holdSections as $key => $hold) {
                     $hold['recordId'] = $hold['id'];
                     if ($hold['shortId'] == $resourceInfo->shortId) {
                         $hold['recordId'] = $resourceInfo->record_id;
                         $hold['id'] = $resourceInfo->record_id;
                         $hold['shortId'] = $resourceInfo->shortId;
                         //Load title, author, and format information about the title
                         $hold['title'] = isset($resourceInfo->title) ? $resourceInfo->title : 'Unknown';
                         $hold['sortTitle'] = isset($resourceInfo->title_sort) ? $resourceInfo->title_sort : 'unknown';
                         $hold['author'] = isset($resourceInfo->author) ? $resourceInfo->author : null;
                         $hold['format'] = isset($resourceInfo->format) ? $resourceInfo->format : null;
                         $hold['isbn'] = isset($resourceInfo->isbn) ? $resourceInfo->isbn : '';
                         $hold['upc'] = isset($resourceInfo->upc) ? $resourceInfo->upc : '';
                         $hold['format_category'] = isset($resourceInfo->format_category) ? $resourceInfo->format_category : '';
                         //Load rating information
                         $hold['ratingData'] = $resourceInfo->getRatingData($user);
                         $holds[$section][$key] = $hold;
                     }
                 }
             }
         }
     }
     //Process sorting
     //echo ("<br/>\r\nSorting by $sortOption");
     foreach ($holds as $sectionName => $section) {
         $sortKeys = array();
         $i = 0;
         foreach ($section as $key => $hold) {
             $sortTitle = isset($hold['sortTitle']) ? $hold['sortTitle'] : (isset($hold['title']) ? $hold['title'] : "Unknown");
             if ($sectionName == 'available') {
                 $sortKeys[$key] = $sortTitle;
             } else {
                 if ($sortOption == 'title') {
                     $sortKeys[$key] = $sortTitle;
                 } elseif ($sortOption == 'author') {
                     $sortKeys[$key] = (isset($hold['author']) ? $hold['author'] : "Unknown") . '-' . $sortTitle;
                 } elseif ($sortOption == 'placed') {
                     $sortKeys[$key] = $hold['createTime'] . '-' . $sortTitle;
                 } elseif ($sortOption == 'format') {
                     $sortKeys[$key] = (isset($hold['format']) ? $hold['format'] : "Unknown") . '-' . $sortTitle;
                 } elseif ($sortOption == 'location') {
                     $sortKeys[$key] = (isset($hold['location']) ? $hold['location'] : "Unknown") . '-' . $sortTitle;
                 } elseif ($sortOption == 'holdQueueLength') {
                     $sortKeys[$key] = (isset($hold['holdQueueLength']) ? $hold['holdQueueLength'] : 0) . '-' . $sortTitle;
                 } elseif ($sortOption == 'position') {
                     $sortKeys[$key] = str_pad(isset($hold['position']) ? $hold['position'] : 1, 3, "0", STR_PAD_LEFT) . '-' . $sortTitle;
                 } elseif ($sortOption == 'status') {
                     $sortKeys[$key] = (isset($hold['status']) ? $hold['status'] : "Unknown") . '-' . (isset($hold['reactivateTime']) ? $hold['reactivateTime'] : "0") . '-' . $sortTitle;
                 } else {
                     $sortKeys[$key] = $sortTitle;
                 }
                 //echo ("<br/>\r\nSort Key for $key = {$sortKeys[$key]}");
             }
             $sortKeys[$key] = strtolower($sortKeys[$key] . '-' . $i++);
         }
         array_multisort($sortKeys, $section);
         $holds[$sectionName] = $section;
     }
     //Limit to a specific number of records
     if (isset($holds['unavailable'])) {
         $numUnavailableHolds = count($holds['unavailable']);
         if ($recordsPerPage != -1) {
             $startRecord = ($page - 1) * $recordsPerPage;
             $holds['unavailable'] = array_slice($holds['unavailable'], $startRecord, $recordsPerPage);
         }
     } else {
         $numUnavailableHolds = 0;
     }
     if (!isset($holds['available'])) {
         $holds['available'] = array();
     }
//.........这里部分代码省略.........
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:101,代码来源:MillenniumHolds.php

示例12: setEventMessage

    if ($res) {
        $object->busy = $busy;
        $object->mandatory = $mandatory;
        $result = $object->update_element_resource($user);
        if ($result >= 0) {
            setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated'));
            Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . $element . "&element_id=" . $element_id);
            exit;
        } else {
            setEventMessage($object->error, 'errors');
        }
    }
}
// Delete a resource linked to an element
if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->delete && $confirm === 'yes') {
    $res = $object->fetch($id);
    if ($res > 0) {
        $result = $object->delete_resource($lineid, $element);
        if ($result >= 0) {
            setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
            Header("Location: " . $_SERVER['PHP_SELF'] . "?element=" . $element . "&element_id=" . $element_id);
            exit;
        } else {
            setEventMessage($object->error, 'errors');
        }
    } else {
        setEventMessage($object->error, 'errors');
    }
}
$parameters = array('resource_id' => $resource_id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:element_resource.php


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