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


PHP FileModel::fetchObjectIdsByInstance方法代码示例

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


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

示例1: viewAction

 /**
  * Action for viewing a particular page
  */
 public function viewAction()
 {
     $pageID = $this->_getParam('id');
     $subPageNum = $this->_hasParam('sp') ? $this->_getParam('sp') : 1;
     $this->view->spNum = $subPageNum;
     $this->view->spNumSkip = ($subPageNum - 1) * 100;
     $this->view->spNumLeft = 100;
     if ($pageID > 0) {
         $page = new PageModel(array('pageID' => $pageID, 'depth' => 'page'));
         $this->view->attachmentQuestions = FileModel::fetchObjectIdsByInstance($page->instanceID);
     }
     $this->view->page = new PageModel(array('pageID' => $pageID));
     if (!$this->_user->hasAccess('view', $this->view->page)) {
         $this->denyAccess();
     }
     $this->view->currentPageID = $pageID;
 }
开发者ID:humansky,项目名称:qframe,代码行数:20,代码来源:PageController.php

示例2: testFetchObjectIdsByInstance

 public function testFetchObjectIdsByInstance()
 {
     $properties = array('filename' => 'sample.pdf', 'mime' => 'application/pdf');
     $filesNoId = new FileModel(new NoInstanceFoo());
     $filesNoId->storeFilename(TEST_PATH . '/fixtures/sample.pdf', $properties);
     $filesId = new FileModel(new InstanceFoo());
     $filesId->storeFilename(TEST_PATH . '/fixtures/sample.pdf', $properties);
     $objectIds = FileModel::fetchObjectIdsByInstance(1);
     $this->assertTrue(is_array($objectIds));
     $this->assertEquals(count($objectIds), 1);
     $this->assertTrue(isset($objectIds['InstanceFoo']));
     $this->assertTrue(is_array($objectIds['InstanceFoo']));
     $this->assertEquals(count($objectIds['InstanceFoo']), 1);
 }
开发者ID:humansky,项目名称:qframe,代码行数:14,代码来源:FileModelTest.php

