function createNpc() { $trait_table = "npc_traits"; $table = "npc"; $columns = getColumnNames($table); if (empty($_POST["sex"])) { $_POST["sex"] = getGender(); } if (empty($_POST["weight"])) { $_POST["weight"] = getWeight(); } if (empty($_POST["feet"]) || empty($_POST["inches"])) { $_POST["height"] = getHeight(); } else { $_POST["height"] = $_POST["feet"] * 12 + $_POST["inches"]; } if (empty($_POST["age"])) { $_POST["age"] = getAge(); } if (empty($_POST["first_name"])) { $_POST["first_name"] = getName(); } // will add the remaining traits not already added foreach ($columns as $column) { if (empty($_POST[$column])) { $_POST[$column] = getTrait($trait_table, $column); } } }
function getWeights($field, $terms, $N) { $total = 0.0; foreach ($terms as $term => $term_frequency) { $doc_frequency = getDocFrequency($field, $term); $weight = getWeight($term_frequency, $doc_frequency, $N); // printf("%s %s (%d, %d)\n", $term, $weight, $term_frequency, $doc_frequency); $total += $weight; } return $total; }
} return $weight; } mysql_connect("localhost", "root", "bitnami") or die(mysql_error()); mysql_select_db("my_database") or die(mysql_error()); $entry_list = mysql_query("SELECT * FROM entry_list") or die(mysql_error()); $dates = array(); while ($row = mysql_fetch_array($entry_list)) { // echo $id . "<br>"; if ($id == $row['id']) { array_push($dates, $row['date']); } } $json_obj = ""; foreach ($dates as $date) { $w = getWeight($date); $json_obj = $json_obj . "\"" . $date . "\":" . $w . ", "; } $json_obj = "{" . substr($json_obj, 0, strlen($json_obj) - 2) . "}"; // echo $json_obj; ?> <script type="text/javascript"> console.log("hello"); test = <?php echo json_encode($json_obj); ?> ; var arrGraph = JSON.parse(test); console.log(arrGraph); </script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
/** * Adds the specified value and it's corresponding weight to this list. * A weight with a value equal to or less than zero will prevent the * specified value from being added to this list. Valid weight values * must be greater than zero. * * If the specified value and weight combination exist in this list * then only the weight for the given value is updated; otherwise the * value weight combination is added to this list. * * @param $value mixed the value to add to this list. * @param $weight int the weight to apply to the specified value. * * @return LoadBalanceList this list. */ public function add($value, $weight) { // if the specified weight is less than zero // there's no need to proceed. Valid weight // values must be greater than zero. if ($weight < 0) { return $this; } // In order to verify if the specified value // and weight combination already exist in this // list, we create an element node that we can // use to search this list. $element = new Element($value, $weight); $index = $this->search($element); // if this list does not contain the given value // weight combination we add it to this list; // otherwise we update the existing weight of the // specified value with the given weight. if ($index < 0) { $this->elements[] = $element; } else { $target = $this->elements[$index]; $target->setWeight($weight); // if the specified weight is smaller than the // values distribution count, we reset the count. // In other words this means that the value // has been accessed more times than the new // weight allows. if ($target->getCount() > $target . getWeight()) { $target->setCount(0); } } $this->modCount++; return $this; }
$result = mysql_query($query); if (mysql_num_rows($result) == 0) { echo _("The data has yet to be entered by the lactation consultant.") . "<br />"; } else { while ($row = mysql_fetch_array($result)) { echo _("If any of this information is incorrect") . ", <a href=\"mailto:LACTOR <" . WEB_SUPPORT_EMAIL . ">?subject=Change Infant Information for " . $_SESSION['mid'] . "\">" . _("please contact the lactation consultant") . ".</a><br />"; echo "<br />"; echo "<table border='0'><tbody>"; echo "<tr><td>" . _("Infant initials") . ":</td><td>" . $row['InfantInitials'] . "</td></tr>"; echo "<tr><td>" . _("Gestational age") . ":</td><td>" . getVocab('gestate', $row['GestationalAge']) . "</td></tr>"; echo "<tr><td>" . _("Appropiateness for gestational age") . ":</td><td>" . getVocab('GestationalAge', $row['AppropAge']) . "</td></tr>"; echo "<br />"; echo "<tr><td>" . _("Date of birth") . ":</td><td>" . modDate2($row['DOB']) . "</td></tr>"; echo "<tr><td>" . _("Infant weight at birth") . ":</td><td>" . getWeight($row['BirthWeight']) . "</td></tr>"; echo "<tr><td>" . _("Date of discharge") . ":</td><td>" . modDate2($row['DOD']) . "</td></tr>"; echo "<tr><td>" . _("Weight at discharge") . ":</td><td>" . getWeight($row['DischargeWeight']) . "</td></tr>"; echo "<br />"; echo "<tr><td>" . _("Type of first feeding") . ":</td><td>" . getVocab('TypeFirstDischarge', $row['TypeFirstBreast']) . "</td></tr>"; echo "<tr><td>" . _("Infant's age at first feeding session") . ":</td><td>" . getVocab('AgeFirstFeed', $row['TypeFirstBreast']) . "</td></tr>"; echo "<tr><td>" . _("Time of starting breast milk expression") . ":</td><td>" . getVocab('TimeStartBreast', $row['AgeFirstFeed']) . "</td></tr>"; echo "<tr><td>" . _("Frequency of breast milk expression") . ":</td><td>" . getVocab('FreqBreastExpr', $row['FreqBreastExpr']) . "</td></tr>"; echo "<br />"; echo "<tr><td>" . _("First primary care provider visit") . ":</td><td>" . getVocab('FirstPrimCare', $row['FirstPrimCare']) . "</td></tr>"; echo "<tr><td>" . _("Need for extra primary care provider") . ":</td><td>" . getVocab('NeedExtraCare', $row['NeedExtraCare']) . "</td></tr>"; echo "<tr><td>" . _("Times of extra primary care on first month") . ":</td><td>" . getVocab('TimesExtraCare', $row['TimesExtraCare']) . "</td></tr>"; echo "<tr><td>" . _("Hospitalization during the first month") . ":</td><td>" . getVocab('HospFirstMonth', $row['HospFirstMonth']) . "</td></tr>"; echo "</tbody></table>"; } } ?> </div>
$csvData[$count]['weight_type'] = ''; $csvData[$count]['price_type'] = ''; $csvData[$count]['price_view'] = ''; $csvData[$count++]['leggingscolor'] = ''; } /*Bundle Products*/ $csvData[$count]['sku'] = 'WL#' . $value['id']; $csvData[$count]['bin_location'] = ''; $csvData[$count]['type'] = 'grouped'; $csvData[$count]['store'] = 'default'; $csvData[$count]['name'] = $tempData['title']; $csvData[$count]['description'] = $tempData['title']; $csvData[$count]['short_description'] = $tempData['title']; $csvData[$count]['price'] = $tempData['price']; $csvData[$count]['qty'] = 1; $csvData[$count]['weight'] = getWeight($value['category'], $value['subcategory']); $csvData[$count]['is_in_stock'] = 1; $csvData[$count]['manage_stock'] = 1; $csvData[$count]['use_config_manage_stock'] = 1; $csvData[$count]['status'] = 1; $csvData[$count]['visibility'] = '"Catalog, Search"'; $csvData[$count]['categories'] = getCategory($value['category'], $value['subcategory']); $csvData[$count]['pack'] = $tempData['pack']; $csvData[$count]['fabric'] = $tempData['fabric']; $csvData[$count]['made'] = $tempData['made']; $csvData[$count]['source'] = 'sngapparelinc'; $csvData[$count]['source_sku'] = $tempData['item_no']; $csvData[$count]['tax_class_id'] = 'None'; $csvData[$count]['image'] = $value['id'] . '_wl_' . basename(str_replace(array(",", '\'', '"'), "", $tempData['images'][0]['large'])); $csvData[$count]['small_image'] = $value['id'] . '_wl_' . basename(str_replace(array(",", '\'', '"'), "", $tempData['images'][0]['small'])); $csvData[$count]['thumbnail'] = $value['id'] . '_wl_' . basename(str_replace(array(",", '\'', '"'), "", $tempData['images'][0]['small']));
function calculateBuyScore($tableName) { $BUY = "BUY"; $SELL = "SELL"; $DN = "DO NOTHING"; $counter = 0; $sql = "SELECT * FROM {$tableName} ORDER BY date DESC LIMIT 30"; $resultSet = mysql_query($sql); if (mysql_query($sql)) { while ($row = mysql_fetch_array($resultSet)) { $finalScore = 0; $date = $row['date']; $tp = $row['TP']; $dma_5 = $row['DMA_5']; $dma_10 = $row['DMA_10']; $dma_20 = $row['DMA_20']; $dma_50 = $row['DMA_50']; $dma_100 = $row['DMA_100']; $rsi = $row['RSI']; $so = $row['SO']; $cmi = $row['CMI']; if (strcmp($tp, $BUY) == 0) { $tpScore = getWeight("TP"); $finalScore += $tpScore; } if (strcmp($dma_5, $BUY) == 0) { $dma_5Score = getWeight("DMA_5"); $finalScore += $dma_5Score; } if (strcmp($dma_10, $BUY) == 0) { $dma_10Score = getWeight("DMA_10"); $finalScore += $dma_10Score; } if (strcmp($dma_20, $BUY) == 0) { $dma_20Score = getWeight("DMA_20"); $finalScore += $dma_20Score; } if (strcmp($dma_50, $BUY) == 0) { $dma_50Score = getWeight("DMA_50"); $finalScore += $dma_50Score; } if (strcmp($dma_100, $BUY) == 0) { $dma_100Score = getWeight("DMA_100"); $finalScore += $dma_100Score; } if (strcmp($rsi, $BUY) == 0) { $rsiScore = getWeight("RSI"); $finalScore += $rsiScore; } if (strcmp($so, $BUY) == 0) { $soScore = getWeight("SO"); $finalScore += $soScore; } if (strcmp($cmi, $BUY) == 0) { $cmiScore = getWeight("CMI"); $finalScore += $cmiScore; } insertIntoBuyScore($tableName, $finalScore, $counter); $counter++; } } }
if (isset($row['DOD']) && $row['DOD'] != "0000-00-00 00:00:00") { $d2 = modDate2($row['DOD']); } else { $d2 = ""; } echo "<tr><td>" . _("Date of birth") . ":</td><td><input class='datepicker' type='text' value='" . $d1 . "' name='dateBirth' /></td></tr>"; echo "<tr><td>" . _("Infant weight at birth") . ":</td><td><select name='BirthWeightPounds'>"; echo selectControlledVocabulary('pounds', getWeight($row['BirthWeight'], 0)); echo "</select> <select name='BirthWeightOunces'>"; echo selectControlledVocabulary('ounces', getWeight($row['BirthWeight'], 1)); echo "</select></td></tr>"; echo "<tr><td>" . _("Date of discharge") . ":</td><td><input class='datepicker' type='text' value='" . $d2 . "' name='dateDischarge' /></td></tr>"; echo "<tr><td>" . _("Weight at discharge") . ":</td><td><select name='DischargeWeightPounds'>"; echo selectControlledVocabulary('pounds', getWeight($row['DischargeWeight'], 0)); echo "</select> <select name='DischargeWeightOunces'>"; echo selectControlledVocabulary('ounces', getWeight($row['DischargeWeight'], 1)); echo "</select></td></tr>"; echo "<tr><td>" . _("Type of first feeding") . ":</td><td><select name='TypeFirstBreast' class='standardselect'>"; echo selectControlledVocabulary("TypeFirstDischarge", $row['TypeFirstBreast']); echo "</select></td></tr>"; echo "<tr><td>" . _("Infant's age at first feeding session") . ":</td><td><select name='AgeFirstFeed' class='standardselect'>"; echo selectControlledVocabulary("AgeFirstFeed", $row['AgeFirstFeed']); echo "</select></td></tr>"; echo "<tr><td>" . _("Time of starting breast milk expression") . ":</td><td><select name='TimeStartBreast' class='standardselect'>"; echo selectControlledVocabulary("TimeStartBreast", $row['TimeStartBreast']); echo "</select></td></tr>"; echo "<tr><td>" . _("Frequency of breast milk expression") . ":</td><td><select name='FreqBreastExpr' class='standardselect'>"; echo selectControlledVocabulary("FreqBreastExpr", $row['FreqBreastExpr']); echo "</select></td></tr>"; echo "<tr><td>" . _("First primary care provider visit") . ":</td><td><select name='FirstPrimCare' class='standardselect'>"; echo selectControlledVocabulary("FirstPrimCare", $row['FirstPrimCare']);
protected function setInfoCart66() { $this->itemID = $this->row['id']; $this->productID = $this->row['product_id']; $this->code = $this->row['item_number']; $this->sku = $this->row['item_number']; $this->name = $this->row['description']; $this->quantity = $this->row['quantity']; $this->price = ''; if (substr($this->row['description'], -1) == ")") { $tab = explode('(', $this->row['description']); $this->name = $tab[0]; $attributes = explode(',', str_replace(')', '', $tab[1])); foreach ($attributes as $attribute) { array_push($this->attributes, new Attribute($this->software, $this->date, 'Attribute', $attribute)); } } $this->unitprice = $this->row['product_price']; $this->weight = getWeight($this->row); }
/*Setting size*/ $csvData[$count]['leggingspacksize'] = implode(",", array_keys($packArray)); $csvData[$count]['leggingspackqty'] = implode(",", $packArray); $csvData[$count++]['leggingscolor'] = $color['color']; } /*Config Prodcut Price*/ $totalQty = 0; foreach ($packArray as $q) { $totalQty += $q; } // Config Price $configPrice = getSalePrice($tempData['price']) * $totalQty; $configLength = $dimension['length']; $configWidth = $dimension['width']; $configHeight = $dimension['height']; $configWeight = getWeight($value['category'], $value['subcategory']) * $totalQty; /*Create configurable Product*/ $csvData[$count]['sku'] = 'WL#' . $value['id']; $csvData[$count]['type'] = 'configurable'; $csvData[$count]['store'] = 'default'; $csvData[$count]['name'] = $tempData['title']; $csvData[$count]['description'] = $tempData['title']; $csvData[$count]['short_description'] = $tempData['title']; $csvData[$count]['price'] = $configPrice; $csvData[$count]['qty'] = 1; $csvData[$count]['weight'] = $configWeight; $csvData[$count]['is_in_stock'] = 1; $csvData[$count]['manage_stock'] = 1; $csvData[$count]['use_config_manage_stock'] = 1; $csvData[$count]['status'] = 1; $csvData[$count]['visibility'] = '"Catalog, Search"';