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


PHP Document::getID方法代码示例

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


在下文中一共展示了Document::getID方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
         }
     }
 }
开发者ID:pluginsGLPI,项目名称:order,代码行数:32,代码来源:order.class.php

示例2: AssertDocument

 function AssertDocument(Document $document, $id, $title)
 {
     $this->assertEquals($id, $document->getID());
     $this->assertEquals($title, $document->getTitle());
 }
开发者ID:pradosoft,项目名称:prado,代码行数:5,代码来源:InheritanceTest.php

示例3: Document

	</p>
	</form>
	<?php 
    docman_footer(array());
} else {
    if (getStringFromRequest('deletedoc') && $docid) {
        $d = new Document($g, $docid);
        if ($d->isError()) {
            exit_error('Error', $d->getErrorMessage());
        }
        docman_header(_('Document Manager Administration'), _('Edit Groups'), '');
        ?>
		<p>
		<form action="<?php 
        echo $PHP_SELF . '?deletedoc=1&amp;docid=' . $d->getID() . '&amp;group_id=' . $d->Group->getID();
        ?>
" method="post">
		<input type="hidden" name="submit" value="1" /><br />
		<?php 
        echo _('You are about to permanently delete this document.');
        ?>
		<p>
		<input type="checkbox" name="sure" value="1"><?php 
        echo _('I\'m Sure.');
        ?>
<br />
		<input type="checkbox" name="really_sure" value="1"><?php 
        echo _('I\'m Really Sure.');
        ?>
<br />
开发者ID:neymanna,项目名称:fusionforge,代码行数:30,代码来源:index.php

示例4: copyDocuments

 /**
  * Copy order documents into the newly generated item
  * @since 1.5.3
  * @param unknown_type $itemtype
  * @param unknown_type $items_id
  * @param unknown_type $orders_id
  * @param unknown_type $entity
  */
 public static function copyDocuments($itemtype, $items_id, $orders_id, $entity)
 {
     global $CFG_GLPI;
     $config = PluginOrderConfig::getConfig();
     if ($config->canCopyDocuments() && in_array($itemtype, $CFG_GLPI["document_types"])) {
         $document = new Document();
         $docitem = new Document_Item();
         $item = new $itemtype();
         $item->getFromDB($items_id);
         $is_recursive = 0;
         foreach (getAllDatasFromTable('glpi_documents_items', "`itemtype`='PluginOrderOrder'\n                                          AND `items_id`='{$orders_id}'") as $doc) {
             //Create a new document
             $document->getFromDB($doc['documents_id']);
             if ($document->getEntityID() != $entity && !$document->fields['is_recursive'] || !in_array($entity, getSonsOf('glpi_entities', $document->getEntityID()))) {
                 $found_docs = getAllDatasFromTable('glpi_documents', "`entities_id`='{$entity}'\n                                                 AND `sha1sum`='" . $document->fields['sha1sum'] . "'");
                 if (empty($found_docs)) {
                     $tmpdoc = $document->fields;
                     $tmpdoc['entities_id'] = $entity;
                     unset($tmpdoc['id']);
                     $documents_id = $document->add($tmpdoc);
                     $is_recursive = $document->fields['is_recursive'];
                 } else {
                     $found_doc = array_pop($found_docs);
                     $documents_id = $found_doc['id'];
                     $is_recursive = $found_doc['is_recursive'];
                 }
             } else {
                 $documents_id = $document->getID();
                 $is_recursive = $document->fields['is_recursive'];
             }
             //Link the document to the newly generated item
             $fields['documents_id'] = $documents_id;
             $fields['entities_id'] = $entity;
             $fields['items_id'] = $items_id;
             $fields['itemtype'] = $itemtype;
             $fields['is_recursive'] = $is_recursive;
             $newID = $docitem->add($fields);
         }
     }
 }
开发者ID:pluginsGLPI,项目名称:order,代码行数:48,代码来源:link.class.php

示例5: methodAddTicketDocument

 /**
  * Add a document to a existing ticket
  * for an authenticated user
  *
  * @param $params array of options (ticket, uri, name, base64, comment)
  *        only one of uri and base64 must be set
  *        name is mandatory when base64 set, for extension check (filename)
  * @param $protocol     the communication protocol used
  *
  * @return array of hashtable
  **/
 static function methodAddTicketDocument($params, $protocol)
 {
     global $DB, $CFG_GLPI;
     if (isset($params['help'])) {
         return array('ticket' => 'integer,mandatory', 'uri' => 'string,optional', 'base64' => 'string,optional', 'content' => 'string,optional', 'close' => 'bool,optional', 'reopen' => 'bool,optional', 'source' => 'string,optional', 'private' => 'bool,optional', 'help' => 'bool,optional');
     }
     if (!Session::getLoginUserID()) {
         return self::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED);
     }
     $ticket = new Ticket();
     if (!isset($params['ticket'])) {
         return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'ticket');
     }
     if (!is_numeric($params['ticket'])) {
         return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'ticket');
     }
     if (!$ticket->can($params['ticket'], 'r')) {
         return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND);
     }
     if (in_array($ticket->fields["status"], $ticket->getClosedStatusArray())) {
         return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED, '', 'closed ticket');
     }
     if (!$ticket->canAddFollowups()) {
         return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED, '', 'access denied');
     }
     if (isset($params['name']) && !empty($params['name'])) {
         $document_name = addslashes($params['name']);
     } else {
         $document_name = addslashes(sprintf(__('%1$s %2$s'), _x('phone', 'Number'), $ticket->fields['id']));
     }
     $filename = tempnam(GLPI_DOC_DIR . '/_tmp', 'PWS');
     $response = parent::uploadDocument($params, $protocol, $filename, $document_name);
     //An error occured during document upload
     if (parent::isError($protocol, $response)) {
         return $response;
     }
     $doc = new Document();
     $documentitem = new Document_Item();
     $docid = $doc->getFromDBbyContent($ticket->fields["entities_id"], $filename);
     if ($docid) {
         $input = array('itemtype' => $ticket->getType(), 'items_id' => $ticket->getID(), 'documents_id' => $doc->getID());
         if ($DB->request('glpi_documents_items', $input)->numrows()) {
             return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', 'document already associated to this ticket');
         }
         $new = $documentitem->add($input);
     } else {
         $input = array('itemtype' => $ticket->getType(), 'items_id' => $ticket->getID(), 'tickets_id' => $ticket->getID(), 'entities_id' => $ticket->getEntityID(), 'is_recursive' => $ticket->isRecursive(), 'documentcategories_id' => $CFG_GLPI["documentcategories_id_forticket"]);
         $new = $doc->add($input);
     }
     // to not add it twice during followup
     unset($_FILES['filename']);
     if (!$new) {
         return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', self::getDisplayError());
     }
     if (isset($params['comment']) && !empty($params['comment'])) {
         $params['content'] = $params['comment'];
         unset($params['comment']);
     }
     if (isset($params['content']) && !empty($params['content'])) {
         return self::methodAddTicketFollowup($params, $protocol);
     }
     return self::methodGetTicket(array('ticket' => $params['ticket']), $protocol);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:74,代码来源:methodhelpdesk.class.php

