Exemple #1
0
    private function get_print_line_multi($data, $key0, $htmlid, $disp, $action_attr)
    {
        $buf = '<tr>';
        $keys = array_keys($this->_dattrs);
        //allow index field clickable, same as first action
        $actionLink = null;
        $indexActionLink = null;
        if ($action_attr != NULL) {
            if (is_array($action_attr->_minVal)) {
                $index = $action_attr->_minVal[0];
                $type = $data->GetChildVal($index);
                $ti = isset($action_attr->_minVal[$type]) ? $action_attr->_minVal[$type] : $action_attr->_minVal[1];
            } else {
                $ti = $action_attr->_minVal;
            }
            $actdata = $disp->GetActionData($action_attr->_maxVal, $ti, $key0);
            $actionLink = UI::GetActionButtons($actdata, 'icon');
            $indexActionLink = isset($actdata['v']) ? $actdata['v']['href'] : null;
        }
        foreach ($keys as $key) {
            $attr = $this->_dattrs[$key];
            if ($attr->IsFlagOn(DAttr::BM_HIDE)) {
                continue;
            }
            if ($key == 0) {
                if ($this->_icon != NULL) {
                    if ($attr->GetKey() == 'type' && is_array($attr->_maxVal) && is_array($this->_icon)) {
                        $type = $data->GetChildVal('type');
                        $icon_name = isset($this->_icon[$type]) ? $this->_icon[$type] : 'application';
                    } else {
                        $icon_name = $this->_icon;
                    }
                    $buf .= '<td class="icon"><img src="/res/img/icons/' . $icon_name . '.gif"></td>';
                }
            }
            $buf .= '<td';
            if (isset($this->_align[$key])) {
                $buf .= ' align="' . $this->_align[$key] . '"';
            }
            $buf .= '>';
            if ($attr->_type == 'action') {
                $buf .= $actionLink;
            } else {
                if ($attr->_type == 'sel1' && $data->GetChildVal($attr->GetKey()) != NULL) {
                    $attr->SetDerivedSelOptions($disp->GetDerivedSelOptions($this->_id, $attr->_minVal, $data));
                }
                if ($attr->GetKey() == $this->_holderIndex) {
                    $buf .= $attr->toHtml($data, $indexActionLink);
                    if ($this->_hasNote && ($note = $data->GetChildVal('note')) != NULL) {
                        $buf .= '<a href="javascript:void(0);" class="pull-right" rel="tooltip" data-placement="right"
								data-original-title="' . $note . '" data-html="true">
								<i class="fa fa-info-circle"></i></a>';
                    }
                } else {
                    $buf .= $attr->toHtml($data, NULL);
                }
            }
            $buf .= '</td>';
        }
        $buf .= "</tr>\n";
        return $buf;
    }
 protected function process_config()
 {
     //init here
     $this->_disp->InitConf();
     $this->loadConfig();
     $confdata = $this->getConfData($this->_disp);
     $needTrim = 0;
     $tblDef = DTblDef::GetInstance();
     $disp_act = $this->_disp->Get(DInfo::FLD_ACT);
     if ($disp_act == 's') {
         $validator = new ConfValidation();
         $extracted = $validator->ExtractPost($this->_disp);
         if ($extracted->HasErr()) {
             $this->_disp->Set(DInfo::FLD_ACT, 'S');
             $this->_disp->Set(DInfo::FLD_TopMsg, $extracted->Get(CNode::FLD_ERR));
             return $extracted;
         } else {
             $confdata->SavePost($extracted, $this->_disp);
             $this->setChanged(true);
             $needTrim = 2;
         }
     } elseif ($disp_act == 'a') {
         $added = new CNode(CNode::K_EXTRACTED, '');
         return $added;
     } elseif ($disp_act == 'c' || $disp_act == 'n') {
         // 'c': change, 'n': next
         $validator = new ConfValidation();
         $extracted = $validator->ExtractPost($this->_disp);
         if ($disp_act == 'n') {
             $this->_disp->SwitchToSubTid($extracted);
         }
         return $extracted;
     } elseif ($disp_act == 'D') {
         $confdata->DeleteEntry($this->_disp);
         $needTrim = 1;
     } elseif ($disp_act == 'I') {
         if ($this->instantiateTemplate()) {
             $needTrim = 1;
         }
     } elseif ($disp_act == 'd' || $disp_act == 'i') {
         if ($disp_act == 'd') {
             $actions = 'DC';
             $mesg = DMsg::UIStr('note_confirm_delete');
         } else {
             $actions = 'IC';
             $mesg = DMsg::UIStr('note_confirm_instantiate');
         }
         $adata = $this->_disp->GetActionData($actions);
         $mesg = '<p>' . $mesg . '</p>' . UI::GetActionButtons($adata, 'text');
         $this->_disp->Set(DInfo::FLD_TopMsg, $mesg);
     }
     $ctxseq = UIBase::GrabGoodInputWithReset('ANY', 'ctxseq', 'int');
     if ($ctxseq != 0) {
         if ($this->_curOne->ChangeContextSeq($ctxseq)) {
             $needTrim = 1;
         }
     }
     if ($needTrim) {
         $this->_disp->TrimLastId();
         // need reload
         $this->loadConfig();
         $confdata = $this->getConfData($this->_disp);
     }
     return $confdata;
 }