本文整理匯總了PHP中CAppUI::isMsgOK方法的典型用法代碼示例。如果您正苦於以下問題:PHP CAppUI::isMsgOK方法的具體用法?PHP CAppUI::isMsgOK怎麽用?PHP CAppUI::isMsgOK使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CAppUI
的用法示例。
在下文中一共展示了CAppUI::isMsgOK方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doStore
function doStore()
{
global $doc_ged_id, $file_id, $_firstModeleGed;
$file_upload_ok = false;
if ($msg = $this->_obj->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
if ($this->redirectError) {
$this->redirect =& $this->redirectError;
}
} else {
$this->redirect = null;
$doc_ged_id = $this->_obj->doc_ged_id;
if (isset($_FILES["formfile"]) && $_FILES["formfile"]["name"] != "") {
$objFile = new CFileAddEdit();
$objFile->redirect = null;
$objFile->doBind();
$_POST["object_id"] = $doc_ged_id;
$objFile->dostore();
if (CAppUI::isMsgOK()) {
$file_upload_ok = true;
$file_id = $objFile->_obj->file_id;
} else {
// Erreur Upload
if ($this->redirectError) {
$this->redirect =& $this->redirectError;
}
$this->doRedirect();
}
}
}
}
示例2: doStore
//.........這裏部分代碼省略.........
$other_file = new CFile();
$other_file->bind($file);
$other_file->file_name = $file["name"];
$other_file->file_type = $file["type"];
$other_file->doc_size = $file["size"];
$other_file->fillFields();
$other_file->private = CValue::post("private");
if (false == ($res = $other_file->moveTemp($file))) {
CAppUI::setMsg("Fichier non envoyé", UI_MSG_ERROR);
continue;
}
$other_file->author_id = CAppUI::$user->_id;
if ($msg = $other_file->store()) {
CAppUI::setMsg("Fichier non enregistré: {$msg}", UI_MSG_ERROR);
continue;
}
CAppUI::setMsg("Fichier enregistré", UI_MSG_OK);
}
}
// Pour le nom du pdf de fusion, on concatène les noms des fichiers
if ($key != count($aFiles) - 1 && $converted) {
$file_name .= "-";
}
}
// Si des fichiers ont été convertis et ajoutés à PDFMerger,
// création du cfile.
if ($nb_converted) {
$obj->file_name = $file_name . ".pdf";
$obj->file_type = "application/pdf";
$obj->author_id = CAppUI::$user->_id;
$obj->private = CValue::post("private");
$obj->object_id = CValue::post("object_id");
$obj->object_class = CValue::post("object_class");
$obj->updateFormFields();
$obj->fillFields();
$obj->forceDir();
$tmpname = tempnam("/tmp", "pdf_");
$pdf->merge('file', $tmpname);
$obj->doc_size = strlen(file_get_contents($tmpname));
$obj->moveFile($tmpname);
//rename($tmpname, $obj->_file_path . "/" .$obj->file_real_filename);
if ($msg = $obj->store()) {
CAppUI::setMsg("Fichier non enregistré: {$msg}", UI_MSG_ERROR);
} else {
CAppUI::setMsg("Fichier enregistré", UI_MSG_OK);
}
}
} else {
foreach ($aFiles as $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;
}
// Reinstanciate
$this->_obj = new $this->_obj->_class();
/** @var CFile $obj */
$obj = $this->_obj;
$obj->bind($file);
$obj->file_name = empty($file["_rename"]) ? $file["name"] : $file["_rename"];
$obj->file_type = $file["type"];
if ($obj->file_type == "application/x-download") {
$obj->file_type = CMbPath::guessMimeType($obj->file_name);
}
$obj->doc_size = $file["size"];
$obj->fillFields();
$obj->private = CValue::post("private");
if ($file["_mode"] == "file") {
$res = $obj->moveTemp($file);
} else {
$res = $obj->moveFile($file["tmp_name"]);
}
if (false == $res) {
CAppUI::setMsg("Fichier non envoyé", UI_MSG_ERROR);
continue;
}
// File owner on creation
if (!$obj->file_id) {
$obj->author_id = CAppUI::$user->_id;
}
if ($msg = $obj->store()) {
CAppUI::setMsg("Fichier non enregistré: {$msg}", UI_MSG_ERROR);
continue;
}
CAppUI::setMsg("Fichier enregistré", UI_MSG_OK);
}
}
// Redaction du message et renvoi
if (CAppUI::isMsgOK() && $this->redirectStore) {
$this->redirect =& $this->redirectStore;
}
if (!CAppUI::isMsgOK() && $this->redirectError) {
$this->redirect =& $this->redirectError;
}
} else {
parent::doStore();
}
}
示例3: 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;
}
}
示例4: doStore
function doStore()
{
global $doc_ged_id, $file_id, $_validation;
if ($this->_obj->doc_ged_id) {
// Procédure Existante --> Verification
//if ($this->_old->etat == CDocGed::REDAC && $_validation === null) {
if (isset($_FILES["formfile"])) {
// Test d'upload du fichier
$objFile = new CFileAddEdit();
$objFile->redirect = null;
$objFile->doIt();
if (!CAppUI::isMsgOK()) {
// Erreur sur le fichier !
if ($this->redirectError) {
$this->redirect =& $this->redirectError;
}
$this->doRedirect();
} else {
$file_id = $objFile->_obj->file_id;
}
}
}
if ($this->_old->group_id && $this->_obj->doc_chapitre_id && $this->_obj->doc_categorie_id && !$this->_old->num_ref) {
// Nouvelle Procédure
$this->_obj->version = 1;
$where = array();
$where["num_ref"] = "IS NOT NULL";
$where["group_id"] = "= '" . $this->_old->group_id . "'";
$where["doc_chapitre_id"] = "= '" . $this->_obj->doc_chapitre_id . "'";
$where["doc_categorie_id"] = "= '" . $this->_obj->doc_categorie_id . "'";
$where["annule"] = "= '0'";
$order = "num_ref DESC";
if ($this->_obj->num_ref) {
// Numérotée manuellement
$where["num_ref"] = "= '" . $this->_obj->num_ref . "'";
$sameNumRef = new CDocGed();
$sameNumRef->loadObject($where, $order);
if ($sameNumRef->_id) {
$this->_obj->num_ref = null;
}
} else {
// Pas de numéro : Récup n° dernier doc dans meme chapitre et catégorie
$where["num_ref"] = "IS NOT NULL";
$lastNumRef = new CDocGed();
$lastNumRef->loadObject($where, $order);
if (!$lastNumRef->_id) {
$this->_obj->num_ref = 1;
} else {
$this->_obj->num_ref = $lastNumRef->num_ref + 1;
}
}
}
if (!($this->_old->etat == CDocGed::VALID && $this->_obj->etat == CDocGed::TERMINE)) {
// Annulation changement de version
$this->_obj->version = $this->_old->version;
}
if ($msg = $this->_obj->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
if ($this->redirectError) {
$this->redirect =& $this->redirectError;
}
} else {
$this->redirect = null;
$doc_ged_id = $this->_obj->doc_ged_id;
}
}