Exemplo n.º 1
0
 public function getResult($n)
 {
     if ($this->cRow === null && !$this->fetchRow()) {
         return null;
     }
     return _hx_array_get(array_values($this->cRow), $n);
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
 public function edit($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();
     while ($keys->hasNext()) {
         $k = $keys->next();
         haxe_Log::trace($k, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 55, "className" => "model.Clients", "methodName" => "edit")));
         $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_Clients_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);
     }
     $editTables = new haxe_ds_StringMap();
     $ti = 0;
     $_g2 = 0;
     while ($_g2 < $tableNames->length) {
         $table = $tableNames[$_g2];
         ++$_g2;
         $p = new haxe_ds_StringMap();
         $sb = new StringBuf();
         $phValues = new _hx_array(array());
         $p->set("primary_id", $param->get("primary_id"));
         if ($table === "clients") {
             $p->set("table", "vicidial_list");
             $p->set("jointable", "fly_crm." . _hx_string_or_null($table));
             $p->set("joincond", "ON vicidial_list.lead_id=fly_crm.clients.lead_id");
             $p->set("fields", Std::string(_hx_string_call($param->get("fields"), "split", array(","))->map(array(new _hx_lambda(array(&$_g2, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_1"), 'execute'))->join(",")) . "," . _hx_string_or_null($tableFields->get($table)->map(array(new _hx_lambda(array(&$_g2, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_2"), 'execute'))->join(",")));
             $p->set("where", "vicidial_list.lead_id|" . Std::string($param->get("lead_id")));
             $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doJoin($p, $sb, $phValues)));
         } else {
             $p->set("table", "fly_crm." . _hx_string_or_null($table));
             $p->set("fields", $tableFields->get($table)->join(","));
             $p->set("where", "client_id|" . Std::string($param->get("client_id")));
             $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doSelect($p, $sb, $phValues)));
         }
         haxe_Log::trace($p, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 105, "className" => "model.Clients", "methodName" => "edit")));
         unset($table, $sb, $phValues, $p);
     }
     $this->data = _hx_anonymous(array("fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "editData" => php_Lib::associativeArrayOfHash($editTables), "typeMap" => php_Lib::associativeArrayOfHash($typeMap), "optionsMap" => php_Lib::associativeArrayOfHash($optionsMap), "recordings" => $this->getRecordings(Std::parseInt($param->get("lead_id")))));
     return $this->json_encode();
 }
Exemplo n.º 5
0
 public function load($moduleSequence)
 {
     $_g = 0;
     while ($_g < $moduleSequence->length) {
         $path = $moduleSequence[$_g];
         ++$_g;
         if (zcale_core_web_ModuleLoader_0($this, $_g, $moduleSequence, $path) === true && $path !== _hx_array_get(new _hx_array(array("zcale.Core", "zcale.core")), 0) && Lambda::has(zcale_core_web_ModuleLoader::$loadedModules, $path) === false) {
             $this->modules->push($path);
         }
         unset($path);
     }
     $this->loadNextModule();
 }
Exemplo n.º 6
0
 public function unserialize()
 {
     $_g = null;
     $p = $this->pos++;
     $_g = ord(substr($this->buf, $p, 1));
     switch ($_g) {
         case 110:
             return null;
             break;
         case 116:
             return true;
             break;
         case 102:
             return false;
             break;
         case 122:
             return 0;
             break;
         case 105:
             return $this->readDigits();
             break;
         case 100:
             $p1 = $this->pos;
             while (true) {
                 $c = ord(substr($this->buf, $this->pos, 1));
                 if ($c >= 43 && $c < 58 || $c === 101 || $c === 69) {
                     $this->pos++;
                 } else {
                     break;
                 }
                 unset($c);
             }
             return Std::parseFloat(_hx_substr($this->buf, $p1, $this->pos - $p1));
             break;
         case 121:
             $len = $this->readDigits();
             if (haxe_Unserializer_3($this, $_g, $len) !== 58 || $this->length - $this->pos < $len) {
                 throw new HException("Invalid string length");
             }
             $s = _hx_substr($this->buf, $this->pos, $len);
             $this->pos += $len;
             $s = urldecode($s);
             $this->scache->push($s);
             return $s;
             break;
         case 107:
             return Math::$NaN;
             break;
         case 109:
             return Math::$NEGATIVE_INFINITY;
             break;
         case 112:
             return Math::$POSITIVE_INFINITY;
             break;
         case 97:
             $buf = $this->buf;
             $a = new _hx_array(array());
             $this->cache->push($a);
             while (true) {
                 $c1 = ord(substr($this->buf, $this->pos, 1));
                 if ($c1 === 104) {
                     $this->pos++;
                     break;
                 }
                 if ($c1 === 117) {
                     $this->pos++;
                     $n = $this->readDigits();
                     $a[$a->length + $n - 1] = null;
                     unset($n);
                 } else {
                     $a->push($this->unserialize());
                 }
                 unset($c1);
             }
             return $a;
             break;
         case 111:
             $o = _hx_anonymous(array());
             $this->cache->push($o);
             $this->unserializeObject($o);
             return $o;
             break;
         case 114:
             $n1 = $this->readDigits();
             if ($n1 < 0 || $n1 >= $this->cache->length) {
                 throw new HException("Invalid reference");
             }
             return $this->cache[$n1];
             break;
         case 82:
             $n2 = $this->readDigits();
             if ($n2 < 0 || $n2 >= $this->scache->length) {
                 throw new HException("Invalid string reference");
             }
             return $this->scache[$n2];
             break;
         case 120:
             throw new HException($this->unserialize());
             break;
         case 99:
             $name = $this->unserialize();
             $cl = $this->resolver->resolveClass($name);
             if ($cl === null) {
                 throw new HException("Class not found " . _hx_string_or_null($name));
             }
             $o1 = Type::createEmptyInstance($cl);
             $this->cache->push($o1);
             $this->unserializeObject($o1);
             return $o1;
             break;
         case 119:
             $name1 = $this->unserialize();
             $edecl = $this->resolver->resolveEnum($name1);
             if ($edecl === null) {
                 throw new HException("Enum not found " . _hx_string_or_null($name1));
             }
             $e = $this->unserializeEnum($edecl, $this->unserialize());
             $this->cache->push($e);
             return $e;
             break;
         case 106:
             $name2 = $this->unserialize();
             $edecl1 = $this->resolver->resolveEnum($name2);
             if ($edecl1 === null) {
                 throw new HException("Enum not found " . _hx_string_or_null($name2));
             }
             $this->pos++;
             $index = $this->readDigits();
             $tag = _hx_array_get(Type::getEnumConstructs($edecl1), $index);
             if ($tag === null) {
                 throw new HException("Unknown enum index " . _hx_string_or_null($name2) . "@" . _hx_string_rec($index, ""));
             }
             $e1 = $this->unserializeEnum($edecl1, $tag);
             $this->cache->push($e1);
             return $e1;
             break;
         case 108:
             $l = new HList();
             $this->cache->push($l);
             $buf1 = $this->buf;
             while (ord(substr($this->buf, $this->pos, 1)) !== 104) {
                 $l->add($this->unserialize());
             }
             $this->pos++;
             return $l;
             break;
         case 98:
             $h = new haxe_ds_StringMap();
             $this->cache->push($h);
             $buf2 = $this->buf;
             while (ord(substr($this->buf, $this->pos, 1)) !== 104) {
                 $s1 = $this->unserialize();
                 $h->set($s1, $this->unserialize());
                 unset($s1);
             }
             $this->pos++;
             return $h;
             break;
         case 113:
             $h1 = new haxe_ds_IntMap();
             $this->cache->push($h1);
             $buf3 = $this->buf;
             $c2 = null;
             $p3 = $this->pos++;
             $c2 = ord(substr($this->buf, $p3, 1));
             while ($c2 === 58) {
                 $i = $this->readDigits();
                 $h1->set($i, $this->unserialize());
                 $p4 = $this->pos++;
                 $c2 = ord(substr($this->buf, $p4, 1));
                 unset($p4);
                 unset($i);
             }
             if ($c2 !== 104) {
                 throw new HException("Invalid IntMap format");
             }
             return $h1;
             break;
         case 77:
             $h2 = new haxe_ds_ObjectMap();
             $this->cache->push($h2);
             $buf4 = $this->buf;
             while (ord(substr($this->buf, $this->pos, 1)) !== 104) {
                 $s2 = $this->unserialize();
                 $h2->set($s2, $this->unserialize());
                 unset($s2);
             }
             $this->pos++;
             return $h2;
             break;
         case 118:
             $d = Date::fromString(_hx_substr($this->buf, $this->pos, 19));
             $this->cache->push($d);
             $this->pos += 19;
             return $d;
             break;
         case 115:
             $len1 = $this->readDigits();
             $buf5 = $this->buf;
             if (haxe_Unserializer_4($this, $_g, $buf5, $len1) !== 58 || $this->length - $this->pos < $len1) {
                 throw new HException("Invalid bytes length");
             }
             $codes = haxe_Unserializer::$CODES;
             if ($codes === null) {
                 $codes = haxe_Unserializer::initCodes();
                 haxe_Unserializer::$CODES = $codes;
             }
             $i1 = $this->pos;
             $rest = $len1 & 3;
             $size = null;
             $size = ($len1 >> 2) * 3 + haxe_Unserializer_5($this, $_g, $buf5, $codes, $i1, $len1, $rest, $size);
             $max = $i1 + ($len1 - $rest);
             $bytes = haxe_io_Bytes::alloc($size);
             $bpos = 0;
             while ($i1 < $max) {
                 $c11 = $codes[haxe_Unserializer_6($this, $_g, $bpos, $buf5, $bytes, $codes, $i1, $len1, $max, $rest, $size)];
                 $c21 = $codes[haxe_Unserializer_7($this, $_g, $bpos, $buf5, $bytes, $c11, $codes, $i1, $len1, $max, $rest, $size)];
                 $pos = $bpos++;
                 $bytes->b[$pos] = chr($c11 << 2 | $c21 >> 4);
                 unset($pos);
                 $c3 = $codes[haxe_Unserializer_8($this, $_g, $bpos, $buf5, $bytes, $c11, $c21, $codes, $i1, $len1, $max, $rest, $size)];
                 $pos1 = $bpos++;
                 $bytes->b[$pos1] = chr($c21 << 4 | $c3 >> 2);
                 unset($pos1);
                 $c4 = $codes[haxe_Unserializer_9($this, $_g, $bpos, $buf5, $bytes, $c11, $c21, $c3, $codes, $i1, $len1, $max, $rest, $size)];
                 $pos2 = $bpos++;
                 $bytes->b[$pos2] = chr($c3 << 6 | $c4);
                 unset($pos2);
                 unset($c4, $c3, $c21, $c11);
             }
             if ($rest >= 2) {
                 $c12 = $codes[haxe_Unserializer_10($this, $_g, $bpos, $buf5, $bytes, $codes, $i1, $len1, $max, $rest, $size)];
                 $c22 = $codes[haxe_Unserializer_11($this, $_g, $bpos, $buf5, $bytes, $c12, $codes, $i1, $len1, $max, $rest, $size)];
                 $pos3 = $bpos++;
                 $bytes->b[$pos3] = chr($c12 << 2 | $c22 >> 4);
                 if ($rest === 3) {
                     $c31 = $codes[haxe_Unserializer_12($this, $_g, $bpos, $buf5, $bytes, $c12, $c22, $codes, $i1, $len1, $max, $rest, $size)];
                     $pos4 = $bpos++;
                     $bytes->b[$pos4] = chr($c22 << 4 | $c31 >> 2);
                 }
             }
             $this->pos += $len1;
             $this->cache->push($bytes);
             return $bytes;
             break;
         case 67:
             $name3 = $this->unserialize();
             $cl1 = $this->resolver->resolveClass($name3);
             if ($cl1 === null) {
                 throw new HException("Class not found " . _hx_string_or_null($name3));
             }
             $o2 = Type::createEmptyInstance($cl1);
             $this->cache->push($o2);
             $o2->hxUnserialize($this);
             if (haxe_Unserializer_13($this, $_g, $cl1, $name3, $o2) !== 103) {
                 throw new HException("Invalid custom data");
             }
             return $o2;
             break;
         default:
             break;
     }
     $this->pos--;
     throw new HException("Invalid char " . _hx_string_or_null(_hx_char_at($this->buf, $this->pos)) . " at position " . _hx_string_rec($this->pos, ""));
 }
Exemplo n.º 7
0
 static function createEnumIndex($e, $index, $params)
 {
     $c = _hx_array_get(Type::getEnumConstructs($e), $index);
     if ($c === null) {
         throw new HException($index . " is not a valid enum constructor index");
     }
     return Type::createEnum($e, $c, $params);
 }
Exemplo n.º 8
0
 static function tableFields($table, $db = null)
 {
     if ($db === null) {
         $db = "asterisk";
     }
     $res = S::$my->query("SELECT GROUP_CONCAT(COLUMN_NAME) FROM information_schema.columns WHERE table_schema = \"" . _hx_string_or_null($db) . "\" AND table_name = \"" . _hx_string_or_null($table) . "\";", null);
     if (Util::any2bool($res) && $res->num_rows === 1) {
         return _hx_string_call(_hx_array_get($res->fetch_array(2), 0), "split", array(","));
     }
     return null;
 }
 public function generateUri($uri, $isPhysical = null)
 {
     if ($isPhysical === null) {
         $isPhysical = false;
     }
     $uriOut = ufront_web_url_VirtualUrl::parse($uri, $isPhysical);
     $i = $this->urlFilters->length - 1;
     while ($i >= 0) {
         _hx_array_get($this->urlFilters, $i--)->filterOut($uriOut);
     }
     return $uriOut->toString();
 }
Exemplo n.º 10
0
 public function check4Update($param)
 {
     $lead_id = Std::parseInt($param->get("lead_id"));
     haxe_Log::trace(_hx_string_or_null(S::$host) . ":" . Std::string($lead_id), _hx_anonymous(array("fileName" => "AgcApi.hx", "lineNumber" => 30, "className" => "model.AgcApi", "methodName" => "check4Update")));
     return $this->json_response(_hx_array_get($this->query("SELECT state FROM vicidial_list WHERE lead_id=" . Std::string($lead_id)), 0));
 }
Exemplo n.º 11
0
 public function toOrder3()
 {
     $order = new _hx_array(array());
     if ($this->reference === null) {
         if (null == $this->map_a2b) {
             throw new HException('null iterable');
         }
         $__hx__it = $this->map_a2b->keys();
         while ($__hx__it->hasNext()) {
             unset($k);
             $k = $__hx__it->next();
             $unit = new coopy_Unit(null, null, null);
             $unit->l = $k;
             $unit->r = $this->a2b($k);
             $order->push($unit);
             unset($unit);
         }
         if (null == $this->map_b2a) {
             throw new HException('null iterable');
         }
         $__hx__it = $this->map_b2a->keys();
         while ($__hx__it->hasNext()) {
             unset($k1);
             $k1 = $__hx__it->next();
             if ($this->b2a($k1) === -1) {
                 $unit1 = new coopy_Unit(null, null, null);
                 $unit1->l = -1;
                 $unit1->r = $k1;
                 $order->push($unit1);
                 unset($unit1);
             }
         }
     } else {
         if (null == $this->map_a2b) {
             throw new HException('null iterable');
         }
         $__hx__it = $this->map_a2b->keys();
         while ($__hx__it->hasNext()) {
             unset($k2);
             $k2 = $__hx__it->next();
             $unit2 = new coopy_Unit(null, null, null);
             $unit2->p = $k2;
             $unit2->l = $this->reference->a2b($k2);
             $unit2->r = $this->a2b($k2);
             $order->push($unit2);
             unset($unit2);
         }
         if (null == $this->reference->map_b2a) {
             throw new HException('null iterable');
         }
         $__hx__it = $this->reference->map_b2a->keys();
         while ($__hx__it->hasNext()) {
             unset($k3);
             $k3 = $__hx__it->next();
             if ($this->reference->b2a($k3) === -1) {
                 $unit3 = new coopy_Unit(null, null, null);
                 $unit3->p = -1;
                 $unit3->l = $k3;
                 $unit3->r = -1;
                 $order->push($unit3);
                 unset($unit3);
             }
         }
         if (null == $this->map_b2a) {
             throw new HException('null iterable');
         }
         $__hx__it = $this->map_b2a->keys();
         while ($__hx__it->hasNext()) {
             unset($k4);
             $k4 = $__hx__it->next();
             if ($this->b2a($k4) === -1) {
                 $unit4 = new coopy_Unit(null, null, null);
                 $unit4->p = -1;
                 $unit4->l = -1;
                 $unit4->r = $k4;
                 $order->push($unit4);
                 unset($unit4);
             }
         }
     }
     $top = $order->length;
     $remotes = new _hx_array(array());
     $locals = new _hx_array(array());
     $_g = 0;
     while ($_g < $top) {
         $o = $_g++;
         if (_hx_array_get($order, $o)->r >= 0) {
             $remotes->push($o);
         } else {
             $locals->push($o);
         }
         unset($o);
     }
     $remote_sort = array(new _hx_lambda(array(&$locals, &$order, &$remotes, &$top), "coopy_Alignment_0"), 'execute');
     $local_sort = array(new _hx_lambda(array(&$locals, &$order, &$remote_sort, &$remotes, &$top), "coopy_Alignment_1"), 'execute');
     if ($this->reference !== null) {
         $remote_sort = array(new _hx_lambda(array(&$local_sort, &$locals, &$order, &$remote_sort, &$remotes, &$top), "coopy_Alignment_2"), 'execute');
         $local_sort = array(new _hx_lambda(array(&$local_sort, &$locals, &$order, &$remote_sort, &$remotes, &$top), "coopy_Alignment_3"), 'execute');
     }
     $remotes->sort($remote_sort);
     $locals->sort($local_sort);
     $revised_order = new _hx_array(array());
     $at_r = 0;
     $at_l = 0;
     $_g1 = 0;
     while ($_g1 < $top) {
         $o4 = $_g1++;
         if ($at_r < $remotes->length && $at_l < $locals->length) {
             $ur = $order[$remotes[$at_r]];
             $ul = $order[$locals[$at_l]];
             if ($ul->l === -1 && $ul->p >= 0 && $ur->p >= 0) {
                 if ($ur->p > $ul->p) {
                     $revised_order->push($ul);
                     $at_l++;
                     continue;
                 }
             } else {
                 if ($ur->l > $ul->l) {
                     $revised_order->push($ul);
                     $at_l++;
                     continue;
                 }
             }
             $revised_order->push($ur);
             $at_r++;
             continue;
             unset($ur, $ul);
         }
         if ($at_r < $remotes->length) {
             $ur1 = $order[$remotes[$at_r]];
             $revised_order->push($ur1);
             $at_r++;
             continue;
             unset($ur1);
         }
         if ($at_l < $locals->length) {
             $ul1 = $order[$locals[$at_l]];
             $revised_order->push($ul1);
             $at_l++;
             continue;
             unset($ul1);
         }
         unset($o4);
     }
     $order = $revised_order;
     $result = new coopy_Ordering();
     $result->setList($order);
     if ($this->reference === null) {
         $result->ignoreParent();
     }
     return $result;
 }
Exemplo n.º 12
0
 public function edit($param)
 {
     $fieldNames = new haxe_ds_StringMap();
     $typeMap = null;
     $typeMap = model_Clients_5($this, $fieldNames, $param, $typeMap);
     $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" => "Clients.hx", "lineNumber" => 139, "className" => "model.Clients", "methodName" => "edit")));
     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_Clients_6"), 'execute'));
         $tableFields->set($k, $cFields);
         $_g2 = 0;
         $_g1 = $cFields->length;
         while ($_g2 < $_g1) {
             $f = $_g2++;
             $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($_g2, $_g1);
         unset($k, $cFields, $aFields);
     }
     haxe_Log::trace($tableNames, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 158, "className" => "model.Clients", "methodName" => "edit")));
     $editTables = new haxe_ds_StringMap();
     $ti = 0;
     $tableNames->remove("vicidial_list");
     $tableNames->push("buchungs_anforderungen");
     $_g11 = 0;
     while ($_g11 < $tableNames->length) {
         $table = $tableNames[$_g11];
         ++$_g11;
         $p = new haxe_ds_StringMap();
         $sb = new StringBuf();
         $phValues = new _hx_array(array());
         $p->set("primary_id", $param->get("primary_id"));
         switch ($table) {
             case "clients":
                 $p->set("table", "vicidial_list");
                 $p->set("jointable", "fly_crm." . _hx_string_or_null($table));
                 $p->set("joincond", $param->get("joincond"));
                 $p->set("fields", Std::string(_hx_string_call($param->get("fields"), "split", array(","))->map(array(new _hx_lambda(array(&$_g11, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_7"), 'execute'))->join(",")) . "," . _hx_string_or_null($tableFields->get($table)->map(array(new _hx_lambda(array(&$_g11, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_8"), 'execute'))->join(",")));
                 $p->set("where", "vicidial_list.lead_id|" . Std::string($param->get("lead_id")));
                 $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doJoin($p, $sb, $phValues)));
                 break;
             case "buchungs_anforderungen":
                 $p->set("table", "fly_crm." . _hx_string_or_null($table));
                 $p->set("fields", model_Clients::$pay_history_fields->map(array(new _hx_lambda(array(&$_g11, &$eF, &$editTables, &$fieldNames, &$keys, &$optionsMap, &$p, &$param, &$phValues, &$sb, &$table, &$tableFields, &$tableNames, &$ti, &$typeMap), "model_Clients_9"), 'execute'))->join(","));
                 $p->set("where", "`Mandat-ID`|" . Std::string($param->get("client_id")) . "K1");
                 $editTables->set("pay_history", php_Lib::hashOfAssociativeArray($this->doSelect($p, $sb, $phValues)));
                 break;
             default:
                 $p->set("table", model_Clients_10($this, $_g11, $eF, $editTables, $fieldNames, $keys, $optionsMap, $p, $param, $phValues, $sb, $table, $tableFields, $tableNames, $ti, $typeMap));
                 $p->set("fields", $tableFields->get($table)->join(","));
                 if ($table === "vicidial_list") {
                     $p->set("where", "vendor_lead_code|" . Std::string($param->get("client_id")));
                 } else {
                     $p->set("where", "client_id|" . Std::string($param->get("client_id")));
                 }
                 $editTables->set($table, php_Lib::hashOfAssociativeArray($this->doSelect($p, $sb, $phValues)));
                 if ($table === "pay_source") {
                     haxe_Log::trace($tableFields->get($table), _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 198, "className" => "model.Clients", "methodName" => "edit")));
                 }
                 break;
         }
         unset($table, $sb, $phValues, $p);
     }
     $recordings = $this->getRecordings(Std::parseInt($param->get("lead_id")));
     $editTables->set("konto_auszug", php_Lib::hashOfAssociativeArray(_hx_deref(new model_ClientHistory(null))->findClient(model_Clients_11($this, $eF, $editTables, $fieldNames, $keys, $optionsMap, $param, $recordings, $tableFields, $tableNames, $ti, $typeMap), true)));
     $this->data = _hx_anonymous(array("fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "editData" => php_Lib::associativeArrayOfHash($editTables), "typeMap" => php_Lib::associativeArrayOfHash($typeMap), "optionsMap" => php_Lib::associativeArrayOfHash($optionsMap), "recordings" => $recordings));
     $userMap = new haxe_ds_StringMap();
     $sb1 = new StringBuf();
     $phValues1 = new _hx_array(array());
     $p1 = new haxe_ds_StringMap();
     $p1->set("table", "vicidial_users");
     $p1->set("fields", "user,full_name");
     $p1->set("where", "user_group|AGENTS_A");
     $owner = Std::parseInt(model_Clients_12($this, $eF, $editTables, $fieldNames, $keys, $optionsMap, $p1, $param, $phValues1, $recordings, $sb1, $tableFields, $tableNames, $ti, $typeMap, $userMap));
     haxe_Log::trace($owner, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 218, "className" => "model.Clients", "methodName" => "edit")));
     $this->data->userMap = _hx_deref(new model_Users(null))->get_info(null);
     return $this->json_encode();
 }
