| | 9 | |
| | 10 | {{{ |
| | 11 | #!php |
| | 12 | include_once(MOD_PATH.'ADocuments/beans/Document.inc'); |
| | 13 | |
| | 14 | $doc_id = 123; |
| | 15 | $document = Document::getInstance($doc_id); |
| | 16 | if ($document->isReferenced()) { |
| | 17 | $document->set('tpstid', 2); |
| | 18 | $document->set('is_fix', TRUE); |
| | 19 | $document->save(); |
| | 20 | } |
| | 21 | }}} |
| | 22 | |
| | 23 | == Wywołanie formularza do potwierdzenie wykonania czynności == |
| | 24 | Chodzi o formularz typu confir, który można wykorzystać w mechanizmie CustomWidget: |
| | 25 | |
| | 26 | {{{ |
| | 27 | #!php |
| | 28 | require_once(LIB_PATH.'widgets/ConfirmBox.inc'); |
| | 29 | |
| | 30 | // identyfikator sprawdzenia |
| | 31 | $hwnd = Application::getShortName(__CLASS__.__LINE__); |
| | 32 | |
| | 33 | // sprawdzenie czy przyszło potwierdzenie i jeśli jest i jest na Nie CONFIRM_NO |
| | 34 | if (($confirmation = ConfirmBox::getConfirmation($hwnd)) AND ($confirmation == ConfirmBox::CONFIRM_NO)) { |
| | 35 | // tutaj możesz coś zrobić jak users kliknął Nie |
| | 36 | return FALSE; |
| | 37 | } |
| | 38 | |
| | 39 | // to samo się wywołuje i sprawdza |
| | 40 | if (ConfirmBox::confirm($hwnd, Translator::translate('Treść pytania'), NULL, ConfirmBox::CONFIRM_YES|ConfirmBox::CONFIRM_NO, 'question.gif', NULL, NULL, 360, 150) == ConfirmBox::CONFIRM_YES) { |
| | 41 | // tutaj możesz coś zrobić jak user dał Tak CONFIRM_YES |
| | 42 | } |
| | 43 | }}} |