示例3: toXML

 /**
  * Exports an Instance XML Document
  *
  * @param  integer If true, exports the entire questionnaire definition (question text, etc). 
  *                 If false, only exports guid and response data.
  * @param array PageHeader strings to export.  If empty, export entire instance.
  * @return string XML Document
  */
 public function toXML($complete = 0, $pageHeaders = array())
 {
     $instanceID = $this->instanceRow->instanceID;
     QFrame_Db_Table::resetAll();
     $this->attachmentQuestions = FileModel::fetchObjectIdsByInstance($this->instanceRow->instanceID);
     $instance = new InstanceModel(array('instanceID' => $instanceID, 'depth' => 'response'));
     $xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
     $xml .= '<csi:questionnaire';
     $xml .= ' xmlns:csi="http://www.csinitiative.com/ns/csi-qframe"';
     $xml .= ' questionnaireName="' . self::_xmlentities($instance->questionnaireName) . '" questionnaireVersion="' . self::_xmlentities($instance->questionnaireVersion) . '" revision="' . self::_xmlentities($instance->revision) . '" targetQFrameVersion="' . QFRAME_VERSION . '" instanceName="' . self::_xmlentities($instance->instanceName) . '">' . "\n";
     $xml .= "  <csi:pages>\n";
     while ($page = $instance->nextPage()) {
         if (count($pageHeaders) > 0 && array_search($page->pageHeader, $pageHeaders) === FALSE) {
             continue;
         }
         $xml .= "    <csi:page>\n";
         if ($complete) {
             $xml .= "      <csi:pageHeader>" . self::_xmlentities($page->pageHeader) . "</csi:pageHeader>\n";
         }
         $xml .= "      <csi:pageGUID>" . self::_xmlentities($page->pageGUID) . "</csi:pageGUID>\n";
         $xml .= "      <csi:seqNumber>" . self::_xmlentities($page->seqNumber) . "</csi:seqNumber>\n";
         if ($complete) {
             $xml .= "      <csi:description>" . self::_xmlentities($page->description) . "</csi:description>\n";
             $xml .= "      <csi:headerText>" . self::_xmlentities($page->headerText) . "</csi:headerText>\n";
             $xml .= "      <csi:footerText>" . self::_xmlentities($page->footerText) . "</csi:footerText>\n";
             $xml .= "      <csi:cloneable>" . self::_xmlentities($page->cloneable) . "</csi:cloneable>\n";
             $xml .= "      <csi:defaultPageHidden>" . self::_xmlentities($page->defaultPageHidden) . "</csi:defaultPageHidden>\n";
         }
         $xml .= "      <csi:sections>\n";
         while ($section = $page->nextSection()) {
             $xml .= "        <csi:section>\n";
             if ($complete) {
                 $xml .= '          <csi:sectionHeader>' . self::_xmlentities($section->sectionHeader) . "</csi:sectionHeader>\n";
             }
             $xml .= '          <csi:sectionGUID>' . self::_xmlentities($section->sectionGUID) . "</csi:sectionGUID>\n";
             $xml .= '          <csi:seqNumber>' . self::_xmlentities($section->seqNumber) . "</csi:seqNumber>\n";
             if ($complete) {
                 $xml .= '          <csi:description>' . self::_xmlentities($section->description) . "</csi:description>\n";
                 $xml .= '          <csi:cloneable>' . self::_xmlentities($section->cloneable) . "</csi:cloneable>\n";
                 $xml .= '          <csi:defaultSectionHidden>' . self::_xmlentities($section->defaultSectionHidden) . "</csi:defaultSectionHidden>\n";
                 $references = $section->references;
                 if (count($references) > 0) {
                     $xml .= "          <csi:sectionReferences>";
                     foreach ($references as $reference) {
                         $xml .= "            <csi:reference>";
                         $xml .= '              <csi:shortName>' . self::_xmlentities($reference['shortName']) . "</csi:shortName>\n";
                         $xml .= '              <csi:referenceName>' . self::_xmlentities($reference['referenceName']) . "</csi:referenceName>\n";
                         $xml .= '              <csi:item>' . self::_xmlentities($reference['item']) . "</csi:item>\n";
                         $xml .= '              <csi:referenceURL>' . self::_xmlentities($reference['referenceURL']) . "</csi:referenceURL>\n";
                         $xml .= '              <csi:referenceText>' . self::_xmlentities($reference['referenceText']) . "</csi:referenceText>\n";
                         $xml .= "</csi:reference>\n";
                     }
                     $xml .= "</csi:sectionReferences>\n";
                 }
             }
             $xml .= "          <csi:questions>\n";
             while ($question = $section->nextQuestion()) {
                 $padding = '';
                 if (count($question->children)) {
                     $xml .= "            <csi:questionGroup>\n";
                     if ($complete) {
                         $xml .= "              <csi:qText>" . self::_xmlentities($question->qText) . "</csi:qText>\n";
                     }
                     $xml .= "              <csi:questionGUID>" . self::_xmlentities($question->questionGUID) . "</csi:questionGUID>\n";
                     $xml .= "              <csi:seqNumber>" . self::_xmlentities($question->seqNumber) . "</csi:seqNumber>\n";
                     if ($complete && strlen(self::_xmlentities($question->questionNumber))) {
                         $xml .= "              <csi:groupQuestionNumber>" . self::_xmlentities($question->questionNumber) . "</csi:groupQuestionNumber>\n";
                     }
                     $xml .= "              <csi:cloneable>" . self::_xmlentities($question->cloneable) . "</csi:cloneable>\n";
                     $xml .= "              <csi:groupDefaultQuestionHidden>" . self::_xmlentities($question->defaultQuestionHidden) . "</csi:groupDefaultQuestionHidden>\n";
                     $references = $question->references;
                     if (count($references) > 0) {
                         $xml .= "              <csi:groupQuestionReferences>";
                         foreach ($references as $reference) {
                             $xml .= "              <csi:reference>\n";
                             $xml .= "                <csi:shortName>" . self::_xmlentities($reference['shortName']) . "</csi:shortName>\n";
                             $xml .= "                <csi:referenceName>" . self::_xmlentities($reference['referenceName']) . "</csi:referenceName>\n";
                             $xml .= "                <csi:item>" . self::_xmlentities($reference['item']) . "</csi:item>\n";
                             $xml .= "                <csi:referenceURL>" . self::_xmlentities($reference['referenceURL']) . "</csi:referenceURL>\n";
                             $xml .= "                <csi:referenceText>" . self::_xmlentities($reference['referenceText']) . "</csi:referenceText>\n";
                             $xml .= "              </csi:reference>\n";
                         }
                         $xml .= "</csi:groupQuestionReferences>\n";
                     }
                     if (isset($this->attachmentQuestions['QuestionModel'][$question->questionID])) {
                         $fileObj = new FileModel($question);
                         $ids = $fileObj->fetchAll();
                         if (count($ids)) {
                             $xml .= "              <csi:attachments>\n";
                             foreach ($ids as $id) {
                                 $xml .= "                <csi:attachment>\n";
                                 $file = $fileObj->fetchProperties($id);
//.........这里部分代码省略.........
开发者ID:humansky,项目名称:qframe,代码行数:101,代码来源:InstanceModel.php

示例4: addAttachments

 /**
  * Adds all attachments associated with the instance to the zip archive
  */
 public function addAttachments()
 {
     $attachmentQuestions = FileModel::fetchObjectIdsByInstance($this->instance->instanceID);
     $instance = new InstanceModel(array('instanceID' => $this->instance->instanceID, 'depth' => 'question'));
     while ($page = $instance->nextPage()) {
         while ($section = $page->nextSection()) {
             while ($question = $section->nextQuestion()) {
                 if (isset($attachmentQuestions['QuestionModel'][$question->questionID])) {
                     $fileObj = new FileModel($question);
                     $ids = $fileObj->fetchAll();
                     if ($ids === NULL) {
                         continue;
                     }
                     foreach ($ids as $id) {
                         $file = $fileObj->fetchWithProperties($id);
                         $this->addFromString("files/{$id}", $file['contents']);
                     }
                 }
             }
         }
     }
 }
开发者ID:humansky,项目名称:qframe,代码行数:25,代码来源:ZipArchiveModel.php


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