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


PHP DocumentType::getListForUserAndFolder方法代码示例

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


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

示例1: form_initialdata

 function form_initialdata()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt("Add a document"), 'action' => 'processInitialData', 'actionparams' => 'postExpected=1&fFolderId=' . $this->oFolder->getId(), 'fail_action' => 'main', 'context' => &$this, 'extraargs' => $this->meldPersistQuery("", "", true), 'submit_label' => _kt("Add"), 'file_upload' => true));
     $aTypes = array();
     foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
         if (!$oDocumentType->getDisabled()) {
             $aTypes[] = $oDocumentType;
         }
     }
     // Onchange gets the name of the file and inserts it as the document title.
     $sFileOnchange = "javascript:\n            var doc = document.getElementById('document_name');\n            if(doc.value == ''){\n                var arrPath=this.value.split('/');\n                if(arrPath.length == 1){\n                    var arrPath=this.value.split('\\\\');\n                }\n                var name=arrPath[arrPath.length-1];\n                var name=name.split('.');\n                var len = name.length;\n                if(len > 1){\n                    if(name[len-1].length <= 4){\n                        name.pop();\n                    }\n                }\n                var title=name.join('.');\n                doc.value=title;\n            }";
     $oForm->setWidgets(array(array('ktcore.widgets.file', array('label' => _kt('File'), 'description' => _kt('The contents of the document to be added to the document management system.'), 'name' => 'file', 'required' => true, 'onchange' => $sFileOnchange)), array('ktcore.widgets.string', array('label' => _kt('Document Title'), 'description' => sprintf(_kt('The document title is used as the main name of a document throughout %s.'), APP_NAME), 'name' => 'document_name', 'required' => true, 'id' => 'document_name')), array('ktcore.widgets.entityselection', array('label' => _kt('Document Type'), 'description' => _kt('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'), 'name' => 'document_type', 'required' => true, 'vocab' => $aTypes, 'initial_string' => _kt('- Please select a document type -'), 'id_method' => 'getId', 'label_method' => 'getName', 'simple_select' => false))));
     // Electronic Signature if enabled
     global $default;
     if ($default->enableESignatures) {
         $oForm->addWidget(array('ktcore.widgets.info', array('label' => _kt('This action requires authentication'), 'description' => _kt('Please provide your user credentials as confirmation of this action.'), 'name' => 'info')));
         $oForm->addWidget(array('ktcore.widgets.string', array('label' => _kt('Username'), 'name' => 'sign_username', 'required' => true)));
         $oForm->addWidget(array('ktcore.widgets.password', array('label' => _kt('Password'), 'name' => 'sign_password', 'required' => true)));
         $oForm->addWidget(array('ktcore.widgets.reason', array('label' => _kt('Reason'), 'description' => _kt('Please specify why you are checking out this document.  It will assist other users in understanding why you have locked this file.  Please bear in mind that you can use a maximum of <strong>250</strong> characters.'), 'name' => 'reason')));
     }
     $oForm->setValidators(array(array('ktcore.validators.file', array('test' => 'file', 'output' => 'file')), array('ktcore.validators.fileillegalchar', array('test' => 'file', 'output' => 'file')), array('ktcore.validators.string', array('test' => 'document_name', 'output' => 'document_name')), array('ktcore.validators.entity', array('test' => 'document_type', 'output' => 'document_type', 'class' => 'DocumentType', 'ids' => true))));
     if ($default->enableESignatures) {
         $oForm->addValidator(array('electonic.signatures.validators.authenticate', array('object_id' => $this->oFolder->getId(), 'type' => 'folder', 'action' => 'ktcore.transactions.add_document', 'test' => 'info', 'output' => 'info')));
     }
     return $oForm;
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:27,代码来源:addDocument.php

