LimeSurvey Manual
Menu
Navigation
Main page
Recent changes
Random page
Help
Search
Special pages
Printable version
Recent changes
Help
English
Log in
Actions
Translate
Language statistics
Message group statistics
Export
Special
Export translations
Settings
Group
Activating a survey
Adding answers or subquestions
Administering LimeSurvey
Alternatives to the LimeSurvey import function
Assessments
Backup entire database
Batch deletion
Category:Advanced Question Settings
Category:General Question Options
Category:Question Settings
Central Participant Database
Changing an active survey
Check data integrity
Check question logic
Check survey logic - Advanced
Closing a survey
ComfortUpdate
Copy question
Data encryption
Data entry
Data policy settings
DateFunctions
Default answers
Delete question
Delete survey
Display/Export survey
Edit question
Email bounce tracking system
Email templates
Export question
Export responses
Exporting results
Expression Manager
Expression Manager sample surveys
ExpressionScript - Presentation
ExpressionScript Engine - Quick start guide
ExpressionScript examples
ExpressionScript How-tos
ExpressionScript sample surveys
Extension compatibility
Failed email notifications
First login - your user preferences
General FAQ
General settings
Getting started
Global settings
Google API howto
Home page settings
How to design a good survey (guide)
Import responses
Importing a survey
Installation - LimeSurvey CE
Installation FAQ
Installation of the LimeSurvey XAMPP package
Installation security hints
Installation using a command line interface (CLI)
Installation Version 1.92 or older
Iterate survey
Label sets
LDAP settings
License
LimeSurvey Manual
LimeSurvey PRO vs LimeSurvey CE
LimeSurvey Users
LimeSurvey Video-Tutorial
LimeSurvey-compatible hosting companies
List question groups
List questions
Localization
Major version upgrade
Make your plugin compatible with LS4
Manage user groups
Manage users
Menu configuration
Menu entries configuration
Multilingual survey
New Template System in LS3.x
Not categorized and advanced features
Notifications & data
Optional settings
Overview
Panel integration
Participant settings
Plugin manager
Plugin menu
Plugins - advanced
Presentation
Preview function
Problems & solutions
Publication & access
QS:Allowed filetypes
QS:Alphasort
QS:Answer width
QS:Array filter
QS:Array filter exclude
QS:Array filter style
QS:Assessment value
QS:Autocheck exclusive option
QS:Category separator
QS:Chart type
QS:Choice column width
QS:Choice header
QS:Code filter
QS:Commented checkbox
QS:CSS Class
QS:Date max
QS:Date min
QS:Date time format
QS:Display chart
QS:Display columns
QS:Display map
QS:Display rows
QS:Display type
QS:Dropdown dates
QS:Dropdown dates year max
QS:Dropdown dates year min
QS:Dropdown prefix
QS:Dropdown prepostfix
QS:Dropdown separators
QS:Dropdown size
QS:Dualscale headerA
QS:Dualscale headerB
QS:Em validation q
QS:Em validation q tip
QS:Em validation sq
QS:Em validation sq tip
QS:Encryption
QS:Equals num value
QS:Equation
QS:Exclusive option
QS:Get order previous q
QS:Hidden
QS:Hide tip
QS:Input box size
QS:Input boxes
QS:Input max characters
QS:Label column width
QS:Location city
QS:Location country
QS:Location defaultcoordinates
QS:Location mapheight
QS:Location mapservice
QS:Location mapwidth
QS:Location mapzoom
QS:Location nodefaultfromip
QS:Location postal
QS:Location state
QS:Mandatory
QS:Max answers
QS:Max filesize
QS:Max num value
QS:Max num value n
QS:Max num value sgqa
QS:Max subquestions
QS:Maximum chars
QS:Maximum number of files
QS:Min answers
QS:Min num value
QS:Min num value n
QS:Minimum number of files
QS:Minute step interval
QS:Month display style
QS:Multiflexible checkbox
QS:Multiflexible max
QS:Multiflexible min
QS:Multiflexible step
QS:Num value int only
QS:Numbers only
QS:Other
QS:Other comment mandatory
QS:Other numbers only
QS:Other Position
QS:Other replace text
QS:Page break
QS:Prefix
QS:Preg validation
QS:Printable survey relevance help
QS:Public statistics
QS:Question theme
QS:Random group
QS:Random order
QS:Rank header
QS:Relevance
QS:Remove text or uncheck checkbox
QS:Repeat headers
QS:Reverse
QS:Samechoiceheight
QS:Samelistheight
QS:Scale export
QS:Show comment
QS:Show grand total
QS:Show title
QS:Show totals
QS:Showpopups
QS:Slider accuracy
QS:Slider default
QS:Slider handle shape
QS:Slider handle Unicode shape
QS:Slider initial value
QS:Slider layout
QS:Slider max
QS:Slider middlestart
QS:Slider min
QS:Slider orientation
QS:Slider rating
QS:Slider reset
QS:Slider reverse
QS:Slider separator
QS:Slider showminmax
QS:Subquestion width
QS:Suffix
QS:Text input width
QS:Theme editor - advanced options
QS:Time limit
QS:Time limit action
QS:Time limit countdown message
QS:Time limit disable next
QS:Time limit disable prev
QS:Time limit message
QS:Time limit message delay
QS:Time limit message style
QS:Time limit timer style
QS:Time limit warning
QS:Time limit warning display time
QS:Time limit warning message
QS:Time limit warning style
QS:Use dropdown
QS:Value range allows missing
Question groups - introduction
Question toolbar options
Question type - 5 point choice
Question type - Array
Question type - Array (10 point choice)
Question type - Array (5 point choice)
Question type - Array (Increase-Same-Decrease)
Question type - Array (Numbers)
Question type - Array (Texts)
Question type - Array (Yes-No-Uncertain)
Question type - Array by column
Question type - Array dual scale
Question type - Date
Question type - Equation
Question type - File upload
Question type - Gender
Question type - Huge free text
Question type - Language switch
Question type - List (Dropdown)
Question type - List (Radio)
Question type - List with comment
Question type - Long free text
Question type - Multiple choice
Question type - Multiple choice with comments
Question type - Multiple numerical input
Question type - Multiple short text
Question type - Numerical input
Question type - Ranking
Question type - Short free text
Question type - Text display
Question type - Yes-No
Question types
Questions - introduction
QueXML PDF Export
Quick start guide - LimeSurvey 2.50+
Quick start guide - LimeSurvey 3.0+
Quick-translation
Regenerate question codes
Reorder questions and question groups
Reset conditions
Resources
Responses & statistics
Responses (survey results)
Running a survey safely
Setting conditions
SGQA identifier
Statistics
Survey group permissions
Survey menu
Survey participants
Survey permissions
Survey quotas
Survey settings
Survey settings version 2
Survey structure
Survey toolbar options
Surveys - introduction
Surveys - management
Tab Separated Value survey structure
Template:Deprecated
Template:DeprecatedIn
Template:Example
Template:FeatureChange
Template:FeatureStarting
Template:Hint
Template:NewIn
Template:UpdatedIn
Testing a survey
Text elements
Theme editor
Theme options
Themes
Timing statistics
Tools
Transferring an installation
Translating LimeSurvey
Troubleshooting
TwoFactorAdminLogin
Upgrading from a previous version
URL fields
Using regular expressions
Version change log
Version guide
View saved but not submitted responses
Workarounds
Language
aa - Afar
ab - Abkhazian
abs - Ambonese Malay
ace - Achinese
acm - Iraqi Arabic
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
aln - Gheg Albanian
alt - Southern Altai
am - Amharic
ami - Amis
an - Aragonese
ang - Old English
ann - Obolo
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
ban-bali - Balinese (Balinese script)
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bci - Baoulé
bcl - Central Bikol
bdr - West Coast Bajau
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bew - Betawi
bg - Bulgarian
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
blk - Pa'O
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Buginese
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
cdo - Min Dong Chinese
ce - Chechen
ceb - Cebuano
ch - Chamorro
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cpx - Pu-Xian Min
cpx-hans - Pu-Xian Min (Simplified Han script)
cpx-hant - Pu-Xian Min (Traditional Han script)
cpx-latn - Pu-Xian Min (Latin script)
cr - Cree
crh - Crimean Tatar
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
crh-ro - Crimean Tatar (Romania)
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
dag - Dagbani
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
dga - Dagaare
din - Dinka
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dv - Divehi
dz - Dzongkha
ee - Ewe
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - Spanish (formal address)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
fat - Fanti
ff - Fula
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fon - Fon
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gaa - Ga
gag - Gagauz
gan - Gan Chinese
gan-hans - Gan (Simplified)
gan-hant - Gan (Traditional)
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
gld - Nanai
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
gpe - Ghanaian Pidgin
grc - Ancient Greek
gsw - Alemannic
gu - Gujarati
guc - Wayuu
gur - Frafra
guw - Gun
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
hno - Northern Hindko
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
hsn - Xiang Chinese
ht - Haitian Creole
hu - Hungarian
hu-formal - Hungarian (formal address)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
id - Indonesian
ie - Interlingue
ig - Igbo
igl - Igala
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kai - Karekare
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kcg - Tyap
kea - Kabuverdianu
kg - Kongo
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjh - Khakas
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ksw - S'gaw Karen
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kus - Kʋsaal
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lki - Laki
lld - Ladin
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mad - Madurese
mag - Magahi
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Māori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mnc - Manchu
mnc-latn - Manchu (Latin script)
mnc-mong - Manchu (Mongolian script)
mni - Manipuri
mnw - Mon
mo - Moldovan
mos - Mossi
mr - Marathi
mrh - Mara
mrj - Western Mari
ms - Malay
ms-arab - Malay (Jawi script)
mt - Maltese
mus - Muscogee
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Min Nan Chinese
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
nia - Nias
niu - Niuean
nl - Dutch
nl-informal - Dutch (informal address)
nmz - Nawdm
nn - Norwegian Nynorsk
no - Norwegian
nod - Northern Thai
nog - Nogai
nov - Novial
nqo - N’Ko
nrm - Norman
nso - Northern Sotho
nv - Navajo
ny - Nyanja
nyn - Nyankole
nys - Nyungar
oc - Occitan
ojb - Northwestern Ojibwa
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pcm - Nigerian Pidgin
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
pwn - Paiwan
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rki - Arakanese
rm - Romansh
rmc - Carpathian Romani
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
rsk - Pannonian Rusyn
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rw - Kinyarwanda
ryu - Okinawan
sa - Sanskrit
sah - Yakut
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
se-fi - Northern Sami (Finland)
se-no - Northern Sami (Norway)
se-se - Northern Sami (Sweden)
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
sh-cyrl - Serbo-Croatian (Cyrillic script)
sh-latn - Serbo-Croatian (Latin script)
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy - Shawiya
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sjd - Kildin Sami
sje - Pite Sami
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
smn - Inari Sami
sms - Skolt Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
sro - Campidanese Sardinian
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - Siberian Tatar
su - Sundanese
sv - Swedish
sw - Swahili
syl - Sylheti
szl - Silesian
szy - Sakizaya
ta - Tamil
tay - Tayal
tcy - Tulu
tdd - Tai Nuea
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tly-cyrl - Talysh (Cyrillic script)
tn - Tswana
to - Tongan
tok - Toki Pona
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
trv - Taroko
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vmw - Makhuwa
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
wal - Wolaytta
war - Waray
wls - Wallisian
wo - Wolof
wuu - Wu Chinese
wuu-hans - Wu Chinese (Simplified)
wuu-hant - Wu Chinese (Traditional)
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yrl - Nheengatu
yue - Cantonese
yue-hans - Cantonese (Simplified)
yue-hant - Cantonese (Traditional)
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Format
Export for off-line translation
Export in native format
Export in CSV format
Fetch
{{DISPLAYTITLE:Plugin - nâng cao}}<languages /> <span id="Overview"></span> == Tổng quan == Bắt đầu từ LimeSurvey 2.05, LimeSurvey sẽ chính thức hỗ trợ plugin. Một số plugin sẽ được nhóm LimeSurvey hỗ trợ và sẽ đi vào lõi. Một số sẽ được hỗ trợ bởi những người khác ngoài nhóm LimeSurvey. Để giúp tìm thấy chúng, hãy xem [[Các plugin có sẵn của bên thứ ba]] và thêm plugin của riêng bạn vào đó! Plugin cho phép người dùng tùy chỉnh chức năng cài đặt của họ trong khi vẫn có thể hưởng lợi từ các bản cập nhật phần mềm thường xuyên. Tài liệu này dành cho các nhà phát triển đang mở rộng LimeSurvey cho mục đích sử dụng của riêng họ hoặc cho khách hàng của họ; người dùng cuối sẽ không được tài liệu này trợ giúp. Các plugin phải triển khai giao diện [https://github.com/LimeSurvey/LimeSurvey/blob/master/application/libraries/PluginManager/iPlugin.php iPlugin]. Chúng tôi khuyên bạn nên mở rộng lớp plugin của mình từ lớp [https://github.com/LimeSurvey/LimeSurvey/blob/master/application/libraries/PluginManager/PluginBase.php PluginBase]. Các plugin được phát triển dựa trên cơ chế [http://manual.limesurvey.org/Plugin_events event]. <span id="Plugin_settings"></span> == Cài đặt plugin == Bằng cách mở rộng, bạn sẽ được hưởng lợi từ chức năng chung được yêu cầu bởi các plugin mà chúng tôi đã triển khai cho bạn. Một trong những chức năng này là việc triển khai chức năng getPluginSettings. Hàm này phải trả về một mảng mô tả các tùy chọn cấu hình cho người dùng. Plugin ví dụ chỉ hiển thị 1 cài đặt có thể định cấu hình, thông báo sẽ hiển thị. <syntaxhighlight lang="php"> protected $settings = array( 'logo' => array( 'type' => 'logo', 'path' => 'assets/logo.png' ) , 'message' => array( 'type' => 'string', 'label' => 'Message' ) ); </syntaxhighlight> Mảng chứa tên cho mỗi cài đặt làm khóa. Các giá trị là các mảng chứa dữ liệu meta cần thiết. Các loại được hỗ trợ là: * logo * int (số nguyên) * chuỗi (chữ và số) * văn bản * html * mức độ liên quan * thông tin * mật khẩu * ngày * chọn Ngoài ra còn có một số phím gõ khác: * nhãn, xác định nhãn * mặc định, xác định giá trị để hiển thị nếu không có giá trị nào được chỉ định (chỉ dành cho cài đặt chung, không dành cho cài đặt khảo sát) * hiện tại, xác định giá trị hiện tại. * readOnly : đã hiển thị các cài đặt dưới dạng chỉ đọc * htmlOptions, htmlOptions của phần đầu vào ( xem hướng dẫn sử dụng Yii [[https://www.yiiframework.com/doc/api/1.1/CHtml]]) * pluginOptions, để biết một số cài đặt (html hoặc select): đặt tùy chọn tiện ích * labelOptions : htmlOptions của nhãn * controlOptions : htmlOptions của trình bao bọc nhãn và đầu vào Bạn có thể tìm thấy ví dụ về plugin sử dụng tất cả cài đặt thực tế tại [https://gitlab.com/SondagesPro/SampleAndDemo/exampleSettings exampleSettings] === Đọc và ghi cài đặt plugin === Có thể đọc và ghi cài đặt plugin trực tiếp từ mã plugin của bạn. Ví dụ: <syntaxhighlight lang="php"> $mySetting = $this->get('mySetting'); $this->set('mySetting', $mySetting + 1); </syntaxhighlight> Bạn có thể nhận giá trị mặc định nếu cài đặt là null: <syntaxhighlight lang="php"> $mySetting = $this->get('mySetting', null, null, 10); // 10 là mặc định </syntaxhighlight> === Survey specific plugin settings === Two events are used to create survey specific plugin settings: * newSurveySettings * beforeSurveySettings Example to disable a plugin for a specific survey: <syntaxhighlight lang="php"> public function init() { $this->subscribe('beforeSurveySettings'); $this->subscribe('newSurveySettings'); // Other events... } public function beforeSurveySettings() { $event = $this->event; $surveyId = intval($event->get('survey')); $event->set( "surveysettings.{$this->id}", [ 'name' => get_class($this), 'settings' => [ 'isActive' => [ 'type' => 'boolean', 'label' => 'isActive', 'current' => $this->getIsActive($surveyId), 'help' => 'Activate plugin for this survey' ], ] ] ); } public function newSurveySettings() { $event = $this->event; foreach ($event->get('settings') as $name => $value) { $this->set($name, $value, 'Survey', $event->get('survey'), false); } } private function getIsActive(int $sid): bool { return (bool) $this->get('isActive', 'Survey', $sid, false); } </syntaxhighlight> <span id="Events"></span> == Sự kiện == Các plugin đăng ký sự kiện và có thể tương tác với LimeSurvey khi sự kiện được kích hoạt. Để biết danh sách các sự kiện hiện có, hãy kiểm tra [[Sự kiện plugin]]. == API == Các plugin chỉ nên mở rộng LimeSurvey thông qua API "công khai" của nó. Điều này có nghĩa là việc sử dụng trực tiếp các lớp có trong mã nguồn là một cách làm không tốt. Mặc dù chúng tôi không thể buộc bạn không làm vậy nhưng bạn có nguy cơ gặp phải plugin bị hỏng sau mỗi lần cập nhật nhỏ mà chúng tôi thực hiện. Chỉ tương tác với LimeSurvey càng nhiều càng tốt thông qua các phương pháp được mô tả [http://api.limesurvey.org/classes/LimeSurvey.PluginManager.LimesurveyApi.html tại đây]. Tương tự như đối với các sự kiện Đối tượng API có sẵn thông qua <code>$this->api</code> khi mở rộng từ PluginBase, nếu không, bạn có thể lấy nó từ phiên bản PluginManager được chuyển đến hàm tạo của plugin của bạn. Các chức năng mới có thể được thêm vào đối tượng API theo yêu cầu. <span id="Form_extension{{NewIn|v=6}}"></span> == Tiện ích mở rộng biểu mẫu{{NewIn|v=6}} == <span id="Introduction"></span> === Giới thiệu === Hệ thống tiện ích mở rộng biểu mẫu là một cách tổng quát hơn để mở rộng biểu mẫu trong LimeSurvey cốt lõi mà không cần thêm sự kiện mới cho mỗi biểu mẫu. Nó bao gồm các thành phần sau: * Một mô-đun toàn cầu có tên '''FormExtensionService''' * Một thư viện '''các lớp đầu vào''' mà các plugin có thể thêm vào quá trình khởi tạo mô-đun ở trên * Một '''widget''', cùng với trình kết xuất tùy chỉnh, được sử dụng trong các tệp xem LimeSurvey Mỗi dạng được xác định bằng một '''chuỗi vị trí''', như<form name><dot><tab name> . Ví dụ: <code>globalsettings.general</code> hoặc <code>globalsettings.security</code> . Mục đích đằng sau một hệ thống dựa trên lớp không có HTML là giải phóng các tác giả plugin của tác phẩm để cập nhật HTML khi HTML cốt lõi thay đổi. Tuy nhiên, tác giả có thể sử dụng loại <code>RawHtmlInput</code> nếu cần. Một điều bạn không thể làm trong hệ thống này là thêm ''tab biểu mẫu mới''. <span id="Example"></span> === Ví dụ === Để thêm đầu vào mới vào biểu mẫu từ plugin, hãy sử dụng đoạn mã sau từ <code>init()</code> của bạn: VIỆC CẦN LÀM: Lưu trong cài đặt plugin thay vì lưu chung <syntaxhighlight lang="php"> // Ở đầu tệp use LimeSurvey\Libraries\FormExtension\Inputs\TextInput; use LimeSurvey\Libraries\FormExtension\SaveFailedException; // Bên trong init() Yii::app()->formExtensionService->add( 'globalsettings.general', new TextInput([ 'name' => 'myinput', 'label' => 'Label', 'disabled' => true, 'tooltip' => 'Moo moo moo', 'help' => 'Một số văn bản trợ giúp', 'save' => function($request, $connection) { $value = $request->getPost('myinput'); if ($value === 'một số giá trị không hợp lệ') { Throw new SaveFailedException("Không thể lưu thông tin nhập tùy chỉnh 'myinput'"); } else { SettingGlobal::setSetting('myinput', $value); } } , 'load' => function () { return getGlobalSetting('myinput'); } ]) ); </syntaxhighlight> <span id="Validation"></span> === Xác thực === Việc xác thực đầu vào được thực hiện trong chức năng <code>save</code> (xem ví dụ ở trên). Nếu giá trị được đăng không hợp lệ, hãy ném <code>SaveFailedException</code> và một thông báo flash cảnh báo sẽ được hiển thị cho người dùng. <span id="Supported_forms"></span> === Các hình thức được hỗ trợ === Các hình thức sau đây có thể được mở rộng: * Globalsettings.general{{NewIn|v=6.0.0}} Nếu bạn muốn thêm hỗ trợ cho một biểu mẫu cốt lõi khác, bạn cần áp dụng thay đổi sau trong yêu cầu kéo: Trong tệp xem, thêm: <syntaxhighlight lang="php"> <?php use LimeSurvey\Libraries\FormExtension\FormExtensionWidget; use LimeSurvey\Libraries\FormExtension\Inputs\DefaultBaseRenderer; ?> ... thêm HTML <?= FormExtensionWidget::render( App()-> formExtensionService->getAll('globalsettings.security'), new DefaultBaseRenderer() ); ?> </syntaxhighlight> Bạn có thể phải tạo một lớp trình kết xuất mới dựa trên <code>DefaultBaseRenderer</code> , nếu HTML biểu mẫu khác với các biểu mẫu khác. Bạn cũng có thể cần mở rộng lớp trình kết xuất mặc định với các loại đầu vào chưa được thêm vào. Thay đổi thứ hai bạn phải thực hiện là thêm lệnh gọi đến lớp dịch vụ tiện ích mở rộng biểu mẫu trong hành động của bộ điều khiển lưu biểu mẫu: <syntaxhighlight lang="php"> $request = App()->request; Yii::app()->formExtensionService->applySave('globalsettings', $request); </syntaxhighlight> Đó là nó! <span id="Localization_{{NewIn|v=3}}"></span> == Bản địa hóa {{NewIn|v=3}} == Các plugin có thể thêm tệp ngôn ngữ của riêng chúng. Định dạng tệp được sử dụng là .mo, giống như các bản dịch cốt lõi. Các tập tin phải được lưu trữ trong <plugin root folder>/địa phương/<language> /<language> .mo Ở đâu "<language> " là một từ có hai chữ cái như "de" hoặc "fr". Để sử dụng tệp ngôn ngữ cụ thể, hãy sử dụng chức năng plugin gT: <syntaxhighlight lang="php"> $this->gT("Văn bản plugin cần được dịch"); </syntaxhighlight> Nếu không thể tìm thấy chuỗi đã cho trong tệp ngôn ngữ cụ thể của plugin, hàm sẽ tìm trong tệp ngôn ngữ cốt lõi. Vì vậy, an toàn khi sử dụng các chuỗi như "Hủy": <syntaxhighlight lang="php"> $this->gT("Hủy"); // Sẽ được dịch ngay cả khi "Hủy" không có trong tệp ngôn ngữ plugin </syntaxhighlight> Nếu bạn đang sử dụng chế độ xem cùng với plugin của mình, bạn nên sử dụng <syntaxhighlight lang="php"> $plugin->gT("Dịch tôi"); </syntaxhighlight> để thực hiện bản dịch cụ thể của plugin trong chế độ xem của bạn. Bạn có thể sử dụng tệp [https://github.com/LimeSurvey/LimeSurvey/blob/master/locale/_template/limesurvey.pot Limesurvey.pot] làm ví dụ về hình thức của tệp pot. Điều này được nhập vào công cụ dịch thuật của bạn. <span id="Tools"></span> === Công cụ === Một công cụ nguồn mở để chỉnh sửa các tệp po- và mo- là [https://poedit.net/ Poedit]. <span id="Logging_{{NewIn|v=3}}"></span> == Đang ghi nhật ký {{NewIn|v=3}} == Nếu bạn muốn đăng nhập nội dung nào đó từ plugin của mình, chỉ cần viết <syntaxhighlight lang="php"> $this->log("Tin nhắn của bạn"); </syntaxhighlight> Mức ghi nhật ký mặc định là theo dõi, nhưng bạn có thể đưa ra một mức nhật ký khác làm đối số thứ hai tùy chọn: <syntaxhighlight lang="php"> $this->log("Đã xảy ra lỗi!", CLogger::LEVEL_ERROR); </syntaxhighlight> Tệp nhật ký có thể được tìm thấy trong thư mục <limesurvey root folder>/tmp/runtime/plugin.log Tên plugin của bạn sẽ tự động được sử dụng làm danh mục. Một cách hay để chỉ xem các lỗi từ plugin của bạn là sử dụng grep (trên Linux): $ tail -f tmp/runtime/plugin.log | grep<your plugin name> Thông tin thêm về cách định cấu hình ghi nhật ký trong Yii 1: [[Optional_settings#Logging_settings]]. <span id="Extension_updates_{{NewIn|v=4}}"></span> == Cập nhật tiện ích mở rộng {{NewIn|v=4}} == Kể từ phiên bản LimeSurvey 4.0.0, đã có sẵn một hệ thống để xử lý các bản cập nhật plugin và tiện ích mở rộng khác. Để sử dụng hệ thống này, tệp config.xml tiện ích mở rộng của bạn cần bao gồm cấu hình trình cập nhật. <syntaxhighlight lang="xml"> <updaters> <updater> <stable> 1</stable> <type> nghỉ ngơi</type> <source> https://comfortupdate.limesurvey.org/index.php?r=limestorerest</source> <manualUpdateUrl> https://somedownloadlink.com/maybegithub</manualUpdateUrl> </updater> </updaters> </syntaxhighlight> (Thẻ nguồn ở trên trỏ tới API LimeStore REST, sẽ được sử dụng cho tất cả các tiện ích mở rộng có sẵn trong LimeStore của chúng tôi.) {| class="wikitable" |+ Mô tả thẻ trình cập nhật |- ! Gắn thẻ ! Mô tả |- | ổn định | "1" nếu nguồn này chỉ cung cấp cho bạn số phiên bản ổn định; "0" nếu nguồn cũng sẽ cung cấp các phiên bản không ổn định, như <code>0.3.3-beta</code> . |- | gõ | Hiện tại, chỉ hỗ trợ loại phần <code>rest</code> . Thật dễ dàng để thêm các loại trình cập nhật mới (trình kiểm tra phiên bản), như git, wget, v.v. |- | nguồn | URL để tìm nạp phiên bản mới từ. |- | hướng dẫn sử dụngUpdateUrl | URL mà người dùng có thể truy cập để cập nhật phiên bản mới nhất của tiện ích mở rộng. |- | tự độngUpdateUrl | TODO |} Nếu bạn không muốn cung cấp trình cập nhật, bạn nên đặt văn bản sau vào tệp XML cấu hình của mình: <syntaxhighlight lang="xml"> <updaters disabled="disabled"> </updaters> </syntaxhighlight> Bằng cách này, bạn cho hệ thống biết rằng bạn đã cố tình vô hiệu hóa hệ thống cập nhật và không quên thêm nó. Plugin mới '''UpdateCheck''' - được cài đặt và kích hoạt theo mặc định - kiểm tra các bản cập nhật mới cho ''tất cả'' tiện ích mở rộng đã cài đặt khi quản trị viên cấp cao đăng nhập, không đồng bộ, tối đa một lần sau mỗi 24 giờ. Nếu tìm thấy bất kỳ phiên bản mới nào, một thông báo sẽ được đưa ra. [[File:availableupdates.png||Các bản cập nhật có sẵn]] Nếu tìm thấy bản cập nhật bảo mật mới, thông báo sẽ tự động mở và được xếp vào loại "nguy hiểm". [[File:availablesecurityupdates.png||Các bản cập nhật bảo mật có sẵn]] Bạn có thể kiểm tra cập nhật theo cách thủ công bằng cách đi tới chế độ xem trình quản lý plugin và nhấp vào "Kiểm tra cập nhật". Lưu ý rằng nút này chỉ hiển thị nếu plugin UpdateCheck được kích hoạt. [[File:manuallycheckforupdates.png||Kiểm tra cập nhật theo cách thủ công]] <span id="Under_the_hood"></span> === Dưới mui xe === Phần này cung cấp thông tin tổng quan ngắn gọn về việc triển khai trình cập nhật tiện ích mở rộng. Trình cập nhật tiện ích mở rộng là một phần của thư viện ExtensionInstaller. Dưới đây là sơ đồ UML cho các lớp liên quan đến quá trình cập nhật. [[File:extensionupdateruml.png||Sơ đồ UML của trình cập nhật tiện ích mở rộng]] Luồng chương trình khi Yii khởi động: <pre> Yii bắt đầu VersionFetcherServiceLocator->init() Thêm trình tìm nạp phiên bản REST ExtensionUpdaterServiceLocator->init() Thêm PluginUpdater VIỆC CẦN LÀM: Thêm trình cập nhật cho từng loại tiện ích mở rộng (chủ đề, mẫu câu hỏi, ...) </pre> Luồng chương trình khi chạy plugin UpdaterCheck: <pre> Nhận tất cả các bản cập nhật từ ExtensionUpdaterServiceLocator Lặp lại từng trình cập nhật Đối với mỗi trình cập nhật, lặp qua các trình tìm nạp phiên bản được định cấu hình bởi<updater> XML Đối với mỗi trình tìm nạp phiên bản, hãy liên hệ với nguồn từ xa và nhận thông tin phiên bản Soạn tất cả các phiên bản thành một thông báo </pre> Phương thức [https://github.com/LimeSurvey/LimeSurvey/blob/develop/application/core/plugins/UpdateCheck/UpdateCheck.php#L130 checkAll] trong plugin UpdateCheck cung cấp ví dụ về cách truy vấn tất cả tiện ích mở rộng cho phiên bản mới . <span id="Adding_new_version_fetchers"></span> ==== Thêm trình tìm nạp phiên bản mới ==== Để thêm trình tìm nạp phiên bản tùy chỉnh mới, hãy chạy nó trong quá trình khởi tạo Yii: <syntaxhighlight lang="php"> $service = \Yii::app()->versionFetcherServiceLocator $service->addVersionFetcherType( 'myNewVersionFetcherType', function (\SimpleXMLElement $updaterXml) { return new MyNewVersionFetcher( $updaterXml); } ); </syntaxhighlight> Tất nhiên, lớp <code>MyNewVersionFetcher</code> phải phân lớp <code>VersionFetcher</code> . Để sử dụng trình tìm nạp phiên bản mới của bạn, hãy định cấu hình thẻ <code>type</code> trong XML của trình cập nhật để sử dụng <code>myNewVersionFetcherType</code> (thay vì ví dụ như <code>rest</code> ). <span id="Adding_new_extension_updaters"></span> ==== Thêm trình cập nhật tiện ích mở rộng mới ==== Để thêm trình cập nhật tiện ích mở rộng tùy chỉnh mới, hãy chạy trình này trong quá trình khởi tạo Yii: <syntaxhighlight lang="php"> $service = \Yii::app()->extensionUpdaterServiceLocator; $service->addUpdaterType( 'myNewExtensionUpdater', function () { return MyNewExtensionUpdater::createUpdaters() ; } ); </syntaxhighlight> Lớp <code>MyNewExtensionUpdater</code> phải phân lớp <code>ExtensionUpdater</code> . Thẻ <code>type</code> hàng đầu trong config.xml ('plugin', 'theme', ...) sẽ kiểm soát trình cập nhật tiện ích mở rộng nào được sử dụng cho tiện ích mở rộng này. Hệ thống này chưa thể tùy chỉnh hoàn toàn vì bạn cũng cần thêm ExtensionInstaller tùy chỉnh, các mục menu, v.v. Nhưng về mặt lý thuyết và có thể trong tương lai, bạn có thể thêm một loại tiện ích mở rộng mới theo cách này. <span id="Extension_installer"></span> == Trình cài đặt tiện ích mở rộng == Thư viện trình cài đặt tiện ích mở rộng bao gồm hai lớp trừu tượng: * ExtensionInstaller * FileFetcher ExtensionInstaller được phân lớp cho từng loại tiện ích mở rộng, như PluginInstaller, AskThemeInstaller, v.v. FileFetcher được phân lớp cho từng cách tìm nạp tệp khác nhau. Hiện tại, chỉ hỗ trợ các tệp zip đã tải lên, nhưng trong tương lai, có thể có trình tìm nạp Github hoặc LimeStore. [[Tập tin: Extensioninstalleruml.png]] <span id="Special_plugins"></span> == Các plugin đặc biệt == * [[Phát triển plugin xác thực]] * [[Phát triển plugin xuất]] <div class="mw-translate-fuzzy"> == Các plugin có sẵn == * [[Các plugin xác thực]] * [[Nhật ký kiểm tra]] * [[CintLink]] * [[Các plugin có sẵn của bên thứ ba]] </div> == Hướng dẫn == [https://medium.com/@evently/creating-limesurvey-plugins-adcdf8d7e334 Hướng dẫn từng bước này] chỉ ra cách tạo plugin gửi yêu cầu đăng bài trên mỗi phản hồi khảo sát nộp hồ sơ. Hướng dẫn này chỉ cho bạn cách tạo và lưu cài đặt chung và cài đặt cho mỗi khảo sát, cách đăng ký sự kiện, v.v. [[Danh mục:Phát triển]] [[Danh mục:Plugin]]