Exemplo n.º 13
0
 public function next()
 {
     if (_hx_field($this, "cache") !== null) {
         $t = $this->cache;
         $this->cache = null;
         return $t;
     }
     if (!$this->fetchRow()) {
         return null;
     }
     $o = _hx_anonymous(array());
     $descriptions = $this->getFieldsDescription();
     $_g1 = 0;
     $_g = $this->getNFields();
     while ($_g1 < $_g) {
         $i = $_g1++;
         $o->{_hx_array_get($descriptions, $i)->name} = $this->convert($this->cRow[$i], _hx_array_get($descriptions, $i)->type);
         unset($i);
     }
     return $o;
 }
Exemplo n.º 14
0
 public function removeListener($eventKey, $eventListener)
 {
     if ($this->listeners[$eventKey] !== null) {
         _hx_array_get($this->listeners, $eventKey)->remove($eventListener);
     }
 }
Exemplo n.º 15
0
 public function finishColumns()
 {
     if ($this->finished_columns) {
         return;
     }
     $this->finished_columns = true;
     $this->needSourceColumns();
     $_g1 = $this->payloadCol;
     $_g = $this->payloadTop;
     while ($_g1 < $_g) {
         $i = $_g1++;
         $act = $this->modifier->get($i);
         $hdr = $this->header->get($i);
         if ($act === null) {
             $act = "";
         }
         if ($act === "---") {
             $at = -1;
             if ($this->patchInSourceCol->exists($i)) {
                 $at = $this->patchInSourceCol->get($i);
             }
             $mod = new coopy_HighlightPatchUnit();
             $mod->code = $act;
             $mod->rem = true;
             $mod->sourceRow = $at;
             $mod->patchRow = $i;
             $this->cmods->push($mod);
             unset($mod, $at);
         } else {
             if ($act === "+++") {
                 $mod1 = new coopy_HighlightPatchUnit();
                 $mod1->code = $act;
                 $mod1->add = true;
                 $prev = -1;
                 $cont = false;
                 $mod1->sourceRow = -1;
                 if ($this->cmods->length > 0) {
                     $mod1->sourceRow = _hx_array_get($this->cmods, $this->cmods->length - 1)->sourceRow;
                 }
                 if ($mod1->sourceRow !== -1) {
                     $mod1->sourceRowOffset = 1;
                 }
                 $mod1->patchRow = $i;
                 $this->cmods->push($mod1);
                 unset($prev, $mod1, $cont);
             } else {
                 if ($act !== "...") {
                     $at1 = -1;
                     if ($this->patchInSourceCol->exists($i)) {
                         $at1 = $this->patchInSourceCol->get($i);
                     }
                     $mod2 = new coopy_HighlightPatchUnit();
                     $mod2->code = $act;
                     $mod2->patchRow = $i;
                     $mod2->sourceRow = $at1;
                     $this->cmods->push($mod2);
                     unset($mod2, $at1);
                 }
             }
         }
         unset($i, $hdr, $act);
     }
     $at2 = -1;
     $rat = -1;
     $_g11 = 0;
     $_g2 = $this->cmods->length - 1;
     while ($_g11 < $_g2) {
         $i1 = $_g11++;
         $icode = _hx_array_get($this->cmods, $i1)->code;
         if ($icode !== "+++" && $icode !== "---") {
             $at2 = _hx_array_get($this->cmods, $i1)->sourceRow;
         }
         _hx_array_get($this->cmods, $i1 + 1)->sourcePrevRow = $at2;
         $j = $this->cmods->length - 1 - $i1;
         $jcode = _hx_array_get($this->cmods, $j)->code;
         if ($jcode !== "+++" && $jcode !== "---") {
             $rat = _hx_array_get($this->cmods, $j)->sourceRow;
         }
         _hx_array_get($this->cmods, $j - 1)->sourceNextRow = $rat;
         unset($jcode, $j, $icode, $i1);
     }
     $fate = new _hx_array(array());
     $this->permuteColumns();
     if ($this->headerMove !== null) {
         if ($this->colPermutation->length > 0) {
             $_g3 = 0;
             $_g12 = $this->cmods;
             while ($_g3 < $_g12->length) {
                 $mod3 = $_g12[$_g3];
                 ++$_g3;
                 if ($mod3->sourceRow >= 0) {
                     $mod3->sourceRow = $this->colPermutation[$mod3->sourceRow];
                 }
                 unset($mod3);
             }
             if (!$this->useMetaForColumnChanges()) {
                 $this->source->insertOrDeleteColumns($this->colPermutation, $this->colPermutation->length);
             }
         }
     }
     $len = $this->processMods($this->cmods, $fate, $this->source->get_width());
     if (!$this->useMetaForColumnChanges()) {
         $this->source->insertOrDeleteColumns($fate, $len);
         return;
     }
     $changed = false;
     $_g4 = 0;
     $_g13 = $this->cmods;
     while ($_g4 < $_g13->length) {
         $mod4 = $_g13[$_g4];
         ++$_g4;
         if ($mod4->code !== "") {
             $changed = true;
             break;
         }
         unset($mod4);
     }
     if (!$changed) {
         return;
     }
     $columns = new _hx_array(array());
     $target = new haxe_ds_IntMap();
     $inc = array(new _hx_lambda(array(&$at2, &$changed, &$columns, &$fate, &$len, &$rat, &$target), "coopy_HighlightPatch_0"), 'execute');
     $_g14 = 0;
     $_g5 = $fate->length;
     while ($_g14 < $_g5) {
         $i2 = $_g14++;
         $value = call_user_func_array($inc, array($fate[$i2]));
         $target->set($i2, $value);
         unset($value);
         unset($i2);
     }
     $this->needSourceColumns();
     $this->needDestColumns();
     $_g15 = 1;
     $_g6 = $this->patch->get_width();
     while ($_g15 < $_g6) {
         $idx_patch = $_g15++;
         $change = new coopy_ColumnChange();
         $idx_src = null;
         if ($this->patchInSourceCol->exists($idx_patch)) {
             $idx_src = $this->patchInSourceCol->get($idx_patch);
         } else {
             $idx_src = -1;
         }
         $prev_name = null;
         $name = null;
         if ($idx_src !== -1) {
             $prev_name = $this->source->getCell($idx_src, 0);
         }
         if ($this->modifier->get($idx_patch) !== "---") {
             if ($this->header->exists($idx_patch)) {
                 $name = $this->header->get($idx_patch);
             }
         }
         $change->prevName = $prev_name;
         $change->name = $name;
         if ($this->next_meta !== null) {
             if ($this->next_meta->exists($name)) {
                 $change->props = $this->next_meta->get($name);
             }
         }
         $columns->push($change);
         unset($prev_name, $name, $idx_src, $idx_patch, $change);
     }
     $this->meta->alterColumns($columns);
 }
