本文整理汇总了PHP中CApp::json方法的典型用法代码示例。如果您正苦于以下问题:PHP CApp::json方法的具体用法?PHP CApp::json怎么用?PHP CApp::json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApp
的用法示例。
在下文中一共展示了CApp::json方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CService
CApp::setMemoryLimit("1024M");
CApp::setTimeLimit(240);
$service_id = CValue::get("service_id");
$date = CValue::get("date", CMbDT::date());
$service = new CService();
$service->load($service_id);
$datetime_min = "{$date} 00:00:00";
$datetime_max = "{$date} 23:59:59";
$datetime_avg = "{$date} " . CMbDT::time();
$sejour = new CSejour();
$where = array();
$ljoin = array();
$ljoin["affectation"] = "sejour.sejour_id = affectation.sejour_id";
$where["sejour.entree"] = "<= '{$datetime_max}'";
$where["sejour.sortie"] = " >= '{$datetime_min}'";
$where["affectation.entree"] = "<= '{$datetime_max}'";
$where["affectation.sortie"] = ">= '{$datetime_min}'";
$where["affectation.service_id"] = " = '{$service_id}'";
/** @var CSejour[] $sejours */
$sejours = $sejour->loadList($where, null, null, "sejour.sejour_id", $ljoin);
$ordonnances = array();
foreach ($sejours as $_sejour) {
$_prescription = $_sejour->loadRefPrescriptionSejour();
$_patient = $_sejour->loadRefPatient();
$params = array("prescription_id" => $_prescription->_id ?: "", "in_progress" => 1, "multipart" => 1);
$_content = CApp::fetch("dPprescription", "print_prescription_fr", $params);
$_naissance = str_replace("/", "-", $_patient->getFormattedValue("naissance"));
$ordonnances[] = array("title" => base64_encode($_patient->_view . " - " . $_naissance), "content" => base64_encode($_content), "extension" => "pdf");
}
CApp::json($ordonnances);
示例2: array
$_ex_objects = array(reset($_ex_objects));
}
foreach ($_ex_objects as $_ex_object) {
$_ex_object->load();
// Needed
$_ex_object->getCreateDate();
}
$_count += count($_ex_objects);
if (count($_ex_objects)) {
$_ex_objects = array_map(function ($ex_object) use($_ex_class) {
/** @var CExClass $_ex_class */
$_formula_field = $_ex_class->_formula_field;
$_formula_value = null;
if ($_formula_field) {
$_formula_value = $ex_object->{$_formula_field};
}
/** @var CExObject $ex_object */
return array("id" => $ex_object->_id, "view" => utf8_encode($ex_object->_view), "owner" => utf8_encode($ex_object->loadRefOwner()->_view), "datetime_create" => $ex_object->getFormattedValue("datetime_create"), "formula_value" => $_formula_value === null ? null : utf8_encode($_formula_value));
}, $_ex_objects);
$_ex_objects_by_class[$_ex_class->_id] = array_values($_ex_objects);
}
}
$object_data[$_id_element] = array("id" => $_id, "count" => $_count, "count_avl" => $_count_available, "ex_objects" => $_ex_objects_by_class);
}
$ex_classes_array = array();
foreach ($ex_classes as $_ex_class) {
$ex_classes_array[$_ex_class->_id] = utf8_encode($_ex_class->name);
}
$data = array("ex_classes" => $ex_classes_array, "form_name" => $form_name, "event_name" => $event_name, "object_class" => $object_class, "objects" => $object_data);
CApp::json($data);
示例3: CExClassEvent
/**
* $Id: ajax_trigger_ex_classes.php 23812 2014-07-02 11:49:14Z phenxdesign $
*
* @package Mediboard
* @subpackage forms
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision: 23812 $
*/
//CCanDo::checkAdmin(); // Don't check permissions
$object_guid = CValue::get("object_guid");
$event_name = CValue::get("event_name");
$object = CMbObject::loadFromGuid($object_guid);
CExClassConstraint::$_load_lite = true;
$ex_class_event = new CExClassEvent();
$ds = $ex_class_event->_spec->ds;
$group_id = CGroups::loadCurrent()->_id;
$where = array("ex_class_event.host_class" => $ds->prepare("=%", $object->_class), "ex_class_event.event_name" => $ds->prepare("=%", $event_name), "ex_class_event.disabled" => $ds->prepare("=%", 0), "ex_class.conditional" => $ds->prepare("=%", 0), $ds->prepare("ex_class.group_id = % OR ex_class.group_id IS NULL", $group_id));
$ljoin = array("ex_class" => "ex_class.ex_class_id = ex_class_event.ex_class_id");
/** @var CExClassEvent[] $ex_class_events */
$ex_class_events = $ex_class_event->loadList($where, null, null, null, $ljoin);
CStoredObject::massLoadBackRefs($ex_class_events, "constraints");
$ex_class_events_struct = array();
foreach ($ex_class_events as $_ex_class_event) {
if ($_ex_class_event->checkConstraints($object)) {
$ex_class_events_struct[] = array("ex_class_event_id" => $_ex_class_event->_id, "ex_class_id" => $_ex_class_event->ex_class_id, "event_name" => $event_name, "object_guid" => $object_guid);
}
}
CApp::json($ex_class_events_struct);
示例4: array
$j++;
}
}
// Ticks
$ticks = array();
foreach ($dates as $i => $_date) {
$ticks[$i] = array($i, CMbDT::format($_date, $format));
}
$group_view = utf8_encode($group->_view);
foreach ($data as &$_data) {
$_data["options"] = CFlotrGraph::merge("bars", $_data["options"]);
$_data["options"] = CFlotrGraph::merge($_data["options"], array('colors' => array("#2075F5", "#A89F16", "#F5C320", "#027894", "#784DFF", "#BC772A", "#FF9B34", "#00A080", "#8407E1", "#D04F3E", "#FF7348", "#A89FC6", "#15C320", "#027804"), 'xaxis' => array('ticks' => $ticks, 'labelsAngle' => 45), 'bars' => array('stacked' => true)));
$_data["options"]["subtitle"] = "{$group_view} - Total: {$total}";
$totals = array();
foreach ($_data["series"] as &$_series) {
if (isset($_series["lines"]["show"]) && $_series["lines"]["show"]) {
$_series["bars"]["show"] = false;
continue;
}
foreach ($_series["data"] as $key => $value) {
if (!isset($totals[$key][0])) {
$totals[$key][0] = $key;
$totals[$key][1] = 0;
}
$totals[$key][1] += $value[1];
}
}
$_data["series"][] = array("data" => $totals, "label" => "Total", "bars" => array("show" => false), "lines" => array("show" => false), "markers" => array("show" => true));
}
CApp::json($data, "text/javascript");
示例5: array
$dp = CAppUI::conf("dPurgences Display check_dp", $group);
$display_sfmu = CAppUI::conf("dPurgences display_motif_sfmu");
$sfmu = CAppUI::conf("dPurgences CRPU gestion_motif_sfmu", $group);
$value = array();
if ($cotation > 1) {
if ($rpu->_ref_consult && !$rpu->_ref_consult->_ref_actes && !$rpu->mutation_sejour_id || $rpu->mutation_sejour_id && !$rpu->_ref_sejour_mutation->_count_actes) {
$value[] = "Cotation";
}
}
if ($gemsa > 1) {
if (!$rpu->gemsa) {
$value[] = "CRPU-gemsa";
}
}
if ($ccmu > 1) {
if (!$rpu->ccmu) {
$value[] = "CRPU-ccmu";
}
}
if ($dp > 1) {
if (!$rpu->_DP) {
$value[] = "CRPU-_DP";
}
}
if ($display_sfmu && $sfmu > 1) {
if (!$rpu->motif_sfmu) {
$value[] = "CRPU-motif_sfmu";
}
}
CApp::json($value);
示例6:
<?php
/**
* $Id$
*
* @package Mediboard
* @subpackage Stock
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
$barcode = CValue::get("barcode");
$parsed = CBarcodeParser::parse($barcode);
CApp::json($parsed);
示例7: array
}
$series[$key] = array('data' => array(), 'label' => $_cell_saver ? utf8_encode($_cell_saver) : CAppUI::tr("Unknown"));
fillData($where, $ljoin, $series[$key], $dates);
}
if ($mode === "comparison") {
$data_left = $data[$comparison_left];
$data_right = $comparison_left == $comparison_right ? array("series" => array()) : $data[$comparison_right];
$title = $data_left["options"]["title"] . " / " . $data_right["options"]["title"];
foreach ($data_right["series"] as &$_serie) {
$_serie["yaxis"] = 2;
$_serie["lines"] = array("show" => true);
$_serie["mouse"] = array("track" => true);
$_serie["bars"] = array("show" => false);
}
$data = array("comp" => array("series" => array_merge($data_left["series"], $data_right["series"]), "options" => $data_left["options"]));
}
// Ticks
$i = 0;
$ticks = array();
foreach ($dates as $month => $date) {
$ticks[$i] = array($i, CMbDT::format($month, '%m/%y'));
$i++;
}
foreach ($data as &$_data) {
$ticks[] = array(count($ticks), "Total");
$_data["options"] = CFlotrGraph::merge("bars", $_data["options"]);
$_data["options"] = CFlotrGraph::merge($_data["options"], array('xaxis' => array('ticks' => $ticks, 'labelsAngle' => 45), 'bars' => array('stacked' => true)));
CFlotrGraph::computeTotals($_data["series"], $_data["options"]);
}
CApp::json($data, "text/plain");
示例8: CSejour
$patient->load($patient_id);
$sejour = new CSejour();
$sejour->load($sejour_id);
if ($patient->_id) {
$constantes = $patient->loadRefLatestConstantes(null, array('poids', 'taille'));
$poids = '—';
$taille = '—';
$imc = '—';
$unit_poids = CConstantesMedicales::$list_constantes['poids']['unit'];
$unit_taille = CConstantesMedicales::$list_constantes['taille']['unit'];
if ($constantes[0]->poids) {
$date = CMbDT::format($constantes[1]['poids'], CAppUI::conf('datetime'));
$poids = "<span title='{$date}'>{$constantes[0]->poids} {$unit_poids}</span>";
if ($sejour && $sejour->_id) {
if ($constantes[1]['poids'] < $sejour->entree || $constantes[1]['poids'] > $sejour->sortie) {
// Weight outdated
$msg = utf8_encode(CAppUI::tr('CPatient-msg-Entry is outdated'));
$date = CMbDT::format($constantes[1]['poids'], CAppUI::conf('datetime'));
$poids = "<span title='{$msg} : {$date}' style='color: firebrick;'><strong>{$constantes[0]->poids} {$unit_poids}</strong></span>";
}
}
}
if ($constantes[0]->taille) {
$taille = "{$constantes[0]->taille} {$unit_taille}";
}
if ($constantes[0]->_imc) {
$imc = $constantes[0]->_imc;
}
CApp::json(array('poids' => $poids, 'taille' => $taille, 'imc' => $imc));
}
CApp::rip();
示例9: array
}
if (!$plage_consult->_id) {
CApp::json($plages);
}
// guess next dates
$dates = array();
for ($a = 1; $a <= $nb; $a++) {
$dates[$a] = CMbDT::date("+{$a} {$type}", $date);
}
$where["date"] = $ds->prepareIn($dates);
$plages = $plage_consult->loadList($where, "date ASC");
$date_plage = array();
// fill out
foreach ($dates as $nb => $_date) {
$date_plage[$_date] = array();
}
foreach ($plages as $_plage) {
$date_plage[$_plage->date] = $_plage->_id;
//$date_plage[$_plage->date][] = $_plage->_id; //@TODO : array
}
$results = array();
foreach ($dates as $nb => $_date) {
// try to find something else if no result on date
if (!count($date_plage[$_date])) {
$results[] = $_date;
continue;
}
$results[] = $date_plage[$_date];
}
CApp::json($results);
示例10: CFilesCategory
if (empty($object_ids)) {
CApp::json(array());
CApp::rip();
}
$category = new CFilesCategory();
$category->eligible_file_view = 1;
$categories = $category->loadMatchingList();
$nb_unread = array();
foreach ($object_ids as $_object_id) {
$_nb_unread = 0;
foreach ($categories as $_cat) {
$file = new CFile();
$file->file_category_id = $_cat->_id;
$file->object_class = $object_class;
$file->object_id = $_object_id;
/** @var CFile[] $files */
$files = $file->loadMatchingList();
foreach ($files as $_file) {
if (!$_file->getPerm(PERM_READ)) {
continue;
}
$_file->loadRefReadStatus($user->_id);
if (!$_file->_ref_read_status->_id) {
$_nb_unread++;
}
}
}
$nb_unread["{$object_class}-{$_object_id}"] = $_nb_unread;
}
CApp::json($nb_unread);
CApp::rip();
示例11: implode
$patientMatch->function_id = $function_id;
}
$patientMatch->nom = $nom;
$patientMatch->nom_jeune_fille = $nom_jeune_fille;
$patientMatch->prenom = $prenom;
$patientMatch->prenom_2 = $prenom_2;
$patientMatch->prenom_3 = $prenom_3;
$patientMatch->prenom_4 = $prenom_4;
$patientMatch->naissance = $naissance;
$doubloon = implode("|", $patientMatch->getDoubloonIds());
$siblings = null;
if (!$doubloon) {
$siblings = $patientMatch->getSiblings();
}
//Test pour l'ouverture de la modal
if ($json_result) {
$result = false;
if (!$similar || $siblings || $doubloon && $old_patient->status != "DPOT") {
$result = true;
}
CApp::json($result);
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("similar", $similar);
$smarty->assign("old_patient", $old_patient);
$smarty->assign("doubloon", $doubloon);
$smarty->assign("siblings", $siblings);
$smarty->assign("patient_match", $patientMatch);
$smarty->assign("submit", $submit);
$smarty->display("inc_get_siblings.tpl");