示例2: do_main

 function do_main()
 {
     $this->oPage->setBreadcrumbDetails(_kt("bulk upload"));
     $oTemplate =& $this->oValidator->validateTemplate('ktcore/folder/bulkUpload');
     $add_fields = array();
     $add_fields[] = new KTFileUploadWidget(_kt('Archive file'), _kt('The archive file containing the documents you wish to add to the document management system.'), 'file', "", $this->oPage, true, "file");
     $aVocab = array('' => _kt('- Please select a document type -'));
     foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
         if (!$oDocumentType->getDisabled()) {
             $aVocab[$oDocumentType->getId()] = $oDocumentType->getName();
         }
     }
     $fieldOptions = array("vocab" => $aVocab);
     $add_fields[] = new KTLookupWidget(_kt('Document Type'), _kt('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'), 'fDocumentTypeId', null, $this->oPage, true, "add-document-type", $fieldErrors, $fieldOptions);
     $fieldsets = array();
     $fieldsetDisplayReg =& KTFieldsetDisplayRegistry::getSingleton();
     $activesets = KTFieldset::getGenericFieldsets();
     foreach ($activesets as $oFieldset) {
         $displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace());
         array_push($fieldsets, new $displayClass($oFieldset));
     }
     // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
     global $default;
     $iFolderId = $this->oFolder->getId();
     if ($default->enableESignatures) {
         $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
         $heading = _kt('You are attempting to perform a bulk upload');
         $submit['type'] = 'button';
         $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_upload', 'bulk', 'bulk_upload_form', 'submit', {$iFolderId});";
     } else {
         $submit['type'] = 'submit';
         $submit['onclick'] = '';
     }
     $oTemplate->setData(array('context' => &$this, 'submit' => $submit, 'add_fields' => $add_fields, 'generic_fieldsets' => $fieldsets));
     return $oTemplate->render();
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:36,代码来源:BulkUpload.php

