public function edit($param) { $entry_list_id = $param->get("entry_list_id"); $cF = $this->getCustomFields($entry_list_id); $cFields = $cF->map(array(new _hx_lambda(array(&$cF, &$entry_list_id, &$param), "model_QC_0"), 'execute')); haxe_Log::trace($cFields, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 38, "className" => "model.QC", "methodName" => "edit"))); $fieldNames = new haxe_ds_StringMap(); $typeMap = new haxe_ds_StringMap(); $optionsMap = new haxe_ds_StringMap(); $_g1 = 0; $_g = $cFields->length; while ($_g1 < $_g) { $f = $_g1++; $fieldNames->set($cFields[$f], _hx_array_get($cF, $f)->get("field_name")); if (_hx_array_get($cF, $f)->get("field_options") !== null) { $optionsMap->set($cFields[$f], _hx_array_get($cF, $f)->get("field_options")); } $typeMap->set($cFields[$f], _hx_array_get($cF, $f)->get("field_type")); unset($f); } $param->set("fields", $cFields); $sb = new StringBuf(); $phValues = new _hx_array(array()); haxe_Log::trace($param, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 57, "className" => "model.QC", "methodName" => "edit"))); $this->data = _hx_anonymous(array("fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "rows" => $this->doSelectCustom($param, $sb, $phValues), "typeMap" => php_Lib::associativeArrayOfHash($typeMap), "optionsMap" => php_Lib::associativeArrayOfHash($optionsMap), "recordings" => $this->getRecordings(Std::parseInt($param->get("lead_id"))))); return $this->json_encode(); }
public function getGlobals($param) { $fieldNames = new haxe_ds_StringMap(); $typeMap = new haxe_ds_StringMap(); $optionsMap = new haxe_ds_StringMap(); $eF = $this->getEditorFields(null); $keys = $eF->keys(); $tableNames = new _hx_array(array()); $tableFields = new haxe_ds_StringMap(); haxe_Log::trace($param, _hx_anonymous(array("fileName" => "App.hx", "lineNumber" => 32, "className" => "model.App", "methodName" => "getGlobals"))); while ($keys->hasNext()) { $k = $keys->next(); $tableNames->push($k); $aFields = $eF->get($k); $cFields = $aFields->map(array(new _hx_lambda(array(&$aFields, &$eF, &$fieldNames, &$k, &$keys, &$optionsMap, &$param, &$tableFields, &$tableNames, &$typeMap), "model_App_0"), 'execute')); $tableFields->set($k, $cFields); $_g1 = 0; $_g = $cFields->length; while ($_g1 < $_g) { $f = $_g1++; $fieldNames->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_name")); if (_hx_array_get($aFields, $f)->get("field_options") !== null) { $optionsMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_options")); } $typeMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_type")); unset($f); } unset($_g1, $_g); unset($k, $cFields, $aFields); } $me = new model_Users($param); $me->get_info(null); $data = _hx_anonymous(array("fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "userMap" => $me->globals, "optionsMap" => $optionsMap, "typeMap" => $typeMap, "limit" => _hx_array_get(S::$conf->get("sql"), "LIMIT"))); return $data; }
public function testJsonOut() { $j = new haxe_ds_StringMap(); $j->set("a", 1); $j->set("b", 2); $txt = haxe_format_JsonPrinter::hprint($j, null, null); $this->assertTrue($txt === "{\"a\":1,\"b\":2}" || $txt === "{\"b\":2,\"a\":1}", _hx_anonymous(array("fileName" => "JsonTest.hx", "lineNumber" => 12, "className" => "harness.JsonTest", "methodName" => "testJsonOut"))); }
public function __construct($json, $flags) { if (!php_Boot::$skip_constructor) { $this->db = $json; $names = Reflect::field($json, "names"); $allowed = null; $count = $names->length; if ($flags !== null && $flags->tables !== null) { $allowed = new haxe_ds_StringMap(); $_g = 0; $_g1 = $flags->tables; while ($_g < $_g1->length) { $name = $_g1[$_g]; ++$_g; $allowed->set($name, true); unset($name); } $count = 0; $_g2 = 0; while ($_g2 < $names->length) { $name1 = $names[$_g2]; ++$_g2; if ($allowed->exists($name1)) { $count++; } unset($name1); } } $this->t = new coopy_SimpleTable(2, $count + 1); $this->t->setCell(0, 0, "name"); $this->t->setCell(1, 0, "table"); $v = $this->t->getCellView(); $at = 1; $_g3 = 0; while ($_g3 < $names->length) { $name2 = $names[$_g3]; ++$_g3; if ($allowed !== null) { if (!$allowed->exists($name2)) { continue; } } $this->t->setCell(0, $at, $name2); $tab = Reflect::field($this->db, "tables"); $tab = Reflect::field($tab, $name2); $this->t->setCell(1, $at, $v->wrapTable(new coopy_JsonTable($tab, $name2))); $at++; unset($tab, $name2); } } }
public function renderRow($r) { $row = new haxe_ds_StringMap(); $_g1 = 0; $_g = $this->tab->get_width(); while ($_g1 < $_g) { $c = $_g1++; $key = $this->view->toString($this->tab->getCell($c, $this->header_row)); if ($c === 0 && $this->header_row === 1) { $key = "@:@"; } $value = $this->tab->getCell($c, $r); $row->set($key, $value); unset($value); unset($key, $c); } return haxe_format_JsonPrinter::hprint($row, null, null); }
static function load($cjs) { $js = file_get_contents($cjs); $vars = _hx_explode("var", $js); $vars->shift(); $result = new haxe_ds_StringMap(); haxe_Log::trace($vars->length, _hx_anonymous(array("fileName" => "Config.hx", "lineNumber" => 20, "className" => "Config", "methodName" => "load"))); $jsonS = new Services_JSON(48); $_g = 0; while ($_g < $vars->length) { $v = $vars[$_g]; ++$_g; $data = _hx_explode("=", $v); $json = $jsonS->decode($data[1]); $result->set(trim($data[0]), $json); unset($v, $json, $data); } return $result; }
public function fetchRow() { if ($this->src !== null) { return $this->src->fetchRow(); } if ($this->at >= $this->h) { return null; } $row = new haxe_ds_StringMap(); $_g1 = 0; $_g = $this->columns->length; while ($_g1 < $_g) { $i = $_g1++; $v = $this->t->getCell($i, $this->at); $row->set($this->columns[$i], $v); $v; unset($v); unset($i); } return $row; }
public function get_info($user = null) { $sb = new StringBuf(); $phValues = new _hx_array(array()); $result = new _hx_array(array()); $param = new haxe_ds_StringMap(); $param->set("table", "vicidial_users"); $param->set("fields", "user,user_level, pass,full_name"); $param->set("where", model_Users_0($this, $param, $phValues, $result, $sb, $user)); $param->set("limit", "50"); $userMap = $this->doSelect($param, $sb, $phValues); haxe_Log::trace($param, _hx_anonymous(array("fileName" => "Users.hx", "lineNumber" => 37, "className" => "model.Users", "methodName" => "get_info"))); $_g1 = 0; $_g = $this->num_rows; while ($_g1 < $_g) { $n = $_g1++; $result->push(_hx_anonymous(array("user" => $userMap[$n]["user"], "full_name" => $userMap[$n]["full_name"]))); unset($n); } return $result; }
public function apply() { if ($this->db === null) { return null; } if ($this->align === null) { $this->align = new coopy_Alignment(); } if (!$this->validateSchema()) { return null; } $rowid_name = $this->db->rowid(); $key_cols = new _hx_array(array()); $data_cols = new _hx_array(array()); $all_cols = new _hx_array(array()); $all_cols1 = new _hx_array(array()); $all_cols2 = new _hx_array(array()); $all_cols3 = new _hx_array(array()); $common = $this->local; if ($this->local !== null) { $key_cols = $this->local->getPrimaryKey(); $data_cols = $this->local->getAllButPrimaryKey(); $all_cols = $this->local->getColumnNames(); $all_cols1 = $this->local->getColumnNames(); } if ($this->remote !== null) { $all_cols2 = $this->remote->getColumnNames(); if ($common === null) { $common = $this->remote; } } if ($this->alt !== null) { $all_cols3 = $this->alt->getColumnNames(); if ($common === null) { $common = $this->alt; } } else { $all_cols3 = $all_cols2; } $all_common_cols = new _hx_array(array()); $data_common_cols = new _hx_array(array()); $present1 = new haxe_ds_StringMap(); $present2 = new haxe_ds_StringMap(); $present3 = new haxe_ds_StringMap(); $present_primary = new haxe_ds_StringMap(); $has_column_add = false; $_g1 = 0; $_g = $key_cols->length; while ($_g1 < $_g) { $i = $_g1++; $present_primary->set($key_cols[$i], $i); unset($i); } $_g11 = 0; $_g2 = $all_cols1->length; while ($_g11 < $_g2) { $i1 = $_g11++; $key = $all_cols1[$i1]; $present1->set($key, $i1); unset($key, $i1); } $_g12 = 0; $_g3 = $all_cols2->length; while ($_g12 < $_g3) { $i2 = $_g12++; $key1 = $all_cols2[$i2]; if (!$present1->exists($key1)) { $has_column_add = true; } $present2->set($key1, $i2); unset($key1, $i2); } $_g13 = 0; $_g4 = $all_cols3->length; while ($_g13 < $_g4) { $i3 = $_g13++; $key2 = $all_cols3[$i3]; if (!$present1->exists($key2)) { $has_column_add = true; } $present3->set($key2, $i3); if ($present1->exists($key2)) { if ($present2->exists($key2)) { $all_common_cols->push($key2); if (!$present_primary->exists($key2)) { $data_common_cols->push($key2); } } } unset($key2, $i3); } $this->align->meta = new coopy_Alignment(); $_g14 = 0; $_g5 = $all_cols1->length; while ($_g14 < $_g5) { $i4 = $_g14++; $key3 = $all_cols1[$i4]; if ($present2->exists($key3)) { $this->align->meta->link($i4, $present2->get($key3)); } else { $this->align->meta->link($i4, -1); } unset($key3, $i4); } $_g15 = 0; $_g6 = $all_cols2->length; while ($_g15 < $_g6) { $i5 = $_g15++; $key4 = $all_cols2[$i5]; if (!$present1->exists($key4)) { $this->align->meta->link(-1, $i5); } unset($key4, $i5); } $this->scanColumns($all_cols1, $all_cols2, $key_cols, $present1, $present2, $this->align); $this->align->tables($this->local, $this->remote); if ($this->alt !== null) { $this->scanColumns($all_cols1, $all_cols3, $key_cols, $present1, $present3, $this->align->reference); $this->align->reference->tables($this->local, $this->alt); } $sql_table1 = ""; $sql_table2 = ""; $sql_table3 = ""; if ($this->local !== null) { $sql_table1 = $this->local->getQuotedTableName(); } if ($this->remote !== null) { $sql_table2 = $this->remote->getQuotedTableName(); } if ($this->alt !== null) { $sql_table3 = $this->alt->getQuotedTableName(); } if ($this->peered) { $sql_table1 = "main." . _hx_string_or_null($sql_table1); $sql_table2 = "__peer__." . _hx_string_or_null($sql_table2); } if ($this->alt_peered) { $sql_table2 = "__alt__." . _hx_string_or_null($sql_table3); } $sql_key_cols = ""; $_g16 = 0; $_g7 = $key_cols->length; while ($_g16 < $_g7) { $i6 = $_g16++; if ($i6 > 0) { $sql_key_cols .= ","; } $sql_key_cols .= _hx_string_or_null($common->getQuotedColumnName($key_cols[$i6])); unset($i6); } $sql_all_cols = ""; $_g17 = 0; $_g8 = $all_common_cols->length; while ($_g17 < $_g8) { $i7 = $_g17++; if ($i7 > 0) { $sql_all_cols .= ","; } $sql_all_cols .= _hx_string_or_null($common->getQuotedColumnName($all_common_cols[$i7])); unset($i7); } $sql_all_cols1 = ""; $_g18 = 0; $_g9 = $all_cols1->length; while ($_g18 < $_g9) { $i8 = $_g18++; if ($i8 > 0) { $sql_all_cols1 .= ","; } $sql_all_cols1 .= _hx_string_or_null($this->local->getQuotedColumnName($all_cols1[$i8])); unset($i8); } $sql_all_cols2 = ""; $_g19 = 0; $_g10 = $all_cols2->length; while ($_g19 < $_g10) { $i9 = $_g19++; if ($i9 > 0) { $sql_all_cols2 .= ","; } $sql_all_cols2 .= _hx_string_or_null($this->remote->getQuotedColumnName($all_cols2[$i9])); unset($i9); } $sql_all_cols3 = ""; if ($this->alt !== null) { $_g110 = 0; $_g20 = $all_cols3->length; while ($_g110 < $_g20) { $i10 = $_g110++; if ($i10 > 0) { $sql_all_cols3 .= ","; } $sql_all_cols3 .= _hx_string_or_null($this->alt->getQuotedColumnName($all_cols3[$i10])); unset($i10); } } $sql_key_match2 = ""; $_g111 = 0; $_g21 = $key_cols->length; while ($_g111 < $_g21) { $i11 = $_g111++; if ($i11 > 0) { $sql_key_match2 .= " AND "; } $n = $common->getQuotedColumnName($key_cols[$i11]); $sql_key_match2 .= _hx_string_or_null($sql_table1) . "." . _hx_string_or_null($n) . " IS " . _hx_string_or_null($sql_table2) . "." . _hx_string_or_null($n); unset($n, $i11); } $sql_key_match3 = ""; if ($this->alt !== null) { $_g112 = 0; $_g22 = $key_cols->length; while ($_g112 < $_g22) { $i12 = $_g112++; if ($i12 > 0) { $sql_key_match3 .= " AND "; } $n1 = $common->getQuotedColumnName($key_cols[$i12]); $sql_key_match3 .= _hx_string_or_null($sql_table1) . "." . _hx_string_or_null($n1) . " IS " . _hx_string_or_null($sql_table3) . "." . _hx_string_or_null($n1); unset($n1, $i12); } } $sql_data_mismatch = ""; $_g113 = 0; $_g23 = $data_common_cols->length; while ($_g113 < $_g23) { $i13 = $_g113++; if ($i13 > 0) { $sql_data_mismatch .= " OR "; } $n2 = $common->getQuotedColumnName($data_common_cols[$i13]); $sql_data_mismatch .= _hx_string_or_null($sql_table1) . "." . _hx_string_or_null($n2) . " IS NOT " . _hx_string_or_null($sql_table2) . "." . _hx_string_or_null($n2); unset($n2, $i13); } $_g114 = 0; $_g24 = $all_cols2->length; while ($_g114 < $_g24) { $i14 = $_g114++; $key5 = $all_cols2[$i14]; if (!$present1->exists($key5)) { if ($sql_data_mismatch !== "") { $sql_data_mismatch .= " OR "; } $n3 = $common->getQuotedColumnName($key5); $sql_data_mismatch .= _hx_string_or_null($sql_table2) . "." . _hx_string_or_null($n3) . " IS NOT NULL"; unset($n3); } unset($key5, $i14); } if ($this->alt !== null) { $_g115 = 0; $_g25 = $data_common_cols->length; while ($_g115 < $_g25) { $i15 = $_g115++; if (strlen($sql_data_mismatch) > 0) { $sql_data_mismatch .= " OR "; } $n4 = $common->getQuotedColumnName($data_common_cols[$i15]); $sql_data_mismatch .= _hx_string_or_null($sql_table1) . "." . _hx_string_or_null($n4) . " IS NOT " . _hx_string_or_null($sql_table3) . "." . _hx_string_or_null($n4); unset($n4, $i15); } $_g116 = 0; $_g26 = $all_cols3->length; while ($_g116 < $_g26) { $i16 = $_g116++; $key6 = $all_cols3[$i16]; if (!$present1->exists($key6)) { if ($sql_data_mismatch !== "") { $sql_data_mismatch .= " OR "; } $n5 = $common->getQuotedColumnName($key6); $sql_data_mismatch .= _hx_string_or_null($sql_table3) . "." . _hx_string_or_null($n5) . " IS NOT NULL"; unset($n5); } unset($key6, $i16); } } $sql_dbl_cols = ""; $dbl_cols = new _hx_array(array()); $_g117 = 0; $_g27 = $all_cols1->length; while ($_g117 < $_g27) { $i17 = $_g117++; if ($sql_dbl_cols !== "") { $sql_dbl_cols .= ","; } $buf = "__coopy_" . _hx_string_rec($i17, ""); $n6 = $common->getQuotedColumnName($all_cols1[$i17]); $sql_dbl_cols .= _hx_string_or_null($sql_table1) . "." . _hx_string_or_null($n6) . " AS " . _hx_string_or_null($buf); $dbl_cols->push($buf); unset($n6, $i17, $buf); } $_g118 = 0; $_g28 = $all_cols2->length; while ($_g118 < $_g28) { $i18 = $_g118++; if ($sql_dbl_cols !== "") { $sql_dbl_cols .= ","; } $buf1 = "__coopy_" . _hx_string_rec($i18, "") . "b"; $n7 = $common->getQuotedColumnName($all_cols2[$i18]); $sql_dbl_cols .= _hx_string_or_null($sql_table2) . "." . _hx_string_or_null($n7) . " AS " . _hx_string_or_null($buf1); $dbl_cols->push($buf1); unset($n7, $i18, $buf1); } if ($this->alt !== null) { $_g119 = 0; $_g29 = $all_cols3->length; while ($_g119 < $_g29) { $i19 = $_g119++; if ($sql_dbl_cols !== "") { $sql_dbl_cols .= ","; } $buf2 = "__coopy_" . _hx_string_rec($i19, "") . "c"; $n8 = $common->getQuotedColumnName($all_cols3[$i19]); $sql_dbl_cols .= _hx_string_or_null($sql_table3) . "." . _hx_string_or_null($n8) . " AS " . _hx_string_or_null($buf2); $dbl_cols->push($buf2); unset($n8, $i19, $buf2); } } $sql_order = ""; $_g120 = 0; $_g30 = $key_cols->length; while ($_g120 < $_g30) { $i20 = $_g120++; if ($i20 > 0) { $sql_order .= ","; } $n9 = $common->getQuotedColumnName($key_cols[$i20]); $sql_order .= _hx_string_or_null($n9); unset($n9, $i20); } $rowid = "-3"; $rowid1 = "-3"; $rowid2 = "-3"; $rowid3 = "-3"; if ($rowid_name !== null) { $rowid = $rowid_name; if ($this->local !== null) { $rowid1 = _hx_string_or_null($sql_table1) . "." . _hx_string_or_null($rowid_name); } if ($this->remote !== null) { $rowid2 = _hx_string_or_null($sql_table2) . "." . _hx_string_or_null($rowid_name); } if ($this->alt !== null) { $rowid3 = _hx_string_or_null($sql_table3) . "." . _hx_string_or_null($rowid_name); } } $this->at0 = 1; $this->at1 = 1; $this->at2 = 1; $this->diff_ct = 0; if ($this->remote !== null) { $sql_inserts = "SELECT DISTINCT 0 AS __coopy_code, NULL, " . _hx_string_or_null($rowid) . " AS rowid, NULL, " . _hx_string_or_null($sql_all_cols2) . " FROM " . _hx_string_or_null($sql_table2); if ($this->local !== null) { $sql_inserts .= " WHERE NOT EXISTS (SELECT 1 FROM " . _hx_string_or_null($sql_table1) . _hx_string_or_null($this->where($sql_key_match2)) . ")"; } $sql_inserts_order = _hx_deref(new _hx_array(array("__coopy_code", "NULL", "rowid", "NULL")))->concat($all_cols2); $this->linkQuery($sql_inserts, $sql_inserts_order); } if ($this->alt !== null) { $sql_inserts1 = "SELECT DISTINCT 1 AS __coopy_code, NULL, NULL, " . _hx_string_or_null($rowid) . " AS rowid, " . _hx_string_or_null($sql_all_cols3) . " FROM " . _hx_string_or_null($sql_table3); if ($this->local !== null) { $sql_inserts1 .= " WHERE NOT EXISTS (SELECT 1 FROM " . _hx_string_or_null($sql_table1) . _hx_string_or_null($this->where($sql_key_match3)) . ")"; } $sql_inserts_order1 = _hx_deref(new _hx_array(array("__coopy_code", "NULL", "NULL", "rowid")))->concat($all_cols3); $this->linkQuery($sql_inserts1, $sql_inserts_order1); } if ($this->local !== null && $this->remote !== null) { $sql_updates = "SELECT DISTINCT 2 AS __coopy_code, " . _hx_string_or_null($rowid1) . " AS __coopy_rowid0, " . _hx_string_or_null($rowid2) . " AS __coopy_rowid1, "; if ($this->alt !== null) { $sql_updates .= _hx_string_or_null($rowid3) . " AS __coopy_rowid2,"; } else { $sql_updates .= " NULL,"; } $sql_updates .= _hx_string_or_null($sql_dbl_cols) . " FROM " . _hx_string_or_null($sql_table1); if ($sql_table1 !== $sql_table2) { $sql_updates .= " INNER JOIN " . _hx_string_or_null($sql_table2) . " ON " . _hx_string_or_null($sql_key_match2); } if ($this->alt !== null && $sql_table1 !== $sql_table3) { $sql_updates .= " INNER JOIN " . _hx_string_or_null($sql_table3) . " ON " . _hx_string_or_null($sql_key_match3); } $sql_updates .= _hx_string_or_null($this->where($sql_data_mismatch)); $sql_updates_order = _hx_deref(new _hx_array(array("__coopy_code", "__coopy_rowid0", "__coopy_rowid1", "__coopy_rowid2")))->concat($dbl_cols); $this->linkQuery($sql_updates, $sql_updates_order); } if ($this->alt === null) { if ($this->local !== null) { $sql_deletes = "SELECT DISTINCT 0 AS __coopy_code, " . _hx_string_or_null($rowid) . " AS rowid, NULL, NULL, " . _hx_string_or_null($sql_all_cols1) . " FROM " . _hx_string_or_null($sql_table1); if ($this->remote !== null) { $sql_deletes .= " WHERE NOT EXISTS (SELECT 1 FROM " . _hx_string_or_null($sql_table2) . _hx_string_or_null($this->where($sql_key_match2)) . ")"; } $sql_deletes_order = _hx_deref(new _hx_array(array("__coopy_code", "rowid", "NULL", "NULL")))->concat($all_cols1); $this->linkQuery($sql_deletes, $sql_deletes_order); } } if ($this->alt !== null) { $sql_deletes1 = "SELECT 2 AS __coopy_code, " . _hx_string_or_null($rowid1) . " AS __coopy_rowid0, " . _hx_string_or_null($rowid2) . " AS __coopy_rowid1, "; $sql_deletes1 .= _hx_string_or_null($rowid3) . " AS __coopy_rowid2, "; $sql_deletes1 .= _hx_string_or_null($sql_dbl_cols); $sql_deletes1 .= " FROM " . _hx_string_or_null($sql_table1); if ($this->remote !== null) { $sql_deletes1 .= " LEFT OUTER JOIN " . _hx_string_or_null($sql_table2) . " ON " . _hx_string_or_null($sql_key_match2); } $sql_deletes1 .= " LEFT OUTER JOIN " . _hx_string_or_null($sql_table3) . " ON " . _hx_string_or_null($sql_key_match3); $sql_deletes1 .= " WHERE __coopy_rowid1 IS NULL OR __coopy_rowid2 IS NULL"; $sql_deletes_order1 = _hx_deref(new _hx_array(array("__coopy_code", "__coopy_rowid0", "__coopy_rowid1", "__coopy_rowid2")))->concat($dbl_cols); $this->linkQuery($sql_deletes1, $sql_deletes_order1); } if ($this->diff_ct === 0) { $this->align->markIdentical(); } return $this->align; }
public function edit($param) { $entry_list_id = $param->get("entry_list_id"); $cF = $this->getCustomFields($entry_list_id); $cFields = $cF->map(array(new _hx_lambda(array(&$cF, &$entry_list_id, &$param), "model_QC_0"), 'execute')); haxe_Log::trace($cFields->join(","), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 38, "className" => "model.QC", "methodName" => "edit"))); $fieldDefault = new haxe_ds_StringMap(); $fieldNames = new haxe_ds_StringMap(); $fieldRequired = new haxe_ds_StringMap(); $typeMap = new haxe_ds_StringMap(); $optionsMap = new haxe_ds_StringMap(); $eF = $this->getEditorFields(null)->get("vicidial_list"); $_g = 0; while ($_g < $eF->length) { $f = $eF[$_g]; ++$_g; $fieldNames->set($f->get("field_label"), $f->get("field_name")); if ($f->get("field_options") !== null) { $optionsMap->set($f->get("field_label"), $f->get("field_options")); } $typeMap->set($f->get("field_label"), $f->get("field_type")); unset($f); } $_g1 = 0; $_g2 = $cFields->length; while ($_g1 < $_g2) { $f1 = $_g1++; $fieldNames->set($cFields[$f1], _hx_array_get($cF, $f1)->get("field_name")); if (_hx_array_get($cF, $f1)->get("field_options") !== null) { $optionsMap->set($cFields[$f1], _hx_array_get($cF, $f1)->get("field_options")); } $def = _hx_array_get($cF, $f1)->get("field_default"); if ($def === null) { } else { switch ($def) { case "NULL": case "": break; default: $fieldDefault->set($cFields[$f1], _hx_array_get($cF, $f1)->get("field_default")); break; } } if (_hx_array_get($cF, $f1)->get("field_required") === "Y") { $fieldRequired->set($cFields[$f1], true); } $typeMap->set($cFields[$f1], _hx_array_get($cF, $f1)->get("field_type")); unset($f1, $def); } $cFields->push("entry_date"); $param->set("fields", $cFields); $sb = new StringBuf(); $phValues = new _hx_array(array()); $this->data = _hx_anonymous(array("fieldDefault" => php_Lib::associativeArrayOfHash($fieldDefault), "fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "fieldRequired" => php_Lib::associativeArrayOfHash($fieldRequired), "rows" => $this->doSelectCustom($param, $sb, $phValues), "typeMap" => php_Lib::associativeArrayOfHash($typeMap), "optionsMap" => php_Lib::associativeArrayOfHash($optionsMap), "recordings" => $this->getRecordings(Std::parseInt($param->get("lead_id"))))); $userMap = new haxe_ds_StringMap(); $sb = new StringBuf(); $phValues = new _hx_array(array()); $p = new haxe_ds_StringMap(); $p->set("table", "vicidial_users"); $p->set("fields", "user,full_name"); $p->set("where", "user_group|AGENTS_A"); haxe_Log::trace(_hx_string_rec($this->num_rows, "") . ":" . Std::string($param->get("owner")), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 108, "className" => "model.QC", "methodName" => "edit"))); $this->data->userMap = _hx_deref(new model_Users(null))->get_info(null); return $this->json_encode(); }
static function toStringMap($this1) { $sm = new haxe_ds_StringMap(); if (null == $this1) { throw new HException('null iterable'); } $__hx__it = $this1->keys(); while ($__hx__it->hasNext()) { unset($key); $key = $__hx__it->next(); $sm->set($key, ufront_core__MultiValueMap_MultiValueMap_Impl_::get($this1, $key)); } return $sm; }
public function getIgnoredColumns() { if ($this->columns_to_ignore === null) { return null; } $ignore = new haxe_ds_StringMap(); $_g1 = 0; $_g = $this->columns_to_ignore->length; while ($_g1 < $_g) { $i = $_g1++; $ignore->set($this->columns_to_ignore[$i], true); unset($i); } return $ignore; }
public function splitSchema($db, $name, $sql) { $preamble = ""; $parts = new _hx_array(array()); $double_quote = false; $single_quote = false; $token = ""; $nesting = 0; $_g1 = 0; $_g = strlen($sql); while ($_g1 < $_g) { $i = $_g1++; $ch = _hx_char_at($sql, $i); if ($double_quote || $single_quote) { if ($double_quote) { if ($ch === "\"") { $double_quote = false; } } if ($single_quote) { if ($ch === "'") { $single_quote = false; } } $token .= _hx_string_or_null($ch); continue; } $brk = false; if ($ch === "(") { $nesting++; if ($nesting === 1) { $brk = true; } } else { if ($ch === ")") { $nesting--; if ($nesting === 0) { $brk = true; } } } if ($ch === ",") { $brk = true; if ($nesting === 1) { } } if ($brk) { if (_hx_char_at($token, 0) === " ") { $token = _hx_substr($token, 1, strlen($token)); } if ($preamble === "") { $preamble = $token; } else { $parts->push($token); } $token = ""; } else { $token .= _hx_string_or_null($ch); } unset($i, $ch, $brk); } $cols = $db->getColumns($name); $name2part = new haxe_ds_StringMap(); $name2col = new haxe_ds_StringMap(); $_g11 = 0; $_g2 = $cols->length; while ($_g11 < $_g2) { $i1 = $_g11++; $col = $cols[$i1]; $name2part->set($col->name, $parts[$i1]); $name2col->set($col->name, $cols[$i1]); unset($i1, $col); } return _hx_anonymous(array("preamble" => $preamble, "parts" => $parts, "name2part" => $name2part, "columns" => $cols, "name2column" => $name2col)); }
static function getMoonTimes($date, $lat, $lng, $inUTC = null) { if ($inUTC === null) { $inUTC = false; } if ($inUTC) { $this1 = datetime__DateTime_DateTime_Impl_::utc(suncalc_SunCalc_0($date, $inUTC, $lat, $lng)); $date = Date::fromTime(($this1 - 62135596800.0) * 1000); $date = new Date($date->getFullYear(), $date->getMonth(), $date->getDate(), 0, 0, 0); } else { $date = new Date($date->getFullYear(), $date->getMonth(), $date->getDate(), 0, 0, 0); } $hc = 0.133 * suncalc_SunCalc::$rad; $h0 = suncalc_SunCalc::getMoonPosition($date, $lat, $lng)->altitude - $hc; $h1 = null; $h2 = null; $rise = 0.0; $set = 0.0; $a = null; $b = null; $xe = null; $ye = 0.0; $d = null; $roots = null; $x1 = 0.0; $x2 = 0.0; $dx = null; $i = 1; while ($i <= 24) { $h1 = suncalc_SunCalc::getMoonPosition(suncalc_SunCalc::hoursLater($date, $i), $lat, $lng)->altitude - $hc; $h2 = suncalc_SunCalc::getMoonPosition(suncalc_SunCalc::hoursLater($date, $i + 1), $lat, $lng)->altitude - $hc; $a = ($h0 + $h2) / 2 - $h1; $b = ($h2 - $h0) / 2; $xe = -$b / (2 * $a); $ye = ($a * $xe + $b) * $xe + $h1; $d = $b * $b - 4 * $a * $h1; $roots = 0; if ($d >= 0) { $dx = Math::sqrt($d) / (Math::abs($a) * 2); $x1 = $xe - $dx; $x2 = $xe + $dx; if (Math::abs($x1) <= 1) { $roots++; } if (Math::abs($x2) <= 1) { $roots++; } if ($x1 < -1) { $x1 = $x2; } } if ($roots === 1) { if ($h0 < 0) { $rise = $i + $x1; } else { $set = $i + $x1; } } else { if ($roots === 2) { $rise = $i + ($ye < 0 ? $x2 : $x1); $set = $i + ($ye < 0 ? $x1 : $x2); } } if (!_hx_equal($rise, 0) && !_hx_equal($set, 0)) { break; } $h0 = $h2; $i += 2; } $result = new haxe_ds_StringMap(); if (!_hx_equal($rise, 0)) { $v = suncalc_SunCalc::hoursLater($date, $rise); $result->set("rise", $v); $v; } if (!_hx_equal($set, 0)) { $v1 = suncalc_SunCalc::hoursLater($date, $set); $result->set("set", $v1); $v1; } if (_hx_equal($rise, 0) && _hx_equal($set, 0)) { $result->set($ye > 0 ? "alwaysUp" : "alwaysDown", true); true; } return $result; }
public function getEditorFields($table_name = null) { $sb = new StringBuf(); $phValues = new _hx_array(array()); $param = new haxe_ds_StringMap(); $param->set("table", "fly_crm.editor_fields"); $param->set("where", "field_cost|>-2" . _hx_string_or_null(Model_18($this, $param, $phValues, $sb, $table_name))); $param->set("fields", "field_name,field_label,field_type,field_options,table_name"); $param->set("order", "table_name,field_rank,field_order"); $param->set("limit", "100"); $eFields = null; $a = $this->doSelect($param, $sb, $phValues); $eFields = new _hx_array($a); $ret = new haxe_ds_StringMap(); $_g = 0; while ($_g < $eFields->length) { $ef = $eFields[$_g]; ++$_g; $table = $ef["table_name"]; if (!$ret->exists($table)) { $ret->set($table, new _hx_array(array())); } $a1 = $ret->get($table); $a1->push(php_Lib::hashOfAssociativeArray($ef)); $ret->set($table, $a1); unset($table, $ef, $a1); } return $ret; }
public function fetchRow() { if ($this->db->read()) { $row = new haxe_ds_StringMap(); $_g1 = 0; $_g = $this->columnNames->length; while ($_g1 < $_g) { $i = $_g1++; $v = $this->db->get($i); $row->set($this->columnNames[$i], $v); $v; unset($v); unset($i); } return $row; } $this->db->end(); return null; }
function model_ClientHistory_3() { $_g = new haxe_ds_StringMap(); $_g->set("title", "anrede"); $_g->set("geburts_datum", "birth_date"); return $_g; }
public function getCustomFields($list_id) { $sb = new StringBuf(); $phValues = new _hx_array(array()); $param = new haxe_ds_StringMap(); $param->set("table", "vicidial_lists_fields"); $param->set("where", "list_id|" . _hx_string_or_null(S::$my->real_escape_string($list_id))); $param->set("fields", "field_name,field_label,field_type,field_options,field_required,field_default"); $param->set("order", "field_rank,field_order"); $param->set("limit", "100"); $cFields = null; $a = $this->doSelect($param, $sb, $phValues); $cFields = new _hx_array($a); haxe_Log::trace($cFields->length, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 236, "className" => "model.Clients", "methodName" => "getCustomFields"))); $ret = new _hx_array(array()); $_g = 0; while ($_g < $cFields->length) { $cf = $cFields[$_g]; ++$_g; $field = php_Lib::hashOfAssociativeArray($cf); $ret->push($field); unset($field, $cf); } return $ret; }
static function jsonify($t) { $workbook = new haxe_ds_StringMap(); $sheet = new _hx_array(array()); $w = $t->get_width(); $h = $t->get_height(); $txt = ""; $_g = 0; while ($_g < $h) { $y = $_g++; $row = new _hx_array(array()); $_g1 = 0; while ($_g1 < $w) { $x = $_g1++; $v = $t->getCell($x, $y); $row->push($v); unset($x, $v); } unset($_g1); $sheet->push($row); unset($y, $row); } $workbook->set("sheet", $sheet); return $workbook; }
public function cloneMeta($table = null) { $result = new coopy_SimpleMeta($table, null, null); if ($this->metadata !== null) { $result->keys = new haxe_ds_StringMap(); if (null == $this->keys) { throw new HException('null iterable'); } $__hx__it = $this->keys->keys(); while ($__hx__it->hasNext()) { unset($k); $k = $__hx__it->next(); $result->keys->set($k, true); } $result->metadata = new haxe_ds_StringMap(); if (null == $this->metadata) { throw new HException('null iterable'); } $__hx__it = $this->metadata->keys(); while ($__hx__it->hasNext()) { unset($k1); $k1 = $__hx__it->next(); if (!$this->metadata->exists($k1)) { continue; } $vals = $this->metadata->get($k1); $nvals = new haxe_ds_StringMap(); if (null == $vals) { throw new HException('null iterable'); } $__hx__it2 = $vals->keys(); while ($__hx__it2->hasNext()) { unset($p); $p = $__hx__it2->next(); $value = $vals->get($p); $nvals->set($p, $value); unset($value); } $result->metadata->set($k1, $nvals); unset($vals, $nvals); } } return $result; }
public function alignColumns($align, $a, $b) { $align->range($a->get_width(), $b->get_width()); $align->tables($a, $b); $align->setRowlike(false); $slop = 5; $va = $a->getCellView(); $vb = $b->getCellView(); $ra_best = 0; $rb_best = 0; $ct_best = -1; $ma_best = null; $mb_best = null; $ra_header = 0; $rb_header = 0; $ra_uniques = 0; $rb_uniques = 0; $_g = 0; while ($_g < $slop) { $ra = $_g++; $_g1 = 0; while ($_g1 < $slop) { $rb = $_g1++; $ma = new haxe_ds_StringMap(); $mb = new haxe_ds_StringMap(); $ct = 0; $uniques = 0; if ($ra < $a->get_height()) { $_g3 = 0; $_g2 = $a->get_width(); while ($_g3 < $_g2) { $ca = $_g3++; $key = $va->toString($a->getCell($ca, $ra)); if ($ma->exists($key)) { $ma->set($key, -1); $uniques--; } else { $ma->set($key, $ca); $uniques++; } unset($key, $ca); } unset($_g3, $_g2); if ($uniques > $ra_uniques) { $ra_header = $ra; $ra_uniques = $uniques; } } $uniques = 0; if ($rb < $b->get_height()) { $_g31 = 0; $_g21 = $b->get_width(); while ($_g31 < $_g21) { $cb = $_g31++; $key1 = $vb->toString($b->getCell($cb, $rb)); if ($mb->exists($key1)) { $mb->set($key1, -1); $uniques--; } else { $mb->set($key1, $cb); $uniques++; } unset($key1, $cb); } unset($_g31, $_g21); if ($uniques > $rb_uniques) { $rb_header = $rb; $rb_uniques = $uniques; } } if (null == $ma) { throw new HException('null iterable'); } $__hx__it = $ma->keys(); while ($__hx__it->hasNext()) { unset($key2); $key2 = $__hx__it->next(); $i0 = $ma->get($key2); $i1 = $mb->get($key2); if ($i1 !== null) { if ($i1 >= 0 && $i0 >= 0) { $ct++; } } unset($i1, $i0); } if ($ct > $ct_best) { $ct_best = $ct; $ma_best = $ma; $mb_best = $mb; $ra_best = $ra; $rb_best = $rb; } unset($uniques, $rb, $mb, $ma, $ct); } unset($_g1); unset($ra); } if ($ma_best === null) { if ($a->get_height() > 0 && $b->get_height() === 0) { $align->headers(0, -1); } else { if ($a->get_height() === 0 && $b->get_height() > 0) { $align->headers(-1, 0); } } return; } if (null == $ma_best) { throw new HException('null iterable'); } $__hx__it = $ma_best->keys(); while ($__hx__it->hasNext()) { unset($key3); $key3 = $__hx__it->next(); $i01 = $ma_best->get($key3); $i11 = $mb_best->get($key3); if ($i01 !== null && $i11 !== null) { $align->link($i01, $i11); } else { if ($i01 !== null) { $align->link($i01, -1); } else { if ($i11 !== null) { $align->link(-1, $i11); } } } unset($i11, $i01); } if (null == $mb_best) { throw new HException('null iterable'); } $__hx__it = $mb_best->keys(); while ($__hx__it->hasNext()) { unset($key4); $key4 = $__hx__it->next(); $i02 = $ma_best->get($key4); $i12 = $mb_best->get($key4); if ($i02 === null && $i12 !== null) { $align->link(-1, $i12); } unset($i12, $i02); } $align->headers($ra_header, $rb_header); }
public function analyse_sql($sql) { $rows = null; $dataset = null; $base = new _hx_array(array()); $analysys = new _hx_array(array()); $resultset = null; $row = null; $fields = null; $field_name = null; $rows = system_base_Database::$cnx->request("EXPLAIN EXTENDED " . _hx_string_or_null($sql)); $resultset = $rows->results(); $_g1 = 0; $_g = $rows->get_length(); while ($_g1 < $_g) { $j = $_g1++; $dataset = new haxe_ds_StringMap(); $row = $resultset->pop(); $_g3 = 0; $_g2 = $rows->get_nfields(); while ($_g3 < $_g2) { $i = $_g3++; $fields = Reflect::fields($row); $field_name = $fields[$i]; if ($field_name !== null) { $key = strtoupper($field_name); $value = Reflect::field($row, $field_name); $dataset->set($key, $value); unset($value, $key); } unset($i); } unset($_g3, $_g2); $base[$j] = $dataset; unset($j); } $rows = system_base_Database::$cnx->request("SHOW WARNINGS;"); $extended = _hx_anonymous(array("Level" => $rows->getResult(0), "Code" => $rows->getResult(1), "Message" => $rows->getResult(2))); $rows = system_base_Database::$cnx->request(_hx_string_or_null($sql) . " PROCEDURE ANALYSE()"); $resultset = $rows->results(); $_g11 = 0; $_g4 = $rows->get_length(); while ($_g11 < $_g4) { $j1 = $_g11++; $dataset = new haxe_ds_StringMap(); $row = $resultset->pop(); $_g31 = 0; $_g21 = $rows->get_nfields(); while ($_g31 < $_g21) { $i1 = $_g31++; $fields = Reflect::fields($row); $field_name = $fields[$i1]; if ($field_name !== null) { $key1 = strtoupper($field_name); $value1 = Reflect::field($row, $field_name); $dataset->set($key1, $value1); unset($value1, $key1); } unset($i1); } unset($_g31, $_g21); $analysys[$j1] = $dataset; unset($j1); } return _hx_anonymous(array("SQL" => system_base_Sql_colour::pretify($sql), "base" => $base, "analysys" => $analysys, "extra" => $extended)); }