本文整理汇总了PHP中Codes类的典型用法代码示例。如果您正苦于以下问题:PHP Codes类的具体用法?PHP Codes怎么用?PHP Codes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Codes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeCode
public static function makeCode($data)
{
$codes = new Codes();
foreach ($data as $key => $value) {
$codes->{$key} = $value;
}
$codes->save();
return 1;
}
示例2: use_buycodes
function use_buycodes()
{
Load::model('codes');
Load::model('transaction');
$Codes = new Codes();
$Transaction = new Transaction();
if ($_POST['source'] == "Commission Deduction") {
$Transaction->add_buycodes($_POST['amount']);
$Codes->add($_POST['howmany'], $_POST['acc_type']);
} else {
$Transaction->add_buycodes_request($_POST['howmany'], $_POST['acc_type'], $_POST['amount']);
}
echo 1;
exit;
}
示例3: render
public function render($matches)
{
$text = '';
list($variant, $data) = $matches;
$text = self::render_chart(Codes::fix_tags($data), $variant);
return $text;
}
示例4: doPatientCheck
public function doPatientCheck(RsPatient $patient, $beginDate = null, $endDate = null, $options = null)
{
$data = Codes::lookup($this->getOptionId());
$range = new Range(Range::NEG_INF, Range::POS_INF);
if (isset($options[self::OPTION_RANGE]) && is_a($options[self::OPTION_RANGE], 'Range')) {
$range = $options[self::OPTION_RANGE];
}
foreach ($data as $codeType => $codes) {
foreach ($codes as $code) {
// search through vitals to find the most recent lab result in the date range
// if the result value is within range using Range->test(val), return true
$sql = "SELECT procedure_result.result, procedure_result.date " . "FROM `procedure_type`, " . "`procedure_order`, " . "`procedure_report`, " . "`procedure_result` " . "WHERE procedure_type.procedure_type_id = procedure_order.procedure_type_id " . "AND procedure_order.procedure_order_id = procedure_report.procedure_order_id " . "AND procedure_report.procedure_report_id = procedure_result.procedure_report_id " . "AND ( procedure_type.standard_code = ? OR procedure_type.procedure_code = ? ) " . "AND procedure_report.date_collected >= ? " . "AND procedure_report.date_collected <= ? " . "AND procedure_order.patient_id = ? ";
if ($range->lowerBound != Range::NEG_INF) {
$sql .= "AND procedure_result.result >= ? ";
}
if ($range->upperBound != Range::POS_INF) {
$sql .= "AND procedure_result.result < ? ";
}
$bindings = array($codeType . ':' . $code, $code, $beginDate, $endDate, $patient->id);
if ($range->lowerBound != Range::NEG_INF) {
$bindings[] = $range->lowerBound;
}
if ($range->upperBound != Range::POS_INF) {
$bindings[] = $range->upperBound;
}
$result = sqlStatement($sql, $bindings);
$number = sqlNumRows($result);
if ($number > 0) {
return true;
}
}
}
return false;
}
示例5: doPatientCheck
public function doPatientCheck(RsPatient $patient, $beginDate = null, $endDate = null, $options = null)
{
$return = false;
$listOptions = Codes::lookup($this->getOptionId(), 'CVX');
if (count($listOptions) > 0) {
$sqlQueryBind = array();
$query = "SELECT * " . "FROM immunizations " . "WHERE patient_id = ? AND added_erroneously = '0' " . "AND administered_date >= ? " . "AND administered_date <= ? ";
$query .= "AND ( ";
$count = 0;
array_push($sqlQueryBind, $patient->id, $beginDate, $endDate);
foreach ($listOptions as $option_id) {
$query .= "cvx_code = ? ";
$count++;
if ($count < count($listOptions)) {
$query .= "OR ";
}
array_push($sqlQueryBind, $option_id);
}
$query .= " ) ";
$result = sqlStatement($query, $sqlQueryBind);
$rows = array();
for ($iter = 0; $row = sqlFetchArray($result); $iter++) {
$rows[$iter] = $row;
}
if (isset($options[self::OPTION_COUNT]) && count($rows) >= $options[self::OPTION_COUNT]) {
$return = true;
} else {
if (!isset($options[self::OPTION_COUNT]) && count($rows) > 0) {
$return = true;
}
}
}
return $return;
}
示例6: layout
/**
* list users
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// we need some address
if (!$item['email']) {
continue;
}
// do not write to myself
// if($item['id'] == Surfer::get_id())
// continue;
$label = ucfirst(trim(Codes::beautify(strip_tags($item['full_name'], '<br><div><img><p><span>'))));
if (!$label) {
$label = ucfirst($item['nick_name']);
}
// one entry per address
$items[trim($item['email'])] = $label;
}
// end of processing
SQL::free($result);
return $items;
}
示例7: layout
/**
* list articles
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// clear flows
$text .= '<br style="clear: left" />';
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'article:' . $item['id']);
// the url to view this item
$url = Articles::get_permalink($item);
// use the title to label the link
if (is_object($overlay)) {
$title = Codes::beautify_title($overlay->get_text('title', $item));
} else {
$title = Codes::beautify_title($item['title']);
}
// the hovering title
if ($item['introduction'] && $context['skins_with_details'] == 'Y') {
$hover = strip_tags(Codes::beautify_introduction($item['introduction']));
} else {
$hover = i18n::s('View the page');
}
// title is a link to the target article
$title =& Skin::build_link($url, $title, 'basic', $hover);
// use the thumbnail for this article
if ($icon = trim($item['thumbnail_url'])) {
// fix relative path
if (!preg_match('/^(\\/|http:|https:|ftp:)/', $icon)) {
$icon = $context['url_to_root'] . $icon;
}
// use parameter of the control panel for this one
$options = '';
if (isset($context['classes_for_thumbnail_images'])) {
$options = 'class="' . $context['classes_for_thumbnail_images'] . '" ';
}
// build the complete HTML element
$icon = '<img src="' . $icon . '" alt="" title="' . encode_field($hover) . '" ' . $options . ' />';
// use default icon if nothing to display
} else {
$icon = MAP_IMG;
}
// use the image as a link to the target page
$icon =& Skin::build_link($url, $icon, 'basic', $hover);
// add a floating box
$text .= Skin::build_box($title, $icon, 'floating');
}
// clear flows
$text .= '<br style="clear: left" />';
// end of processing
SQL::free($result);
return $text;
}
示例8: layout
/**
* list images
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// empty list
if (!SQL::count($result)) {
$output = array();
return $output;
}
// we return an array of ($url => $attributes)
$items = array();
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the anchor for this image
if ($item['anchor']) {
$anchor = Anchors::get($item['anchor']);
}
// url to view the image
$url = $context['url_to_home'] . $context['url_to_root'] . Images::get_url($item['id']);
// time of last update
$time = SQL::strtotime($item['edit_date']);
// the title as the label
if ($item['title']) {
$label = ucfirst($item['title']) . ' (' . $item['image_name'] . ')';
} else {
$label = $item['image_name'];
}
// the section
$section = '';
if (is_object($anchor)) {
$section = ucfirst($anchor->get_title());
}
// the author(s) is an e-mail address, according to rss 2.0 spec
$author = $item['create_address'] . ' (' . $item['create_name'] . ')';
if ($item['create_address'] != $item['edit_address']) {
if ($author) {
$author .= ', ';
}
$author .= $item['edit_address'] . ' (' . $item['edit_name'] . ')';
}
// the description
$description = Codes::beautify($item['description']);
// cap the number of words
$description = Skin::cap($description, 300);
// fix image references
$description = preg_replace('#"/([^">]+?)"#', '"' . $context['url_to_home'] . '/$1"', $description);
$introduction = $description;
// other rss fields
$extensions = array();
// url for enclosure
$type = Files::get_mime_type($item['image_name']);
$extensions[] = '<enclosure url="' . $context['url_to_home'] . $context['url_to_root'] . Files::get_path($item['anchor'], 'images') . '/' . $item['image_name'] . '"' . ' length="' . $item['image_size'] . '"' . ' type="' . $type . '" />';
// list all components for this item
$items[$url] = array($time, $label, $author, $section, NULL, $introduction, $description, $extensions);
}
// end of processing
SQL::free($result);
return $items;
}
示例9: layout
/**
* list comments as successive notes in a thread
*
* @param resource the SQL result
* @return string the rendered text
**/
function layout($result)
{
global $context;
// we return formatted text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// build a list of comments
while ($item = SQL::fetch($result)) {
// automatic notification
if ($item['type'] == 'notification') {
$text = '<dd class="thread_other" style="font-style: italic;">' . ucfirst(trim($item['description'])) . '</dd>' . $text;
} else {
// link to user profile -- open links in separate window to enable side browsing of participant profiles
if ($item['create_id']) {
if ($user = Users::get($item['create_id']) && $user['full_name']) {
$hover = $user['full_name'];
} else {
$hover = NULL;
}
$author = Users::get_link($item['create_name'], $item['create_address'], $item['create_id'], TRUE, $hover);
} else {
$author = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id'], TRUE);
}
// differentiate my posts from others
if (Surfer::get_id() && $item['create_id'] == Surfer::get_id()) {
$style = ' class="thread_me"';
} else {
$style = ' class="thread_other"';
}
// a clickable label
$stamp = '#';
// flag old items on same day
if (!strncmp($item['edit_date'], gmstrftime('%Y-%m-%d %H:%M:%S', time()), 10)) {
$stamp = Skin::build_time($item['edit_date']);
} else {
$stamp = Skin::build_date($item['edit_date']);
}
// append this at the end of the comment
$stamp = ' <div style="float: right; font-size: x-small">' . Skin::build_link(Comments::get_url($item['id']), $stamp, 'basic', i18n::s('Edit')) . '</div>';
// package everything --change order to get oldest first
$text = '<dt' . $style . '>' . $author . '</dt><dd' . $style . '>' . $stamp . ucfirst(trim($item['description'])) . '</dd>' . $text;
}
}
// end of processing
SQL::free($result);
// finalize the returned definition list
if ($text) {
$text = '<dl>' . $text . '</dl>';
}
// process yacs codes
$text = Codes::beautify($text);
return $text;
}
示例10: generateCode
public function generateCode()
{
$data = array();
$result = 0;
$count = $_POST['count'];
for ($i = 0; $i < $count; $i++) {
$data['activationcode'] = Crypt::encrypt(str_random(20));
$data['membertype'] = $_POST['membertype'];
$result = $result + Codes::makeCode($data);
}
return $result . " activation codes added.";
}
示例11: layout
/**
* list dates
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// build the calendar
$text = 'BEGIN:VCALENDAR' . CRLF . 'VERSION:2.0' . CRLF . 'PRODID:YACS' . CRLF . 'METHOD:PUBLISH' . CRLF;
// organization, if any
if (isset($context['site_name']) && $context['site_name']) {
$text .= 'X-WR-CALNAME:' . $context['site_name'] . CRLF;
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// one event at a time
$text .= 'BEGIN:VEVENT' . CRLF;
// the event spans limited time
if (isset($item['duration']) && $item['duration']) {
$text .= 'DTSTART:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['date_stamp'])) . CRLF;
$text .= 'DTEND:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['date_stamp']) + $item['duration'] * 60) . CRLF;
// a full-day event
} else {
$text .= 'DTSTART;VALUE=DATE:' . date('Ymd', SQL::strtotime($item['date_stamp'])) . CRLF;
$text .= 'DTEND;VALUE=DATE:' . date('Ymd', SQL::strtotime($item['date_stamp']) + 86400) . CRLF;
}
// url to view the date
$text .= 'URL:' . Articles::get_permalink($item) . CRLF;
// organization, if any
if (isset($item['introduction']) && $item['introduction']) {
$text .= 'DESCRIPTION:' . str_replace(array("\n", "\r"), ' ', strip_tags($item['introduction'])) . CRLF;
}
// build a valid title
if (isset($item['title']) && $item['title']) {
$text .= 'SUMMARY:' . Codes::beautify_title($item['title']) . CRLF;
}
// required by Outlook 2003
if (isset($item['id']) && $item['id']) {
$text .= 'UID:' . $item['id'] . CRLF;
}
// date of creation
if (isset($item['create_date']) && $item['create_date']) {
$text .= 'CREATED:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['create_date'])) . CRLF;
}
// date of last modification
if (isset($item['edit_date']) && $item['edit_date']) {
$text .= 'DTSTAMP:' . gmdate('Ymd\\THis\\Z', SQL::strtotime($item['edit_date'])) . CRLF;
}
// next event
$text .= 'SEQUENCE:0' . CRLF . 'END:VEVENT' . CRLF;
}
// date of last update
$text .= 'END:VCALENDAR' . CRLF;
// end of processing
SQL::free($result);
return $text;
}
示例12: testPrepareCodes
public function testPrepareCodes()
{
$C = new Codes();
$C->format = "ABC******";
// 9 characters + ',' will be 10 chars
$C->prefix = $C->setPrefix($C->format);
$C->num_random_chars = strlen($C->format) - strlen($C->prefix);
$C->fieldlength = 100;
// sets fieldlength artifically low just for test usually 32768
$num_codes = 101;
$codes = $C->generateMany($num_codes);
$code_length = strlen($codes[0]);
$prep = $C->prepareCodesForInsert($codes);
$c = ceil($num_codes * ($code_length + 1) / $C->fieldlength);
// echo "\n | first code : $codes[0] ";
// echo " | num_codes : $num_codes ";
// echo " | code_length : $code_length \n";
print_r($prep);
// we expect the number of strings of codes to be 11
$this->assertTrue(count($prep) == $c);
}
示例13: doPatientCheck
public function doPatientCheck(RsPatient $patient, $beginDate = null, $endDate = null, $options = null)
{
$data = Codes::lookup($this->getOptionId());
$type = $this->getListType();
foreach ($data as $codeType => $codes) {
foreach ($codes as $code) {
if (exist_lists_item($patient->id, $type, $codeType . '::' . $code, $endDate)) {
return true;
}
}
}
return false;
}
示例14: test
public function test(CqmPatient $patient, $beginDate, $endDate)
{
//Group A Streptococcus Test Array
$strep_test_code = "'" . implode("','", Codes::lookup(LabResult::STREPTOCOCCUS_TEST, 'LOINC')) . "'";
//Patients who were tested for Streptococcus A during the same encounter that the antibiotic was prescribed, Encounter category should be office visit.
$query = "SELECT count(*) as cnt FROM form_encounter fe " . "INNER JOIN openemr_postcalendar_categories opc ON fe.pc_catid = opc.pc_catid " . "INNER JOIN procedure_order po ON po.encounter_id = fe.encounter " . "INNER JOIN procedure_order_code pc ON po.procedure_order_id = pc.procedure_order_id " . "INNER JOIN procedure_report pr on pr.procedure_order_id = po.procedure_order_id " . "INNER JOIN procedure_result pres on pres.procedure_report_id = pr.procedure_report_id " . "WHERE opc.pc_catname = 'Office Visit' AND fe.pid = ? AND (fe.date BETWEEN ? AND ? ) " . " AND pres.result_code in ({$strep_test_code}) AND ( DATEDIFF(po.date_ordered,fe.date) between 0 and 3 or DATEDIFF(fe.date,po.date_ordered) between 0 and 3)";
$check = sqlQuery($query, array($patient->id, $beginDate, $endDate));
if ($check['cnt'] > 0) {
return true;
} else {
return false;
}
}
示例15: configure
public function configure()
{
$this->widgetSchema['category'] = new sfWidgetFormChoice(array('choices' => Codes::getCategories()));
$this->validatorSchema['category'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys(Codes::getCategories())));
$this->widgetSchema['referenced_relation'] = new sfWidgetFormChoice(array('choices' => array('specimens' => 'Specimen Code', 'specimen_parts' => 'Parts Code')));
$this->validatorSchema['referenced_relation'] = new sfValidatorChoice(array('required' => false, 'choices' => array('specimens' => 'specimens', 'specimen_parts' => 'specimen_parts')));
$this->widgetSchema['code_part'] = new sfWidgetFormInput(array(), array('style' => 'width:97%;'));
$this->widgetSchema['code_from'] = new sfWidgetFormInput(array(), array('class' => 'lsmall_size'));
$this->widgetSchema['code_to'] = new sfWidgetFormInput(array(), array('class' => 'lsmall_size'));
$this->validatorSchema['code_part'] = new sfValidatorString(array('required' => false, 'trim' => true));
$this->validatorSchema['code_from'] = new sfValidatorString(array('required' => false, 'trim' => true));
$this->validatorSchema['code_to'] = new sfValidatorString(array('required' => false, 'trim' => true));
$this->mergePostValidator(new CodesLineValidatorSchema());
}