function getControlPDF(&$PDOdb)
 {
     $res = array();
     foreach ($this->TAssetOFControl as $ofControl) {
         $control = new TAssetControl();
         $control->load($PDOdb, $ofControl->fk_control);
         switch ($control->type) {
             case 'text':
             case 'num':
                 $res[] = array('question' => utf8_decode($control->question), 'response' => $ofControl->response);
                 break;
             case 'checkbox':
                 $res[] = array('question' => utf8_decode($control->question), 'response' => $ofControl->response ? 'Oui' : 'Non');
                 break;
             case 'checkboxmultiple':
                 $res2 = '';
                 foreach ($control->TAssetControlMultiple as $controlVal) {
                     $res2 .= $controlVal->value . ', ';
                 }
                 $res[] = array('question' => utf8_decode($control->question), 'response' => rtrim($res2, ', '));
                 break;
         }
     }
     return $res;
 }
Exemplo n.º 2
0
        $control = new TAssetControl();
        $control->load($ATMdb, $id);
        if ($control->removeChild('TAssetControlMultiple', __get('id_value', 0, 'integer'))) {
            $control->save($ATMdb);
            setEventMessage($langs->trans('AssetMsgDeleteControlValue'));
        } else {
            setEventMessage($langs->trans('AssetErrDeleteControlValue'));
        }
        _fiche($ATMdb, $control, 'view');
        break;
    default:
        if ($id <= 0) {
            header('Location: ' . DOL_MAIN_URL_ROOT . '/custom/asset/list_control.php');
        }
        $control = new TAssetControl();
        $control->load($ATMdb, $id);
        _fiche($ATMdb, $control, 'view');
        break;
}
function _fiche(&$ATMdb, &$control, $mode = 'view', $editValue = false)
{
    global $db, $langs;
    llxHeader('', $langs->trans('AssetAddControl'), '', '');
    $TBS = new TTemplateTBS();
    $form = new TFormCore();
    $form->Set_typeaff($mode);
    $TForm = array('id' => $control->getId(), 'libelle' => $form->texte('', 'libelle', $control->libelle, 50, 255), 'type' => $form->combo('', 'type', TAssetControl::$TType, $control->type), 'question' => $form->texte('', 'question', $control->question, 120, 255));
    $TFormVal = _fiche_value($ATMdb, $editValue);
    $TVal = _liste_valeur($ATMdb, $control->getId(), $control->type);
    print $TBS->render('./tpl/control.tpl.php', array('TVal' => $TVal), array('co' => $TForm, 'FormVal' => $TFormVal, 'view' => array('mode' => $mode, 'editValue' => $editValue, 'type' => $control->type, 'url' => dol_buildpath('/of/control.php', 1))));
    llxFooter();