本文整理汇总了PHP中DocumentType类的典型用法代码示例。如果您正苦于以下问题:PHP DocumentType类的具体用法?PHP DocumentType怎么用?PHP DocumentType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DocumentType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
if (isset($_GET['id'])) {
$model = Document::model()->findByPk($_GET['id']);
$this->render('detail', array('model' => $model));
} else {
if ($_GET['type_id']) {
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'status = 1 AND doc_group=\'service\' AND doc_type_id=' . $_GET['type_id'];
$criteria->order = 'sort_order';
$total = Document::model()->count($criteria);
$pages = new CPagination($total);
$pages->setPageSize(20);
$pages->applyLimit($criteria);
$model = Document::model()->findAll($criteria);
$type = DocumentType::model()->findByPk($_GET['type_id']);
$this->render('index', array('model' => $model, 'type' => $type, 'pages' => $pages));
} else {
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'status = 1 AND doc_group=\'service\'';
$criteria->order = 'sort_order';
$total = Document::model()->count($criteria);
$pages = new CPagination($total);
$pages->setPageSize(20);
$pages->applyLimit($criteria);
$model = Document::model()->findAll($criteria);
$this->render('index', array('model' => $model, 'pages' => $pages));
}
}
}
示例2: actionType
public function actionType($id)
{
$criteria = new CDbCriteria();
$criteria->select = '*';
$criteria->condition = 'status = 1 AND doc_type_id =' . $id;
$criteria->order = 'sort_order ASC ,last_update DESC';
$model = Document::model()->findAll($criteria);
$type = DocumentType::model()->findByPK($id);
$this->render('index', array('model' => $model, 'type' => $type));
}
示例3: 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();
}
示例4: array
<td>
<input class='date-pick' id='effectiveDate' name='effectiveDate' style='width:80px' value='<?php
echo $effectiveDate;
?>
' />
</td>
</tr>
<tr>
<td style='text-align:right;vertical-align:top;'><label for="documentType" class="formText">Document Type:</label><br /><span id='span_error_documentTypeID' class='errorText'></span></td>
<td>
<span id='span_documentType'>
<select name='documentTypeID' id='documentTypeID' style='width:185px;'>
<?php
$display = array();
$documentType = new DocumentType();
foreach ($documentType->allAsArray() as $display) {
if ($document->documentTypeID == $display['documentTypeID']) {
echo "<option value='" . $display['documentTypeID'] . "' selected>" . $display['shortName'] . "</option>";
} else {
echo "<option value='" . $display['documentTypeID'] . "'>" . $display['shortName'] . "</option>";
}
}
?>
</select>
</span>
<br />
<span id='span_newDocumentType'><a href="javascript:newDocumentType();">add document type</a></span>
<br />
</td>
</tr>
示例5: actionSitemap
public function actionSitemap()
{
$condition = new CDbCriteria();
$condition->condition = "news_type_id =2 AND status = 1";
$condition->order = "create_date desc,news_id desc";
$condition->offset = 0;
$condition->limit = 6;
$student_news = News::model()->findAll($condition);
$news_criteria = new CDbCriteria();
$news_criteria->condition = "news_type_id =1 AND status = 1";
$news_criteria->order = "create_date desc,news_id desc";
$news_criteria->offset = 0;
$news_criteria->limit = 3;
$news = News::model()->findAll($news_criteria);
$job_criteria = new CDbCriteria();
$job_criteria->condition = "news_type_id =3 AND status = 1";
$job_criteria->order = "create_date desc,news_id desc";
$job_criteria->offset = 0;
$job_criteria->limit = 6;
$job_news = News::model()->findAll($job_criteria);
$pr_criteria = new CDbCriteria();
$pr_criteria->condition = "news_type_id =5 AND status = 1";
$pr_criteria->order = "create_date desc,news_id desc";
$pr_criteria->offset = 0;
$pr_criteria->limit = 3;
$newsInSide = News::model()->findAll($pr_criteria);
$link_criteria = new CDbCriteria();
$link_criteria->condition = "status = 1";
$link_criteria->order = "sort_order";
$links = Link::model()->findAll($link_criteria);
$criteria = new CDbCriteria();
$criteria->condition = "status = 1 AND doc_group ='download'";
$criteria->order = "sort_order";
$doc = DocumentType::model()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->condition = "status = 1";
$criteria->order = "sort_order";
$org = Organization::model()->findAll($criteria);
$criteria = new CDbCriteria();
$criteria->condition = "status = 1";
$criteria->order = "sort_order";
$report = ReportType::model()->findAll($criteria);
$vdo_criteria = new CDbCriteria();
$vdo_criteria->condition = "page_id = 3 AND status = 1";
$vdo = Page::model()->find($vdo_criteria);
// echo "<br> ===> ";
// echo "<pre>";
// print_r($vdo);
// echo "</pre>";
// exit;
$this->render('sitemap', array('news' => $news, 'newsInSide' => $newsInSide, 'job' => $job_news, 'student_news' => $student_news, 'doc' => $doc, 'org' => $org, 'links' => $links, 'report' => $report, 'vdo' => $vdo));
}
示例6: CDbCriteria
}
?>
href="<?php
echo Yii::app()->createUrl('information');
?>
"><?php
echo $admission;
?>
</a>
<ul>
<?php
$criteria = new CDbCriteria();
$criteria->condition = 'status=:status AND doc_group=\'service\'';
$criteria->params = array(':status' => 1);
$criteria->order = 'sort_order';
$doc_type = DocumentType::model()->findAll($criteria);
foreach ($doc_type as $type) {
?>
<li><a href="<?php
echo Yii::app()->createUrl('information', array('type_id' => $type->doc_type_id));
?>
"><?php
echo $type->name_th;
?>
</a></li>
<?php
}
?>
<!--li><a href="<?php
echo Yii::app()->createUrl('admission');
?>
示例7: showForm
//.........这里部分代码省略.........
echo "<td colspan='3'>";
if ($canupdate) {
echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>";
echo "<table class='tab_format' width='100%'><tr><td width='30%'>";
Ticket_Ticket::dropdownLinks('_link[link]', isset($values["_link"]) ? $values["_link"]['link'] : '');
echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n";
echo "</td><td width='70%'>";
$linkparam = array('name' => '_link[tickets_id_2]', 'displaywith' => array('id'));
if (isset($values["_link"])) {
$linkparam['value'] = $values["_link"]['tickets_id_2'];
}
Ticket::dropdown($linkparam);
echo "</td></tr></table>";
echo "</div>";
if (isset($values["_link"]) && !empty($values["_link"]['tickets_id_2'])) {
echo "<script language='javascript'>";
echo Html::jsShow("linkedticket{$rand_linked_ticket}");
echo "</script>";
}
}
Ticket_Ticket::displayLinkedTicketsTo($ID);
echo "</td>";
}
echo "</tr>";
// View files added
echo "<tr class='tab_bg_1'>";
// Permit to add doc when creating a ticket
echo "<th style='width:{$colsize1}%'>";
echo $tt->getBeginHiddenFieldText('_documents_id');
$doctitle = sprintf(__('File (%s)'), Document::getMaxUploadSize());
printf(__('%1$s%2$s'), $doctitle, $tt->getMandatoryMark('_documents_id'));
// Do not show if hidden.
if (!$tt->isHiddenField('_documents_id')) {
DocumentType::showAvailableTypesLink();
}
echo $tt->getEndHiddenFieldText('_documents_id');
echo "</th>";
echo "<td colspan='3'>";
// Do not set values
echo $tt->getEndHiddenFieldValue('_documents_id');
if ($tt->isPredefinedField('_documents_id')) {
if (isset($values['_documents_id']) && is_array($values['_documents_id']) && count($values['_documents_id'])) {
echo "<span class='b'>" . __('Default documents:') . '</span>';
echo "<br>";
$doc = new Document();
foreach ($values['_documents_id'] as $key => $val) {
if ($doc->getFromDB($val)) {
echo "<input type='hidden' name='_documents_id[{$key}]' value='{$val}'>";
echo "- " . $doc->getNameID() . "<br>";
}
}
}
}
echo "<div id='fileupload_info'></div>";
echo "</td>";
echo "</tr>";
if ((!$ID || $canupdate || $canupdate_descr || Session::haveRightsOr(self::$rightname, array(self::ASSIGN, self::STEAL, DELETE, PURGE))) && !$options['template_preview']) {
echo "<tr class='tab_bg_1'>";
if ($ID) {
if (Session::haveRightsOr(self::$rightname, array(UPDATE, DELETE, PURGE)) || $this->canDeleteItem() || $this->canUpdateItem()) {
echo "<td class='tab_bg_2 center' colspan='4'>";
if ($this->fields["is_deleted"] == 1) {
if (self::canPurge()) {
echo "<input type='submit' class='submit' name='restore' value='" . _sx('button', 'Restore') . "'> ";
}
} else {
示例8: setDocType
/**
* The original document's type, such as Sales Invoice or Purchase Invoice.
*
* @var string
* @see DocumentType
*/
public function setDocType($value)
{
DocumentType::Validate($value);
$this->DocType = $value;
return $this;
}
示例9: 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;
}
示例10: do_viewComparison
function do_viewComparison()
{
$document_data = array();
$document_id = KTUtil::arrayGet($_REQUEST, 'fDocumentId');
if ($document_id === null) {
$this->oPage->addError(sprintf(_kt("No document was requested. Please <a href=\"%s\">browse</a> for one."), KTBrowseUtil::getBrowseBaseUrl()));
return $this->do_error();
}
$document_data['document_id'] = $document_id;
$base_version = KTUtil::arrayGet($_REQUEST, 'fBaseVersion');
// try get the document.
$oDocument =& Document::get($document_id, $base_version);
if (PEAR::isError($oDocument)) {
$this->oPage->addError(sprintf(_kt("The base document you attempted to retrieve is invalid. Please <a href=\"%s\">browse</a> for one."), KTBrowseUtil::getBrowseBaseUrl()));
return $this->do_error();
}
if (!Permission::userHasDocumentReadPermission($oDocument)) {
// FIXME inconsistent.
$this->oPage->addError(_kt('You are not allowed to view this document'));
return $this->permissionDenied();
}
$this->oDocument =& $oDocument;
$this->oPage->setSecondaryTitle($oDocument->getName());
$aOptions = array('documentaction' => 'viewDocument', 'folderaction' => 'browse');
$this->aBreadcrumbs = kt_array_merge($this->aBreadcrumbs, KTBrowseUtil::breadcrumbsForDocument($oDocument, $aOptions));
$this->oPage->setBreadcrumbDetails(_kt('compare versions'));
$comparison_version = KTUtil::arrayGet($_REQUEST, 'fComparisonVersion');
if ($comparison_version === null) {
$this->oPage->addError(sprintf(_kt("No comparison version was requested. Please <a href=\"%s\">select a version</a>."), KTUtil::addQueryStringSelf('action=history&fDocumentId=' . $document_id)));
return $this->do_error();
}
$oComparison =& Document::get($oDocument->getId(), $comparison_version);
if (PEAR::isError($oComparison)) {
$this->errorRedirectToMain(_kt('Invalid document to compare against.'));
}
$comparison_data = array();
$comparison_data['document_id'] = $oComparison->getId();
$document_data['document'] = $oDocument;
$comparison_data['document'] = $oComparison;
$document_data['document_type'] =& DocumentType::get($oDocument->getDocumentTypeID());
$comparison_data['document_type'] =& DocumentType::get($oComparison->getDocumentTypeID());
// follow twice: once for normal, once for comparison.
$is_valid_doctype = true;
if (PEAR::isError($document_data['document_type'])) {
$this->oPage->addError(_kt('The document you requested has an invalid <strong>document type</strong>. Unfortunately, this means that we cannot effectively display it.'));
$is_valid_doctype = false;
}
// we want to grab all the md for this doc, since its faster that way.
$mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($base_version)));
$field_values = array();
foreach ($mdlist as $oFieldLink) {
$field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue();
}
$document_data['field_values'] = $field_values;
$mdlist =& DocumentFieldLink::getList(array('metadata_version_id = ?', array($comparison_version)));
$field_values = array();
foreach ($mdlist as $oFieldLink) {
$field_values[$oFieldLink->getDocumentFieldID()] = $oFieldLink->getValue();
}
$comparison_data['field_values'] = $field_values;
// Fieldset generation.
//
// we need to create a set of FieldsetDisplay objects
// that adapt the Fieldsets associated with this lot
// to the view (i.e. ZX3). Unfortunately, we don't have
// any of the plumbing to do it, so we handle this here.
$fieldsets = array();
// we always have a generic.
array_push($fieldsets, new GenericFieldsetDisplay());
// FIXME can we key this on fieldset namespace? or can we have duplicates?
// now we get the other fieldsets, IF there is a valid doctype.
if ($is_valid_doctype) {
// these are the _actual_ fieldsets.
$fieldsetDisplayReg =& KTFieldsetDisplayRegistry::getSingleton();
// and the generics
$activesets = KTFieldset::getGenericFieldsets();
foreach ($activesets as $oFieldset) {
$displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace());
array_push($fieldsets, new $displayClass($oFieldset));
}
$activesets = KTFieldset::getForDocumentType($oDocument->getDocumentTypeID());
foreach ($activesets as $oFieldset) {
$displayClass = $fieldsetDisplayReg->getHandler($oFieldset->getNamespace());
array_push($fieldsets, new $displayClass($oFieldset));
}
}
// FIXME handle ad-hoc fieldsets.
$this->addPortlets();
$oTemplate = $this->oValidator->validateTemplate('ktcore/document/compare');
$aTemplateData = array('context' => $this, 'document_id' => $document_id, 'document' => $oDocument, 'document_data' => $document_data, 'comparison_data' => $comparison_data, 'comparison_document' => $oComparison, 'fieldsets' => $fieldsets);
//var_dump($aTemplateData['comparison_data']);
return $oTemplate->render($aTemplateData);
}
示例11: getUploadFileValidLocationName
/**
* Find a valid path for the new file
*
* @param $dir dir to search a free path for the file
* @param $sha1sum SHA1 of the file
*
* @return nothing
**/
static function getUploadFileValidLocationName($dir, $sha1sum)
{
global $CFG_GLPI, $LANG;
if (empty($dir)) {
$message = $LANG['document'][32];
if (haveRight('dropdown', 'r')) {
$dt = new DocumentType();
$message .= " <a target='_blank' href='" . $dt->getSearchURL() . "'>\n <img src=\"" . $CFG_GLPI["root_doc"] . "/pics/aide.png\"></a>";
}
addMessageAfterRedirect($message, false, ERROR);
return '';
}
if (!is_dir(GLPI_DOC_DIR)) {
addMessageAfterRedirect($LANG['document'][31] . " " . GLPI_DOC_DIR, false, ERROR);
return '';
}
$subdir = $dir . '/' . substr($sha1sum, 0, 2);
if (!is_dir(GLPI_DOC_DIR . "/" . $subdir) && @mkdir(GLPI_DOC_DIR . "/" . $subdir, 0777, true)) {
addMessageAfterRedirect($LANG['document'][34] . " " . GLPI_DOC_DIR . "/" . $subdir);
}
if (!is_dir(GLPI_DOC_DIR . "/" . $subdir)) {
addMessageAfterRedirect($LANG['document'][29] . " " . GLPI_DOC_DIR . "/" . $subdir . " " . $LANG['document'][30], false, ERROR);
return '';
}
return $subdir . '/' . substr($sha1sum, 2) . '.' . $dir;
}
示例12: getMetadata
/**
* Create a table of the document metadata.
* Hard coded for the moment
*
* @return unknown
*/
function getMetadata()
{
/* Get document info */
// Filename
$sFilenameLb = _kt('Document Filename: ');
$sFilename = $this->_oDocument->getFileName();
// Mime type
$sMimeTypeLb = _kt('File is a: ');
$iMimeId = $this->_oDocument->getMimeTypeID();
$sMimeType = KTMime::getMimeTypeName($iMimeId);
$sMimeType = KTMime::getFriendlyNameForString($sMimeType);
// Version
$sVersionLb = _kt('Document Version: ');
$iVersion = $this->_oDocument->getVersion();
// Created by
$sCreatedByLb = _kt('Created by: ');
$iCreatorId = $this->_oDocument->getCreatorID();
$sCreated = $this->_oDocument->getCreatedDateTime();
$oCreator = User::get($iCreatorId);
$sCreatedBy = $oCreator->getName() . ' (' . $sCreated . ')';
// Owned by
$sOwnedByLb = _kt('Owned by: ');
$iOwnedId = $this->_oDocument->getOwnerID();
$oOwner = User::get($iOwnedId);
$sOwnedBy = $oOwner->getName();
// Last update by
$iModifiedId = $this->_oDocument->getModifiedUserId();
$sLastUpdatedByLb = '';
$sLastUpdatedBy = '';
if (!empty($iModifiedId)) {
$sLastUpdatedByLb = _kt('Last updated by: ');
$sModified = $this->_oDocument->getLastModifiedDate();
$oModifier = User::get($iModifiedId);
$sLastUpdatedBy = $oModifier->getName() . ' (' . $sModified . ')';
}
// Document type
$sDocTypeLb = _kt('Document Type: ');
$iDocTypeId = $this->_oDocument->getDocumentTypeID();
$oDocType = DocumentType::get($iDocTypeId);
$sDocType = $oDocType->getName();
// Workflow
$iWFId = $this->_oDocument->getWorkflowId();
$sWF = '';
$sWFLb = '';
if (!empty($iWFId)) {
$sWFLb = _kt('Workflow: ');
$iWFStateId = $this->_oDocument->getWorkflowStateId();
$oWF = KTWorkflow::get($iWFId);
$sWF = $oWF->getHumanName();
$oWFState = KTWorkflowState::get($iWFStateId);
$sWF .= ' (' . $oWFState->getHumanName() . ')';
}
// Checked out by
$sCheckedLb = '';
$sCheckedOutBy = '';
if ($this->_oDocument->getIsCheckedOut()) {
$sCheckedLb = _kt('Checked out by: ');
$iCheckedID = $this->_oDocument->getCheckedOutUserID();
$oCheckedUser = User::get($iCheckedID);
$sCheckedOutBy = $oCheckedUser->getName();
}
// Id
$sIdLb = _kt('Document ID: ');
$sId = $this->_IDocId;
/* Create table */
$sInfo = "<div style='float:left; width:405px;'>\n <table cellspacing='3px' cellpadding='3px' width='405px'>\n <tr><td>{$sFilenameLb}</td><td><b>{$sFilename}</b></td></tr>\n <tr><td>{$sMimeTypeLb}</td><td><b>{$sMimeType}</b></td></tr>\n <tr><td>{$sVersionLb}</td><td><b>{$iVersion}</b></td></tr>\n <tr><td>{$sCreatedByLb}</td><td><b>{$sCreatedBy}</b></td></tr>\n <tr><td>{$sOwnedByLb}</td><td><b>{$sOwnedBy}</b></td></tr>";
if (!empty($sLastUpdatedBy)) {
$sInfo .= "<tr><td>{$sLastUpdatedByLb}</td><td><b>{$sLastUpdatedBy}</b></td></tr>";
}
$sInfo .= "<tr><td>{$sDocTypeLb}</td><td><b>{$sDocType}</b></td></tr>";
if (!empty($sWF)) {
$sInfo .= "<tr><td>{$sWFLb}</td><td><b>{$sWF}</b></td></tr>";
}
if (!empty($sCheckedOutBy)) {
$sInfo .= "<tr><td>{$sCheckedLb}</td><td><b>{$sCheckedOutBy}</b></td></tr>";
}
$sInfo .= "<tr><td>{$sIdLb}</td><td><b>{$sId}</b></td></tr>";
$sInfo .= " </table></div>";
return $sInfo;
}
示例13: do_finalise
function do_finalise()
{
$this->persistParams(array('fFileKey'));
$sess_key = $_REQUEST['fFileKey'];
$oForm = $this->form_metadata($sess_key);
$res = $oForm->validate();
if (!empty($res['errors'])) {
return $oForm->handleError();
}
$data = $res['results'];
$extra_d = $_SESSION['_add_data'][$sess_key];
$doctypeid = $extra_d['document_type'];
$aGenericFieldsetIds = KTFieldset::getGenericFieldsets(array('ids' => false));
$aSpecificFieldsetIds = KTFieldset::getForDocumentType($doctypeid, array('ids' => false));
$fieldsets = kt_array_merge($aGenericFieldsetIds, $aSpecificFieldsetIds);
$MDPack = array();
foreach ($fieldsets as $oFieldset) {
$fields = $oFieldset->getFields();
$values = (array) KTUtil::arrayGet($data, 'fieldset_' . $oFieldset->getId());
foreach ($fields as $oField) {
$val = KTUtil::arrayGet($values, 'metadata_' . $oField->getId());
if ($oFieldset->getIsConditional()) {
if ($val == _kt('No selection.')) {
$val = null;
}
}
// ALT.METADATA.LAYER.DIE.DIE.DIE
if (!is_null($val)) {
$MDPack[] = array($oField, $val);
}
}
}
// older code
$mpo =& new JavascriptObserver($this);
$oUploadChannel =& KTUploadChannel::getSingleton();
$oUploadChannel->addObserver($mpo);
require_once KT_LIB_DIR . '/storage/storagemanager.inc.php';
//require_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php');
require_once KT_LIB_DIR . '/documentmanagement/DocumentType.inc';
require_once KT_LIB_DIR . '/metadata/fieldset.inc.php';
require_once KT_LIB_DIR . '/documentmanagement/documentutil.inc.php';
$aErrorOptions = array('redirect_to' => array('main', sprintf('fFolderId=%d', $this->oFolder->getId())), 'max_str_len' => 200);
$aFile = $this->oValidator->validateFile($extra_d['file'], $aErrorOptions);
$sTitle = $extra_d['document_name'];
$iFolderId = $this->oFolder->getId();
$aOptions = array('temp_file' => $aFile['tmp_name'], 'documenttype' => DocumentType::get($extra_d['document_type']), 'metadata' => $MDPack, 'description' => $sTitle, 'cleanup_initial_file' => true);
$mpo->start();
//$this->startTransaction();
$oDocument =& KTDocumentUtil::add($this->oFolder, $aFile['name'], $this->oUser, $aOptions);
if (PEAR::isError($oDocument)) {
$message = $oDocument->getMessage();
$this->errorRedirectTo('main', sprintf(_kt("Unexpected failure to add document - %s"), $message), 'fFolderId=' . $this->oFolder->getId());
exit(0);
}
$this->addInfoMessage(_kt("Document added"));
//$this->commitTransaction();
$mpo->redirectToDocument($oDocument->getId());
exit(0);
}
示例14: prune
/**
* Exclude object from result
*
* @param DocumentType $documentType Object to remove from the list of results
*
* @return DocumentTypeQuery The current query, for fluid interface
*/
public function prune($documentType = null)
{
if ($documentType) {
$this->addUsingAlias(DocumentTypePeer::ID, $documentType->getId(), Criteria::NOT_EQUAL);
}
return $this;
}
示例15: __construct
function __construct($id, $clientid, $name, $type, $serial, $parcel, $details, $status, $lastUpdated, $timestamp, $file, $thumbnail)
{
$this->id = $id;
$this->client = Client::GetClient($clientid);
$this->name = $name;
$this->type = DocumentType::Get($type);
$this->serial = $serial;
$this->parcel = $parcel;
$this->details = $details;
$this->status = $status;
$this->lastUpdated = $lastUpdated;
$this->timestamp = $timestamp;
$this->file = $file;
$this->thumbnail = $thumbnail;
}