if ($surface_reduction['ar_way']) { $reduction = floatval($surface_reduction['ar_percent']); } else { $reduction = -floatval($surface_reduction['ar_percent']); } } $surface_reduction = 1 + $reduction / 100; // Add the special groups price & surface $special_price = 0; $special_surface = 0; $percent_coef = 1; // Get dimensions parameters $param1 = DB::getInstance()->getValue('SELECT name FROM ' . _DB_PREFIX_ . 'attribute_lang AS al LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute_combination AS pac ON pac.id_attribute = al.id_attribute ' . 'LEFT JOIN ' . _DB_PREFIX_ . 'attribute AS a ON pac.id_attribute = a.id_attribute WHERE pac.id_product_attribute = ' . $product_attribute . ' AND id_attribute_group = ' . $dimensions[0] . ' AND id_lang = ' . (int) $cookie->id_lang); $param2 = DB::getInstance()->getValue('SELECT name FROM ' . _DB_PREFIX_ . 'attribute_lang AS al LEFT JOIN ' . _DB_PREFIX_ . 'product_attribute_combination AS pac ON pac.id_attribute = al.id_attribute ' . 'LEFT JOIN ' . _DB_PREFIX_ . 'attribute AS a ON pac.id_attribute = a.id_attribute WHERE pac.id_product_attribute = ' . $product_attribute . ' AND id_attribute_group = ' . $dimensions[1] . ' AND id_lang = ' . (int) $cookie->id_lang); $scale1 = get_scale($scales[$dimensions[0]]); $scale2 = get_scale($scales[$dimensions[1]]); foreach ($more_tmp as $more_attribute) { // Get the attribute group $attribute_group = DB::getInstance()->ExecuteS('SELECT distinct(id_attribute_group) FROM ' . _DB_PREFIX_ . 'attribute WHERE id_attribute = ' . $more_attribute); // Get the special group type $group_type = DB::getInstance()->ExecuteS('SELECT * FROM ' . _DB_PREFIX_ . 'aimultidimensions_specials WHERE as_group = ' . $attribute_group[0]['id_attribute_group']); if (isset($group_type[0])) { switch ($group_type[0]['as_type']) { case '0': // Inclusive // Get the fixe price $fixed_price = (double) DB::getInstance()->getValue('SELECT asa_value FROM ' . _DB_PREFIX_ . 'aimultidimensions_specials_attributes WHERE asa_attribute = ' . $more_attribute . ' AND asa_group = ' . $attribute_group[0]['id_attribute_group']); if ($fixed_price) { $special_price += $fixed_price; } break;
function get_moreAttributesPrice($v7b05156abcf5, $v0390f4ac89dd) { $v85f53d729293 = 0; $v0718daedffe1 = Configuration::get('AIMD_FIRST_DIMENSION_ID'); $v0172036d6988 = Configuration::get('AIMD_SECOND_DIMENSION_ID'); $va567afddd571 = Configuration::get('AIMD_THIRD_DIMENSION_ID'); $vb878a4f527e5 = get_scale(Configuration::get('AIMD_FIRST_DIMENSION_SCALE')); $v7832cdbf309e = get_scale(Configuration::get('AIMD_SECOND_DIMENSION_SCALE')); $v7b29aade8812 = get_scale(Configuration::get('AIMD_THIRD_DIMENSION_SCALE')); $v37f9cfc64b77 = Db::getInstance()->ExecuteS('SELECT distinct(attribute.id_attribute) FROM ' . _DB_PREFIX_ . 'attribute as attribute LEFT JOIN ' . _DB_PREFIX_ . 'attribute_lang as lang ON attribute.id_attribute = lang.id_attribute ' . 'WHERE attribute.id_attribute_group = ' . $v0718daedffe1 . ' AND lang.name = ' . $vb878a4f527e5); $v2e97a5c1e28e = Db::getInstance()->ExecuteS('SELECT distinct(attribute.id_attribute) FROM ' . _DB_PREFIX_ . 'attribute as attribute LEFT JOIN ' . _DB_PREFIX_ . 'attribute_lang as lang ON attribute.id_attribute = lang.id_attribute ' . 'WHERE attribute.id_attribute_group = ' . $v0172036d6988 . ' AND lang.name = ' . $v7832cdbf309e); $vc9af513a38fa = Db::getInstance()->ExecuteS('SELECT distinct(attribute.id_attribute) FROM ' . _DB_PREFIX_ . 'attribute as attribute LEFT JOIN ' . _DB_PREFIX_ . 'attribute_lang as lang ON attribute.id_attribute = lang.id_attribute ' . 'WHERE attribute.id_attribute_group = ' . $va567afddd571 . ' AND lang.name = ' . $v7b29aade8812); $v0c695db2467f = DB::getInstance()->ExecuteS('SELECT id_product_attribute FROM ' . _DB_PREFIX_ . 'product_attribute_combination WHERE id_attribute IN ( ' . implode(', ', $v7b05156abcf5) . ' , ' . $v37f9cfc64b77[0]['id_attribute'] . ' , ' . $v2e97a5c1e28e[0]['id_attribute'] . ' , ' . $vc9af513a38fa[0]['id_attribute'] . ') GROUP BY id_product_attribute ORDER BY COUNT(id_attribute) DESC, id_product_attribute ASC'); if (count($v0c695db2467f)) { foreach ($v0c695db2467f as $v71979fa1b961) { $v90e355ee873b = DB::getInstance()->getValue('SELECT price FROM ' . _DB_PREFIX_ . 'product_attribute WHERE id_product_attribute = ' . $v71979fa1b961['id_product_attribute'] . ' AND aimd_value = 0 AND id_product = ' . $v0390f4ac89dd); if ($v90e355ee873b) { $v85f53d729293 = (double) $v90e355ee873b; break; } } } return $v85f53d729293; }
/** * Processes the file to import the ALIS data * * Opens the file, loops through each row. Cleans the values in each column, * and inserts or updates the statistics for each subject, then loops over * the records in the table and flags any quality issues. * * Returns a report of successess and failures. * * @see open_file() * @global object $DB Database interface * @return string A report of successes and failures. */ public function process() { global $DB; $file = $this->open_file(); $qualtype = false; $import->qualcount = 0; $import->subjectcount = 0; $import->updatecount = 0; while ($line = \fgetcsv($file, 0, '|')) { // If there's only one column on this line, then it's a qualification heading if (\count($line) == 1) { $qualname = param_clean($line[0], \PARAM_ALPHANUM); // Create a new qualtype record if there isn't one already. if (!($qualtype = $DB->get_record_select('report_targetgrades_qualtype', $DB->sql_compare_text('name') . ' = ?', array($qualname)))) { if (!($qualscale = $DB->get_record('scale', array('name' => $qualname . ' MTG')))) { if ($scale = get_scale($qualname)) { $qualscale = new \stdClass(); $qualscale->name = $qualname . ' MTG'; $qualscale->scale = $scale; $qualscale->description = $qualname . ' Minimum/Target Grades'; $qualscale->id = $DB->insert_record('scale', $qualscale); } } if ($qualscale) { $qualtype = new \stdClass(); $qualtype->name = $qualname; $qualtype->scaleid = $qualscale->id; $qualtype->id = $DB->insert_record('report_targetgrades_qualtype', $qualtype); $import->qualcount++; } } } else { // If we have a record for this course's qualtype if ($qualtype) { $name = \clean_param($line[0], \PARAM_TEXT); $samplesize = \clean_param(str_replace(',', '', $line[1]), \PARAM_INT); $gradient = \clean_param($line[2], \PARAM_FLOAT); $intercept = \clean_param($line[3], \PARAM_FLOAT); $correlation = \clean_param($line[4], \PARAM_FLOAT); $standarddeviation = \clean_param($line[5], \PARAM_FLOAT); if ($subject = $DB->get_record_select('report_targetgrades_alisdata', $DB->sql_compare_text('name') . ' = ? AND qualtypeid = ?', array($name, $qualtype->id))) { $subject->samplesize = $samplesize; $subject->gradient = $gradient; $subject->intercept = $intercept; $subject->correlation = $correlation; $subject->standarddeviation = $standarddeviation; $DB->update_record('report_targetgrades_alisdata', $subject); $import->updatecount++; } else { $subject = new \stdClass(); $subject->name = $name; $subject->samplesize = $samplesize; $subject->gradient = $gradient; $subject->intercept = $intercept; $subject->correlation = $correlation; $subject->standarddeviation = $standarddeviation; $subject->qualtypeid = $qualtype->id; $DB->insert_record('report_targetgrades_alisdata', $subject); $import->subjectcount++; } } } } \fclose($file); // All the stats are now in the DB, so do a pass over the table to flag up any quality issues with the data $averagesize = round($DB->get_record_sql('SELECT AVG(samplesize) as avg FROM {report_targetgrades_alisdata}')->avg); $select = 'SELECT ta.*, tq.name as qualification '; $from = 'FROM {report_targetgrades_alisdata} ta JOIN {report_targetgrades_qualtype} tq ON ta.qualtypeid = tq.id'; $alisdata = $DB->get_records_sql($select . $from); foreach ($alisdata as $alis) { if ($alis->samplesize < $averagesize) { if ($alis->samplesize < $averagesize / 2) { if ($alis->samplesize < $averagesize / 4) { $alis->quality_samplesize = 3; } else { $alis->quality_samplesize = 2; } } else { $alis->quality_samplesize = 1; } } else { $alis->quality_samplesize = 0; } if ($alis->correlation < CORRELATION_THRESHOLD) { $alis->quality_correlation = 1; } else { $alis->quality_correlation = 0; } switch ($alis->qualification) { case ALIS_GCSE: case ALIS_BTEC_FIRST_DIPLOMA: case ALIS_IB_STANDARD: case ALIS_IB_HIGHER: case ALIS_OCR_NATIONAL_CERTIFICATE: case ALIS_OCR_NATIONAL_DIPLOMA: $boundary = 1; break; case ALIS_ADVANCED_GCE: case ALIS_ADVANCED_GCE_DOUBLE: $boundary = 20; break; case ALIS_ADVANCED_SUBSIDIARY_GCE: case ALIS_ADVANCED_SUBSIDIARY_GCE_DOUBLE: $boundary = 10; break; case ALIS_BTEC_NATIONAL_AWARD: case ALIS_BTEC_NATIONAL_DIPLOMA: case ALIS_BTEC_NATIONAL_CERTIFICATE: $boundary = 40; break; case ALIS_CACHE_L3_DIPLOMA: $boundary = 60; break; } if ($alis->standarddeviation > $boundary) { if ($alis->standarddeviation > $boundary * 2) { $alis->quality_deviation = 2; } else { $alis->quality_deviation = 1; } } else { $alis->quality_deviation = 0; } $DB->update_record('report_targetgrades_alisdata', $alis); } return $import; }