本文整理匯總了PHP中Document_Item::getFromDBByQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP Document_Item::getFromDBByQuery方法的具體用法?PHP Document_Item::getFromDBByQuery怎麽用?PHP Document_Item::getFromDBByQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Document_Item
的用法示例。
在下文中一共展示了Document_Item::getFromDBByQuery方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addDocumentCategory
public static function addDocumentCategory(Document $document)
{
$config = PluginOrderConfig::getConfig();
if (isset($document->input['itemtype']) && $document->input['itemtype'] == __CLASS__ && !$document->input['documentcategories_id']) {
$category = $config->getDefaultDocumentCategory();
if ($category) {
$document->update(array('id' => $document->getID(), 'documentcategories_id' => $category));
}
}
// Fomrat document name
if (isset($document->input['itemtype']) && $document->input['itemtype'] == __CLASS__ && $document->input['documentcategories_id'] && $config->canRenameDocuments()) {
// Get document category
$documentCategory = new PluginOrderDocumentCategory();
if (!$documentCategory->getFromDBByQuery(" WHERE `documentcategories_id` = '" . $document->input['documentcategories_id'] . "'")) {
$documentCategory->getEmpty();
}
// Get order linked to document
$document_item = new Document_Item();
if ($document_item->getFromDBByQuery(" WHERE `documents_id` = '" . $document->fields['id'] . "' AND `itemtype` = '" . self::getType() . "'")) {
// Update document name
$order = new self();
$order->getFromDB($document_item->fields['items_id']);
$extension = explode('.', $document->fields['filename']);
$tag = "";
if (!empty($documentCategory->fields['documentcategories_prefix'])) {
$tag = $documentCategory->fields['documentcategories_prefix'] . "-";
}
$document->fields['filename'] = $tag . $order->fields['num_order'] . "." . $extension[1];
$document->updateInDB(array('filename'));
}
}
}