示例3: form_changetype

 function form_changetype()
 {
     $oForm = new KTForm();
     $oForm->setOptions(array('label' => _kt("Change Document Type"), 'description' => _kt("Changing the document type will allow different metadata to be associated with it."), 'identifier' => 'ktcore.doc.edit.typechange', 'submit_label' => _kt("Update Document"), 'context' => $this, 'cancel_action' => 'main', 'action' => 'trytype'));
     $type = DocumentType::get($this->oDocument->getDocumentTypeId());
     $current_type_name = $type->getName();
     $oFolder = Folder::get($this->oDocument->getFolderID());
     $oForm->setWidgets(array(array('ktcore.widgets.entityselection', array('label' => _kt("New Document Type"), 'description' => _kt("Please select the new type for this document."), 'important_description' => sprintf(_kt("The document is currently of type \"%s\"."), $current_type_name), 'value' => $type->getId(), 'label_method' => 'getName', 'vocab' => DocumentType::getListForUserAndFolder($this->oUser, $oFolder), 'simple_select' => false, 'required' => true, 'name' => 'type'))));
     $oForm->setValidators(array(array('ktcore.validators.entity', array('test' => 'type', 'output' => 'type', 'class' => 'DocumentType'))));
     return $oForm;
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:11,代码来源:edit.php

示例4: getBulkImportForm

 /**
  * Returns the main Bulk Upload Form
  * @return KTForm 
  *
  */
 function getBulkImportForm()
 {
     $this->oPage->setBreadcrumbDetails(_kt("bulk import"));
     //Adding the required Bulk Upload javascript includes
     $aJavascript[] = 'resources/js/taillog.js';
     $aJavascript[] = 'resources/js/conditional_usage.js';
     $aJavascript[] = 'resources/js/kt_bulkupload.js';
     //Loading the widget js libraries to support dynamic "Ajax Loaded" widget rendering
     //FIXME: The widgets can support this via dynamic call to place libs in the head if they aren't loaded
     //       jQuery can do this but need time to implement/test.
     $aJavascript[] = 'thirdpartyjs/jquery/jquery-1.3.2.js';
     $aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/tiny_mce.js';
     $aJavascript[] = 'resources/js/kt_tinymce_init.js';
     $aJavascript[] = 'thirdpartyjs/tinymce/jscripts/tiny_mce/jquery.tinymce.js';
     $this->oPage->requireJSResources($aJavascript);
     $oForm = new KTForm();
     $oForm->setOptions(array('identifier' => 'ktcore.folder.bulkUpload', 'label' => _kt('Import from Server Location'), 'submit_label' => _kt('Import'), 'action' => 'import', 'fail_action' => 'main', 'encoding' => 'multipart/form-data', 'context' => &$this, 'extraargs' => $this->meldPersistQuery("", "", true), 'description' => _kt('The bulk import facility allows for a number of documents to be added to the document management system easily. Provide a path on the server, and all documents and folders within that path will be added to the document management system.')));
     $oWF =& KTWidgetFactory::getSingleton();
     $widgets = array();
     $validators = array();
     // Adding the File Upload Widget
     //Legacy kt3 widgets don't conform to ktcore type widgets by virtue of the 'name' attribute.
     //$widgets[] = new KTFileUploadWidget(_kt('Archive file'), , 'file', "", $this->oPage, true, "file");
     $widgets[] = $oWF->get('ktcore.widgets.string', array('label' => _kt('Path'), 'required' => true, 'name' => 'path', 'id' => 'path', 'value' => '', 'description' => _kt('The path containing the documents to be added to the document management system.')));
     $aVocab = array('' => _kt('- Please select a document type -'));
     foreach (DocumentType::getListForUserAndFolder($this->oUser, $this->oFolder) as $oDocumentType) {
         if (!$oDocumentType->getDisabled()) {
             $aVocab[$oDocumentType->getId()] = $oDocumentType->getName();
         }
     }
     //Adding document type lookup widget
     $widgets[] = $oWF->get('ktcore.widgets.selection', array('label' => _kt('Document Type'), 'id' => 'add-document-type', 'description' => _kt('Document Types, defined by the administrator, are used to categorise documents. Please select a Document Type from the list below.'), 'name' => 'fDocumentTypeId', 'required' => true, 'vocab' => $aVocab, 'id_method' => 'getId', 'label_method' => 'getName', 'simple_select' => false));
     //Adding the quick "add" button for when no meta data needs to be added.
     //FIXME: This widget should only display if there are any "required" fields for the given document type
     //       Default/general document field type must also be taken into consideration
     $widgets[] = $oWF->get('ktcore.widgets.button', array('value' => _kt('Add'), 'id' => 'quick_add', 'description' => _kt('If you do not need to modify any the metadata for this document (see below), then you can simply click "Add" here to finish the process and add the document.'), 'name' => 'btn_quick_submit'));
     $oFReg =& KTFieldsetRegistry::getSingleton();
     $activesets = KTFieldset::getGenericFieldsets();
     foreach ($activesets as $oFieldset) {
         $widgets = kt_array_merge($widgets, $oFReg->widgetsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
         $validators = kt_array_merge($validators, $oFReg->validatorsForFieldset($oFieldset, 'fieldset_' . $oFieldset->getId(), $this->oDocument));
     }
     //Adding the type_metadata_fields layer to be updated via ajax for non generic metadata fieldsets
     $widgets[] = $oWF->get('ktcore.widgets.layer', array('value' => '', 'id' => 'type_metadata_fields'));
     $oForm->setWidgets($widgets);
     $oForm->setValidators($validators);
     // Implement an electronic signature for accessing the admin section, it will appear every 10 minutes
     global $default;
     $iFolderId = $this->oFolder->getId();
     if ($default->enableESignatures) {
         $sUrl = KTPluginUtil::getPluginPath('electronic.signatures.plugin', true);
         $heading = _kt('You are attempting to perform a bulk upload');
         $submit['type'] = 'button';
         $submit['onclick'] = "javascript: showSignatureForm('{$sUrl}', '{$heading}', 'ktcore.transactions.bulk_upload', 'bulk', 'bulk_upload_form', 'submit', {$iFolderId});";
     } else {
         $submit['type'] = 'submit';
         $submit['onclick'] = '';
     }
     return $oForm;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:65,代码来源:BulkImport.php


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