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


PHP Document::find方法代码示例

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


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

示例1: download

 /**
  * 
  */
 function download()
 {
     if ($this->Session->check('Search.document_ids')) {
         $document_ids = $this->Session->read('Search.document_ids');
         $repo = $this->requireRepository();
         $doc_pack = $repo['Repository']['documentpack_size'];
         $docs = array();
         foreach ($document_ids as $id) {
             $docs[] = $this->Document->find('first', array('conditions' => array('Document.id' => $id), 'recursive' => -1));
         }
         // if there are more documents, shuffle them
         if (count($docs) > $doc_pack) {
             shuffle($docs);
             $docs_ids = array_rand($docs, $doc_pack);
             $docs_ids_array = is_array($docs_ids) ? $docs_ids : array($docs_ids);
             $docs = array_intersect_key($docs, array_flip($docs_ids_array));
         }
         // cgajardo: constituents to be attached
         $constituents = $this->ConstituentsKit->find('all', array('conditions' => array('ConstituentsKit.kit_id' => $repo['Repository']['kit_id'], 'ConstituentsKit.constituent_id' != '0'), 'recursive' => 2, 'fields' => array("Constituent.sysname")));
         // cgajardo: attach folios that belongs to each document
         foreach ($docs as &$doc) {
             $doc['files'] = array();
             $doc['files'] = $this->Attachfile->find('all', array('conditions' => array('Attachfile.document_id' => $doc['Document']['id']), 'recursive' => -1, 'fields' => array("Attachfile.id", "Attachfile.filename", "Attachfile.type")));
         }
         $this->set(compact('docs', 'doc_pack', 'constituents'));
         $this->_clean_session();
     }
 }
开发者ID:rmeruane,项目名称:repositorium,代码行数:31,代码来源:documents_controller.php

示例2: render

 function render()
 {
     $document = Document::find($_SESSION['document_id']);
     $this->html = file_get_contents('app/views/render/header.pdf.php');
     $this->html .= '<div id="cover">
   <img src="public/uploads/' . $document->logo . '">
   <h1>' . $document->name . '</h1>
   <div style="position: fixed; bottom: 50px;">
     <h3>LONDRINA - PR</h3>
     <h3>' . $document->year . '</h3>
   </div>
 </div>';
     $this->html .= file_get_contents('app/views/render/logos.pdf.php');
     $counter = 0;
     foreach ($this->sections as $section => $subs) {
         $model = Document::find($_SESSION['document_id'])->{$section};
         $counter = floor($counter) + 1;
         foreach ($subs as $label => $name) {
             if ($label == 'swot') {
                 $this->render_swot($model);
             } else {
                 $this->html .= '<h2>' . $counter . " {$name}</h2><p>" . $model->{$label} . "</p>";
                 $counter += 0.1;
             }
         }
     }
     $this->html .= '</div></body></html>';
     $dompdf = new DOMPDF();
     $dompdf->load_html($this->html);
     $dompdf->render();
     header('Content-Type: application/pdf');
     echo $dompdf->output();
 }
开发者ID:hugoabonizio,项目名称:GaiaPDTI,代码行数:33,代码来源:render_controller.php

示例3: render

 function render()
 {
     $document = Document::find($_SESSION['document_id']);
     $html = file_get_contents('app/views/render/header.pdf.php');
     $html .= '<div id="cover">
   <img src="public/uploads/' . $document->logo . '">
   <h1>' . "Plano Diretor de Tecnologia da Informação da Prefeitura Municipal de Guaraci" . '</h1>
   <h3>LONDRINA - PR</h3>
   <h3>' . $document->year . '</h3>
 </div>';
     $html .= file_get_contents('app/views/render/logos.pdf.php');
     foreach ($this->sections as $section => $subs) {
         $model = Document::find($_SESSION['document_id'])->{$section}();
         $counter = 1;
         foreach ($subs as $label => $name) {
             $html .= '<h2>' . $counter . " {$name}</h2><p>" . $model->{$label} . "</p>";
             $counter += 0.1;
         }
     }
     $html .= '</div></body></html>';
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->render();
     header('Content-Type: application/pdf');
     echo $dompdf->output();
 }
开发者ID:hugoabonizio,项目名称:BirdsPHP-scaffold,代码行数:26,代码来源:render_controller.php

