本文整理汇总了PHP中attr函数的典型用法代码示例。如果您正苦于以下问题:PHP attr函数的具体用法?PHP attr怎么用?PHP attr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了attr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_task
/**
* This function creates a task as a record in the form_taskman DB_table.
*/
function make_task($ajax_req)
{
global $send;
$from_id = $ajax_req['from_id'];
$to_id = $ajax_req['to_id'];
$patient_id = $ajax_req['pid'];
$doc_type = $ajax_req['doc_type'];
$doc_id = $ajax_req['doc_id'];
$enc = $ajax_req['enc'];
$query = "SELECT * FROM users WHERE id=?";
$to_data = sqlQuery($query, array($to_id));
$filename = "Fax_" . $encounter . "_" . $to_data['lname'] . ".pdf";
$query = "SELECT * FROM documents where encounter_id=? and foreign_id=? and url like ?";
$doc = sqlQuery($query, array($encounter, $pid, '%' . $filename . '%'));
$sql = "SELECT * from form_taskman where FROM_ID=? and TO_ID=? and PATIENT_ID=? and ENC_ID=?";
$task = sqlQuery($sql, array($from_id, $to_id, $patient_id, $enc));
if (!$doc['ID'] && $task['ID'] && $task['REQ_DATE'] < time() - 60) {
// The task was requested more than a minute ago (prevents multi-clicks from "re-generating" the PDF),
// but the document was deleted (to redo it)...
// Delete the task, recreate the task, and send the newly made PDF.
$sql = "DELETE from form_taskman where FROM_ID=? and TO_ID=? and PATIENT_ID=? and ENC_ID=?";
$task = sqlQuery($sql, array($from_id, $to_id, $patient_id, $enc));
}
if ($task['ID'] && $task['COMPLETED'] == '2') {
$send['comments'] = xlt('This fax has already been sent.') . " " . xlt('If you made changes and want to re-send it, delete the original (in Communications) and try again.') . " " . xlt('Filename') . ": " . $filename;
echo json_encode($send);
exit;
} else {
if ($task['ID'] && $task['COMPLETED'] == '1') {
if ($task['DOC_TYPE'] == 'Fax') {
$send['DOC_link'] = "<a href='" . $webroot . "/openemr/controller.php?document&view&patient_id=" . $task['PATIENT_ID'] . "&doc_id=" . $task['DOC_ID'] . "'\n\t\t\t\t\t\t\t\ttarget='_blank' title='" . xla('View the Summary Report sent to Fax Server.') . "'>\n\t\t\t\t\t\t\t\t<i class='fa fa-file-pdf-o fa-fw'></i></a>\n\t\t\t\t\t\t\t\t<i class='fa fa-repeat fa-fw' \n\t\t\t\t\t\t\t\t\tonclick=\"top.restoreSession(); create_task('" . attr($pat_data['ref_providerID']) . "','Fax-resend','ref'); return false;\">\n\t\t\t\t\t\t\t\t\t</i>\n\t\t\t\t\t\t\t";
//add a resend option.
$send['comments'] = xlt('This fax has already been sent.');
echo json_encode($send);
exit;
} else {
if ($task['DOC_TYPE'] == "Fax-resend") {
//we need to resend this fax????
//You can only resend from here once.
$send['comments'] = xlt('To resend, delete the file from Communications and try again.');
echo json_encode($send);
update_taskman($task, 'refaxed', '2');
exit;
} else {
//DOC_TYPE is a Fax or Report
$send['comments'] = xlt('Currently working on making this document') . "...\n";
}
}
} else {
if (!$task['ID']) {
$sql = "INSERT into form_taskman \n\t\t\t\t(REQ_DATE, FROM_ID, TO_ID, PATIENT_ID, DOC_TYPE, DOC_ID, ENC_ID) VALUES\n\t\t\t\t(NOW(), '{$from_id}', '{$to_id}','{$patient_id}','{$doc_type}','{$doc_id}','{$enc}')";
sqlQuery($sql);
} else {
$send['comments'] = xlt('Currently working on making this document') . "...\n";
}
}
}
}
示例2: getOrganize
function getOrganize($state, $name, $attr)
{
$OBJ =& get_instance();
if ($state === '') {
$state = 1;
}
$s = option(1, $OBJ->lang->word('chronological'), $state, 1);
$s .= option(2, $OBJ->lang->word('sectional'), $state, 2);
return select($name, attr($attr), $s);
}
示例3: generateDateQualifierSelect
function generateDateQualifierSelect($name, $options, $obj)
{
echo "<select name='" . attr($name) . "'>";
for ($idx = 0; $idx < count($options); $idx++) {
echo "<option value='" . attr($options[$idx][1]) . "'";
if ($obj[$name] == $options[$idx][1]) {
echo " selected";
}
echo ">" . text($options[$idx][0]) . "</option>";
}
echo "</select>";
}
示例4: input_multiselect
function input_multiselect($name, $options, $value, $opt = array())
{
$opt['type'] = 'multiselect';
$input = input_merge_opt($name, $value, $opt);
$attr = attr(array_diff_key(clean_opt($input), array_fill_keys(array('name', 'value'), 0)));
foreach ($options as $val => $label) {
$label = lang($val);
if ($label) {
$options[$val] = $label;
}
}
$input['form_input'] = form_multiselect($input['name'], $options, explode('|', $input['value']), $attr);
return input_markup($input);
}
示例5: attr_class
function attr_class()
{
$classes = array();
$args = func_get_args();
foreach ($args as $arg) {
if (empty($arg) || is_array($arg) && count($arg) == 0) {
continue;
}
$classes = array_merge($classes, is_array($arg) ? $arg : array($arg));
}
$classes = array_filter($classes);
if (count($classes) > 0) {
attr('class', join(' ', $classes));
}
}
示例6: classDeclaration
/**
* Create a class declaration from the given array and class name.
*
* @param array the array map containing the keys and values.
* @param the class name.
* @return string.
*/
static function classDeclaration(array $array, $className)
{
function serializeValue($value)
{
$type = gettype($value);
if ('string' == $type) {
return '"' . $value . '"';
}
if ('integer' == $type || 'double' == $type) {
return $value;
}
if ('boolean' == $type) {
return $value ? 'true' : 'false';
}
if ('array' == $type && (array) $value === $value) {
$str = '';
foreach ($value as $k => $v) {
$str .= '' == $str ? 'array( ' : ', ';
if (is_numeric($k)) {
$str .= " '{$k}' => " . serializeValue($v);
} else {
$str .= " {$k} => " . serializeValue($v);
}
}
$str .= ' )';
return $str;
}
return '';
}
function attr($value)
{
return ' = ' . serializeValue($value);
}
$class = "class {$className} { \n";
foreach ($array as $key => $value) {
if (is_numeric($key)) {
$class .= "public \$unknown{$key}" . attr($value) . ";\n";
} else {
$class .= "public \${$key}" . attr($value) . ";\n";
}
}
$class .= "\n}";
return $class;
}
示例7: icon
function icon($icon, $url = FALSE, $attr = array(), $state = '', $type = 'icon')
{
if (!isset($attr['class'])) {
$attr['class'] = '';
}
$attr['class'] .= ' ' . $type;
if ($type == 'icon') {
$attr['class'] .= '-' . $icon;
$content = ' ';
} else {
$content = 'text';
}
if ($state) {
$attr['class'] .= ' ' . $type . '-' . $state;
}
$content = $type != 'icon' ? $icon : ' ';
$attr['class'] = ltrim($attr['class']);
return $url ? anchor($url, $content, $attr) : '<i ' . attr($attr) . '>' . $content . '</i>';
}
示例8: short
function short($code, $return = false)
{
function attr($attr, $place)
{
if (!empty($attr[$place])) {
return $attr[$place];
}
}
preg_match_all("/\\((?:[^()]|(?R))+\\)|'[^']*'|[^(),\\s]+/", $code, $matches);
$attr = $matches[0];
$attr[1] = str_replace('(', '', $attr[1]);
$attr[1] = str_replace(')', '', $attr[1]);
$shorts = array('image' => '<img src="' . attr($attr, 1) . '" width="' . attr($attr, 2) . '" height="' . attr($attr, 3) . '" />', 'bold' => '<b>' . attr($attr, 1) . '</b>', 'div' => '<div>' . attr($attr, 1) . '</div>', 'italic' => '<i>' . attr($attr, 1) . '</i>', 'paragraph' => '<p>' . attr($attr, 1) . '</p>');
if ($return == false) {
return $shorts[$attr[0]];
}
if ($return == true) {
print $shorts[$attr[0]];
}
}
示例9: genProviderSelect
function genProviderSelect($selname, $toptext, $default = 0, $disabled = false)
{
$query = "SELECT id, lname, fname FROM users WHERE " . "( authorized = 1 OR info LIKE '%provider%' ) AND username != '' " . "AND active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) " . "ORDER BY lname, fname";
$res = sqlStatement($query);
echo " <select name='" . attr($selname) . "'";
if ($disabled) {
echo " disabled";
}
echo ">\n";
echo " <option value=''>" . text($toptext) . "\n";
while ($row = sqlFetchArray($res)) {
$provid = $row['id'];
echo " <option value='" . attr($provid) . "'";
if ($provid == $default) {
echo " selected";
}
echo ">" . text($row['lname'] . ", " . $row['fname']) . "\n";
}
echo text($provid);
echo " </select>\n";
}
示例10: echoLine
function echoLine($iname, $date, $charges, $ptpaid, $inspaid, $duept, $encounter = 0, $copay = 0, $patcopay = 0)
{
global $var_index;
$var_index++;
$balance = bucks($charges - $ptpaid - $inspaid);
$balance = round($duept, 2) != 0 ? 0 : $balance;
//if balance is due from patient, then insurance balance is displayed as zero
$encounter = $encounter ? $encounter : '';
echo " <tr id='tr_" . attr($var_index) . "' >\n";
echo " <td class='detail'>" . text(oeFormatShortDate($date)) . "</td>\n";
echo " <td class='detail' id='" . attr($date) . "' align='center'>" . htmlspecialchars($encounter, ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='center' id='td_charges_{$var_index}' >" . htmlspecialchars(bucks($charges), ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='center' id='td_inspaid_{$var_index}' >" . htmlspecialchars(bucks($inspaid * -1), ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='center' id='td_ptpaid_{$var_index}' >" . htmlspecialchars(bucks($ptpaid * -1), ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='center' id='td_patient_copay_{$var_index}' >" . htmlspecialchars(bucks($patcopay), ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='center' id='td_copay_{$var_index}' >" . htmlspecialchars(bucks($copay), ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='center' id='balance_{$var_index}'>" . htmlspecialchars(bucks($balance), ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='center' id='duept_{$var_index}'>" . htmlspecialchars(bucks(round($duept, 2) * 1), ENT_QUOTES) . "</td>\n";
echo " <td class='detail' align='right'><input type='text' name='" . attr($iname) . "' id='paying_" . attr($var_index) . "' " . " value='" . '' . "' onchange='coloring();calctotal()' autocomplete='off' " . "onkeyup='calctotal()' style='width:50px'/></td>\n";
echo " </tr>\n";
}
示例11: genWarehouseList
function genWarehouseList($tag_name, $currvalue, $title, $class = '')
{
global $drug_id;
$drow = sqlQuery("SELECT allow_multiple FROM drugs WHERE drug_id = ?", array($drug_id));
$allow_multiple = $drow['allow_multiple'];
$lres = sqlStatement("SELECT * FROM list_options " . "WHERE list_id = 'warehouse' ORDER BY seq, title");
echo "<select name='" . attr($tag_name) . "' id='" . attr($tag_name) . "'";
if ($class) {
echo " class='" . attr($class) . "'";
}
echo " title='" . attr($title) . "'>";
$got_selected = FALSE;
$count = 0;
if ($allow_multiple) {
echo "<option value=''>" . xlt('Unassigned') . "</option>";
++$count;
}
while ($lrow = sqlFetchArray($lres)) {
$whid = $lrow['option_id'];
if ($whid != $currvalue && !$allow_multiple && checkWarehouseUsed($whid)) {
continue;
}
echo "<option value='" . attr($whid) . "'";
if (strlen($currvalue) == 0 && $lrow['is_default'] || strlen($currvalue) > 0 && $whid == $currvalue) {
echo " selected";
$got_selected = TRUE;
}
echo ">" . text($lrow['title']) . "</option>\n";
++$count;
}
if (!$got_selected && strlen($currvalue) > 0) {
echo "<option value='" . attr($currvalue) . "' selected>* " . text($currvalue) . " *</option>";
echo "</select>";
echo " <font color='red' title='" . xla('Please choose a valid selection from the list.') . "'>" . xlt('Fix this') . "!</font>";
} else {
echo "</select>";
}
return $count;
}
示例12: parseFlickrFeed
function parseFlickrFeed($id, $n, $perrow)
{
$url = "http://api.flickr.com/services/feeds/photos_public.gne?id={$id}&lang=it-it&format=rss_200";
$s = url2_get_contents($url);
preg_match_all('#<item>(.*)</item>#Us', $s, $items);
$out = "";
for ($i = 0; $i < count($items[1]); $i++) {
if ($i >= $n) {
return $out;
}
$item = $items[1][$i];
preg_match_all('#<link>(.*)</link>#Us', $item, $temp);
$link = $temp[1][0];
preg_match_all('#<title>(.*)</title>#Us', $item, $temp);
$title = $temp[1][0];
preg_match_all('#<media:content([^>]*)>#Us', $item, $temp);
$imglink = attr($temp[0][0], "url");
preg_match_all('#<media:thumbnail([^>]*)>#Us', $item, $temp);
$thumb = attr($temp[0][0], "url");
$out .= "<li class=\"" . ($i % $perrow == $perrow - 1 ? 'last' : "") . "\"><a href=\"" . $imglink . "\" target='_blank' data-rel=\"prettyPhoto[flickr]\" title=\"" . str_replace('"', '', $title) . "\"><img src='{$thumb}'/></a></li>";
}
return $out;
}
示例13: writeTemplateLine
function writeTemplateLine($selector, $dosage, $period, $quantity, $refills, $prices, $taxrates)
{
global $tmpl_line_no;
++$tmpl_line_no;
echo " <tr>\n";
echo " <td class='tmplcell drugsonly'>";
echo "<input type='text' name='form_tmpl[{$tmpl_line_no}][selector]' value='" . attr($selector) . "' size='8' maxlength='100'>";
echo "</td>\n";
echo " <td class='tmplcell drugsonly'>";
echo "<input type='text' name='form_tmpl[{$tmpl_line_no}][dosage]' value='" . attr($dosage) . "' size='6' maxlength='10'>";
echo "</td>\n";
echo " <td class='tmplcell drugsonly'>";
generate_form_field(array('data_type' => 1, 'field_id' => 'tmpl[' . $tmpl_line_no . '][period]', 'list_id' => 'drug_interval', 'empty_title' => 'SKIP'), $period);
echo "</td>\n";
echo " <td class='tmplcell drugsonly'>";
echo "<input type='text' name='form_tmpl[{$tmpl_line_no}][quantity]' value='" . attr($quantity) . "' size='3' maxlength='7'>";
echo "</td>\n";
echo " <td class='tmplcell drugsonly'>";
echo "<input type='text' name='form_tmpl[{$tmpl_line_no}][refills]' value='" . attr($refills) . "' size='3' maxlength='5'>";
echo "</td>\n";
foreach ($prices as $pricelevel => $price) {
echo " <td class='tmplcell'>";
echo "<input type='text' name='form_tmpl[{$tmpl_line_no}][price][" . attr($pricelevel) . "]' value='" . attr($price) . "' size='6' maxlength='12'>";
echo "</td>\n";
}
$pres = sqlStatement("SELECT option_id FROM list_options " . "WHERE list_id = 'taxrate' ORDER BY seq");
while ($prow = sqlFetchArray($pres)) {
echo " <td class='tmplcell'>";
echo "<input type='checkbox' name='form_tmpl[{$tmpl_line_no}][taxrate][" . attr($prow['option_id']) . "]' value='1'";
if (strpos(":{$taxrates}", $prow['option_id']) !== false) {
echo " checked";
}
echo " /></td>\n";
}
echo " </tr>\n";
}
示例14: xlt
<table>
<tr>
<td width='200px'>
<div style='float:left'>
<table class='text'>
<tr>
<td class='label'>
<?php
echo xlt('Patient ID');
?>
:
</td>
<td>
<input type='text' name='form_patient_id' size='10' maxlength='31' value='<?php
echo attr($form_patient_id);
?>
'
title='<?php
echo xla('Patient ID');
?>
' />
</td>
</tr>
</table>
</div>
</td>
<td align='left' valign='middle' height="100%">
<table style='border-left:1px solid; width:100%; height:100%' >
示例15: generate_qoe_html
/**
* Generate HTML for the QOE form suitable for insertion into a <div>.
* This HTML may contain single quotes but not unescaped double quotes.
*
* @param integer $ptid Value matching a procedure_type_id in the procedure_types table.
* @param integer $orderid Procedure order ID, if there is an existing order.
* @param integer $dbseq Procedure order item sequence number, if there is an existing procedure.
* @param string $formseq Zero-relative occurrence number in the form.
* @return string The generated HTML.
*/
function generate_qoe_html($ptid = 0, $orderid = 0, $dbseq = 0, $formseq = 0)
{
global $rootdir, $qoe_init_javascript;
$s = "";
$qoe_init_javascript = '';
$prefix = 'ans' . $formseq . '_';
if (empty($ptid)) {
return $s;
}
$s .= "<table>";
// Get all the questions for the given procedure order type.
$qres = sqlStatement("SELECT " . "q.question_code, q.question_text, q.options, q.required, q.maxsize, " . "q.fldtype, q.tips " . "FROM procedure_type AS t " . "JOIN procedure_questions AS q ON q.lab_id = t.lab_id " . "AND q.procedure_code = t.procedure_code AND q.activity = 1 " . "WHERE t.procedure_type_id = ? " . "ORDER BY q.seq, q.question_text", array($ptid));
while ($qrow = sqlFetchArray($qres)) {
$options = trim($qrow['options']);
$qfieldid = $prefix . attr(trim($qrow['question_code']));
$fldtype = $qrow['fldtype'];
$maxsize = 0 + $qrow['maxsize'];
// Get answer value(s) to this question, if any.
$answers = array();
if ($orderid && $dbseq > 0) {
$ares = sqlStatement("SELECT answer FROM procedure_answers WHERE " . "procedure_order_id = ? AND procedure_order_seq = ? AND question_code = ? " . "ORDER BY answer_seq", array($orderid, $dbseq, $qrow['question_code']));
while ($arow = sqlFetchArray($ares)) {
$answers[] = $arow['answer'];
}
}
$s .= "<tr>";
$s .= "<td width='1%' valign='top' nowrap";
if ($qrow['required']) {
$s .= " style='color:#880000'";
}
// TBD: move to stylesheet
$s .= ">" . attr($qrow['question_text']) . "</td>";
$s .= "<td valign='top'>";
if ($fldtype == 'T') {
// Text Field.
$s .= "<input type='text' name='{$qfieldid}' size='50'";
$s .= " maxlength='" . ($maxsize ? $maxsize : 255) . "'";
if (!empty($answers)) {
$s .= " value='" . attr($answers[0]) . "'";
}
$s .= " />";
$s .= " " . text($qrow['tips']);
} else {
if ($fldtype == 'N') {
// Numeric text Field.
// TBD: Add some JavaScript validation for this.
$s .= "<input type='text' name='{$qfieldid}' maxlength='8'";
if (!empty($answers)) {
$s .= " value='" . attr($answers[0]) . "'";
}
$s .= " />";
$s .= " " . text($qrow['tips']);
} else {
if ($fldtype == 'D') {
// Date Field.
$s .= "<input type='text' size='10' name='{$qfieldid}' id='{$qfieldid}'";
if (!empty($answers)) {
$s .= " value='" . attr($answers[0]) . "'";
}
$s .= " onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />";
$s .= "<img src='{$rootdir}/pic/show_calendar.gif' align='absbottom' width='24' height='22'" . " id='img_{$qfieldid}' border='0' alt='[?]' style='cursor:pointer'" . " title='" . htmlspecialchars(xl('Click here to choose a date'), ENT_QUOTES) . "' />";
$qoe_init_javascript .= " Calendar.setup({inputField:'{$qfieldid}', ifFormat:'%Y-%m-%d', button:'img_{$qfieldid}'});";
} else {
if ($fldtype == 'G') {
// Gestational age in weeks and days.
$currweeks = -1;
$currdays = -1;
if (!empty($answers)) {
$currweeks = intval($answers[0] / 7);
$currdays = $answers[0] % 7;
}
$s .= "<select name='G1_{$qfieldid}'>";
$s .= "<option value=''></option>";
for ($i = 5; $i <= 21; ++$i) {
$s .= "<option value='{$i}'";
if ($i == $currweeks) {
$s .= " selected";
}
$s .= ">{$i}</option>";
}
$s .= "</select>";
$s .= " " . xlt('weeks') . " ";
$s .= "<select name='G2_{$qfieldid}'>";
$s .= "<option value=''></option>";
for ($i = 0; $i <= 6; ++$i) {
$s .= "<option value='{$i}'";
if ($i == $currdays) {
$s .= " selected";
}
$s .= ">{$i}</option>";
//.........这里部分代码省略.........