当前位置: 首页>>代码示例>>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;未经允许,请勿转载。