示例4: initialize

 public function initialize($context, $parameters = null)
 {
     parent::initialize($context);
     $user = $context->getUser();
     $id = $context->getRequest()->getParameter('id');
     $lang = $context->getRequest()->getParameter('lang');
     $document = Document::find('Image', $id);
     $type = $document->get('image_type');
     $this->setParameter('is_moderator', $user->hasCredential('moderator'));
     $this->setParameter('was', $type);
     $this->getParameterHolder()->add($parameters);
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:12,代码来源:myImageTypeValidator.class.php

示例5: getDocView

 public function getDocView($id)
 {
     $document = Document::find($id);
     $user = Document::find($id)->user();
     $organization = User::find($document->user->organization_id)->organization;
     $type = $document->os_type;
     $items = Document::find($id)->items;
     // Если такого документа нет, то вернем пользователю ошибку 404 - Не найдено
     if (!$document) {
         App::abort(404);
     }
     return View::make('inspector.document_view', array('items' => $items, 'document' => $document, 'organization' => $organization));
 }
开发者ID:alexsynarchin,项目名称:Itnk,代码行数:13,代码来源:OssController.php

示例6: initialize

 public function initialize($context, $parameters = null)
 {
     parent::initialize($context);
     $user = $context->getUser();
     $id = $context->getRequest()->getParameter('id');
     if (!empty($id)) {
         $lang = $context->getRequest()->getParameter('lang');
         $document = Document::find('Article', $id);
         $collaborative_article = $document->get('article_type') == 1;
         $this->setParameter('is_moderator', $user->hasCredential('moderator'));
         $this->setParameter('was_collaborative', $collaborative_article);
     }
     $this->getParameterHolder()->add($parameters);
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:14,代码来源:myArticleTypeValidator.class.php

示例7: change

 function change()
 {
     $document = Document::find($_SESSION['document_id']);
     if (!empty($_FILES)) {
         $basename = basename($_FILES['logo']['name']);
         $uploaded_name = uniqid(rand(), true) . $basename;
         move_uploaded_file($_FILES['logo']['tmp_name'], 'public/uploads/' . $uploaded_name);
         $document->logo = $uploaded_name;
     }
     $document->name = $this->params('name');
     $document->year = $this->params('year');
     $document->save();
     $this->flash('result', 'Atualizado com sucesso!');
     $this->redirect('/documents/' . $_SESSION['document_id'] . '/options');
 }
开发者ID:hugoabonizio,项目名称:BirdsPHP-scaffold,代码行数:15,代码来源:documents_controller.php

示例8: saveModel

 protected function saveModel($document = false)
 {
     if (Input::get('id')) {
         $document = Document::find(Input::get('id'));
     }
     if (!$document) {
         $document = new Document();
     }
     $document->type = Input::get('type');
     $document->title = Input::get('title');
     $document->description = Input::get('description');
     $document->url = Input::get('url');
     $document->meta = Input::get('meta');
     $document->save();
     return $document;
 }
开发者ID:strikles,项目名称:php,代码行数:16,代码来源:DocumentsController.php

示例9: deadline_update

 public function deadline_update()
 {
     $updateId = Input::get('updateId');
     $changedDate = Input::get('changedDate');
     $formatedDate = date("M, jS  Y", strtotime($changedDate));
     $document = Document::find($updateId);
     $document->deadline = $changedDate;
     if ($document->save()) {
         $suData = array('success' => true);
     }
     echo json_encode($suData);
     exit;
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Laravel-DocEditor,代码行数:13,代码来源:DocumentController.php

示例10: findDocuments

 /**
  * Get a list of all documents that meet the provided criteria.
  *
  * @param array|null $params Optional. An associative array to filter the
  *                           list of all documents uploaded. None are
  *                           necessary; all are optional. Use the following
  *                           options:
  *                             - int|null 'limit' The number of documents to
  *                               return.
  *                             - string|DateTime|null 'createdBefore' Upper
  *                               date limit to filter by.
  *                             - string|DateTime|null 'createdAfter' Lower
  *                               date limit to filter by.
  *
  * @return array An array containing document instances matching the
  *               request.
  * @throws Box\View\BoxViewException
  */
 public function findDocuments($params = [])
 {
     return Document::find($this, $params);
 }
开发者ID:stof,项目名称:php-box-view,代码行数:22,代码来源:Client.php

示例11: get_view_document

 public function get_view_document($id)
 {
     return View::make('tenants.documents.create')->with('document', Document::find($id));
 }
开发者ID:andyfoster,项目名称:tenantplus,代码行数:4,代码来源:tenants.php

示例12: executeInsertimagetag

 public function executeInsertimagetag()
 {
     $user = $this->getUser();
     $prefered_cultures = $user->getCulturesForDocuments();
     $module = $this->getRequestParameter('mod');
     $id = $this->getRequestParameter('id');
     $associated_docs = Association::findAllWithBestName($id, $prefered_cultures);
     $associated_images = Document::fetchAdditionalFieldsFor(array_filter($associated_docs, array('c2cTools', 'is_image')), 'Image', array('filename', 'image_type'));
     $doc = Document::find(c2cTools::module2model($module), $id);
     if (empty($doc)) {
         $this->setNotFoundAndRedirect();
     }
     if (c2cTools::is_collaborative_document($doc)) {
         // for collaborative content, keep only collaborative images
         $associated_images = array_filter($associated_images, array('c2cTools', 'is_collaborative_document'));
     }
     $this->document_id = $id;
     $this->div = $this->getRequestParameter('div');
     $this->associated_images = $associated_images;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:20,代码来源:actions.class.php

示例13: postUpdate

 public function postUpdate($id)
 {
     $document = Document::find($id);
     $document->document_date = Input::get('document_date');
     $document->actual_date = Input::get('actual_date');
     $document->save();
     return Redirect::action('DocumentsController@getView', [$document->id]);
 }
开发者ID:alexsynarchin,项目名称:Itnk,代码行数:8,代码来源:DocumentsController.php

示例14: assignTask

 public function assignTask()
 {
     $id = Input::get('hide_taskid');
     $user_id = Auth::user()->id;
     $taskDetails = TaskDetails::find($id);
     $taskDetails->assignee_id = $user_id;
     $taskDetails->status = "Active";
     $task_row = Task::find($taskDetails->task_id);
     $addToDateReceived = $task_row->maxDuration;
     $taskd = TaskDetails::find($id);
     $docs = Document::find($taskd->doc_id);
     if ($taskd->status == "Done") {
         Session::put('errorchecklist', 'Accept failed. Task was already completed by another user.');
         return Redirect::back();
     } else {
         if ($taskd->status == "Active") {
             Session::put('errorchecklist', 'Accept failed. Task was already accepted by another user.');
             return Redirect::back();
         }
     }
     // Get date today and the due date;
     $dateReceived = date('Y-m-d H:i:s');
     if ($addToDateReceived == 0) {
         $dueDate = '9999-01-01 00:00:00';
     } else {
         $dueDate = date('Y-m-d H:i:s', strtotime("{$addToDateReceived} days"));
     }
     $taskDetails->dateReceived = $dateReceived;
     $taskDetails->dueDate = $dueDate;
     $taskDetails->save();
     return Redirect::to("task/{$id}");
 }
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:32,代码来源:TaskController.php

示例15: Association

             }
             if (!$DRY_RUN) {
                 $asso = new Association();
                 $asso->doSaveWithValues($doc['id'], $image_data['id'], $association_type, $TOPO_MODERATOR_USER_ID);
             }
             $stat_associations_required++;
         }
         $image_ids[$tag[1]] = $image_data['id'];
     } else {
         // no corresponding id, the tag is incorrect and must not be modified. but a warning should be notified
         $stat_docs_with_invalid_references[] = $doc['id'] . ' (' . $doc['culture'] . ' - ' . $doc['name'] . ') http://' . $SERVER_NAME . '/' . strtolower($table) . 's' . '/' . $doc['id'] . '/' . $doc['culture'] . "\n";
     }
 }
 // replace image tags
 $conn = sfDoctrine::Connection();
 $db_doc = Document::find($table, $doc['id']);
 if (!$DRY_RUN) {
     $conn->beginTransaction();
     $history_metadata = new HistoryMetadata();
     $history_metadata->setComment('Updated image tags');
     $history_metadata->set('is_minor', true);
     $history_metadata->set('user_id', $TOPO_MODERATOR_USER_ID);
     $history_metadata->save();
     $db_doc->setCulture($doc['culture']);
 }
 foreach ($fields as $field) {
     $tag_data = $tags_for_field[$field];
     $text = $doc[$field];
     foreach ($tag_data as $tag_idx) {
         $references_to_modify++;
         $tag = $tags[$tag_idx];
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:updateImageTags.php


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