Exemplo n.º 16
0
 public function findClient($param, $dataOnly = null)
 {
     $sql = new StringBuf();
     $phValues = new _hx_array(array());
     $cond = "";
     $limit = $param->get("limit");
     if (!Util::any2bool($limit)) {
         $limit = _hx_array_get(S::$conf->get("sql"), "LIMIT");
         if (!Util::any2bool($limit)) {
             $limit = 15;
         }
     }
     $globalCond = "";
     $reasons = "";
     $where = $param->get("where");
     if (strlen($where) > 0) {
         $where1 = _hx_explode(",", $where);
         $whereElements = $where1->filter(array(new _hx_lambda(array(&$cond, &$dataOnly, &$globalCond, &$limit, &$param, &$phValues, &$reasons, &$sql, &$where, &$where1), "model_ClientHistory_2"), 'execute'));
         $_g = 0;
         while ($_g < $where1->length) {
             $w = $where1[$_g];
             ++$_g;
             $wData = _hx_string_call($w, "split", array("|"));
             $_g1 = $wData[0];
             switch ($_g1) {
                 case "reason":
                     $reasons = $wData->slice(1, null)->join(" ");
                     break;
             }
             unset($_g1);
             unset($wData, $w);
         }
         if ($whereElements->length > 0) {
             $globalCond = $this->addCond($whereElements, $phValues);
         }
     }
     $sql->add("SELECT SQL_CALC_FOUND_ROWS * FROM(");
     $first = true;
     if (_hx_index_of($reasons, "AC04", null) > -1) {
         if ($first) {
             $first = false;
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"AC04\" AS reason FROM `konto_auszug` WHERE i LIKE \"%AC04 KONTO AUFGELOEST%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"AC04\" AS reason FROM `konto_auszug` WHERE j LIKE \"%AC04 KONTO AUFGELOEST%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     if (_hx_index_of($reasons, "AC01", null) > -1) {
         if ($first) {
             $first = false;
         } else {
             $sql->add("UNION ");
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"AC01\" AS reason FROM `konto_auszug` WHERE i LIKE \"%AC01 IBAN FEHLERHAFT%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"AC01\" AS reason FROM `konto_auszug` WHERE j LIKE \"%AC01 IBAN FEHLERHAFT%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     if (_hx_index_of($reasons, "MD06", null) > -1) {
         if ($first) {
             $first = false;
         } else {
             $sql->add("UNION ");
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"MD06\" AS reason FROM `konto_auszug` WHERE i LIKE \"%MD06 WIDERSPRUCH DURCH ZAHLER%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"MD06\" AS reason FROM `konto_auszug` WHERE j LIKE \"%MD06 WIDERSPRUCH DURCH ZAHLER%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     if (_hx_index_of($reasons, "MS03", null) > -1) {
         if ($first) {
             $first = false;
         } else {
             $sql->add("UNION ");
         }
         $sql->add("(SELECT d, e AS amount, SUBSTR(j,17,8) AS m_ID, z AS IBAN, \"MS03\" AS reason FROM `konto_auszug` WHERE i LIKE \"%MS03 SONSTIGE GRUENDE%\" " . _hx_string_or_null($cond) . "  LIMIT 0,10000)");
         $sql->add("UNION ");
         $sql->add("(SELECT d, e AS amount, SUBSTR(k, 17, 8) AS m_ID, z AS IBAN, \"MS03\" AS reason FROM `konto_auszug` WHERE j LIKE \"%MS03 SONSTIGE GRUENDE%\" " . _hx_string_or_null($cond) . "  LIMIT 0, 10000)");
     }
     $sql->add(" )_lim " . _hx_string_or_null($globalCond) . " LIMIT " . _hx_string_rec($limit, ""));
     S::$my->select_db("fly_crm");
     $rows = $this->execute($sql->b, $phValues);
     if ($dataOnly) {
         return $rows;
     }
     $this->data = _hx_anonymous(array("count" => _hx_array_get($this->query("SELECT FOUND_ROWS()"), 0)["FOUND_ROWS()"], "page" => $param->exists("page") ? Std::parseInt($param->get("page")) : 1, "rows" => $rows));
     return $this->json_encode();
 }
Exemplo n.º 17
0
 public function asTable()
 {
     $pct = 3;
     $this->getColumns();
     $w = $this->columnNames->length;
     $mt = new coopy_SimpleTable($w + 1, $pct);
     $mt->setCell(0, 0, "@");
     $mt->setCell(0, 1, "type");
     $mt->setCell(0, 2, "key");
     $_g = 0;
     while ($_g < $w) {
         $x = $_g++;
         $i = $x + 1;
         $mt->setCell($i, 0, $this->columnNames[$x]);
         $mt->setCell($i, 1, _hx_array_get($this->columns, $x)->type_value);
         $mt->setCell($i, 2, _hx_array_get($this->columns, $x)->primary ? "primary" : "");
         unset($x, $i);
     }
     return $mt;
 }
Exemplo n.º 18
0
 public function buildCond($whereParam, $sob, $phValues, $first = null)
 {
     if ($first === null) {
         $first = true;
     }
     $sb = new StringBuf();
     $where = _hx_explode(",", $whereParam);
     if ($where->length === 0) {
         return false;
     }
     $_g = 0;
     while ($_g < $where->length) {
         $w = $where[$_g];
         ++$_g;
         $wData = _hx_string_call($w, "split", array("|"));
         $values = $wData->slice(2, null);
         $filter_tables = null;
         if (Util::any2bool($this->param) && $this->param->exists("filter_tables") && Util::any2bool($this->param->get("filter_tables"))) {
             $jt = $this->param->get("filter_tables");
             $filter_tables = _hx_explode(",", $jt);
             unset($jt);
         }
         haxe_Log::trace(Std::string($wData) . ":" . _hx_string_or_null($this->joinTable) . ":" . Std::string($filter_tables), _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 386, "className" => "Model", "methodName" => "buildCond")));
         if (_hx_deref(new EReg("^pay_[a-zA-Z_]+\\.", ""))->match($wData[0]) && _hx_array_get(_hx_explode(".", $wData[0]), 0) !== $this->joinTable) {
             continue;
         }
         if ($first) {
             $sb->add(" WHERE ");
         } else {
             $sb->add(" AND ");
         }
         $first = false;
         $_g1 = strtoupper($wData[1]);
         switch ($_g1) {
             case "BETWEEN":
                 if (!($values->length === 2) && Lambda::hforeach($values, array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$sob, &$values, &$w, &$wData, &$where, &$whereParam), "Model_13"), 'execute'))) {
                     S::hexit("BETWEEN needs 2 values - got only:" . _hx_string_or_null($values->join(",")));
                 }
                 $sb->add($this->quoteField($wData[0]));
                 $sb->add(" BETWEEN ? AND ?");
                 $phValues->push(new _hx_array(array($wData[0], $values[0])));
                 $phValues->push(new _hx_array(array($wData[0], $values[1])));
                 break;
             case "IN":
                 $sb->add($this->quoteField($wData[0]));
                 $sb->add(" IN(");
                 $sb->add($values->map(array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$sob, &$values, &$w, &$wData, &$where, &$whereParam), "Model_14"), 'execute'))->join(","));
                 $sb->add(")");
                 break;
             case "LIKE":
                 $sb->add($this->quoteField($wData[0]));
                 $sb->add(" LIKE ?");
                 $phValues->push(new _hx_array(array($wData[0], $wData[2])));
                 break;
             default:
                 $sb->add($this->quoteField($wData[0]));
                 if (_hx_deref(new EReg("^(<|>)", ""))->match($wData[1])) {
                     $eR = new EReg("^(<|>)", "");
                     $eR->match($wData[1]);
                     $val = Std::parseFloat($eR->matchedRight());
                     $sb->add(_hx_string_or_null($eR->matched(0)) . "?");
                     $phValues->push(new _hx_array(array($wData[0], $val)));
                     continue 2;
                 }
                 if ($wData[1] === "NULL") {
                     $sb->add(" IS NULL");
                 } else {
                     $sb->add(" = ?");
                     $phValues->push(new _hx_array(array($wData[0], $wData[1])));
                 }
                 break;
         }
         unset($_g1);
         unset($wData, $w, $values, $filter_tables);
     }
     $sob->add($sb->b);
     return true;
 }
