本文整理匯總了PHP中CAppUI類的典型用法代碼示例。如果您正苦於以下問題:PHP CAppUI類的具體用法?PHP CAppUI怎麽用?PHP CAppUI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CAppUI類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUserMailHash
/**
* Set the hash for the user mails
*
* @return bool
*/
protected function setUserMailHash()
{
$ds = CSQLDataSource::get("std");
$mails = $ds->loadList("SELECT m.user_mail_id, m.account_class, m.account_id, m.from, m.to, m.subject, c.content FROM user_mail as m, content_html as c WHERE m.account_class IS NOT NULL AND m.account_id IS NOT NULL AND m.text_html_id = c.content_id ORDER BY m.user_mail_id DESC;");
if (count($mails)) {
$values = array();
foreach ($mails as $_mail) {
$data = "==FROM==\n" . $_mail['from'] . "\n==TO==\n" . $_mail['to'] . "\n==SUBJECT==\n" . $_mail['subject'] . "\n==CONTENT==\n" . $_mail['content'];
$hash = CMbSecurity::hash(CMbSecurity::SHA256, $data);
$values[] = '(' . $_mail['user_mail_id'] . ', ' . $_mail['account_id'] . ', \'' . $_mail['account_class'] . "', '{$hash}')";
}
$mails = $ds->loadList("SELECT m.user_mail_id, m.account_class, m.account_id, m.from, m.to, m.subject, c.content FROM user_mail AS m, content_any AS c WHERE m.account_class IS NOT NULL AND m.account_id IS NOT NULL AND m.text_html_id IS NULL AND m.text_plain_id = c.content_id ORDER BY m.user_mail_id DESC;");
foreach ($mails as $_mail) {
$data = "==FROM==\n" . $_mail['from'] . "\n==TO==\n" . $_mail['to'] . "\n==SUBJECT==\n" . $_mail['subject'] . "\n==CONTENT==\n" . $_mail['content'];
$hash = CMbSecurity::hash(CMbSecurity::SHA256, $data);
$values[] = '(' . $_mail['user_mail_id'] . ', ' . $_mail['account_id'] . ', \'' . $_mail['account_class'] . "', '{$hash}')";
}
$query = "INSERT INTO `user_mail` (`user_mail_id`, `account_id`, `account_class`, `hash`) VALUES " . implode(', ', $values) . " ON DUPLICATE KEY UPDATE `hash` = VALUES(`hash`);";
$ds->query($query);
if ($msg = $ds->error()) {
CAppUI::stepAjax($msg, UI_MSG_WARNING);
return false;
}
}
return true;
}
示例2: remove
public function remove(CAppUI $AppUI, w2p_Utilities_Date $date)
{
$perms = $AppUI->acl();
$removed = false;
if ($this->holiday_id && $perms->checkModuleItem('holiday', 'edit', $this->holiday_id)) {
$holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
$holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
if ($holiday_start_date->equals($date->duplicate())) {
if ($holiday_end_date->equals($date->duplicate())) {
$removed = $this->delete($AppUI);
} else {
$holiday_start_date = new w2p_Utilities_Date($this->holiday_start_date);
$this->holiday_start_date = $holiday_start_date->getNextDay()->getDate();
$removed = $this->store($AppUI);
}
} elseif ($holiday_end_date->equals($date->duplicate())) {
$holiday_end_date = new w2p_Utilities_Date($this->holiday_end_date);
$this->holiday_end_date = $holiday_end_date->getPrevDay()->getDate();
$removed = $this->store($AppUI);
} elseif ($holiday_start_date->before($date->duplicate()) && $holiday_end_date->after($date->duplicate())) {
$holiday_end_date = $this->holiday_end_date;
$this->holiday_end_date = $date->getPrevDay()->getDate();
$removed = $this->store($AppUI);
$this->holiday_id = 0;
// create new record
$this->holiday_start_date = $date->getNextDay()->getDate();
$this->holiday_end_date = $holiday_end_date;
$removed = $this->store($AppUI);
}
}
return $removed;
}
示例3: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$errorMsgArray = $this->check();
if (count($errorMsgArray) > 0) {
return $errorMsgArray;
}
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->field_id && canEdit('system')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if (0 == $this->field_id && canEdit('system')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
return $stored;
}
示例4: store
public function store(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$stored = false;
$this->file_folder_id = (int) $this->file_folder_id;
$this->file_folder_parent = (int) $this->file_folder_parent;
$this->_error = $this->check();
if (count($this->_error)) {
return $this->_error;
}
/*
* TODO: I don't like the duplication on each of these two branches, but I
* don't have a good idea on how to fix it at the moment...
*/
if ($this->file_folder_id && $perms->checkModuleItem('files', 'edit')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
if (0 == $this->file_folder_id && $perms->checkModuleItem('files', 'add')) {
if ($msg = parent::store()) {
return $msg;
}
$stored = true;
}
return $stored;
}
示例5: 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;
}
示例6: renderColumn
public static function renderColumn(CAppUI $AppUI, $fieldName, $row)
{
switch ($fieldName) {
case 'project_creator':
case 'project_owner':
$s .= '<td nowrap="nowrap">';
$s .= w2PgetUsernameFromID($row[$fieldName]);
$s .= '</td>';
break;
case 'project_target_budget':
case 'project_actual_budget':
$s .= '<td>';
$s .= $w2Pconfig['currency_symbol'];
$s .= formatCurrency($row[$fieldName], $AppUI->getPref('CURRENCYFORM'));
$s .= '</td>';
break;
case 'project_url':
case 'project_demo_url':
$s .= '<td>';
$s .= w2p_url($row[$fieldName]);
$s .= '</td>';
break;
case 'project_start_date':
case 'project_end_date':
$df = $AppUI->getPref('SHDATEFORMAT');
$myDate = intval($row[$fieldName]) ? new w2p_Utilities_Date($row[$fieldName]) : null;
$s .= '<td nowrap="nowrap" class="center">' . ($myDate ? $myDate->format($df) : '-') . '</td>';
break;
default:
$s .= '<td nowrap="nowrap" class="center">';
$s .= htmlspecialchars($row[$fieldName], ENT_QUOTES);
$s .= '</td>';
}
return $s;
}
示例7: remove
public function remove(CAppUI $AppUI = null)
{
global $AppUI;
$q = new w2p_Database_Query();
$q->dropTable('history');
$q->exec();
$perms = $AppUI->acl();
return $perms->unregisterModule('history');
}
示例8: delete
public function delete(CAppUI $AppUI)
{
$perms = $AppUI->acl();
$this->_error = array();
if ($perms->checkModuleItem('resources', 'delete', $this->resource_id)) {
if ($msg = parent::delete()) {
return $msg;
}
return true;
}
return false;
}
示例9: 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;
}
示例10: __construct
/**
* @see parent::__construct
*/
function __construct()
{
$this->evenement = "evt_serveurintervention";
$this->acquittement = "acquittementsServeurActes";
$version = str_replace(".", "", CAppUI::conf("hprimxml {$this->evenement} version"));
parent::__construct("serveurActivitePmsi_v{$version}", "msgAcquittementsServeurActes{$version}");
}
示例11: mine
static function mine($parent_class)
{
$classes = CApp::getChildClasses($parent_class);
$limit = CAppUI::conf("dataminer_limit");
foreach ($classes as $_class) {
$miner = new $_class();
$report = $miner->mineSome($limit, "mine");
$dt = CMbDT::dateTime();
echo "<{$dt}> Miner: {$_class}. Success mining count is '" . $report["success"] . "'\n";
if (!$report["failure"]) {
echo "<{$dt}> Miner: {$_class}. Failure mining counts is '" . $report["failure"] . "'\n";
}
$miner = new $_class();
$report = $miner->mineSome($limit, "remine");
$dt = CMbDT::dateTime();
echo "<{$dt}> Reminer: {$_class}. Success remining count is '" . $report["success"] . "'\n";
if (!$report["failure"]) {
echo "<{$dt}> Reminer: {$_class}. Failure remining counts is '" . $report["failure"] . "'\n";
}
$miner = new $_class();
$report = $miner->mineSome($limit, "postmine");
$dt = CMbDT::dateTime();
echo "<{$dt}> Postminer: {$_class}. Success postmining count is '" . $report["success"] . "'\n";
if (!$report["failure"]) {
echo "<{$dt}> Postminer: {$_class}. Failure postmining counts is '" . $report["failure"] . "'\n";
}
}
}
示例12: onAfterStore
/**
* @see parent::onAfterStore()
*/
function onAfterStore(CMbObject $mbObject)
{
if (!$this->isHandled($mbObject)) {
return false;
}
/** @var CConsultation $consultation */
$consultation = $mbObject;
$praticien = $consultation->loadRefPraticien();
if (!$praticien || $praticien && !$praticien->_id) {
return false;
}
$function = $praticien->loadRefFunction();
if (!$function || $function && !$function->_id) {
return false;
}
$functions = CAppUI::conf("ihe RAD-3 function_ids");
$functions = explode("|", $functions);
if (!in_array($function->_id, $functions)) {
return false;
}
$code = "O01";
if (!$this->isMessageSupported($this->transaction, $this->message, $code, $consultation->_receiver)) {
return false;
}
$this->sendITI($this->profil, $this->transaction, $this->message, $code, $consultation);
return true;
}
示例13: logForSejour
/**
* logSejourAccess
*
* @param CSejour $sejour
*
* @return bool has the access been logged
*/
static function logForSejour($sejour)
{
$group = $sejour->loadRefEtablissement();
if (!CAppUI::conf("admin CLogAccessMedicalData enable_log_access", $group) || !$sejour->_id) {
return false;
}
$user = CMediusers::get();
$conf = CAppUI::conf("admin CLogAccessMedicalData round_datetime", $group);
$datetime = CMbDT::dateTime();
switch ($conf) {
case '1m':
// minute
$datetime = CMbDT::format($datetime, "%y-%m-%d %H:%M:00");
break;
case '10m':
// 10 minutes
$minute = CMbDT::format($datetime, "%M");
$minute = str_pad(floor($minute / 10) * 10, 2, 0, STR_PAD_RIGHT);
$datetime = CMbDT::format($datetime, "%y-%m-%d %H:{$minute}:00");
break;
case '1d':
// 1 day
$datetime = CMbDT::format($datetime, "%y-%m-%d 00:00:00");
break;
default:
// 1 hour
$datetime = CMbDT::format($datetime, "%y-%m-%d %H:00:00");
break;
}
return self::logintoDb($user->_id, $sejour->_class, $sejour->_id, $datetime, $group->_id);
}
示例14: generateEnteteMessageAcquittement
/**
* @see parent::generateEnteteMessageAcquittement()
*/
function generateEnteteMessageAcquittement($statut, $codes = null, $commentaires = null)
{
$echg_hprim = $this->_ref_echange_hprim;
$identifiant = $echg_hprim->_id ? str_pad($echg_hprim->_id, 6, '0', STR_PAD_LEFT) : "ES{$this->now}";
$acquittementsServeurActivitePmsi = $this->addElement($this, $this->acquittement, null, "http://www.hprim.org/hprimXML");
$this->addAttribute($acquittementsServeurActivitePmsi, "version", CAppUI::conf("hprimxml {$this->evenement} version"));
$enteteMessageAcquittement = $this->addElement($acquittementsServeurActivitePmsi, "enteteMessage");
$this->addAttribute($enteteMessageAcquittement, "statut", $statut);
$this->addElement($enteteMessageAcquittement, "identifiantMessage", $identifiant);
$this->addDateTimeElement($enteteMessageAcquittement, "dateHeureProduction");
$emetteur = $this->addElement($enteteMessageAcquittement, "emetteur");
$agents = $this->addElement($emetteur, "agents");
$this->addAgent($agents, "application", "MediBoard", "Gestion des Etablissements de Santé");
$group = CGroups::loadCurrent();
$group->loadLastId400();
$this->addAgent($agents, $this->getAttSysteme(), CAppUI::conf('mb_id'), $group->text);
$echg_hprim->loadRefsInteropActor();
// Pour un acquittement l'emetteur du message devient destinataire
$destinataire = $this->addElement($enteteMessageAcquittement, "destinataire");
$agents = $this->addElement($destinataire, "agents");
$this->addAgent($agents, "application", $echg_hprim->_ref_sender->nom, $echg_hprim->_ref_sender->libelle);
/* @todo Doit-on gérer le système du destinataire ? */
//$this->addAgent($agents, "système", $group->_id, $group->text);
$this->addElement($enteteMessageAcquittement, "identifiantMessageAcquitte", $this->_identifiant_acquitte);
}
示例15: mbAutoload
/**
* Mediboard class autoloader
*
* @param string $class Class to be loaded
*
* @return bool
*/
function mbAutoload($class)
{
$file_exists = false;
$time = microtime(true);
// Entry already in cache
if (isset(CApp::$classPaths[$class])) {
// The class is known to not be in MB
if (CApp::$classPaths[$class] === false) {
return false;
}
// Load it if we can
if ($file_exists = file_exists(CApp::$classPaths[$class])) {
CApp::$performance["autoloadCount"]++;
return include_once CApp::$classPaths[$class];
}
}
// File moved ?
if (!$file_exists) {
unset(CApp::$classPaths[$class]);
}
// CSetup* class
if (preg_match('/^CSetup(.+)$/', $class, $matches)) {
$dirs = array("modules/{$matches['1']}/setup.php");
} else {
$class_file = $class;
$suffix = ".class";
// Namespaced class
if (strpos($class_file, "\\") !== false) {
$namespace = explode("\\", $class_file);
// Mediboard class
if ($namespace[0] === "Mediboard") {
array_shift($namespace);
$class_file = implode("/", $namespace);
} else {
$class_file = "vendor/" . implode("/", $namespace);
$suffix = "";
}
}
$class_file .= $suffix;
$dirs = array("classes/{$class_file}.php", "classes/*/{$class_file}.php", "mobile/*/{$class_file}.php", "modules/*/classes/{$class_file}.php", "modules/*/classes/*/{$class_file}.php", "modules/*/classes/*/*/{$class_file}.php", "install/classes/{$class_file}.php");
}
$rootDir = CAppUI::conf("root_dir");
$class_path = false;
foreach ($dirs as $dir) {
$files = glob("{$rootDir}/{$dir}");
foreach ($files as $filename) {
include_once $filename;
// The class was found
if (class_exists($class, false) || interface_exists($class, false)) {
$class_path = $filename;
break 2;
}
}
}
// Class not found, it is not in MB
CApp::$classPaths[$class] = $class_path;
SHM::put("class-paths", CApp::$classPaths);
CApp::$performance["autoload"][$class] = (microtime(true) - $time) * 1000;
return $class_path !== false;
}