示例6: Document

                        }
                    }
                } else {
                    if ($action == 'delete') {
                        if ($do == 'none') {
                            ?>
        <a onclick="load('documents', 'delete', 'delete', {id: '<?php 
                            echo $_GET['id'];
                            ?>
'})">Continue?</a> (<b>NOTE:</b> This action cannot be reversed!)
        <?php 
                        } else {
                            if ($do == 'delete') {
                                $document = new Document($_GET['id']);
                                $document->delete();
                                Event::addEvent('Document ' . $document->getPrefix()->getPrefixAbbrev() . $document->getID() . ' has been deleted.', $_SESSION['user'], 3);
                                ?>
        <script>
            load('documents', 'view', 'none', {});
        </script>
        <?php 
                            }
                        }
                    } else {
                        if ($action == 'sign') {
                            $document = new Document($_GET['id']);
                            $document->sign($_SESSION['user']);
                            ?>
    <script>
        load('documents', 'view', 'none', {id: '<?php 
                            echo $_GET['id'];
开发者ID:Keshaun1222,项目名称:IRIN,代码行数:31,代码来源:documents.php

示例7: addDocumentCategory

 static function addDocumentCategory(Document $document)
 {
     if (isset($document->input['itemtype']) && $document->input['itemtype'] == __CLASS__ && !$document->input['documentcategories_id']) {
         $config = PluginOrderConfig::getConfig();
         $category = $config->getDefaultDocumentCategory();
         if ($category) {
             $document->update(array('id' => $document->getID(), 'documentcategories_id' => $category));
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:10,代码来源:order.class.php


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