Example #1
0
    {
        if (!$this->validate()) {
            return FALSE;
        }
        $vDB = GetDB();
        $vValues = $this->getSubmitValues(TRUE);
        //            $vId = $vValues['id'];
        $vRecord = array();
        if (!empty($vValues['id'])) {
            $vRecord['id'] = $vValues['id'];
        }
        CopyRecordStrValue($vRecord, $vValues, 'name');
        $vResult = $vDB->InsertOrUpdateById('rb_directions', $vRecord);
        //       var_dump($vRecord);
        //       var_dump($vDB);
        return $vResult;
    }
}
$vId = array_key_exists('id', $_GET) ? $_GET['id'] : '';
$vForm = new TEditor($vId);
if (!$vForm->Save()) {
    $vTemplate =& CreateTemplate();
    $vRenderer =& CreateRenderer($vTemplate);
    $vForm->accept($vRenderer);
    $vView =& new TBaseView();
    $vView->form = $vRenderer->toObject();
    $vTemplate->compile('refs/direction_edit.html');
    $vTemplate->outputObject($vView);
} else {
    RedirectToList('directions.html');
}
Example #2
0
        CopyRecordStrValue($vRecord, $vValues, 'diagnosis');
        CopyRecordBoolValue($vRecord, $vValues, 'done');
        CopyRecordStrValue($vRecord, $vValues, 'description');
        $vResult = $vDB->InsertOrUpdateById('emst_rg', $vRecord);
        if (empty($vID) && !empty($vResult)) {
            $this->_submitValues['id'] = $vResult;
            $this->getElement('id')->setValue($vResult);
            $vRecord['id'] = $vResult;
            $_SESSION['_rg_dir_backup'] = $vRecord;
        }
        return $vResult;
    }
}
$vID = @$_GET['id'];
$vCaseID = @$_GET['caseid'];
$vForm = new TEditor($vID, $vCaseID);
switch ($vForm->ActionDispatcher()) {
    case 1:
        //    print "redirect to prev page";
        unset($_SESSION['_rg_dir_backup']);
        Redirect($vForm->_submitValues['html_referer']);
        break;
    case 2:
        //    Redirect( CompoundURL('/doc/rg_dir.pdf', array('id'=>$vForm->_submitValues['id'])) );
        //    break;
        $vTemplate =& CreateTemplate();
        $vRenderer =& CreateRenderer($vTemplate);
        $vForm->accept($vRenderer);
        $vView =& new TBaseView();
        $vView->form = $vRenderer->toObject();
        //    $vView->popup_url = CompoundURL('/doc/rg_dir.pdf', array(session_name()=>session_id(), 'id'=>$vForm->_submitValues['id']));