當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Documents::saveentity方法代碼示例

本文整理匯總了PHP中Documents::saveentity方法的典型用法代碼示例。如果您正苦於以下問題:PHP Documents::saveentity方法的具體用法?PHP Documents::saveentity怎麽用?PHP Documents::saveentity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Documents的用法示例。


在下文中一共展示了Documents::saveentity方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: CreateDocument

function CreateDocument($filepath, $ifattach, $id, $module, &$docid)
{
    $adb = PearDatabase::getInstance();
    $current_user = vglobal('current_user');
    $size = filesize($filepath);
    //echo $size;
    require_once 'modules/Documents/Documents.php';
    $obiekt = new Documents();
    ###
    $storage_path = decideFilePath();
    $pelnasciezka = $storage_path . $filepath;
    //echo $pelnasciezka;
    $wynik = $adb->query("select value from vtiger_osspdf_config where name='{$module}' and conf_id = 'GENERALCONFIGURATION'", true);
    $wartosc = $adb->query_result($wynik, 0, "value");
    if ($wartosc == 'default') {
        $assign = $current_user->id;
    } else {
        $assign = $wartosc;
    }
    ### Tworzenie nowego Dokumentu
    $obiekt->column_fields['notes_title'] = getTranslatedString($module, $module) . ' ' . $_REQUEST['file_name'] . ' ' . date("Y-m-d H:i:s");
    $obiekt->column_fields['filename'] = $filepath;
    $obiekt->column_fields['notecontent'] = 'OSSPdf';
    $obiekt->column_fields['folderid'] = '1';
    $obiekt->column_fields['filetype'] = "application/pdf";
    $obiekt->column_fields['filesize'] = $size;
    $obiekt->column_fields['filelocationtype'] = 'I';
    $obiekt->column_fields['filestatus'] = '1';
    $obiekt->column_fields['assigned_user_id'] = $assign;
    ### Zapis Dokumentu
    $obiekt->saveentity("Documents");
    $docid = $obiekt->id;
    $newid = $adb->getUniqueId('vtiger_crmentity');
    ### Dodanie relacji między załacznikiem a dokumentem
    $sql = "INSERT INTO vtiger_seattachmentsrel (`crmid`,`attachmentsid`) VALUES ('{$docid}','{$newid}')";
    //echo $sql;
    $wykonaj = $adb->query($sql, true);
    $date_var = date("Y-m-d H:i:s");
    ### Dodanie wpisu o załączniku
    $sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?, ?, ?, ?, ?, ?, ?)";
    $params1 = array($newid, $current_user->id, $current_user->id, "Documents Attachment", NULL, $adb->formatDate($date_var, true), $adb->formatDate($date_var, true));
    $adb->pquery($sql1, $params1, true);
    ### Dodanie informacji o załączniku do tabeli attachments
    $sql = "INSERT INTO vtiger_attachments (`attachmentsid`,`name`,`type`,`path`) VALUES ('{$newid}','{$filepath}','application/pdf','{$storage_path}')";
    //echo $sql;
    $wykonaj = $adb->pquery($sql, array(), true);
    ### Przeniesienie pliku do właściwego podkatalogu
    return $docid;
}
開發者ID:rcrrich,項目名稱:UpdatePackages,代碼行數:49,代碼來源:PDFExport.php


注:本文中的Documents::saveentity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。