本文整理汇总了PHP中CDoObjectAddEdit类的典型用法代码示例。如果您正苦于以下问题:PHP CDoObjectAddEdit类的具体用法?PHP CDoObjectAddEdit怎么用?PHP CDoObjectAddEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDoObjectAddEdit类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: CCompteRendu
* @author SARL OpenXtrem <[email protected]>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version SVN: $Id:\$
* @link http://www.mediboard.org
*/
if (isset($_POST["_do_empty_pdf"])) {
$compte_rendu_id = CValue::post("compte_rendu_id");
$compte_rendu = new CCompteRendu();
$compte_rendu->load($compte_rendu_id);
$compte_rendu->loadRefsFiles();
foreach ($compte_rendu->_ref_files as $_file) {
$_file->fileEmpty();
}
CApp::rip();
}
$do = new CDoObjectAddEdit("CCompteRendu");
$do->redirectDelete = "m=dPcompteRendu&new=1";
// Récupération des marges du modele en fast mode
if (isset($_POST["fast_edit"]) && $_POST["fast_edit"] == 1 && isset($_POST["object_id"]) && $_POST["object_id"] != '') {
$compte_rendu = new CCompteRendu();
$compte_rendu->load($_POST["modele_id"]);
if ($compte_rendu->_id) {
$do->request["margin_top"] = $compte_rendu->margin_top;
$do->request["margin_bottom"] = $compte_rendu->margin_bottom;
$do->request["margin_left"] = $compte_rendu->margin_left;
$do->request["margin_right"] = $compte_rendu->margin_right;
}
}
if (isset($_POST["_source"])) {
$_POST["_source"] = stripslashes($_POST["_source"]);
}
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_modele_aed.php
示例2: CDoObjectAddEdit
<?php
/**
* $Id$
*
* @package Mediboard
* @subpackage Labo
* @author SARL OpenXtrem <[email protected]>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
$do = new CDoObjectAddEdit("CPrescriptionLaboExamen");
$pack = new CPackExamensLabo();
$pack->load($_POST["_pack_examens_labo_id"]);
$pack->loadRefs();
foreach ($pack->_ref_items_examen_labo as $item) {
$_POST["examen_labo_id"] = $item->_ref_examen_labo->_id;
$_POST["pack_examens_labo_id"] = $pack->_id;
$do->doBind();
$do->doStore();
}
$do->ajax = 1;
$do->doRedirect();
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:23,代码来源:do_prescription_pack_add.php
示例3: array
$where["plageconsult.chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrat), $chir_id);
$order = "plageconsult.date";
$listConsults = array();
$consult = new CConsultation();
/** @var CConsultation[] $listConsults */
$listConsults = $consult->loadList($where, $order, null, null, $ljoin);
$total = array("nb" => 0, "value" => 0);
foreach ($listConsults as $consult) {
$consult->loadRefsFwd();
$consult->loadRefsReglements();
if (CModule::getActive("fse")) {
if ($fse = CFseFactory::createFSE()) {
$fse->loadIdsFSE($consult);
}
}
$consult->_new_reglement_tiers = new CReglement();
$consult->_new_reglement_tiers->setObject($consult);
$consult->_new_reglement_tiers->mode = "virement";
$consult->_new_reglement_tiers->montant = $consult->_du_restant_tiers;
$hasNoemie = !$consult->_current_fse || $consult->_current_fse->hasNoemie();
if (!$hasNoemie) {
$_POST["consultation_id"] = $consult->_id;
$_POST["montant"] = $consult->_du_restant_tiers;
$do = new CDoObjectAddEdit("CReglement", "reglement_id");
$do->redirect = null;
$do->doIt();
}
}
// Redirection finale
$do->redirect = "m=cabinet&a=print_noemie&dialog=1";
$do->doRedirect();
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_multi_noemie_aed.php
示例4: CMedecin
/**
* $Id$
*
* @package Mediboard
* @subpackage Patients
* @author SARL OpenXtrem <[email protected]>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
$ds = CSQLDataSource::get("std");
$medecin1 = new CMedecin();
$medecin1->load($_POST["medecin1_id"]);
$medecin2 = new CMedecin();
$medecin2->load($_POST["medecin2_id"]);
$do = new CDoObjectAddEdit("CMedecin", "medecin_id");
$do->doBind();
// Création du nouveau medecin
if (intval(CValue::post("del"))) {
$do->doDelete();
} else {
$do->doStore();
}
/** @var CMedecin $newMedecin */
$newMedecin =& $do->_obj;
// Transfert de toutes les backrefs
if ($msg = $newMedecin->transferBackRefsFrom($medecin1)) {
$do->errorRedirect($msg);
}
if ($msg = $newMedecin->transferBackRefsFrom($medecin2)) {
$do->errorRedirect($msg);
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:30,代码来源:do_medecins_fusion.php
示例5: CDoObjectAddEdit
<?php
/**
* $Id$
*
* @package Mediboard
* @subpackage Stock
* @author SARL OpenXtrem <[email protected]>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
$do = new CDoObjectAddEdit('CProduct');
if (CValue::post("_duplicate")) {
$do->doBind();
$product = $do->_old;
$product->code .= "-copie";
$product->name .= " (Copie)";
$product->_id = null;
if ($msg = $product->store()) {
CAppUI::setMsg($msg);
} else {
// Redirection vers le nouveau
$_GET["product_id"] = $product->_id;
}
} else {
$do->doIt();
}
开发者ID:fbone,项目名称:mediboard4,代码行数:27,代码来源:do_product_aed.php
示例6: CDoObjectAddEdit
$modify_affectation = CMbDT::addDateTime("00:{$tolerance}:00", $entree) > $_POST["_date_split"];
// Modifier la première affectation, affectation du lit si la tolérance de création d'afectation n'est pas atteint
$do = new CDoObjectAddEdit("CAffectation", "affectation_id");
if ($modify_affectation) {
$_POST["lit_id"] = $_POST["_new_lit_id"];
} else {
$_POST["entree"] = $entree;
$_POST["sortie"] = $_POST["_date_split"];
}
$do->redirect = null;
$do->redirectStore = null;
$do->doIt();
$first_affectation = $do->_obj;
// Créer la seconde si la tolérance est dépassé
if (!$modify_affectation) {
$do = new CDoObjectAddEdit("CAffectation", "affectation_id");
$_POST["ajax"] = 1;
$_POST["entree"] = $_POST["_date_split"];
$_POST["sortie"] = $sortie;
$_POST["lit_id"] = $_POST["_new_lit_id"];
$_POST["affectation_id"] = null;
$do->doSingle(false);
}
// Gérer le déplacement du ou des bébés si nécessaire
if (CModule::getActive("maternite")) {
/** @var CAffectation[] $affectations_enfant */
$affectations_enfant = $first_affectation->loadBackRefs("affectations_enfant");
foreach ($affectations_enfant as $_affectation) {
$save_sortie = $_affectation->sortie;
$modify_affectation_enfant = CMbDT::addDateTime("00:{$tolerance}:00", $_affectation->entree) > $_POST["_date_split"];
if ($modify_affectation_enfant) {
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:31,代码来源:do_affectation_split.php
示例7: CDoObjectAddEdit
<?php
/**
* $Id: do_traitement_aed.php 19219 2013-05-21 12:26:07Z phenxdesign $
*
* @package Mediboard
* @subpackage Patients
* @author SARL OpenXtrem <[email protected]>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision: 19219 $
*/
$autoadd_default = CAppUI::pref("AUTOADDSIGN", true);
$del = $_POST["del"];
// Sejour
// si on a un sejour et que l'option d'ajout automatique est activée
if (isset($_POST["_sejour_id"]) && $autoadd_default && $_POST["_sejour_id"] != "") {
$doSejour = new CDoObjectAddEdit("CTraitement", "traitement_id");
// Ajout de l'antecedent dans le sejour
$_POST["dossier_medical_id"] = CDossierMedical::dossierMedicalId($_POST["_sejour_id"], "CSejour");
$doSejour->redirectStore = null;
$doSejour->redirect = null;
$doSejour->doIt();
}
$_POST["del"] = $del;
// Patient
$doPatient = new CDoObjectAddEdit("CTraitement", "traitement_id");
if ($_POST["del"] != 1 && isset($_POST["_patient_id"])) {
$_POST["dossier_medical_id"] = CDossierMedical::dossierMedicalId($_POST["_patient_id"], "CPatient");
}
$_POST["ajax"] = 1;
$doPatient->doIt();
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_traitement_aed.php
示例8: CDoObjectAddEdit
<?php
/* $Id$ */
/**
* @package Mediboard
* @subpackage dPrepas
* @version $Revision$
* @author Sébastien Fillonneau
*/
$do = new CDoObjectAddEdit("CMenu", "menu_id");
$do->doIt();
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:11,代码来源:do_menu_aed.php
示例9: array
* @subpackage System
* @author SARL OpenXtrem <[email protected]>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
$objects_id = CValue::post("_objects_id");
// array
$objects_class = CValue::post("_objects_class");
$base_object_id = CValue::post("_base_object_id");
$del = CValue::post("del");
$fast = CValue::post("fast");
CApp::setMemoryLimit("512M");
// If the class is valid
if (class_exists($objects_class)) {
$objects = array();
$do = new CDoObjectAddEdit($objects_class);
// If alt mode, load the specified object
if ($base_object_id) {
$do->_obj->load($base_object_id);
}
// Création du nouvel objet
if (intval($del)) {
$do->errorRedirect("Fusion en mode suppression impossible");
}
// Unset the base_object from the list
if ($do->_obj->_id) {
foreach ($objects_id as $key => $object_id) {
if ($do->_obj->_id == $object_id) {
unset($objects_id[$key]);
unset($_POST["_merging"][$base_object_id]);
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:31,代码来源:do_object_merge.php
示例10: doRedirect
/**
* @see parent::doRedirect()
*/
function doRedirect()
{
if (CAppUI::conf("dPsalleOp CActeCCAM codage_strict") || !$this->_old->_id || !$this->_obj->_id) {
$this->_ref_object->correctActes();
}
parent::doRedirect();
}
开发者ID:fbone,项目名称:mediboard4,代码行数:10,代码来源:do_acteccam_aed.php
示例11: doDelete
function doDelete()
{
parent::doDelete();
$dialog = CValue::post("dialog");
if ($dialog) {
$this->redirectDelete .= "&name=" . $this->_obj->nom . "&firstName=" . $this->_obj->prenom . "&id=0";
}
}
开发者ID:fbone,项目名称:mediboard4,代码行数:8,代码来源:do_patients_aed.php
示例12: doStore
/**
* @see parent::doStore()
*/
function doStore()
{
if (isset($_FILES['attachment'])) {
$mail_id = CValue::post('mail_id');
$mail = new CUserMail();
$mail->load($mail_id);
$files = array();
foreach ($_FILES['attachment']['error'] as $key => $file_error) {
if (isset($_FILES['attachment']['name'][$key])) {
$files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
}
}
foreach ($files as $_key => $_file) {
if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
continue;
}
if ($_file['error'] != 0) {
CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
continue;
}
$attachment = new CMailAttachments();
$attachment->name = $_file['name'];
$content_type = mime_content_type($_file['tmp_name']);
$attachment->type = $attachment->getTypeInt($content_type);
$attachment->bytes = $_file['size'];
$attachment->mail_id = $mail_id;
$content_type = explode('/', $content_type);
$attachment->subtype = strtoupper($content_type[1]);
$attachment->disposition = 'ATTACHMENT';
$attachment->extension = substr(strrchr($attachment->name, '.'), 1);
$attachment->part = $mail->countBackRefs('mail_attachments') + 1;
$attachment->store();
$file = new CFile();
$file->setObject($attachment);
$file->author_id = CAppUI::$user->_id;
$file->file_name = $attachment->name;
$file->file_date = CMbDT::dateTime();
$file->fillFields();
$file->updateFormFields();
$file->doc_size = $attachment->bytes;
$file->file_type = mime_content_type($_file['tmp_name']);
$file->moveFile($_file, true);
if ($msg = $file->store()) {
CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
CApp::rip();
}
$attachment->file_id = $file->_id;
if ($msg = $attachment->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
CApp::rip();
}
}
CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
} else {
parent::doStore();
}
}
开发者ID:fbone,项目名称:mediboard4,代码行数:60,代码来源:CMailAttachmentController.class.php
示例13: doStore
function doStore()
{
parent::doStore();
$dialog = CValue::post("dialog");
$isNew = !CValue::post("patient_id");
$patient_id = $this->_obj->patient_id;
if ($isNew) {
$this->redirectStore .= "&patient_id={$patient_id}&created={$patient_id}";
} elseif ($dialog) {
$this->redirectStore .= "&name=" . $this->_obj->nom . "&firstname=" . $this->_obj->prenom;
}
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:12,代码来源:do_patients_fusion.php
示例14: doBind
function doBind()
{
parent::doBind();
// recuperation du sejour_id
$_sejour_id = CValue::post("_sejour_id", null);
// si pas de sejour_id, redirection
if (!$_sejour_id) {
$this->doRedirect();
}
// Creation du nouvel antecedent
unset($_POST["antecedent_id"]);
$this->_obj = $this->_old;
$this->_obj->_id = null;
$this->_obj->antecedent_id = null;
// Calcul de la valeur de l'id du dossier_medical du sejour
$this->_obj->dossier_medical_id = CDossierMedical::dossierMedicalId($_sejour_id, "CSejour");
}
开发者ID:fbone,项目名称:mediboard4,代码行数:17,代码来源:do_copy_antecedent.php
示例15: doStore
function doStore()
{
global $_validation, $m;
if (!$_validation) {
// Pas de $_validation ==> pas d'edition de la fiche
if (!$this->_old->fiche_ei_id) {
// Nouvelle fiche
$this->_obj->date_fiche = CMbDT::dateTime();
} elseif ($this->_old->qualite_date_validation) {
// NE RIEN FAIRE !! -> Attente de verif et de controle
} elseif (!$this->_old->qualite_date_validation && $this->_old->service_date_validation) {
$this->_obj->qualite_date_validation = CMbDT::dateTime();
} elseif (!$this->_old->service_date_validation && $this->_old->date_validation) {
$this->_obj->service_date_validation = CMbDT::dateTime();
} elseif (!$this->_old->date_validation) {
$this->_obj->date_validation = CMbDT::dateTime();
}
}
$this->redirectStore = "m={$m}&tab=vw_incidentvalid";
parent::doStore();
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:21,代码来源:do_ficheEi_aed.php
示例16: doStore
function doStore()
{
parent::doStore();
if (CModule::getActive("dPprescription") && !$this->_old->_id) {
$p_to_c = new CPrescriptionProtocoleToConcept();
$count_p_to_c = $p_to_c->countList();
if ($count_p_to_c > 0) {
/** @var CExObject $ex_object */
$ex_object = $this->_obj;
$all_fields = $ex_object->loadRefExClass()->loadRefsAllFields();
$bool_concept_ids = array();
foreach ($all_fields as $_field) {
if (strpos($_field->prop, "bool") === 0 && $_field->concept_id && $ex_object->{$_field->name} == "1") {
$bool_concept_ids[] = $_field->concept_id;
}
}
$bool_concept_ids = array_unique($bool_concept_ids);
$where = array("concept_id" => $p_to_c->getDS()->prepareIn($bool_concept_ids));
$protocole_ids = array_values(CMbArray::pluck($p_to_c->loadList($where), "protocole_id"));
if (count($protocole_ids)) {
/** @var CSejour $sejour */
$sejour = $ex_object->getReferenceObject("CSejour");
if ($sejour && $sejour->_id) {
$prescription = $sejour->loadRefPrescriptionSejour();
if (!$prescription->_id) {
$prescription = new CPrescription();
$prescription->object_id = $sejour->_id;
$prescription->object_class = $sejour->_class;
$prescription->type = "sejour";
if ($msg = $prescription->store()) {
CAppUI::setMsg($msg, UI_MSG_WARNING);
}
}
$ops_ids = implode("-", CMbArray::pluck($sejour->loadRefsOperations(array("annulee" => "= '0'")), "operation_id"));
CAppUI::callbackAjax("window.opener.ExObject.checkOpsBeforeProtocole", $protocole_ids, $prescription->_id, $sejour->_id, $ops_ids);
}
}
}
}
}
开发者ID:fbone,项目名称:mediboard4,代码行数:40,代码来源:do_ex_object_aed.php
示例17: doStore
/**
* @see parent::doStore()
*/
function doStore()
{
$upload = null;
if (CValue::POST("_from_yoplet") == 1) {
/** @var CFile $obj */
$obj = $this->_obj;
$array_file_name = array();
$path = CAppUI::conf("dPfiles yoplet_upload_path");
if (!$path) {
$path = "tmp";
}
// On retire les backslashes d'escape
$file_name = stripslashes($this->request['_file_path']);
// Récupération du nom de l'image en partant de la fin de la chaîne
// et en rencontrant le premier \ ou /
preg_match('@[\\\\/]([^\\\\/]*)$@i', $file_name, $array_file_name);
$file_name = $array_file_name[1];
$extension = strrchr($file_name, '.');
$_rename = $this->request['_rename'] ? $this->request['_rename'] : 'upload';
$file_path = "{$path}/" . $this->request['_checksum'];
$obj->file_name = $_rename == 'upload' ? $file_name : $_rename . $extension;
$obj->_old_file_path = $this->request['_file_path'];
$obj->doc_size = filesize($file_path);
$obj->author_id = CAppUI::$user->_id;
if (CModule::getActive("cda")) {
$obj->type_doc = $this->request["type_doc"];
}
$obj->fillFields();
$obj->updateFormFields();
$obj->file_type = CMbPath::guessMimeType($file_name);
if ($msg = $obj->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
$obj->forceDir();
$obj->moveFile($file_path);
}
return parent::doStore();
}
$_file_category_id = CValue::post("_file_category_id");
$language = CValue::post("language");
$type_doc = CValue::post("type_doc");
$named = CValue::post("named");
$rename = CValue::post("_rename");
CValue::setSession("_rename", $rename);
if (isset($_FILES["formfile"])) {
$aFiles = array();
$upload =& $_FILES["formfile"];
foreach ($upload["error"] as $fileNumber => $etatFile) {
if (!$named) {
$rename = $rename ? $rename . strrchr($upload["name"][$fileNumber], '.') : "";
}
if ($upload["name"][$fileNumber]) {
$aFiles[] = array("_mode" => "file", "name" => $upload["name"][$fileNumber], "type" => CMbPath::guessMimeType($upload["name"][$fileNumber]), "tmp_name" => $upload["tmp_name"][$fileNumber], "error" => $upload["error"][$fileNumber], "size" => $upload["size"][$fileNumber], "language" => $language, "type_doc" => $type_doc, "file_category_id" => $_file_category_id, "object_id" => CValue::post("object_id"), "object_class" => CValue::post("object_class"), "_rename" => $rename);
}
}
// Pasted images, via Data uri
if (!empty($_POST["formdatauri"])) {
$data_uris = $_POST["formdatauri"];
$data_names = $_POST["formdatauri_name"];
foreach ($data_uris as $fileNumber => $fileContent) {
$parsed = $this->parseDataUri($fileContent);
$_name = $data_names[$fileNumber];
if (!$named) {
$ext = strrchr($_name, '.');
if ($ext === false) {
$ext = "." . substr(strrchr($parsed["mime"], '/'), 1);
$_name .= $ext;
}
$rename = $rename ? $rename . $ext : "";
}
$temp = tempnam(sys_get_temp_dir(), "up_");
file_put_contents($temp, $parsed["data"]);
if ($data_names[$fileNumber]) {
$aFiles[] = array("_mode" => "datauri", "name" => $_name, "type" => $parsed["mime"], "tmp_name" => $temp, "error" => 0, "size" => strlen($parsed["data"]), "language" => $language, "type_doc" => $type_doc, "file_category_id" => $_file_category_id, "object_id" => CValue::post("object_id"), "object_class" => CValue::post("object_class"), "_rename" => $rename);
}
}
}
$merge_files = CValue::post("_merge_files");
if ($merge_files) {
$pdf = new CMbPDFMerger();
$this->_obj = new $this->_obj->_class();
/** @var CFile $obj */
$obj = $this->_obj;
$file_name = "";
$nb_converted = 0;
foreach ($aFiles as $key => $file) {
$converted = 0;
if ($file["error"] == UPLOAD_ERR_NO_FILE) {
continue;
}
if ($file["error"] != 0) {
CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $file["error"]), UI_MSG_ERROR);
continue;
}
// Si c'est un pdf, on le rajoute sans aucun traitement
if (substr(strrchr($file["name"], '.'), 1) == "pdf") {
$file_name .= substr($file["name"], 0, strpos($file["name"], '.'));
//.........这里部分代码省略.........
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:101,代码来源:CFileAddEdit.class.php
示例18: doStore
function doStore()
{
$this->_obj->resetModifications();
parent::doStore();
}
开发者ID:fbone,项目名称:mediboard4,代码行数:5,代码来源:do_validationrepas_aed.php
示例19: doStore
/**
* @see parent::doStore()
*/
function doStore()
{
/** @var CUserMail $mail */
$mail = $this->_obj;
$mail->date_inbox = CMbDT::dateTime();
$mail->date_read = $mail->date_inbox;
$content_html = new CContentHTML();
$mail->_content = CUserMail::purifyHTML($mail->_content);
$content_html->content = $mail->_content;
if (!($msg = $content_html->store())) {
$mail->text_html_id = $content_html->_id;
$mail->_text_html = $content_html;
}
$content_plain = new CContentAny();
$content_plain->content = strip_tags($mail->_content);
if (!($msg = $content_plain->store())) {
$mail->text_plain_id = $content_plain->_id;
}
$hash = CMbSecurity::hash(CMbSecurity::SHA256, "==FROM==\n{$mail->from}\n==TO==\n{$mail->to}\n==SUBJECT==\n{$mail->subject}\n==CONTENT==\n{$mail->_content}");
if ($msg = $mail->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
return parent::doStore();
}
$action = CValue::post('action');
switch ($action) {
case 'draft':
$mail->draft = '1';
CAppUI::setMsg('CUserMail-msg-drafted', UI_MSG_OK);
break;
case 'send':
$mail->sent = '1';
$mail->draft = '0';
$account = $mail->loadAccount();
if ($mail->_is_apicrypt) {
/** @var CSourceSMTP $smtp */
$smtp = CExchangeSource::get("mediuser-{$account->object_id}-apicrypt", 'smtp');
} else {
/** @var CSourceSMTP $smtp */
$smtp = CExchangeSource::get("mediuser-{$account->object_id}", 'smtp');
}
$smtp->init();
foreach (explode(',', $mail->to) as $_address) {
$smtp->addTo($_address);
}
if ($mail->cc != '') {
foreach (explode(',', $mail->cc) as $_address) {
$smtp->addCc($_address);
}
}
if ($mail->bcc != '') {
foreach (explode(',', $mail->bcc) as $_address) {
$smtp->addBcc($_address);
}
}
$smtp->setSubject($mail->subject);
if ($mail->_is_apicrypt) {
$receiver = explode(',', $mail->to);
$body = CApicrypt::encryptBody($account->object_id, $receiver[0], $mail->_content);
$smtp->setBody($body);
} else {
$smtp->setBody($mail->_content);
}
/** @var CMailAttachments[] $attachments */
$attachments = $mail->loadAttachments();
foreach ($attachments as $_attachment) {
$file = $_attachment->loadFiles();
$smtp->addAttachment($file->_file_path, $file->file_name);
}
try {
$smtp->send();
CAppUI::setMsg('CUserMail-msg-sent', UI_MSG_OK);
} catch (phpmailerException $e) {
CAppUI::setMsg($e->errorMessage(), UI_MSG_ERROR);
} catch (CMbException $e) {
$e->stepAjax();
}
break;
default:
}
$mail->store();
if (CAppUI::isMsgOK() && $this->redirectStore) {
$this->redirect =& $this->redirectStore;
}
if (!CAppUI::isMsgOK() && $this->redirectError) {
$this->redirect =& $this->redirectError;
}
}
开发者ID:fbone,项目名称:mediboard4,代码行数:90,代码来源:CUserMailController.class.php
注:本文中的CDoObjectAddEdit类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论