本文整理汇总了PHP中KTUtil::getObject方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::getObject方法的具体用法?PHP KTUtil::getObject怎么用?PHP KTUtil::getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::getObject方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: synchroniseGroupToSource
function synchroniseGroupToSource($oGroup)
{
$oGroup =& KTUtil::getObject('Group', $oGroup);
$iSourceId = $oGroup->getAuthenticationSourceId();
$oAuthenticator = KTAuthenticationUtil::getAuthenticatorForSource($iSourceId);
return $oAuthenticator->synchroniseGroup($oGroup);
}
示例2: fieldsetsForDocument
function fieldsetsForDocument($oDocument, $iTypeOverride = null)
{
global $default;
$oDocument = KTUtil::getObject('Document', $oDocument);
$iMetadataVersionId = $oDocument->getMetadataVersionId();
$iDocumentTypeId = $oDocument->getDocumentTypeId();
if (!is_null($iTypeOverride)) {
$iDocumentTypeId = $iTypeOverride;
}
$sQuery = "SELECT DISTINCT F.id AS fieldset_id " . "FROM {$default->document_metadata_version_table} AS DM INNER JOIN document_fields_link AS DFL ON DM.id = DFL.metadata_version_id " . "INNER JOIN {$default->document_fields_table} AS DF ON DF.ID = DFL.document_field_id " . "INNER JOIN {$default->fieldsets_table} AS F ON F.id = DF.parent_fieldset " . "WHERE DM.id = ?" . "AND F.disabled = false";
$aParam = array($iMetadataVersionId);
$aDocumentFieldsetIds = DBUtil::getResultArrayKey(array($sQuery, $aParam), 'fieldset_id');
$aGenericFieldsetIds = KTFieldset::getGenericFieldsets(array('ids' => true));
$aSpecificFieldsetIds = KTFieldset::getForDocumentType($iDocumentTypeId, array('ids' => true));
$aFieldsetIds = kt_array_merge($aDocumentFieldsetIds, $aGenericFieldsetIds, $aSpecificFieldsetIds);
$aFieldsetIds = array_unique($aFieldsetIds);
sort($aFieldsetIds);
$aRet = array();
foreach ($aFieldsetIds as $iID) {
$aRet[] = call_user_func(array('KTFieldset', 'get'), $iID);
}
return $aRet;
}
示例3: testConditionOnFolder
function testConditionOnFolder($oSearch, $oFolder)
{
$oSearch =& KTUtil::getObject('KTSavedSearch', $oSearch);
$iFolderId = KTUtil::getId($oFolder);
/*
* Make a new criteria set, an AND of the existing criteria set
* and the sql statement requiring that D.id be the document id
* given to us.
*/
$aCriteriaSet = array("join" => "AND", "subgroup" => array($oSearch->getSearch(), array("join" => "AND", "values" => array(array("sql" => array("F.id = ?", array($iFolderId)))))));
$aOptions = array('select' => 'COUNT(DISTINCT(F.id)) AS cnt');
$aQuery = KTSearchUtil::criteriaToFolderQuery($aCriteriaSet, null, null, $aOptions);
if (PEAR::isError($aQuery)) {
// caused by no permissions being set.
return false;
}
$cnt = DBUtil::getOneResultKey($aQuery, 'cnt');
if (PEAR::isError($cnt)) {
return $cnt;
}
if (is_null($cnt)) {
return false;
}
if (!is_numeric($cnt)) {
return PEAR::raiseError(_kt("Non-integer returned when looking for count"));
}
return $cnt > 0;
}
示例4: getAllowedForDescriptor
function getAllowedForDescriptor($oDescriptor)
{
$oDescriptor =& KTUtil::getObject('KTPermissionDescriptor', $oDescriptor);
return $oDescriptor->getAllowed();
}
示例5: synchroniseGroup
function synchroniseGroup($oGroup)
{
$oGroup =& KTUtil::getObject('Group', $oGroup);
$dn = $oGroup->getAuthenticationDetails();
$aAttr = $this->getGroup($dn, array('member'));
if (PEAR::isError($aAttr)) {
return $aAttr;
}
$aMembers = KTUtil::arrayGet($aAttr, 'member', array());
if (!is_array($aMembers)) {
$aMembers = array($aMembers);
}
$aUserIds = array();
foreach ($aMembers as $sMember) {
$iUserId = User::getByAuthenticationSourceAndDetails($this->oSource, $sMember, array('ids' => true));
if (PEAR::isError($iUserId)) {
continue;
}
$aUserIds[] = $iUserId;
}
$oGroup->setMembers($aUserIds);
}
示例6:
function &getByField($oField)
{
$oField =& KTUtil::getObject('DocumentField', $oField);
$iFieldsetId = $oField->getParentFieldsetId();
return KTFieldset::get($iFieldsetId);
}
示例7: getWorkflowStateForDocument
/**
* Gets the workflow state that applies to the given document,
* returning null if there is no workflow assigned.
*/
function getWorkflowStateForDocument($oDocument, $aOptions = null)
{
$ids = KTUtil::arrayGet($aOptions, 'ids', false);
if (is_a($oDocument, 'KTDocumentCore')) {
$oDocument = $oDocument->getId();
}
$oDocument = KTUtil::getObject('Document', $oDocument);
$iWorkflowStateId = $oDocument->getWorkflowStateId();
if (PEAR::isError($iWorkflowStateId)) {
return $iWorkflowStateId;
}
if (is_null($iWorkflowStateId)) {
return $iWorkflowStateId;
}
if ($ids) {
return $iWorkflowStateId;
}
return KTWorkflowState::get($iWorkflowStateId);
}
示例8: breadcrumbsForFolder
function breadcrumbsForFolder($oFolder, $aOptions = null)
{
$oFolder =& KTUtil::getObject('Folder', $oFolder);
$sAction = KTUtil::arrayGet($aOptions, 'folderaction');
if (PEAR::isError($oFolder)) {
$url = KTUtil::addQueryStringSelf('fFolderId=1');
if (!empty($sAction)) {
$url = generateControllerUrl($sAction, 'fFolderId=1');
}
return array(array('url' => $url, 'name' => '…'));
}
$bFinal = KTUtil::arrayGet($aOptions, 'final', true, false);
$bFolderBrowseBase = KTUtil::arrayGet($aOptions, 'folderbase', '');
$aBreadcrumbs = array();
// skip root.
//$folder_path_names = $oFolder->getPathArray();
$folder_path_ids = array_slice(explode(',', $oFolder->getParentFolderIds()), 1);
$parents = count($folder_path_ids);
// we have made the "default" folder non-root, so we need to be able
// to reach "Root" (Folder::get(1)).
$url = KTUtil::addQueryStringSelf('fFolderId=1');
if (!empty($sAction)) {
$url = generateControllerUrl($sAction, 'fFolderId=1');
}
$aBreadcrumbs[] = array('url' => $url, 'name' => _kt('Folders'));
$oUser = User::get($_SESSION['userID']);
if ($parents != 0) {
foreach (range(0, $parents - 1) as $index) {
$id = $folder_path_ids[$index];
$oThisFolder = Folder::get($id);
$sFolderName = $oThisFolder->getName();
$url = KTUtil::addQueryStringSelf('fFolderId=' . $id);
if (!empty($sAction)) {
$url = generateControllerUrl($sAction, 'fFolderId=' . $id);
}
if (!KTPermissionUtil::userHasPermissionOnItem($oUser, 'ktcore.permissions.folder_details', $oThisFolder)) {
if (KTBrowseUtil::inAdminMode($oUser, $oThisFolder)) {
$aBreadcrumbs[] = array('url' => $url, 'name' => sprintf('(%s)', $sFolderName));
} else {
$aBreadcrumbs[] = array('name' => '...');
}
continue;
}
$aBreadcrumbs[] = array('url' => $url, 'name' => $sFolderName);
}
}
// now add this folder, _if we aren't in 1_.
if ($oFolder->getId() != 1) {
$id = $oFolder->getId();
$url = KTUtil::addQueryStringSelf('fFolderId=' . $id);
if (!empty($sAction)) {
$url = generateControllerUrl($sAction, 'fFolderId=' . $id);
}
if (!KTPermissionUtil::userHasPermissionOnItem($oUser, 'ktcore.permissions.folder_details', $oFolder)) {
if (KTBrowseUtil::inAdminMode($oUser, $oFolder)) {
$aBreadcrumbs[] = array('url' => $url, 'name' => sprintf('(%s)', $oFolder->getName()));
} else {
$aBreadcrumbs[] = array('name' => '...');
}
} else {
if ($bFinal) {
$aBreadcrumbs[] = array('name' => $oFolder->getName());
} else {
$aBreadcrumbs[] = array('url' => $url, 'name' => $oFolder->getName());
}
}
}
$aCompactBreadcrumbs = array();
$lastdotdotdot = false;
foreach ($aBreadcrumbs as $aBreadcrumb) {
if ($aBreadcrumb['name'] == '...') {
if ($lastdotdotdot == true) {
continue;
}
$lastdotdotdot = true;
} else {
$lastdotdotdot = false;
}
$aCompactBreadcrumbs[] = $aBreadcrumb;
}
return $aCompactBreadcrumbs;
}
示例9:
function &getForUser($oUser)
{
$oUser =& KTUtil::getObject('User', $oUser);
$iAuthenticationSourceId = $oUser->getAuthenticationSourceId();
if (empty($iAuthenticationSourceId)) {
return null;
}
return KTAuthenticationSource::get($iAuthenticationSourceId);
}
示例10:
function &getByDocument($oDocument)
{
$oDocument =& KTUtil::getObject('Document', $oDocument);
$iStateId = $oDocument->getWorkflowStateId();
if (PEAR::isError($iStateId)) {
return $iStateId;
}
if (is_null($iStateId)) {
return $iStateId;
}
return KTWorkflowState::get($iStateId);
}
示例11: deleteVersion
/**
* Delete a selected version of the document.
*/
function deleteVersion($oDocument, $iVersionID, $sReason)
{
$oDocument =& KTUtil::getObject('Document', $oDocument);
$oVersion =& KTDocumentMetadataVersion::get($iVersionID);
$oStorageManager =& KTStorageManagerUtil::getSingleton();
global $default;
if (empty($sReason)) {
return PEAR::raiseError(_kt('Deletion requires a reason'));
}
if (PEAR::isError($oDocument) || $oDocument == false) {
return PEAR::raiseError(_kt('Invalid document object.'));
}
if (PEAR::isError($oVersion) || $oVersion == false) {
return PEAR::raiseError(_kt('Invalid document version object.'));
}
$iContentId = $oVersion->getContentVersionId();
$oContentVersion = KTDocumentContentVersion::get($iContentId);
if (PEAR::isError($oContentVersion) || $oContentVersion == false) {
return PEAR::raiseError(_kt('Invalid document content version object.'));
}
// Check that the document content is not the same as the current content version
$sDocStoragePath = $oDocument->getStoragePath();
$sVersionStoragePath = $oContentVersion->getStoragePath();
if ($sDocStoragePath == $sVersionStoragePath) {
return PEAR::raiseError(_kt("Can't delete version: content is the same as the current document content."));
}
DBUtil::startTransaction();
// now delete the document version
$res = $oStorageManager->deleteVersion($oVersion);
if (PEAR::isError($res) || $res == false) {
//could not delete the document version from the file system
$default->log->error('Deletion: Filesystem error deleting the metadata version ' . $oVersion->getMetadataVersion() . ' of the document ' . $oDocument->getFileName() . ' from folder ' . Folder::getFolderPath($oDocument->getFolderID()) . ' id=' . $oDocument->getFolderID());
// we use a _real_ transaction here ...
DBUtil::rollback();
return PEAR::raiseError(_kt('There was a problem deleting the document from storage.'));
}
// change status for the metadata version
$oVersion->setStatusId(VERSION_DELETED);
$oVersion->update();
// set the storage path to empty
// $oContentVersion->setStoragePath('');
DBUtil::commit();
}