本文整理汇总了PHP中CValue类的典型用法代码示例。如果您正苦于以下问题:PHP CValue类的具体用法?PHP CValue怎么用?PHP CValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getHtmlValue
/**
* @see parent::getHtmlValue()
*/
function getHtmlValue($object, $smarty = null, $params = array())
{
$value = $object->{$this->fieldName};
// Empty value: no paragraph
if (!$value) {
return "";
}
// Truncate case: no breakers but inline bullets instead
if ($truncate = CValue::read($params, "truncate")) {
$value = CMbString::truncate($value, $truncate === true ? null : $truncate);
$value = CMbString::nl2bull($value);
return CMbString::htmlSpecialChars($value);
}
// Markdown case: full delegation
if ($this->markdown) {
// In order to prevent from double escaping
$content = CMbString::markdown(html_entity_decode($value));
return "<div class='markdown'>{$content}</div>";
}
// Standard case: breakers and paragraph enhancers
$text = "";
$value = str_replace(array("\r\n", "\r"), "\n", $value);
$paragraphs = preg_split("/\n{2,}/", $value);
foreach ($paragraphs as $_paragraph) {
if (!empty($_paragraph)) {
$_paragraph = nl2br(CMbString::htmlSpecialChars($_paragraph));
$text .= "<p>{$_paragraph}</p>";
}
}
return $text;
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:34,代码来源:CTextSpec.class.php
示例2: getValue
/**
* @see parent::getValue()
*/
function getValue($object, $smarty = null, $params = array())
{
include_once $smarty->_get_plugin_filepath('modifier', 'date_format');
$propValue = $object->{$this->fieldName};
$format = CValue::first(@$params["format"], CAppUI::conf("time"));
return $propValue ? smarty_modifier_date_format($propValue, $format) : "";
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:10,代码来源:CTimeSpec.class.php
示例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);
}
}
}
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_mediusers_aed.php
示例4: 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;
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:33,代码来源:CCSRF.class.php
示例5: 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
示例6: 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
示例7: getValue
/**
* @see parent::getValue()
*/
function getValue($object, $smarty = null, $params = array())
{
if ($smarty) {
include_once $smarty->_get_plugin_filepath('modifier', 'date_format');
}
$propValue = $object->{$this->fieldName};
$format = CValue::first(@$params["format"], CAppUI::conf("date"));
return $propValue && $propValue != "0000-00-00" ? $this->progressive ? $this->progressiveFormat($propValue) : smarty_modifier_date_format($propValue, $format) : "";
// TODO: test and use strftime($format, strtotime($propValue)) instead of smarty
}
开发者ID:fbone,项目名称:mediboard4,代码行数:13,代码来源:CDateSpec.class.php
示例8: updateFormFields
/**
* @see parent::updateFormFields()
*/
function updateFormFields()
{
$this->_query_params_get = $get = json_decode($this->query_params_get, true);
$this->_query_params_post = $post = json_decode($this->query_params_post, true);
$this->_session_data = $session = json_decode($this->session_data, true);
$get = is_array($get) ? $get : array();
$post = is_array($post) ? $post : array();
$this->_module = CValue::first(CMbArray::extract($get, "m"), CMbArray::extract($post, "m"));
$this->_action = CValue::first(CMbArray::extract($get, "tab"), CMbArray::extract($get, "a"), CMbArray::extract($post, "dosql"));
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:13,代码来源:CLongRequestLog.class.php
示例9: redirect
/**
* Redirect to the last page
*
* @return void
*/
function redirect()
{
if (CValue::post("ajax")) {
echo CAppUI::getMsg();
CApp::rip();
}
$m = CValue::post("m");
$tab = CValue::post("tab");
CAppUI::redirect("m={$m}&tab={$tab}");
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:15,代码来源:do_translate_aed.php
示例10: 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
示例11: doBind
function doBind()
{
$this->ajax = CValue::post("ajax");
$this->suppressHeaders = CValue::post("suppressHeaders");
$this->callBack = CValue::post("callback");
unset($_POST["ajax"]);
unset($_POST["suppressHeaders"]);
unset($_POST["callback"]);
// Object binding
$this->_obj->bind($_POST["suivi"]);
$this->_old->load($this->_obj->_id);
}
开发者ID:fbone,项目名称:mediboard4,代码行数:12,代码来源:do_docgedmodele_aed.php
示例12: run
/**
* Run test
*
* @param string $code Event code
* @param CCnStep $step Step
*
* @throws CMbException
*
* @return void
*/
static function run($code, CCnStep $step)
{
$receiver = $step->_ref_test->loadRefPartner()->loadReceiverHL7v2();
if ($receiver) {
CValue::setSessionAbs("cn_receiver_guid", $receiver->_guid);
}
$transaction = str_replace("-", "", $step->transaction);
if (!$transaction) {
throw new CMbException("CIHETestCase-no_transaction");
}
call_user_func(array("C{$transaction}Test", "test{$code}"), $step);
}
开发者ID:fbone,项目名称:mediboard4,代码行数:22,代码来源:CIHETestCase.class.php
示例13: toMB
function toMB($value, CHL7v2Field $field)
{
$parsed = $this->parseHL7($value, $field);
// empty value
if ($parsed === "") {
return "";
}
// invalid value
if ($parsed === false) {
return;
}
return CValue::read($parsed, "hour", "00") . ":" . CValue::read($parsed, "minute", "00") . ":" . CValue::read($parsed, "second", "00");
}
开发者ID:fbone,项目名称:mediboard4,代码行数:13,代码来源:CHL7v2DataTypeTime.class.php
示例14: toHL7
function toHL7($value, CHL7v2Field $field)
{
$parsed = $this->parseMB($value, $field);
// empty value
if ($parsed === "") {
return "";
}
// invalid value
if ($parsed === false) {
return;
}
return CValue::read($parsed, "year") . (CValue::read($parsed, "month") === "00" ? "" : CValue::read($parsed, "month")) . (CValue::read($parsed, "day") === "00" ? "" : CValue::read($parsed, "day")) . CValue::read($parsed, "hour") . CValue::read($parsed, "minute") . CValue::read($parsed, "second");
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:13,代码来源:CHL7v2DataTypeDateTime.class.php
示例15: toMB
function toMB($value, CHL7v2Field $field)
{
$parsed = $this->parseHL7($value, $field);
// empty value
if ($parsed === "") {
return "";
}
// invalid value
if ($parsed === false) {
return;
}
return CValue::read($parsed, "year") . "-" . CValue::read($parsed, "month", "00") . "-" . CValue::read($parsed, "day", "00");
}
开发者ID:fbone,项目名称:mediboard4,代码行数:13,代码来源:CHL7v2DataTypeDate.class.php
示例16: mbGetObjectFromGetOrSession
/**
* Returns the CMbObject with given GET or SESSION params keys,
* if it doesn't exist, a redirect is made
*
* @param string $class_key The class name of the object
* @param string $id_key The object ID
* @param string $guid_key The object GUID (classname-id)
*
* @return CMbObject The object loaded or nothing
**/
function mbGetObjectFromGetOrSession($class_key, $id_key, $guid_key = null)
{
$object_class = CValue::getOrSession($class_key);
$object_id = CValue::getOrSession($id_key);
$object_guid = "{$object_class}-{$object_id}";
if ($guid_key) {
$object_guid = CValue::getOrSession($guid_key, $object_guid);
}
$object = CMbObject::loadFromGuid($object_guid);
// Redirection
if (!$object || !$object->_id) {
global $ajax;
CAppUI::redirect("ajax={$ajax}" . "&suppressHeaders=1" . "&m=system" . "&a=object_not_found" . "&object_guid={$object_guid}");
}
return $object;
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:26,代码来源:mb_functions.php
示例17: 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
示例18: changeCheckListCategories
/**
* Changes check list categories
*
* @param array $category_changes Categories changes
*
* @return void
*/
private function changeCheckListCategories($category_changes)
{
// reverse because of the title changes
$category_changes = array_reverse($category_changes);
// Category changes
foreach ($category_changes as $_change) {
$cat_class = $_change[0];
$cat_type = $_change[1];
$cat_title = $_change[2];
$cat_new_title = addslashes($_change[3]);
$cat_new_desc = addslashes(CValue::read($_change, 4, null));
$query = "UPDATE `daily_check_item_category` SET\r\n `daily_check_item_category`.`title` = '{$cat_new_title}' ";
if (isset($cat_new_desc)) {
$query .= ", `daily_check_item_category`.`desc` = '{$cat_new_desc}' ";
}
$query .= "WHERE\r\n `daily_check_item_category`.`target_class` = '{$cat_class}' AND\r\n `daily_check_item_category`.`type` = '{$cat_type}' AND\r\n `daily_check_item_category`.`title` = '{$cat_title}'";
$this->addQuery($query);
}
}
开发者ID:fbone,项目名称:mediboard4,代码行数:26,代码来源:setup.php
示例19: buildPartialTables
/**
* Fonction de construction du cache d'info des durées
* d'hospi et d'interv
*
* @param string $tableName Nom de la table de cache
* @param string $tableFields Champs de la table de cache
* @param array $queryFields Liste des champs du select
* @param string $querySelect Chaine contenant les éléments SELECT à utiliser
* @param array $queryWhere Chaine contenant les éléments WHERE à utiliser
*
* @return void
*/
function buildPartialTables($tableName, $tableFields, $queryFields, $querySelect, $queryWhere)
{
$ds = CSQLDataSource::get("std");
$joinedFields = join(", ", $queryFields);
// Intervale de temps
$intervalle = CValue::get("intervalle");
switch ($intervalle) {
case "month":
$deb = CMbDT::date("-1 month");
break;
case "6month":
$deb = CMbDT::date("-6 month");
break;
case "year":
$deb = CMbDT::date("-1 year");
break;
default:
$deb = CMbDT::date("-10 year");
}
$fin = CMbDT::date();
// Suppression si existe
$drop = "DROP TABLE IF EXISTS `{$tableName}`";
$ds->exec($drop);
// Création de la table partielle
$create = "CREATE TABLE `{$tableName}` (" . "\n`chir_id` int(11) unsigned NOT NULL default '0'," . "{$tableFields}" . "\n`ccam` varchar(255) NOT NULL default ''," . "\nKEY `chir_id` (`chir_id`)," . "\nKEY `ccam` (`ccam`)" . "\n) /*! ENGINE=MyISAM */;";
$ds->exec($create);
// Remplissage de la table partielle
$query = "INSERT INTO `{$tableName}` ({$joinedFields}, `chir_id`, `ccam`)\r\n SELECT {$querySelect}\r\n operations.chir_id,\r\n operations.codes_ccam AS ccam\r\n FROM operations\r\n LEFT JOIN users\r\n ON operations.chir_id = users.user_id\r\n LEFT JOIN plagesop\r\n ON operations.plageop_id = plagesop.plageop_id\r\n WHERE operations.annulee = '0'\r\n {$queryWhere}\r\n AND operations.date BETWEEN '{$deb}' AND '{$fin}'\r\n GROUP BY operations.chir_id, ccam\r\n ORDER BY ccam;";
$ds->exec($query);
CAppUI::stepAjax("Nombre de valeurs pour la table '{$tableName}': " . $ds->affectedRows(), UI_MSG_OK);
// Insert dans la table principale si vide
if (!$ds->loadResult("SELECT COUNT(*) FROM temps_op")) {
$query = "INSERT INTO temps_op ({$joinedFields}, `chir_id`, `ccam`)\r\n SELECT {$joinedFields}, `chir_id`, `ccam`\r\n FROM {$tableName}";
$ds->exec($query);
} else {
$query = "UPDATE temps_op, {$tableName} SET ";
foreach ($queryFields as $queryField) {
$query .= "\ntemps_op.{$queryField} = {$tableName}.{$queryField}, ";
}
$query .= "temps_op.chir_id = {$tableName}.chir_id" . "\nWHERE temps_op.chir_id = {$tableName}.chir_id" . "\nAND temps_op.ccam = {$tableName}.ccam";
$ds->exec($query);
}
}
开发者ID:fbone,项目名称:mediboard4,代码行数:55,代码来源:httpreq_temps_op_new.php
示例20: onAfterMain
/**
* @see parent::onAfterMain()
*/
function onAfterMain()
{
$cron_log_id = CValue::get("execute_cron_log_id");
if (!$cron_log_id) {
return;
}
//Mise à jour du statut du log suite à l'appel au script
$cron_log = new CCronJobLog();
$cron_log->load($cron_log_id);
if (CCronJobLog::$log) {
$cron_log->status = "error";
$cron_log->error = CCronJobLog::$log;
$cron_log->end_datetime = CMbDT::dateTime();
} else {
$cron_log->status = "finished";
$cron_log->end_datetime = CMbDT::dateTime();
}
$cron_log->store();
}
开发者ID:fbone,项目名称:mediboard4,代码行数:22,代码来源:CCronJobIndexHandler.class.php
注:本文中的CValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论