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


PHP Document类代码示例

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


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

示例1: initForm

 /**
  * The function shows edit form and saves data on submit.
  * 
  * @access private
  * @param object $Page The Content Page object.
  * @return string The HTML code.
  */
 protected function initForm(Content_Page $Page)
 {
     if (isset($_POST['submit'])) {
         $Page->setPost($_POST);
         $fields = Error::test($Page);
         if (count($fields)) {
             $this->getView()->set('Error', 'Неверно заполены поля: ' . implode(', ', $fields));
         } else {
             if ($Page->save()) {
                 if ($Page->Module && $Page->Link) {
                     Router::attachPage($Page);
                 } else {
                     Router::detachPage($Page);
                 }
                 return $this->halt('', true);
             } else {
                 $this->getView()->set('Error', 'Ошибка записи данных: ' . $Page->getError() . "\n" . Database::getInstance()->getLastQuery());
             }
         }
     }
     $Document = new Document();
     $this->getView()->set('Documents', $Document->findList(array(), 'Position asc'));
     $this->getView()->set('Page', $Page);
     return $this->getView()->render();
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:32,代码来源:pages.php

示例2: testDocumentPdf

 function testDocumentPdf()
 {
     $o = new Document();
     $o->slug = 'imagick-pdf';
     $o->suffixe = 'pdf';
     $o->storeFile(dirname(__FILE__) . '/images/multipage.pdf');
 }
开发者ID:bersace,项目名称:strass,代码行数:7,代码来源:ImagickTest.php

示例3: saveFile

 function saveFile($document, $portal = false)
 {
     global $sugar_config;
     $focus = new Document();
     if (!empty($document['id'])) {
         $focus->retrieve($document['id']);
     } else {
         return '-1';
     }
     if (!empty($document['file'])) {
         $decodedFile = base64_decode($document['file']);
         $this->upload_file->set_for_soap($document['filename'], $decodedFile);
         $ext_pos = strrpos($this->upload_file->stored_file_name, ".");
         $this->upload_file->file_ext = substr($this->upload_file->stored_file_name, $ext_pos + 1);
         if (in_array($this->upload_file->file_ext, $sugar_config['upload_badext'])) {
             $this->upload_file->stored_file_name .= ".txt";
             $this->upload_file->file_ext = "txt";
         }
         $revision = new DocumentRevision();
         $revision->filename = $this->upload_file->get_stored_file_name();
         $revision->file_mime_type = $this->upload_file->getMimeSoap($revision->filename);
         $revision->file_ext = $this->upload_file->file_ext;
         //$revision->document_name = ;
         $revision->revision = $document['revision'];
         $revision->document_id = $document['id'];
         $revision->save();
         $focus->document_revision_id = $revision->id;
         $focus->save();
         $return_id = $revision->id;
         $this->upload_file->final_move($revision->id);
     } else {
         return '-1';
     }
     return $return_id;
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:35,代码来源:DocumentSoap.php

示例4: testRevisionSave

 function testRevisionSave()
 {
     $ret = $GLOBALS['db']->query("SELECT COUNT(*) AS rowcount1 FROM document_revisions WHERE document_id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['rowcount1'], 0, 'We created an empty revision');
     $ret = $GLOBALS['db']->query("SELECT document_revision_id FROM documents WHERE id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertTrue(empty($row['document_revision_id']), 'We linked the document to a fake document_revision');
     $ds = new DocumentSoap();
     $revision_stuff = array('file' => base64_encode('Pickles has an extravagant beard of pine fur.'), 'filename' => 'a_file_about_pickles.txt', 'id' => $this->doc->id, 'revision' => '1');
     $revisionId = $ds->saveFile($revision_stuff);
     $ret = $GLOBALS['db']->query("SELECT COUNT(*) AS rowcount1 FROM document_revisions WHERE document_id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['rowcount1'], 1, 'We didn\'t create a revision when we should have');
     $ret = $GLOBALS['db']->query("SELECT document_revision_id FROM documents WHERE id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['document_revision_id'], $revisionId, 'We didn\'t link the newly created document revision to the document');
     // Double saving doesn't work because save doesn't reset the new_with_id
     $newDoc = new Document();
     $newDoc->retrieve($this->doc->id);
     $newDoc->document_revision_id = $revisionId;
     $newDoc->save(FALSE);
     $ret = $GLOBALS['db']->query("SELECT COUNT(*) AS rowcount1 FROM document_revisions WHERE document_id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['rowcount1'], 1, 'We didn\'t create a revision when we should have');
     $ret = $GLOBALS['db']->query("SELECT document_revision_id FROM documents WHERE id = '{$this->doc->id}'");
     $row = $GLOBALS['db']->fetchByAssoc($ret);
     $this->assertEquals($row['document_revision_id'], $revisionId, 'We didn\'t link the newly created document revision to the document');
 }
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:29,代码来源:Bug43560Test.php

示例5: generate

 /**
  * Generates document using specified data
  *
  * @param array  $data data for template
  * @return Document generated document
  */
 public function generate($data)
 {
     $document = new Document();
     $document->setFilename("document." . $this->template->getExtension());
     $document->setContents($this->replace($this->template->getContents(), $data));
     return $document;
 }
开发者ID:bezirovoviku,项目名称:temgen,代码行数:13,代码来源:Generator.php

示例6: getList

 public function getList($order = "didascalia")
 {
     $order = trim(filter_var($order, FILTER_SANITIZE_STRING));
     //interrogazione tabella
     $sql = "SELECT * FROM upload ORDER BY {$order}";
     $auth = $this->connector->query($sql);
     $list = array();
     // controllo sul risultato dell'interrogazione
     if (mysql_num_rows($auth) > 0) {
         $doc = new Document();
         $doc->setConnector($this->connector);
         $course = new Course();
         $course->setConnector($this->connector);
         while ($res = $this->connector->getObjectResult($auth)) {
             $doc = new Document($res->id, $res->path, $res->tipo, $res->didascalia);
             //Calcolo le informazioni di servizio
             if ($res->tipo == 1) {
                 $doc->course_name = "TUTTI";
             } else {
                 $doc->course_name = $course->getById($res->tipo)->name;
             }
             $list[] = $doc;
         }
     }
     return $list;
 }
开发者ID:christian-rizza,项目名称:sis-portal,代码行数:26,代码来源:Document.php

示例7: sendForBilling

 function sendForBilling()
 {
     $response = new Response();
     try {
         $projectId = $this->input->post("project-id");
         $amount = $this->input->post("project-bill-amount");
         $billDoc = $this->input->post("bill-doc");
         $project = $this->findById("Project", $projectId);
         if ($project == null) {
             throw new RuntimeException("Invalid Project..!");
         }
         $project->setStatus(Project::PROJECT_BILL);
         $project->getWorkOrder()->setStatus(Workorder::STATUS_COMPLETED);
         $project->getWorkOrder()->setApprovedBy($this->getLoggedInUser());
         $bill = new Bill();
         $bill->setAmount($amount);
         $bill->setProject($project);
         $bill->setCreated(new DateTime());
         $bill->setStatus(Bill::STATUS_PENDING);
         if ($billDoc != null && $billDoc != "") {
             foreach ($billDoc as $file) {
                 $doc = new Document();
                 $doc->setName($file);
                 $doc->setCreated(new DateTime());
                 $bill->getBillDoc()->add($doc);
             }
         }
         $this->save($bill);
         $response->setData(Project::PROJECT_BILL);
     } catch (Exception $e) {
         $response->setStatus(false);
         $response->setErrorMessage($e->getMessage());
     }
     $this->output->set_content_type('application/json')->set_output(json_encode($response));
 }
开发者ID:digvijaymohite,项目名称:e-tender,代码行数:35,代码来源:Workorders.php

示例8: matchDoc

 /**
  * Match a document to percolator queries
  *
  * @param  \Elastica\Document                                   $doc
  * @param  string|\Elastica\Query|\Elastica\Query\AbstractQuery $query  Query to filter the percolator queries which
  *                                                                      are executed.
  * @param  string                                               $type
  * @param  array                                                $params Supports setting additional request body options to the percolate request.
  *                                                                      [ Percolator::EXTRA_FILTER,
  *                                                                      Percolator::EXTRA_QUERY,
  *                                                                      Percolator::EXTRA_SIZE,
  *                                                                      Percolator::EXTRA_TRACK_SCORES,
  *                                                                      Percolator::EXTRA_SORT,
  *                                                                      Percolator::EXTRA_FACETS,
  *                                                                      Percolator::EXTRA_AGGS,
  *                                                                      Percolator::EXTRA_HIGHLIGHT ]
  * @return array                                                With matching registered queries.
  */
 public function matchDoc(Document $doc, $query = null, $type = 'type', $params = array())
 {
     $path = $this->_index->getName() . '/' . $type . '/_percolate';
     $data = array('doc' => $doc->getData());
     $this->_applyAdditionalRequestBodyOptions($params, $data);
     return $this->_percolate($path, $query, $data, $params);
 }
开发者ID:backplane,项目名称:elastica,代码行数:25,代码来源:Percolator.php

示例9: create_from_pptxn

 static function create_from_pptxn($pptxn_id)
 {
     $t = new PayPalTxn($pptxn_id);
     # if it already has a payment_id, stop here and just return that id
     if ($t->payment_id() > 0) {
         return $t->payment_id();
     }
     $student_id = $t->student_id();
     if ($student_id === false) {
         return false;
     }
     $set = array('student_id' => $student_id, 'created_at' => 'NOW()');
     $money = $t->money();
     $set['currency'] = $money->code;
     $set['millicents'] = $money->millicents;
     $info = $t->infoarray();
     if (!isset($info['item_number'])) {
         return false;
     }
     $d = new Document($info['item_number']);
     if ($d->failed()) {
         return false;
     }
     $set['document_id'] = $d->id;
     $p = new Payment(false);
     $payment_id = $p->add($set);
     $t->set(array('payment_id' => $payment_id));
     return $payment_id;
 }
开发者ID:songwork,项目名称:songwork,代码行数:29,代码来源:Payment.php

示例10: findEntity

function findEntity()
{
    $document = new Document();
    // Dokument wiederfinden -> Todo: anhand der field_defs generisch suchen
    $result = $document->get_list('', 'document_name = "' . $_REQUEST['document_name'] . '"');
    return $result['list'][0];
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:7,代码来源:FindEntity.php

示例11: getDocument

 /**
  * @param mixed $accessor
  * @param bool  $retrieve
  * @return Document|null
  */
 public function getDocument($accessor = null, $retrieve = false)
 {
     if ($accessor === null) {
         $accessor = static::DEFAULT_ACCESSOR;
     }
     if ($accessor === null) {
         // the value contains the document itself
         $doc = $this->value;
         // if the view didn't emit the actual doc as value but was called with include_docs=true
         if (!$doc || !isset($doc->_id) && !isset($doc['_id'])) {
             $doc = $this->doc;
         }
     } elseif (is_callable($accessor)) {
         // an anonymous function or another kind of callback that will grab the value for us
         $doc = call_user_func($accessor, $this);
     } elseif (is_array($this->value) && isset($this->value[$accessor])) {
         // value is an array
         $doc = $this->value[$accessor];
     } elseif (isset($this->value->{$accessor})) {
         // it's the name of a property
         $doc = $this->value->{$accessor};
     } else {
         // exception
     }
     if ($doc) {
         $retval = new Document($this->getViewResult()->getDatabase());
         $retval->hydrate($doc);
         return $retval;
     } elseif ($retrieve) {
         // the view didn't emit the actual doc as value and the view wasn't called with include_docs=true
         return $this->viewResult->getDatabase()->retrieveDocument($this->id);
     } else {
         return null;
     }
 }
开发者ID:dzuelke,项目名称:phpcouch,代码行数:40,代码来源:ViewResultRow.php

示例12: getTokenIssues

 function getTokenIssues($tokenID)
 {
     $paraID = false;
     $context = false;
     $place = false;
     $db = $this->startDB();
     $sql = "SELECT * FROM gap_issues WHERE tokenID = {$tokenID}  AND active = 1 ORDER BY updated DESC;";
     $result = $db->fetchAll($sql, 2);
     $sql = "SELECT * FROM gap_issues WHERE tokenID = {$tokenID}  AND active = 0 ORDER BY updated DESC;";
     $resultOld = $db->fetchAll($sql, 2);
     $tokensObj = new Tokens();
     $tokenData = $tokensObj->getTokenByID($tokenID);
     $tokensObj->highlightToken = $tokenID;
     if (is_array($tokenData)) {
         $token = $tokenData["token"];
         $paraID = $tokenData["paraID"];
         $pageID = $tokenData["pageID"];
         $docID = $tokenData["docID"];
         $context = $tokensObj->getGapVisDocPage($docID, $pageID, $paraID, $tokenID);
         $place = $tokensObj->getPlaceByTokensID($tokenID);
         $related = false;
         $relatedPlaceTokens = false;
         if (is_array($place)) {
             $related = $tokensObj->getTokenIDsBySharedPlaceURIid($tokenID, $place["uriID"], $token);
             $relatedPlaceTokens = $tokensObj->getUniqueTokensFromPlaceURI($place["uri"]);
         }
         $docObj = new Document();
         $document = $docObj->getByID($docID);
     }
     $output = array("tokenID" => $tokenID, "token" => $token, "docID" => $docID, "document" => $document, "pageID" => $pageID, "context" => $context, "place" => $place, "related" => $related, "relatedPlaceTokens" => $relatedPlaceTokens, "issues" => $result, "oldIssues" => $resultOld, "oldPlaces" => $tokensObj->getTokenDeactivatedPlaceRefs($tokenID));
     return $output;
 }
开发者ID:shawngraham,项目名称:gap2,代码行数:32,代码来源:Issues.php

示例13: get_all_linked_attachment_revisions

function get_all_linked_attachment_revisions($attachmentsequence)
{
    $attachmentIds = explode(' ', trim($attachmentsequence));
    $attachments = array();
    foreach ($attachmentIds as $id) {
        $revision = new DocumentRevision();
        if (!$revision->retrieve($id)) {
            // if in old format try to recover by document id
            $attachment = new Document();
            if ($attachment->retrieve($id)) {
                $attachment->revision = '';
                $attachment->doc_rev_id = '';
                $attachments[] = $attachment;
            }
        } else {
            $attachment = new Document();
            if ($attachment->retrieve($revision->document_id)) {
                $attachment->revision = $revision->revision;
                $attachment->doc_rev_id = $revision->id;
                $attachments[] = $attachment;
            }
        }
    }
    return $attachments;
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:25,代码来源:Attachments.php

示例14: addNews

 public function addNews()
 {
     foreach ($this->fileArray as $file) {
         $title = explode(".", $file)[0];
         $book = new Document($this->path, $file, $title);
         $book->save();
     }
 }
开发者ID:AliEksi,项目名称:DokuDok,代码行数:8,代码来源:list.php

示例15: export

 public static function export(Document $document)
 {
     $json = db::query('SELECT creation_date, data FROM snapshots WHERE document = ' . db::value($document->getId()) . ' ORDER BY creation_date DESC');
     foreach ($json as $i => $row) {
         $json[$i]['data'] = json_decode($row['data']);
     }
     return $json;
 }
开发者ID:roadlabs,项目名称:diagraph,代码行数:8,代码来源:snapshot.php


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