public function getRecord($edit)
 {
     $rec = parent::getRecord($edit);
     $rec[customer] = $this->getCustomer($rec[customer_id]);
     $rec[customer] = $rec[customer][customer];
     $sql = "SELECT * \n                FROM blockpos \n                JOIN boards ON boards.id=blockpos.board_id \n                WHERE blockpos.block_id='{$edit}'";
     $rec[blockpos] = sql::fetchAll($sql);
     $param = multibyte::Json_decode(multibyte::Unescape($this->getComment($rec[comment_id])));
     if (empty($param["class"])) {
         $param["class"] = $rec[blockpos][0]["class"];
     }
     if (empty($param[basemat])) {
         $basemat = explode("-", $rec[blockpos][0][textolite]);
         $param[basemat] = $basemat[0];
     }
     $rec["comment"] = $param["coment"];
     $wideandgaps = $param["wideandgaps"];
     // если слои еще не заполнены заполним из wideandgaps
     for ($i = 1; $i < 11; $i++) {
         $sl1 = $wideandgaps[2 * $i - 2][0];
         $sl2 = $wideandgaps[2 * $i - 1][0];
         $pr1 = $wideandgaps[2 * $i - 2][1];
         $pr2 = $wideandgaps[2 * $i - 1][1];
         if (!isset($param["sl{$i}"]) || empty($param["sl{$i}"])) {
             if (!empty($sl1)) {
                 $param["sl{$i}"] = $sl1 . "-" . $sl2;
                 $param["pr{$i}"] = sprintf("%5.3f/%5.3f", $pr1, $pr2);
             }
         }
     }
     $rec["param"] = $param;
     $rec[files] = $this->getFilesForId('blocks', $edit);
     return $rec;
 }
 public function setRecord($data)
 {
     $data[blocktype] = $this->blocktype;
     $operation[$data[operation_id]] = array('date' => $data[action_date], 'comment_id' => sqltable_model::getCommentId($data[comment]));
     // если в поле для нового ввели номер сопроводиловки уже существующий в журнале
     // то будем править его
     $sql = "SELECT * FROM {$this->maintable} WHERE lanch_id='{$data[lanch_id]}'";
     $res = sql::fetchOne($sql);
     if (empty($res)) {
         // гадство! тут нужен уникальный, а без коментариев будет получаться один
         sql::insert('coments', array(array("comment" => multibyte::Json_encode($operation))));
         $data[coment_id] = sql::lastId();
     } else {
         $coment = multibyte::Json_decode(sqltable_model::getComment($res[coment_id]));
         $coment[$data[operation_id]] = $operation[$data[operation_id]];
         // заменить старый по ключу
         sql::insertUpdate('coments', array(array("id" => $res[coment_id], "comment" => multibyte::Json_encode($coment))));
         $data[edit] = $res[id];
         // если был такой его и правим
         $data[coment_id] = $res[coment_id];
     }
     $data[lastoperation] = $data[operation_id];
     parent::setRecord($data);
     return true;
 }
Beispiel #3
0
 public function action_commentupdate($coment_id)
 {
     $operationid = $_REQUEST[idstr];
     $operations = multibyte::Json_decode(sqltable_model::getComment($coment_id));
     $coment_id = $operations[$operationid][comment_id];
     $out = sqltable_model::getComment($coment_id);
     $date = ajaxform::date2datepicker($operations[$operationid][date]);
     $out .= "<script>\$(\"*[datepicker='1']\").val('{$date}')</script>";
     return $out;
 }
Beispiel #4
0
    public static function init() {
        header("HTTP/1.0 200 OK");

        $json = multibyte::Json_decode($_REQUEST['json']);

        if ($json) {

            unset($_REQUEST[json]);

            $_REQUEST = array_merge($_REQUEST, $json);
            self::$ajaxform_recieve = true;

            //header("CONTENT-TYPE: TEXT/X-JSON; CHARSET={$_SERVER[Encoding]}");
            header("CONTENT-TYPE: APPLICATION/JSON; CHARSET={$_SERVER[Encoding]}");
        }
        self::$ajaxform_recieve = true;
        ob_start("ajaxform_recieve::process");
    }
Beispiel #5
0
    function checkboxes($name, $values, $value, $options = array()) {

        ob_start();

        $value = $this->getValue($name, $value);
        $value = (@!is_array($value)) ? multibyte::Json_decode($value) : $value;

        list($optionsHTML, $options) = $this->parseOptions($options);
        list($block, $line) = $this->getBlock($options[nobr], $this->getId($name));

        $options[nobr] = true;

        echo $block[begin];
        if (is_array($values))
            foreach ($values as $id => $label) {

                echo $line[begin];
                $val = (@in_array($id, $value) || !empty($value[$id])) ? 1 : 0;
                echo $this->checkbox($name . "|" . $id, $label, $val, $options, true);
                echo $line[end];
            }
        echo $block[end];

        return ob_get_clean();
    }