本文整理匯總了PHP中CAppUI::setMsg方法的典型用法代碼示例。如果您正苦於以下問題:PHP CAppUI::setMsg方法的具體用法?PHP CAppUI::setMsg怎麽用?PHP CAppUI::setMsg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CAppUI
的用法示例。
在下文中一共展示了CAppUI::setMsg方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkProtection
/**
* Check anti-CSRF protection
*/
static function checkProtection()
{
if (!CAppUI::conf("csrf_protection") || strtoupper($_SERVER['REQUEST_METHOD']) != 'POST') {
return;
}
if (!isset($_POST["csrf"])) {
CAppUI::setMsg("CCSRF-no_token", UI_MSG_ERROR);
return;
}
if (array_key_exists($_POST['csrf'], $_SESSION["tokens"])) {
$token = $_SESSION['tokens'][$_POST['csrf']];
if ($token["lifetime"] >= time()) {
foreach ($token["fields"] as $_field => $_value) {
if (CValue::read($_POST, $_field) != $_value) {
CAppUI::setMsg("CCSRF-form_corrupted", UI_MSG_ERROR);
unset($_SESSION['tokens'][$_POST['csrf']]);
return;
}
}
//mbTrace("Le jeton est accepté !");
unset($_SESSION['tokens'][$_POST['csrf']]);
} else {
CAppUI::setMsg("CCSRF-token_outdated", UI_MSG_ERROR);
unset($_SESSION['tokens'][$_POST['csrf']]);
}
return;
}
CAppUI::setMsg("CCSRF-token_does_not_exist", UI_MSG_ERROR);
return;
}
示例2: process
public function process(CAppUI $AppUI, array $myArray)
{
if (!$this->object->bind($myArray)) {
$AppUI->setMsg($this->object->getError(), UI_MSG_ERROR);
$this->resultPath = $this->errorPath;
return $AppUI;
}
$action = $this->delete ? 'deleted' : 'stored';
$this->success = $this->delete ? $this->object->delete($AppUI) : $this->object->store($AppUI);
if (is_array($this->success) || !$this->success) {
$AppUI->holdObject($this->object);
/*
* TODO: This nasty structure was introduced in v3.0 and is only
* transitional while the individual modules are updated to
* stop using $this->success as both a boolean and the error array.
* -- This was due to a bad design decision on my part. -caseydk
*/
if (is_array($this->object->getError())) {
$AppUI->setMsg($this->object->getError(), UI_MSG_ERROR);
} else {
$AppUI->setMsg($this->success, UI_MSG_ERROR);
}
$this->resultPath = $this->errorPath;
return $AppUI;
}
if ($this->success) {
$AppUI->setMsg($this->prefix . ' ' . $action, UI_MSG_OK, true);
$this->resultPath = $this->successPath;
} else {
$this->resultPath = $this->accessDeniedPath;
}
return $AppUI;
}
示例3: doStore
/**
* Store
*
* @return void
*/
function doStore()
{
// keep track of former values for fieldModified below
$obj = $this->_obj;
$old = $obj->loadOldObject();
if ($msg = $obj->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
if ($this->redirectError) {
CAppUI::redirect($this->redirectError);
}
} else {
// Keep trace for redirections
CValue::setSession($this->objectKey, $obj->_id);
// Insert new group and function permission
if ($obj->fieldModified("function_id") || !$old->_id) {
$obj->insFunctionPermission();
$obj->insGroupPermission();
}
// Message
CAppUI::setMsg($old->_id ? $this->modifyMsg : $this->createMsg, UI_MSG_OK);
// Redirection
if ($this->redirectStore) {
CAppUI::redirect($this->redirectStore);
}
}
}
示例4: checkHL7v2Tables
/**
* Check HL7v2 tables presence
*
* @return bool
*/
protected function checkHL7v2Tables()
{
$dshl7 = CSQLDataSource::get("hl7v2", true);
if (!$dshl7 || !$dshl7->loadTable("table_entry")) {
CAppUI::setMsg("CHL7v2Tables-missing", UI_MSG_ERROR);
return false;
}
return true;
}
示例5: 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();
}
}
示例6: storeObject
/**
* Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
*
* @param CMbObject $object Objet à enregister
*
* @return void
*/
function storeObject($object)
{
$title = $object->_id ? "-msg-modify" : "-msg-create";
if ($msg = $object->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
echo CAppUI::getMsg();
CApp::rip();
}
CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
示例7: viewMsg
/**
* $Id$
*
* @package Mediboard
* @subpackage Urgences
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
function viewMsg($msg, $action, $txt = "")
{
global $m, $tab;
$action = CAppUI::tr($action);
if ($msg) {
CAppUI::setMsg("{$action}: {$msg}", UI_MSG_ERROR);
CAppUI::redirect("m={$m}&tab={$tab}");
return;
}
CAppUI::setMsg("{$action} {$txt}", UI_MSG_OK);
}
示例8: storeObject
/**
* Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
*
* @param CMbObject $object Objet à enregister
*
* @return void
*/
function storeObject($object)
{
$title = $object->_id ? "-msg-modify" : "-msg-create";
if ($msg = $object->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
echo CAppUI::getMsg();
// Il peut y avoir un msg de retour postérieur à la création de l'objet
// On continue donc le processus de création de la naissance
//CApp::rip();
}
CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
示例9: onAfterStore
/**
* @see parent::onAfterStore()
*/
function onAfterStore(CMbObject $mbObject)
{
if (!$this->isHandled($mbObject)) {
return;
}
/** @var $mbObject CAffectation */
/** @var $_affectation CAffectation */
foreach ($mbObject->loadRefsAffectationsEnfant() as $_affectation) {
$_affectation->lit_id = $mbObject->lit_id;
if ($msg = $_affectation->store()) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
}
}
}
示例10: notify
/**
* Subject notification mechanism
*
* @param string $message on[Before|After][Build]
*
* @return void
*/
static function notify($message)
{
$args = func_get_args();
array_shift($args);
// $message
// Event Handlers
self::makeHandlers();
foreach (self::$handlers as $_handler) {
try {
call_user_func_array(array($_handler, "on{$message}"), $args);
} catch (Exception $e) {
CAppUI::setMsg($e, UI_MSG_ERROR);
}
}
}
示例11: connect
/**
* @throws CMbException
* @return CSourceLDAP
*/
static function connect()
{
$source_ldap = new CSourceLDAP();
/** @var CSourceLDAP[] $sources_ldap */
$sources_ldap = $source_ldap->loadList(null, "priority DESC");
if (empty($sources_ldap)) {
throw new CMbException("CSourceLDAP_undefined");
}
foreach ($sources_ldap as $_source) {
try {
$ldapconn = $_source->ldap_connect();
$_source->_ldapconn = $ldapconn;
return $_source;
} catch (CMbException $e) {
CAppUI::setMsg($e->getMessage(), UI_MSG_WARNING);
}
}
return false;
}
示例12: 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);
}
}
}
}
}
示例13: CFichePaie
<?php
/**
* $Id$
*
* @package Mediboard
* @subpackage GestionCab
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CCanDo::checkRead();
$fiche_paie_id = CValue::getOrSession("fiche_paie_id", null);
$fichePaie = new CFichePaie();
$fichePaie->load($fiche_paie_id);
if (!$fichePaie->fiche_paie_id) {
CAppUI::setMsg("Vous n'avez pas choisi de fiche de paie", UI_MSG_ERROR);
CAppUI::redirect("m=dPgestionCab&tab=edit_paie");
}
if ($fichePaie->final_file) {
echo $fichePaie->final_file;
} else {
$fichePaie->loadRefsFwd();
$fichePaie->_ref_params_paie->loadRefsFwd();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("fichePaie", $fichePaie);
$smarty->display("print_fiche.tpl");
}
示例14: CConsultation
<?php
/**
* $Id$
*
* @package Mediboard
* @subpackage dPcabinet
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
$consultation_id = CValue::post("consultation_id");
$plageconsult_id = CValue::post("plageconsult_id");
$heure = CValue::post("heure");
$consult = new CConsultation();
$consult->load($consultation_id);
$new_consult = new CConsultation();
$new_consult->plageconsult_id = $plageconsult_id;
$new_consult->heure = $heure;
$new_consult->chrono = CConsultation::PLANIFIE;
$new_consult->patient_id = $consult->patient_id;
$new_consult->categorie_id = $consult->categorie_id;
$msg = $new_consult->store();
if ($msg) {
CAppUI::setMsg($msg, UI_MSG_ERROR);
} else {
CAppUI::setMsg(CAppUI::tr("CConsultation-msg-create"), UI_MSG_OK);
}
echo CAppUI::getMsg();
CApp::rip();
示例15: importFile
/**
* import the patient file
*
* @param string $file path to the file
* @param int $start start int
* @param int $count number of iterations
* @param resource $file_import file for report
*
* @return null
*/
function importFile($file, $start, $count, $file_import)
{
$fp = fopen($file, 'r');
$csv_file = new CCSVFile($fp);
$csv_file->column_names = $csv_file->readLine();
if ($start == 0) {
$start++;
} elseif ($start > 1) {
$csv_file->jumpLine($start);
}
$group_id = CGroups::loadCurrent()->_id;
$treated_line = 0;
while ($treated_line < $count) {
$treated_line++;
$patient = new CPatient();
$_patient = $csv_file->readLine(true);
if (!$_patient) {
CAppUI::stepAjax('Importation terminée', UI_MSG_OK);
CApp::rip();
}
$patient->bind($_patient);
$patient->loadFromIPP($group_id);
if ($patient->_id) {
$start++;
continue;
}
$nom = $_patient['nom'] ? $_patient['nom'] : $_patient['nom_jeune_fille'];
if (!$patient->nom) {
if ($patient->nom_jeune_fille) {
$patient->nom = $patient->nom_jeune_fille;
} else {
CMbDebug::log("Ligne #{$start} : Pas de nom");
$start++;
continue;
}
}
$naissance = null;
if ($patient->naissance) {
$naissance = preg_replace('/(\\d{2})\\/(\\d{2})\\/(\\d{4})/', '\\3-\\2-\\1', $patient->naissance);
$patient->naissance = $naissance;
}
$patient->repair();
if (!$patient->naissance) {
CMbDebug::log($_patient);
CMbDebug::log("Ligne #{$start} : Date de naissance invalide ({$_patient['naissance']})");
$start++;
continue;
}
$patient->loadMatchingPatient();
if (!$patient->_id) {
$patient->bind($_patient);
$patient->nom = $nom;
$patient->naissance = $naissance;
$patient->tel = preg_replace("/[^0-9]/", "", $patient->tel);
$patient->tel_autre = preg_replace("/[^0-9]/", "", $patient->tel_autre);
$patient->sexe = strtolower($patient->sexe);
$patient->repair();
if ($msg = $patient->store()) {
CMbDebug::log($patient, null, true);
CMbDebug::log("Ligne #{$start} :{$msg}");
$start++;
continue;
}
}
$ipp = CIdSante400::getMatch($patient->_class, CPatient::getTagIPP($group_id), $patient->_IPP, $patient->_id);
if ($ipp->_id && $ipp->id400 != $patient->_IPP) {
CMbDebug::log("Ligne #{$start} : Ce patient possède déjà un IPP ({$ipp->id400})");
$start++;
continue;
}
if (!$ipp->_id) {
if ($msg = $ipp->store()) {
CMbDebug::log("Ligne #{$start} :{$msg}");
$start++;
continue;
}
}
CAppUI::setMsg('CPatient-msg-create', UI_MSG_OK);
}
echo CAppUI::getMsg();
}