Exemplo n.º 19
0
 static function getURI()
 {
     $s = $_SERVER['REQUEST_URI'];
     return _hx_array_get(_hx_explode("?", $s), 0);
 }
Exemplo n.º 20
0
 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();
 }
Exemplo n.º 21
0
 public function alignCore2($align, $a, $b)
 {
     if ($align->meta === null) {
         $align->meta = new coopy_Alignment();
     }
     $this->alignColumns($align->meta, $a, $b);
     $column_order = $align->meta->toOrder();
     $align->range($a->get_height(), $b->get_height());
     $align->tables($a, $b);
     $align->setRowlike(true);
     $w = $a->get_width();
     $ha = $a->get_height();
     $hb = $b->get_height();
     $av = $a->getCellView();
     $ids = null;
     $ignore = null;
     if ($this->comp->compare_flags !== null) {
         $ids = $this->comp->compare_flags->ids;
         $ignore = $this->comp->compare_flags->getIgnoredColumns();
     }
     $common_units = new _hx_array(array());
     $ra_header = $align->getSourceHeader();
     $rb_header = $align->getSourceHeader();
     $_g = 0;
     $_g1 = $column_order->getList();
     while ($_g < $_g1->length) {
         $unit = $_g1[$_g];
         ++$_g;
         if ($unit->l >= 0 && $unit->r >= 0 && $unit->p !== -1) {
             if ($ignore !== null) {
                 if ($unit->l >= 0 && $ra_header >= 0 && $ra_header < $a->get_height()) {
                     $name = $av->toString($a->getCell($unit->l, $ra_header));
                     if ($ignore->exists($name)) {
                         continue;
                     }
                     unset($name);
                 }
                 if ($unit->r >= 0 && $rb_header >= 0 && $rb_header < $b->get_height()) {
                     $name1 = $av->toString($b->getCell($unit->r, $rb_header));
                     if ($ignore->exists($name1)) {
                         continue;
                     }
                     unset($name1);
                 }
             }
             $common_units->push($unit);
         }
         unset($unit);
     }
     $index_top = null;
     $pending_ct = $ha;
     $reverse_pending_ct = $hb;
     $used = new haxe_ds_IntMap();
     $used_reverse = new haxe_ds_IntMap();
     if ($ids !== null) {
         $index_top = new coopy_IndexPair($this->comp->compare_flags);
         $ids_as_map = new haxe_ds_StringMap();
         $_g2 = 0;
         while ($_g2 < $ids->length) {
             $id = $ids[$_g2];
             ++$_g2;
             $ids_as_map->set($id, true);
             true;
             unset($id);
         }
         $_g3 = 0;
         while ($_g3 < $common_units->length) {
             $unit1 = $common_units[$_g3];
             ++$_g3;
             $na = $av->toString($a->getCell($unit1->l, 0));
             $nb = $av->toString($b->getCell($unit1->r, 0));
             if ($ids_as_map->exists($na) || $ids_as_map->exists($nb)) {
                 $index_top->addColumns($unit1->l, $unit1->r);
                 $align->addIndexColumns($unit1);
             }
             unset($unit1, $nb, $na);
         }
         $index_top->indexTables($a, $b, 1);
         if ($this->indexes !== null) {
             $this->indexes->push($index_top);
         }
         $_g4 = 0;
         while ($_g4 < $ha) {
             $j = $_g4++;
             $cross = $index_top->queryLocal($j);
             $spot_a = $cross->spot_a;
             $spot_b = $cross->spot_b;
             if ($spot_a !== 1 || $spot_b !== 1) {
                 continue;
             }
             $jb = $cross->item_b->lst[0];
             $align->link($j, $jb);
             $used->set($jb, 1);
             if (!$used_reverse->exists($j)) {
                 $reverse_pending_ct--;
             }
             $used_reverse->set($j, 1);
             unset($spot_b, $spot_a, $jb, $j, $cross);
         }
     } else {
         $N = 5;
         $columns = new _hx_array(array());
         if ($common_units->length > $N) {
             $columns_eval = new _hx_array(array());
             $_g11 = 0;
             $_g5 = $common_units->length;
             while ($_g11 < $_g5) {
                 $i = $_g11++;
                 $ct = 0;
                 $mem = new haxe_ds_StringMap();
                 $mem2 = new haxe_ds_StringMap();
                 $ca = _hx_array_get($common_units, $i)->l;
                 $cb = _hx_array_get($common_units, $i)->r;
                 $_g21 = 0;
                 while ($_g21 < $ha) {
                     $j1 = $_g21++;
                     $key = $av->toString($a->getCell($ca, $j1));
                     if (!$mem->exists($key)) {
                         $mem->set($key, 1);
                         $ct++;
                     }
                     unset($key, $j1);
                 }
                 unset($_g21);
                 $_g22 = 0;
                 while ($_g22 < $hb) {
                     $j2 = $_g22++;
                     $key1 = $av->toString($b->getCell($cb, $j2));
                     if (!$mem2->exists($key1)) {
                         $mem2->set($key1, 1);
                         $ct++;
                     }
                     unset($key1, $j2);
                 }
                 unset($_g22);
                 $columns_eval->push(new _hx_array(array($i, $ct)));
                 unset($mem2, $mem, $i, $ct, $cb, $ca);
             }
             $sorter = array(new _hx_lambda(array(&$N, &$a, &$align, &$av, &$b, &$column_order, &$columns, &$columns_eval, &$common_units, &$ha, &$hb, &$ids, &$ignore, &$index_top, &$pending_ct, &$ra_header, &$rb_header, &$reverse_pending_ct, &$used, &$used_reverse, &$w), "coopy_CompareTable_0"), 'execute');
             $columns_eval->sort($sorter);
             $columns = Lambda::harray(Lambda::map($columns_eval, array(new _hx_lambda(array(&$N, &$a, &$align, &$av, &$b, &$column_order, &$columns, &$columns_eval, &$common_units, &$ha, &$hb, &$ids, &$ignore, &$index_top, &$pending_ct, &$ra_header, &$rb_header, &$reverse_pending_ct, &$sorter, &$used, &$used_reverse, &$w), "coopy_CompareTable_1"), 'execute')));
             $columns = $columns->slice(0, $N);
         } else {
             $_g12 = 0;
             $_g6 = $common_units->length;
             while ($_g12 < $_g6) {
                 $i1 = $_g12++;
                 $columns->push($i1);
                 unset($i1);
             }
         }
         $top = Math::round(Math::pow(2, $columns->length));
         $pending = new haxe_ds_IntMap();
         $_g7 = 0;
         while ($_g7 < $ha) {
             $j3 = $_g7++;
             $pending->set($j3, $j3);
             unset($j3);
         }
         $added_columns = new haxe_ds_IntMap();
         $index_ct = 0;
         $_g8 = 0;
         while ($_g8 < $top) {
             $k = $_g8++;
             if ($k === 0) {
                 continue;
             }
             if ($pending_ct === 0) {
                 break;
             }
             $active_columns = new _hx_array(array());
             $kk = $k;
             $at = 0;
             while ($kk > 0) {
                 if (_hx_mod($kk, 2) === 1) {
                     $active_columns->push($columns[$at]);
                 }
                 $kk >>= 1;
                 $at++;
             }
             $index = new coopy_IndexPair($this->comp->compare_flags);
             $_g23 = 0;
             $_g13 = $active_columns->length;
             while ($_g23 < $_g13) {
                 $k1 = $_g23++;
                 $col = $active_columns[$k1];
                 $unit2 = $common_units[$col];
                 $index->addColumns($unit2->l, $unit2->r);
                 if (!$added_columns->exists($col)) {
                     $align->addIndexColumns($unit2);
                     $added_columns->set($col, true);
                 }
                 unset($unit2, $k1, $col);
             }
             unset($_g23, $_g13);
             $index->indexTables($a, $b, 1);
             if ($k === $top - 1) {
                 $index_top = $index;
             }
             $h = $a->get_height();
             if ($b->get_height() > $h) {
                 $h = $b->get_height();
             }
             if ($h < 1) {
                 $h = 1;
             }
             $wide_top_freq = $index->getTopFreq();
             $ratio = $wide_top_freq;
             $ratio /= $h + 20;
             if ($ratio >= 0.1) {
                 if ($index_ct > 0 || $k < $top - 1) {
                     continue;
                 }
             }
             $index_ct++;
             if ($this->indexes !== null) {
                 $this->indexes->push($index);
             }
             $fixed = new _hx_array(array());
             if (null == $pending) {
                 throw new HException('null iterable');
             }
             $__hx__it = $pending->keys();
             while ($__hx__it->hasNext()) {
                 unset($j4);
                 $j4 = $__hx__it->next();
                 $cross1 = $index->queryLocal($j4);
                 $spot_a1 = $cross1->spot_a;
                 $spot_b1 = $cross1->spot_b;
                 if ($spot_a1 !== 1 || $spot_b1 !== 1) {
                     continue;
                 }
                 $val = $cross1->item_b->lst[0];
                 if (!$used->exists($val)) {
                     $fixed->push($j4);
                     $align->link($j4, $val);
                     $used->set($val, 1);
                     if (!$used_reverse->exists($j4)) {
                         $reverse_pending_ct--;
                     }
                     $used_reverse->set($j4, 1);
                 }
                 unset($val, $spot_b1, $spot_a1, $cross1);
             }
             $_g24 = 0;
             $_g14 = $fixed->length;
             while ($_g24 < $_g14) {
                 $j5 = $_g24++;
                 $pending->remove($fixed[$j5]);
                 $pending_ct--;
                 unset($j5);
             }
             unset($_g24, $_g14);
             unset($wide_top_freq, $ratio, $kk, $k, $index, $h, $fixed, $at, $active_columns);
         }
     }
     if ($index_top !== null) {
         $offset = 0;
         $scale = 1;
         $_g9 = 0;
         while ($_g9 < 2) {
             $sgn = $_g9++;
             if ($pending_ct > 0) {
                 $xb = null;
                 if ($scale === -1 && $hb > 0) {
                     $xb = $hb - 1;
                 }
                 $_g15 = 0;
                 while ($_g15 < $ha) {
                     $xa0 = $_g15++;
                     $xa = $xa0 * $scale + $offset;
                     $xb2 = $align->a2b($xa);
                     if ($xb2 !== null) {
                         $xb = $xb2 + $scale;
                         if ($xb >= $hb || $xb < 0) {
                             break;
                         }
                         continue;
                     }
                     if ($xb === null) {
                         continue;
                     }
                     $ka = $index_top->localKey($xa);
                     $kb = $index_top->remoteKey($xb);
                     if ($ka !== $kb) {
                         continue;
                     }
                     if ($used->exists($xb)) {
                         continue;
                     }
                     $align->link($xa, $xb);
                     $used->set($xb, 1);
                     $used_reverse->set($xa, 1);
                     $pending_ct--;
                     $xb += $scale;
                     if ($xb >= $hb || $xb < 0) {
                         break;
                     }
                     if ($pending_ct === 0) {
                         break;
                     }
                     unset($xb2, $xa0, $xa, $kb, $ka);
                 }
                 unset($_g15);
                 unset($xb);
             }
             $offset = $ha - 1;
             $scale = -1;
             unset($sgn);
         }
         $offset = 0;
         $scale = 1;
         $_g10 = 0;
         while ($_g10 < 2) {
             $sgn1 = $_g10++;
             if ($reverse_pending_ct > 0) {
                 $xa1 = null;
                 if ($scale === -1 && $ha > 0) {
                     $xa1 = $ha - 1;
                 }
                 $_g16 = 0;
                 while ($_g16 < $hb) {
                     $xb0 = $_g16++;
                     $xb1 = $xb0 * $scale + $offset;
                     $xa2 = $align->b2a($xb1);
                     if ($xa2 !== null) {
                         $xa1 = $xa2 + $scale;
                         if ($xa1 >= $ha || $xa1 < 0) {
                             break;
                         }
                         continue;
                     }
                     if ($xa1 === null) {
                         continue;
                     }
                     $ka1 = $index_top->localKey($xa1);
                     $kb1 = $index_top->remoteKey($xb1);
                     if ($ka1 !== $kb1) {
                         continue;
                     }
                     if ($used_reverse->exists($xa1)) {
                         continue;
                     }
                     $align->link($xa1, $xb1);
                     $used->set($xb1, 1);
                     $used_reverse->set($xa1, 1);
                     $reverse_pending_ct--;
                     $xa1 += $scale;
                     if ($xa1 >= $ha || $xa1 < 0) {
                         break;
                     }
                     if ($reverse_pending_ct === 0) {
                         break;
                     }
                     unset($xb1, $xb0, $xa2, $kb1, $ka1);
                 }
                 unset($_g16);
                 unset($xa1);
             }
             $offset = $hb - 1;
             $scale = -1;
             unset($sgn1);
         }
     }
     $_g17 = 1;
     while ($_g17 < $ha) {
         $i2 = $_g17++;
         if (!$used_reverse->exists($i2)) {
             $align->link($i2, -1);
         }
         unset($i2);
     }
     $_g18 = 1;
     while ($_g18 < $hb) {
         $i3 = $_g18++;
         if (!$used->exists($i3)) {
             $align->link(-1, $i3);
         }
         unset($i3);
     }
     if ($ha > 0 && $hb > 0) {
         $align->link(0, 0);
     }
 }